Skip to content

vibhorxpandey/IDBI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

YOUTUBE LIVE LINK : https://youtu.be/U11B5rlBy4o?si=pTFr-G9i7H9hmOxC LIVE PROTOTYPE LINK : https://lendlens-idbi-track02.vercel.app/

LendLens — Consent First Pre-Approved Offer Engine

IDBI Innovate 2026 · Track 02 (Lead Generation / Behavioural Analytics / Retail Lending) · Round-1 Prototype

The right offer, to the right customer, at the right time — with a reason the

Relationship Manager can say out loud.**

LendLens ingests consented transaction + behavioural data, runs two engines (Income & Repayment Capacity and Intent & Propensity), passes every decision through a SHAP explainability + fairness gate, and hands the RM a ranked list of pre-approved loan offers — each with a plain-English reason, a predicted conversion probability, the best time to call, and the offer amount + EMI.

It runs end-to-end with zero external dependencies — no Kaggle download, no network, no API keys — and is fully deterministic (RANDOM_STATE = 42), so the same run produces the same leads every time.


The problem

Retail lending lead-gen fails on two gaps:

  1. Eligibility ≠ intent. Banks blast "pre-approved" SMS to everyone who qualifies, ignoring who actually wants a loan right now. RMs waste days on cold leads.
  2. Documented income ≠ real income. A huge portion of India's workforce is self-employed or part of the gig economy. Their salary-slip income massively understates their real cash flow — so they get rejected or under-offered, even though their bank statements tell a very different story.

LendLens closes both gaps at once. Our key thesis, proven across 5,001 synthetic customers:

Customer Segment % of Declared Income vs. True Inferred Income
Salaried 99%
Gig Economy 58%
Self-Employed 43%

This income gap is the single biggest opportunity for growth in retail lending.


