Decides what to do about a cash-on-delivery order that might not come back — and prices the decision in the merchant's own rupees, including the cost of being wrong about a good customer.
Razorpay AI Buildathon, Track 02 (AI Risk Manager).
On 44,288 held-out orders across months 15-18 (116 days, never touched during development):
| Net against the merchant's existing rule | ₹72,86,592 (₹18,84,463 / month) |
| - of which given up on good orders | ₹20,07,115 |
| PR-AUC | 0.6773, against a no-skill baseline of 0.3040 |
| At the operating point | precision 0.388, recall 0.986 |
| Orders the policy acts on | 92.8% |
Profile mid - the middle of three, not the best-looking - measured against worst 10 regions, a rule the merchant could have written from the training window alone. Accuracy is not reported: on this positive rate, allowing every order scores 69.6%.
That last row is the number to argue with. At a base rate of 30.4% the cost argmin really does say intervene on most of the book, so the recall is cheap and the money comes mostly from the merchant's cost ratio rather than from the model's ranking. docs/EVALUATION.md works through it, including what the uncertainty override adds on top.
Full numbers, every ablation, and the limitations: docs/EVALUATION.md — generated from artifact JSON, never typed.
make setup && make sim && make train && make demoThen make serve and make console, and open http://localhost:5173.
No API key needed. The agent layer replays from a committed cache, so the enrichment works on a
clean clone with .env untouched.
There is no public dataset of real Indian COD delivery outcomes. This runs on an agent-based simulator calibrated to published RTO statistics, and the calibration fails the build if it misses a band. That is the honest ceiling on every number in this repository.
Because we wrote the simulator, a reviewer is entitled to discount anything it produces. So the same evaluation machinery — temporal splits, embargo, calibration, conformal coverage, cost-sensitive thresholding, graph features — also runs against 151,112 real e-commerce transactions with genuine device and IP reuse.
It does not all survive the trip, and that is the useful part. Ranking transfers (lift over no-skill holds) and so does point calibration. The conformal interval does not: it covers 75% against a nominal 90%, where on simulated data it lands within a point. That interval is what routes an uncertain order to a human, so the miss is on a path that matters, and it is unfixed. Graph features move the opposite way there too — up on real identifier reuse, down on our own planted rings.
Four more, stated plainly:
- The money rests on merchant assumptions. Whether a verification call rescues 35% of doomed orders, or 42% of nudged customers walk away, is not observable in any dataset we have. Those are inputs, not findings. The Cost Dial exists so a merchant can replace them.
- The ring structure is ours. We chose the sharing motifs, so the graph features find what we planted. Track B's real device reuse is the only honest read on that.
- The pincode features are sparser than the design assumed — 21,329 pincodes over 83,145 training orders. Real merchants concentrate in fewer places and those features would carry more.
- The operating point is close to flagging everything, and the test window is the festive peak. At the mid profile's cost-optimal threshold the argmin alone already flags 77% of orders, and the uncertainty override routes another slice of the allowed remainder to a verification call, so the shipped policy intervenes on 93% of orders. The recall is cheap and most of the money is a fact about the merchant's cost ratio rather than about the model's ranking. Raise the cost of a verification call and both numbers fall.
docs/SPEC-DEVIATIONS.md records all 53 places the specification and reality disagreed, including the ones that were our fault.
It prices the false positive. Every fraud demo shows losses prevented. This one shows, beside it, the margin given up on customers who would have paid — in rupees, as its own line. Netting that away is how a risk system talks itself into blocking everyone.
The threshold is derived, not configured. τ* falls out of a four-action argmin over the
merchant's own costs. Move a slider and it moves. There is no magic number anywhere in the repo.
The language model never touches the score. POST /score returns once the decision exists;
enrichment runs after the response is on the wire. An agent that is slow, broken or unreachable
cannot delay or change a decision, and ?simulate_failure=agent_timeout demonstrates it live.
We tested that boundary rather than asserting it. 18,827 live agent calls later, the Address Agent's structured assessment adds +0.0038 PR-AUC with a 95% interval of [−0.0116, +0.0190] — no measurable difference. Five lines of regex read an address about as well as eight LLM outputs, because the LLM's outputs are redundant with each other.
simulator → features → model → decision → agents → audit
↑
the decision is complete and persisted here
Six layers. Everything up to the decision is deterministic and replayable from
(score, cost config) alone. Everything after it is probabilistic and optional.
ARCHITECTURE.md is the two-page version: the cost model arithmetic, why the LLM sits after the decision, what we chose not to build and why.
- Defense only. Nothing here helps evade a risk system. The simulator generates training data; that is its only purpose and it is labelled as such.
- One loss class, done properly. RTO on cash-on-delivery. Not a fraud platform.
- Held-out metrics, with false-positive cost stated in rupees. Months 15–18 were read exactly once, by the one module that can reach them, after everything else was finished.
src/nishchay/simulator/ |
agent-based order stream, calibrated to published statistics |
src/nishchay/features/ |
point-in-time features; one code path for batch and serving |
src/nishchay/models/ |
training, calibration, benchmarks, ablations |
src/nishchay/decision/ |
the cost model — pure, no ML imports, checkable by hand |
src/nishchay/agents/ |
three bounded agents behind a vendor-neutral port |
src/nishchay/api/ |
FastAPI service, webhook verification, decision store |
src/nishchay/monitoring/ |
ADWIN, Page-Hinkley, PSI — and no path to the trainer |
src/nishchay/eval/ |
protocol.py is the only module that can read the held-out months |
console/ |
React + Vite + TypeScript, five screens |
make test # the full suite
make lint # ruff + mypy strictMIT licensed.