Flagship 01 · Commercial Risk Systems · Rigorous Decisioning
A commercial underwriting copilot that scores credit applications with calibrated probabilities, decomposes scores into exact additive SHAP factors, retrieves historical precedent cases with known outcomes, and generates natural language explanations verified against strict numeric grounding guards.
Under the official German Credit asymmetric loss matrix, approving a bad loan costs 5 cost units, whereas declining a good loan costs 1 cost unit. A standard 0.50 cutoff costs more per applicant than declining every single borrower.
Bayes-Optimal Decision Rule
For probability \(p = P(Y=1 \mid x)\), the expected cost of approving is \(5p\), while the expected cost of declining is \(1(1-p)\). Equating the expected costs yields the theoretical minimum:
Empirically calibrated over out-of-fold training probabilities, the loss-minimizing operational cutoff shifts to 21.2%, achieving expected cost \(0.584\) vs \(0.700\) for a naive policy.
Recomputes confusion matrix and expected loss live over all 250 held-out applicants
Inspect any of the 250 held-out applicants. The model score is decomposed into exact additive SHAP log-odds contributions, paired with regulatory adverse-action reasons and ChromaDB vector precedent cases.
Additive TreeSHAP decomposition with regulatory reason codes
SHAP values sum to the difference between the applicant's predicted log-odds and the expected baseline:
A standard naive bootstrap over group approval rate ratios creates a biased estimator that falsely flags noise as disparity. We replace it with an exact label permutation test.
| Demographic Group | n | Approval Rate | Bad Rate | Approved Among Non-Defaulters | ROC-AUC |
|---|
What happens if protected attributes are eliminated completely? We refit the model without them, recalibrate isotonically, and re-optimize the threshold out-of-fold:
Four layered endpoints ensure that lending decisions never depend on LLM uptime, hallucinations, or API latency:
| Endpoint | Payload Output | LLM Invoked | Failure Mode |
|---|---|---|---|
GET /health |
Model readiness and vector store status | No | Never (Readiness probe) |
POST /score |
Calibrated probability & cost-optimal decision | No | Artifacts missing |
POST /explain |
The above + SHAP factors & adverse action codes | No | Artifacts missing |
POST /ask |
Verified conversational answer with numeric grounding | Yes | Provider down (graceful fallback to verified template) |
1. Numeric Grounding: Every single number in the LLM answer is regex-extracted and asserted against the mathematical context.
2. Citation Verification: Every case ID cited must match a record actually retrieved from ChromaDB.
3. Protected Rationale Guard: Protected attributes cannot be framed as causal rationale for declines.
Showing a hallucinated answer with a disclaimer badge is how bad decisions happen. If an answer fails grounding, the service substitutes a deterministic rule-based template built from verified data and sets grounded: false.
Over 50% of the guard test suite validates that correct answers are not falsely rejected.