SunCulture Transaction Intelligence
A hybrid rules + LLM + retrieval pipeline that standardized 7M+ farmer transactions into the credit signal behind microloans.
- Org
- SunCulture — Series-B agtech, East Africa
- Role
- Data science & ML
- Period
- 2025
- Status
- production
- Stack
- Python · RAG · LLM classification · REST
- Links
- sunculture.io ↗
The problem
SunCulture sells solar-powered irrigation to smallholder farmers across East Africa, financed through microloans. To underwrite those loans, the credit team needed a clean view of each farmer's cash flow — but the raw transaction data was a mess: free-text descriptions, inconsistent merchant names, regional abbreviations, and 500+ category targets ranging from "seeds" to "motorbike repair."
The pipeline's job: classify transactions reliably enough that the output could feed a creditworthiness model that decides real loans.
The constraints
- 7M+ transactions with noisy free-text descriptions and regional abbreviations
- A 500+ category space — pure rules could never cover the tail; pure LLM was too expensive at volume
- Ground truth was scarce: the hand-labeled gold set was small relative to the category space
- A latency budget — new transactions had to score fast enough to inform loan decisions
- A 95%+ accuracy bar for the credit team to trust the signal at all
The loop
A three-tier hybrid, each tier handling what it's cheapest and best at:
- Rule engine (fast path) — exact merchant matches and known prefixes resolve the high-confidence majority at near-zero cost
- LLM + retrieval (long tail) — for uncertain transactions, retrieve the nearest labeled examples from the corpus and condition the model on them, RAG-style
- Confidence-gated human review — only predictions below a confidence threshold route to a person
The loop that kept it improving: errors from each batch were hand-labeled and folded back into the retrieval corpus, so the long-tail tier got sharper with every cycle.
The build
A Python REST service classifies individual transactions or batch files:
- Rule layer covers the majority of common transactions with near-zero marginal cost
- LLM + retrieval layer handles novel or ambiguous descriptions
- Confidence gating routes only the genuinely uncertain subset to manual review
- Output integrates directly with the credit-scoring model feeding loan decisioning
Evidence
The 99% figure comes from a 10,000-item hand-labeled holdout — not training accuracy, not a cherry-picked subset.
- Accuracy was tracked per tier, so the cheap rule path couldn't quietly degrade behind the blended number
- The iterative eval loop (hand-label errors → fold into retrieval corpus) meant the system improved on exactly the cases it got wrong
- Confidence calibration determined the human-review threshold — the −95% review reduction is a direct consequence of the gate, not a separate claim
Impact
- 99% accuracy on the holdout, clearing the credit team's 95% trust bar
- 95% reduction in manual review volume
- A cleaner cash-flow signal feeding microloan underwriting
- Faster loan decisions for smallholder farmers across East Africa
Questions about this project? Press ⌘K — the chat answers from these case studies and cites them.