TECHNICAL ARCHITECTURE & FINANCIAL ENGINE SPECIFICATION

How Financial Decision Lab Works Under the Hood

A comprehensive architectural breakdown of our deterministic 12-stage financial calculation pipeline, mathematical formulas, sufficiency gates, and anti-hallucination regex guardrails.

100% Deterministic Python EngineZero Floating-Point Drift (Integer Paise)Zero LLM Arithmetic5,000 Monte Carlo Runs (Seed=42)
THE 3-TIER OPERATIONAL PIPELINE

From Raw Statement to Verifiable Proof in 3 Steps

Clean, strict separation between untrusted raw input parsing, deterministic mathematical calculation, and guarded natural-language presentation.

STAGE 01

Ingestion & SHA-256 Dedup

Statement parsing for PDF, CSV, and Excel (HDFC, SBI, ICICI, Axis). Generates SHA-256 fingerprint hashes to ensure overlapping statement files are never double-counted.

Output: Sanitized Transaction Stream
STAGE 02

Deterministic Engine & Gate

Evaluates the 4-point data sufficiency gate (≥ 90 days history, max gap ≤ 7 days). Executes balance continuity reconciliation: Opening + ΣTx = Closing.

Output: Verified Reasoning Ledger
STAGE 03

Monte Carlo & Guarded Output

5,000 Monte Carlo daily spend simulations calculate conservative P10, median P50, and optimistic P90 headroom. LLM translates structured ledger to plain narration with regex number guard verification.

Output: Affordability Verdict + Headroom
DATA CLEANING & STREAM PIPELINE

Automated Transaction Normalization & Transfer Pairing

Watch how noisy Indian UPI descriptions, internal account transfers, and statement discrepancies are parsed, cleaned, and reconciled.

Bank Statements+₹85,000.00HDFC Salary Inflow
Card & UPI Feeds-₹12,450.00PhonePe & GPay Spends
Fixed Obligations-₹24,000.00SBI Rent & SIP Debits
Data Cleaning GateΔ = 0 paise · Pass≥ 90-day Sufficiency
Deterministic Core5,000 runs · Seed 42Integer Paise · 0 Float
Reasoning Ledger8-Step AuditRegex Number Guard
Safety Buffer₹58,000 (1.2x)Adaptive Volatility
Safe Headroom+₹42,000 (P50)Air-Gap SQLite fdl.db
01RAW INGESTION

Statement Ingestion

HDFC, SBI, ICICI, Axis

Auto-detects statement formats from any major bank. Computes SHA-256 file hashes to guarantee idempotent imports without duplicate processing.

02RECONCILIATION GATE

Data Cleaning & Gate

Opening + ∑Tx = Closing (Δ = 0)

Strips messy UPI merchant codes, pairs internal transfers to prevent double-counting, and strictly enforces 4-point data sufficiency (≥ 90 days history).

03ZERO FLOAT DRIFT

Deterministic Math Core

5,000 Paths · Integer Paise

Simulates 5,000 daily cash-flow trajectories under random shocks (seed: 42). Computes adaptive safety buffers based on income volatility.

04ANTI-HALLUCINATION

Reasoning Ledger & Vault

8-Step Proof · Headroom +₹42k

Generates an immutable step-by-step mathematical proof. Strict regex guard ensures zero LLM numerical hallucinations; 100% offline in fdl.db.

Universal Statement Ingestion

Universal Bank & Payment Ingestion

Directly upload and analyze bank statements from PhonePe, Google Pay, Paytm, HDFC, SBI, ICICI, Axis, Kotak, and CRED — zero cloud transmission, 100% deterministic local math.

Auto-detects Bank Schemas & Dates
Password-Protected PDF Support
UPI/IMPS Merchant Junk Cleaning
100% Offline Local-First Privacy
PhonePe
Google Pay
Paytm
HDFC Bank
State Bank of India
ICICI Bank
Axis Bank
Kotak Mahindra Bank
CRED
ZERO-HALLUCINATION NARRATION

Dual-Tier AI Architecture with Number Verification Guard

The LLM is strictly confined to natural language comprehension and narration. Every figure cited must exist verbatim in the mathematical Reasoning Ledger.

FINANCIAL PIPELINE ? REAL-TIME
0 LLM Math ? 100% Deterministic
TRIGGERQuery / CSVhdfc ? sbi ? iciciDATA GATEReconciliation4/4 passed ? ?=0DETERMINISTIC MATHMonte Carlo5,000 runs ? seed:42Reasoning LedgerNumber GuardVerified Headroom
?
Query: "Can I afford iPhone 16 (?80,000) on 5th next month?"
SIMULATIONS
5,000 paths
DRIFT TOLERANCE
0.00 Paise
BUFFER FLOOR
?58,000
ENGINE CORE
Deterministic ? Local SQLite
ENGINEERING GUARANTEES

6 Core Invariants Built Into Every Calculation

Why Financial Decision Lab is fundamentally different from generic LLM chat wrappers.

Deterministic Verification Flow

Deterministic Math.Unshakeable Verdicts.

HDFSalary · HDFC (+₹85,000)SBIRent · SBI (-₹24,000)ICIUtilities · ICICI (-₹3,400)UPIGroceries · UPI (-₹12,450)SIPSIP · Mutual Fund (-₹10,000)FDL COREINTEGER PAISE · 0 FLOATLEDGER #184CAN AFFORD ✓Opening: ₹1,42,800.00Buffer: ₹35,000 (1.5x)Headroom: +₹48,500.00P10 · P50 · P90

Continuous Statement Streaming

Categorized credits and recurring debits stream into the deterministic calculation pipeline in integer paise — zero float drift.

8-Step Reasoning Ledger

Every verdict is proven through an immutable mathematical audit trail linking balance, obligations, buffer, and final headroom.

HDFC BankSBI LedgerICICI NetAxis UPIreconciling · hdfc

Local-First Ingestion & Reconciliation

Auto-detects HDFC, SBI, ICICI & Axis statements. Strictly verifies Opening + ΣTx = Closing. Zero cloud data egress.

FORECAST (P50)pred ₹89k (+112%)

Monte Carlo Headroom Forecast

5,000 simulations evaluate daily cash flow volatility to establish exact P10 conservative and P50 median safety margins.

CORE USP · PRIVACY

100% Local-First & Air-Gapped

Runs completely offline on your local device. Statements, transactions, and balances remain strictly in your local SQLite database (fdl.db). Zero cloud transmission, zero telemetry, absolute data privacy.

0 FLOAT DRIFT

Deterministic Integer Paise Math

All calculations are executed in integer paise (1 INR = 100 Paise). The LLM is completely isolated from computing balances, safety buffers, or affordability verdicts.

SEED=42

5,000 Monte Carlo Simulations

Simulates 5,000 daily spend trajectories under random shocks to establish reproducible P10 (conservative), P50 (median), and P90 headroom probability percentiles.

ADAPTIVE

Dynamic Volatility Buffer

Measures income volatility via Coefficient of Variation. Freelancers with irregular credits automatically receive an elevated safety reserve multiplier (up to 2.0x essentials).

AUDITABLE

8-Step Reasoning Ledger

Every verdict produces an immutable mathematical audit trail linking starting balance, expected cash flows, recurring obligations, safety buffers, and final headroom.

ANTI-HALLUCINATION

Number-Verification Guard

When generating natural English narration, a strict regex guard validates every numerical figure cited against the Reasoning Ledger. Any unverified figure defaults to template math.

EXACT FORMULAS & ALGORITHMS

The 8 Core Mathematical Equations Powering Every Verdict

Every calculation is executed in integer paise with zero floating-point drift. Here are the 8 fundamental mathematical invariants enforced by our deterministic engine.

INGESTION · DEDUP0 Duplicates

SHA-256 Idempotent Hash

Fingerprint = SHA256(acc_id || date || paise || desc)

Guarantees duplicate files or overlapping statement date ranges are never double-counted into ledger history.

INTERNAL TRANSFERS±₹25 Tolerance

Transfer Cancellation

sgn(T₁) ≠ sgn(T₂) ∧ |Δt| ≤ 2d ∧ |T₁ + T₂| ≤ Fee

Pairs intra-account transfers between savings accounts so funds shifted to secondary accounts are not treated as expenses.

BALANCE CONTINUITYΔ = 0 Paise

Balance Anchor Equation

Opening + Σ Tx = Closing Balance

Any minor arithmetic mismatch (Δ > 0) instantly halts calculation and flags a discrepancy in the statement table.

DATA SUFFICIENCY≥ 90 Days

4-Point Sufficiency Gate

Span ≥ 90d ∧ MaxGap ≤ 7d ∧ Inflows ≥ 2

Refuses to calculate on blind data; requires continuous transaction history with verified recurring income anchors.

OUTLIER DETECTIONM ≥ 3.5 MAD

Modified Z-Score (MAD)

M_i = 0.6745 · |x_i - x̃| / MAD(x)

Detects abnormal one-off spikes without distorting recurring monthly subscription and utility obligations.

DAILY SIMULATIONSeed = 42

Monte Carlo Evolution

B(t) = B(t-1) + Inc(t) - Fix(t) - Var(t)

Simulates 5,000 daily spend trajectories under random shocks to find conservative P10, median P50, and P90 percentiles.

SAFETY RESERVEk ∈ [1.0x, 2.0x]

Dynamic Volatility Buffer

Buffer = Max(₹5k, k · Essentials, Var)

Multiplied by income volatility CV: 1.0x for salaried workers, scaling up to 2.0x for volatile freelancers.

FINAL VERDICTP10 Conservative

Headroom Proof Formula

Headroom_X = B_min,X - Buffer - Price

AFFORDABLE if Headroom₁₀ ≥ 0; TIGHT if Headroom₅₀ ≥ 0; else NOT ADVISABLE. Zero LLM hallucinations.

Domain Invariants & Threshold Reference (Appendix B)

Enforced deterministically in Python engine & TypeScript contracts
MIN_HISTORY
≥ 90 Days
Full Confidence
MAX_GAP_DAYS
≤ 7 Days
Continuity Bound
MONTE_CARLO
5,000 Runs
Seed = 42
BUFFER_FLOOR
₹5,000.00
500,000 Paise
OUTLIER_MOD_Z
> 3.5 MAD
Spike Filter
TRANSFER_TOL
±₹25.00
2,500 Paise Fee

Experience the Deterministic Engine in Action

Launch the Decision Lab to run simulated purchase scenarios, review your cash horizon, and inspect the live Reasoning Ledger.