The solution — two engines, one trust gate

                       ┌─────────────────────────────────────────────┐
   Consented data  →   │  Account Aggregator (AA) consent   [MOCK]    │
   (txns + behaviour)  └───────────────────┬─────────────────────────┘
                                           ▼
        ┌───────────────────────────┐   ┌───────────────────────────┐
        │  ENGINE A                 │   │  ENGINE B                 │
        │  Income & Repayment       │   │  Intent & Propensity      │
        │  • infer REAL income from │   │  • conversion propensity  │
        │    transactions           │   │    (calibrated)           │
        │  • FOIR-capped affordability│  │  • UPLIFT (T-learner):    │
        │  • XGBoost default risk   │   │    who converts *because* │
        │                           │   │    of outreach            │
        │                           │   │  • product + best-time    │
        └─────────────┬─────────────┘   └─────────────┬─────────────┘
                      └───────────────┬───────────────┘
                                      ▼
                    ┌─────────────────────────────────────┐
                    │  EXPLAINABILITY + FAIRNESS GATE      │
                    │  • Hybrid Reason Codes (SHAP + Heuristic)│
                    │  • 80% disparate-impact rule check   │
                    └──────────────────┬──────────────────┘
                                       ▼
                    ┌─────────────────────────────────────┐
                    │  DECISIONING                         │
                    │  • uplift suppression                │
                    │  • Gold / Silver / Bronze tiers      │
                    │  • pre-approved offer (amt/EMI/rate) │
                    └──────────────────┬──────────────────┘
                                       ▼
              leads.json  →  FastAPI  →  React RM Dashboard
                                       │
                           (ULI / OCEN rails — [MOCK])
  • Engine A recovers a customer's real monthly income from their transaction ledger (recurring salary / business inflows), computes affordability under a hard 50% FOIR cap, and scores default risk on our 8% default-rate dataset.
  • Engine B scores genuine intent, and — crucially — runs an uplift model to find who converts because the RM reaches out (not the "sure things" who'd convert anyway, nor the "lost causes" who never will).
  • Every surfaced lead carries human-readable reasons and passes a fairness gate (80% rule on gender) before it reaches an RM.

A note on Reason Codes

Our hybrid reason-code approach is a deliberate design choice. SHAP owns the core affordability and credit drivers. However, life-event triggers (like page visits or lease renewals) are surfaced by direct detection. We found these events are often collinear with other features and SHAP can under-attribute their importance. This hybrid model ensures both statistical drivers and critical, common-sense events are clearly explained to the Relationship Manager.


Quick start

Requires Python 3.11+ (built & verified on 3.12) and Node 18+. Windows users: make is optional — use python run_all.py.

# 1. Clone the repository
git clone <repo-url>
cd lendlens-idbi-track02

# 2. Python environment
python -m venv .venv
#   Windows: .venv\Scripts\activate      POSIX: source .venv/bin/activate
pip install -r requirements.txt

# 3. Run the whole pipeline (generate → train → explain → score)
python run_all.py            # or:  make all
#   → writes data/processed/leads.json  (deterministic)

# 4. Serve the API  (from the repo root)
uvicorn api.main:app --port 8000        # or:  make api
#   → http://127.0.0.1:8000/leads   ·   /docs for Swagger

# 5. Run the RM dashboard  (second terminal)
cd dashboard
npm install
npm run dev                  # → http://localhost:5173

See Priya's story on the command line (great for the video):

python scripts/demo_priya.py

Results (synthetic validation on 5,001 customers, seed = 42)

Stage Metric Value
Income inference Inferred within ±15% of true income 99.8% of customers (median error 1.4%)
Engine A (default) Test AUC (on 8% default rate) 0.785
Engine B (propensity) Test AUC · calibrated P(convert if contacted) 0.595
Engine B (uplift) Qini · top-decile observed uplift 0.087 · +26.0%
Fairness Disparate-impact ratio (gender) 0.983 — passes 80% rule
Decisioning Gold / Silver / Bronze / Suppressed 458 / 1,299 / 1,749 / 1,495
Offers Pre-approved value · EMI ≤ max affordable ₹242.45 cr · 0 violations

Honest metric framing (the number that matters)

The headline is not "30% conversion." It is:

Top-decile pre-approved-offer acceptance ≈ 42% (Gold tier: 46%) in synthetic validation — versus ~1–3% for cold, undifferentiated outreach.

This is offer acceptance among a warm, consented, top-decile-targeted base, not cold-lead conversion. The funnel:

5,001 consented customers
  │  uplift gate removes 1,495 (30%) where outreach won't move the needle
  ▼   (99.9% of suppressions are uplift-driven, not affordability)
3,506 surfaced leads with offers    avg predicted acceptance 31%
  │  tiered by affordability × conversion × uplift
  ▼
  458 GOLD leads (call first)     avg predicted acceptance 46%, top-decile uplift +26%
                                  ₹40 cr pre-approved value in the Gold tier alone

The uplift model is what earns it: it spends RM time only on the persuadables, whose incremental conversion the outreach actually causes (top decile +26%), and suppresses the sure-things and lost-causes.


Meet Priya (the canonical demo)

CUST_PRIYA is seeded into the data so the 3-minute demo lands every time:

Declared income (salary slip) ₹45,000 / mo
Inferred true income (from her transactions) ₹1,38,200 / mo — 3.1×
Tier / Product Gold / Home
Uplift +0.40 (genuinely persuadable)
Reason codes 3 recent home-loan page visits · Lease renewal detected · Strong credit bureau score
Pre-approved offer Home ₹18,00,000 @ 8.5% / 20y · EMI ₹15,621 (≪ ₹64,100 capacity)

A customer who looks sub-prime on her form is, on her real cash flow, a prime Gold home-loan lead. That is the entire pitch in one row — run python scripts/demo_priya.py to print her full journey.


Guard-rails (hard-coded & visible — see config.py)

Guard-rail Value Where
FOIR cap 50% affordability / max EMI (never exceeded)
Fairness disparate-impact 80% rule fairness gate
Uplift suppression uplift < 0.02 → hidden decisioning
Random seed 42 everywhere (byte-reproducible leads.json)

What's real vs mocked in this Round-1 prototype

Real (runs for real) Mocked / stubbed (clearly labelled)
Synthetic data generation Account Aggregator consent + FI-data fetch
ML Engine A: Income Inference ULI borrower-data aggregation
ML Engine B: Propensity & Uplift OCEN loan-application handoff
SHAP & Heuristic Reason Codes Core-banking / CRM integration
Fairlearn 80%-rule fairness gate Real auth / OTP / credit-bureau calls
Offer Decisioning Engine
FastAPI + RM Dashboard

Stating this yourself is a credibility move — a judge who finds an undisclosed mock distrusts everything; a judge who reads your honest table trusts the parts you built.


Compliance posture

LendLens is built consent-first and explainable to align with:

  • Account Aggregator (AA) framework (RBI / Sahamati) — no data moves without a purpose-bound, revocable consent artefact (simulated here).
  • RBI Digital Lending Directions, 2025 — pre-approved offers carry clear key terms (amount, rate, tenor, EMI); the final credit decision stays with a human RM after full underwriting (LendLens is lead-gen, not auto-disbursal).
  • DPDP Act, 2023 — consent, purpose limitation ("Loan eligibility assessment"), and data minimisation (6 months, deposit accounts only).

Screenshots

Run the dashboard (npm run dev) and drop screenshots into docs/screenshots/:

Screenshot Placeholder Description
docs/screenshots/consent.png Mock AA consent flow (opening move)
docs/screenshots/queue.png Tiered Gold/Silver/Bronze lead queue
docs/screenshots/priya.png Priya's RM card — reason codes + offer
docs/screenshots/portfolio.png Portfolio charts + live fairness badge

Architecture, Layout, and Deployment


Round-2 plan

This prototype was built for the sandbox phase. The path to production inside IDBI includes:

  • Live AA feed via a Sahamati sandbox to replace mock data.
  • Ingestion of IDBI synthetic datasets to replace the generator.
  • Integration with Go Mobile+ and internal RM CRMs.
  • Full AWS or ACC deployment for production scale.
  • Model ops — monitoring, drift/uplift re-validation, and a fraud/KYC gate layered downstream of lead-gen.

License / status

Round-1 hackathon prototype — public-ready, documented, and reproducible. Built for a demo that runs the same way every time and tells a clear story.

About

AI-powered lead generation and income assessment for retail lending — built for IDBI Innovate 2026, Track 02

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages