About
## Challenges we ran into
# Challenges We Ran Into
---
## 🧠 Training an Effective Risk Model
Our biggest challenge was building a risk model that could distinguish genuinely suspicious activity from the huge number of legitimate transactions.
- Cleaned and engineered features from a banking transaction dataset containing millions of records.
- Built an XGBoost-based risk model instead of relying purely on rule-based detection.
- Iteratively tuned features, thresholds, and hyperparameters to reduce false positives while maintaining high recall.
- Designed the pipeline so updated transaction data can continuously improve the model through periodic weight retraining instead of requiring a complete rebuild.
---
## 📊 Preparing the Dataset
Real financial datasets are messy.
Some records lacked KYC details, customer relationships, or consistent formatting.
To make the reasoning pipeline reliable we had to:
- Normalize currencies, timestamps and identifiers.
- Engineer graph-friendly relationship features.
- Manually enrich missing KYC metadata.
- Validate every generated feature before model training.
Without a clean dataset, even the best model produced unreliable results.
---
## 🔗 Discovering Hidden Relationships
Money laundering rarely appears as isolated transactions.
The difficult part was discovering hidden networks between customers.
To solve this we:
- Constructed transaction graphs.
- Connected customers using shared PANs, addresses, devices and transaction behaviour.
- Used the **Louvain Community Detection Algorithm** to automatically identify suspicious communities instead of analysing accounts individually.
This dramatically improved case generation quality.
---
## 📚 Research Concepts We Incorporated
Instead of building a simple LLM wrapper, we incorporated multiple research-backed techniques into the pipeline.
### 1. Activation Probing
Rather than using only Gemma's generated text, we experimented with reading intermediate neural activations to estimate risk directly from the model's internal representations.
### 2. GBNF Constrained Generation
Compliance reports cannot invent legal terminology.
Using **GBNF (Grammar-Based Normal Form)** constrained decoding forces the model to generate only valid report structures and approved legal categories.
### 3. Evidence-First Reasoning
The model is never allowed to "reason first."
Instead it must:
- Gather evidence
- Verify supporting facts
- Decide whether sufficient evidence exists
- Generate the report
If evidence is insufficient, the pipeline refuses to generate conclusions.
### 4. Concept Drift Detection & Incremental Learning
Financial behaviour changes over time.
Instead of treating the model as static, the system is designed to detect dataset drift and periodically retrain the XGBoost model using newly available transaction data, ensuring risk predictions remain accurate.
### 5. Graph-based Community Detection
We integrated graph analytics using the **Louvain Algorithm** to identify coordinated transaction communities, significantly improving the quality of suspicious case detection.
---
## 🤖 Making Gemma Reliable
Running Gemma locally introduced several engineering challenges.
- Larger models exceeded available memory on our hardware.
- Smaller models required careful prompt engineering to preserve report quality.
- Internal reasoning consumed the response budget, causing incomplete outputs until context limits were adjusted.
- Response verification was added to ensure every numerical value generated by the model exactly matched the original transaction data.
---
## ⚖️ Balancing Explainability and Accuracy
Unlike traditional LLM applications, every statement in an STR must be legally defensible.
We therefore built multiple verification layers:
- Every monetary value is cross-checked against source transactions.
- Every conclusion must reference supporting evidence.
- Confidence scores are generated for every section of the report.
- Reports cannot be produced when sufficient evidence is unavailable.
This guarantees the compliance officer always understands **why** the model reached a particular conclusion instead of receiving a black-box prediction.
---
## 🔬 Research Papers That Guided Our Design
Our implementation draws inspiration from multiple research directions rather than a single model:
- **Activation Probing / Linear Probes** — understanding model internal representations.
- **Louvain Community Detection** — graph-based fraud and relationship discovery.
- **GBNF Grammar-Constrained Decoding** — structured and deterministic LLM outputs.
- **Evidence-First / Retrieval-Augmented Reasoning** — preventing hallucinations by grounding every conclusion in evidence.
- **Concept Drift Detection & Incremental Learning** — maintaining model performance as financial behaviour evolves.
## The problem it solves
# The problem it solves
## In one line
Small banks can't afford enterprise-grade AML compliance, while cloud AI solutions cannot legally process sensitive financial data. **viGEMMAlya** solves both problems by running entirely on the bank's own infrastructure and automating the most time-consuming parts of AML investigations.
---
## The problem, broken down
Every bank in India—whether a large commercial bank, NBFC, or co-operative bank—is required to monitor transactions for suspicious activity and submit a **Suspicious Transaction Report (STR)** within **7 working days** whenever money laundering is suspected. Missing this deadline can lead to significant regulatory penalties.
The challenge is that:
- **Small banks cannot afford large compliance teams.** Large institutions employ dedicated AML departments, whereas many smaller banks have only one or two compliance officers responsible for the entire process.
- **Rule-based alert systems generate overwhelming false positives.** Simple rules such as *"Transaction amount > ₹10 lakh"* often flag thousands of legitimate transactions. Every alert still requires manual investigation—reviewing transaction history, identifying linked accounts, checking KYC information, determining applicable regulations, and preparing documentation.
- **Cloud AI is not a viable solution.** Banking regulations and India's DPDP Act require sensitive customer financial data to remain within the bank's infrastructure. This prevents institutions from sending transaction data to external AI services, regardless of their capabilities.
---
## What we built
### Stage 1 — Batch Engine (:8001)
Processes millions of transactions and narrows them down into a small number of genuinely suspicious cases.
**Responsibilities**
- Rule-based transaction screening - Machine Learning risk scoring - Transaction clustering - Gemma-based internal risk representation - High-risk case generation
↓
### Stage 2 — Reasoning Engine (:8002)
Investigates each suspicious case before generating a compliance report.
**Responsibilities**
- Collect supporting evidence - Build investigation timeline - Discover linked accounts - Check KYC and risk indicators - Verify whether sufficient evidence exists - Generate Suspicious Transaction Report (STR) - Verify every numerical value against source data - Produce sentence-level confidence scores
↓
### Stage 3 — Human Review
The compliance officer reviews the AI-generated report and either approves or rejects it.
After approval, the system automatically:
- Sends Email notification
- Sends WhatsApp notification - Exports the official filing - Updates the immutable audit log
---
**Most importantly, the entire pipeline runs completely offline on the bank's own infrastructure. No customer financial data ever leaves the organization.**
---
## Who this helps and how
| Stakeholder | Benefit |
|--------------|---------| | **Compliance Officers** | Spend minutes instead of hours investigating each case. The AI prepares the first draft while the officer focuses on verification and approval. | | **SME Customers** | Faster investigations reduce unnecessary account freezes, allowing businesses to continue payroll, supplier payments, and daily operations. | | **Loan Applicants** | AML verification becomes significantly faster, reducing delays in loan approvals. | | **Businesses with complex transaction patterns** | Lower investigation costs enable banks to onboard legitimate customers that would otherwise require expensive manual reviews. | | **Banks** | Receive automated report generation, complete audit trails, instant notifications, and compliance-ready documentation while keeping all sensitive data on-premise. |
Screenshots
Team
From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.











