
Built for Tractafric Equipment's finance and analytics team, who previously answered these questions by hand in Excel. The real challenge wasn't wiring an LLM to a database: it was three specific traps in the data that break naive text-to-SQL.
The schema has 50 ambiguous columns, including three different "major class" fields, four GPM fields, and percentages stored as fractions. Hand-written semantic SQL views and schema cards mean the model never touches the raw table directly.
Two Caterpillar programmes define support as a GPM% curve rather than a flat threshold. A naive join silently multiplies or mis-picks rows, misstating about 26% of total support (roughly $570K). A correlated-subquery band join fixes this, and it's specifically covered by the benchmark's "join" category.
Business French doesn't match the schema vocabulary: "pompes hydrauliques" has to resolve to PPC codes like HGP, HPM, and HRP across 4,653 French part descriptions. A brute-force NumPy vector index (no vector DB needed at around 5,500 vectors) plus a deterministic taxonomy graph in NetworkX handles this.
Everything runs fully offline: SQLite in read-only mode, a local Ollama model (qwen3.5:9b), no cloud calls, no data leaving the machine. A 100-question gold-set benchmark, with ablations removing the views, resolution, and graph one at a time, shows the semantic-view layer alone is worth about 47 accuracy points, and that the smallest model in the sweep is also the most accurate: reasoning mode and a 30B model both score worse than the 9B default with reasoning off.
Local-LLM chat assistant that turns a plain-language sales question into an auditable SQL query against 3.1M real Caterpillar-dealer records with guardrails built around five verified data traps that silently return a wrong number if ignored.
Churn-risk ranking engine dealer's aftermarket business, isolating a credible 230-account cohort from a 3.1M-row export corrupted by a row-cap bug that silently dropped 63% of customers, and beating recency/frequency baselines with a bootstrap-validated 0.51 PR-AUC.
K-Means segmentation of 2,635 real customers into 4 segments (0.97 bootstrap ARI), surfacing a $668K reactivation list from a deliberately capped export.