Saubhagya Pandey

← Door B · Markets & Risk

FIG. B.4 · Self project · document AI for banking

Banking-Documents GenAI Workbench

Bank statements are where credit decisions go to die by a thousand parsing errors — and where careless GenAI leaks PII. This workbench treats both problems as first-class: pdfplumber parses statements into normalized transactions with salary, FOIR and bounce-event features derived on top; PII is masked before any reviewer or model sees the text; and a RAG stack over RBI Master Directions cites its sources and refuses when it isn’t sure. The regex masking layer runs live below.

PII MASKING — REGEX LAYER, LIVEverbatim port of the repo's masking rules

Paste any statement text. The five regex rules below are ported character-for-character from the repository’s masking module and run in the same order: account number, PAN, email, UPI ID, phone. Microsoft Presidio NER runs after the regex layer in the real pipeline (server-side; not part of this page).

reviewer view — redacted

Statement of [ACCOUNT_NUMBER] for R. Iyer, PAN [PAN].
EMI of Rs 14,200 auto-debited on 03/08 from [ACCOUNT_NUMBER].
Queries: [EMAIL] or [PHONE]. UPI: [UPI_ID].

tokens masked

[ACCOUNT_NUMBER] × 2[PAN] × 1[EMAIL] × 1[UPI_ID] × 1[PHONE] × 1

THE PARSING STACK

Statements arrive as PDFs and leave as structured transactions. Salary credits are identified, FOIR is computed, bounce events are flagged — the features an underwriter actually reads a statement for. The masking pipeline runs in two passes: the deterministic regex layer you can test above, then Microsoft Presidio’s NER for person names, locations and everything pattern-matching misses. Reviewers see only the redacted statement beside the extracted fields.

RAG THAT CITES AND REFUSES

The knowledge side is pgvector retrieval with Ollama over RBI Master Directions and KYC/AML circulars: answers carry source citations, and low-confidence questions are refused rather than smoothed into plausible prose. A Ragas-style harness evaluates every configuration — field accuracy reached 93% and citation fidelity 94% on the best run, and every run is logged so the numbers are auditable.

Prev: FIG. B.3 · Listed-Lender WorkbenchClose with the human layer · About →