From Benchmarks to Production: A Text-to-SQL System for Complex Financial Data
Organizations: Kensho Technologies
Abstract
General-purpose Text-to-SQL systems achieve strong performance on academic benchmarks like Spider and BIRD, where schemas are relatively shallow and column values are often human readable. In production financial databases, where concepts are stored as opaque integer keys rather than human-readable strings, these methods fall below 50%, as even simple queries require multiple joins and filter predicates reference opaque IDs. We present Financial LINking Text-to-SQL (FLINT), a domain-specialized Text-to-SQL system that closes this gap through three key components: (1) a lookup agent that dynamically resolves natural-language concepts to question-specific reference table constraints, (2) embedding-based retrieval of structurally similar query templates from a compact, expert-authored bank, and (3) schema linking that prunes a large table schema to the relevant subset by traversing foreign-key chains, rather than relying on name similarity alone. We evaluate on two datasets totaling 359 questions over production financial schemas. FLINT outperforms various state-of-the-art baselines using the same LLM. The system is deployed in production as part of a financial data retrieval service.
Figures & tables
| Property | Financials | Transactions |
| Total tables | 24 | 18 |
| Reference / lookup | 16 | 12 |
| Core data | 8 | 6 |
| Avg. joins per query | 6.0 | 5.2 |
| Max joins (single query) | 13 | 13 |
| Queries requiring CTEs | 40 | 17 |
| Fin. | Trans. | ||
| Method | Approach | Accuracy (%) | |
| FLINT | Domain-specialized agents | 68.8 | 65.2 |
| Multi-agent / multi-candidate | |||
| CHESS Talaei et al. (2024) | Self-consistency ( ) | 27.1 | 42.0 |
| CHESS Talaei et al. (2024) | Self-consistency ( ) | 35.6 | 49.6 |
| Chase-SQL Pourreza et al. (2025) | Multi-path + tournament | 16.3 | 21.0 |
| Financials | Transactions | |||
|---|---|---|---|---|
| Configuration | Acc. | Acc. | ||
| FLINT (full system) | 68.8 | — | 65.2 | — |
| w/o Lookup Agent | 54.8 | 14.0 | 33.3 | 31.9 |
| w/o Few-Shot Retrieval | 57.9 | 10.9 | 40.6 | 24.6 |
| w/o Schema Linking | 65.2 | 3.6 | 50.7 | 14.5 |
| w/o Reflection | 67.9 | 0.9 | 55.1 | 10.1 |
| Error Category | Fin. | Trans. | Tot. |
|---|---|---|---|
| Correct tables & columns | |||
| Wrong filter / aggregation | 15 | 15 | 30 |
| Correct tables, wrong columns | |||
| Partial match ( 50%) | 35 | 15 | 50 |
| Low match ( 50%) | 11 | 10 | 21 |
| Wrong table selection |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Financials | Transactions | |||
|---|---|---|---|---|
| Difficulty | n | % | n | % |
| Simple (1–3 joins) | 22 | 10 | 38 | 28 |
| Moderate (4–6 joins) | 142 | 64 | 66 | 48 |
| Complex (7+ joins / CTE) | 57 | 26 | 34 | 25 |
| Property | Spider | BIRD | Ours |
|---|---|---|---|
| Avg. joins per query | 1.2 | 1.8 | 5.6 |
| Max joins (single query) | 4 | 6 | 13 |
| Reference/lookup tables | 0 | 0–2 | 12–16 |
| Opaque integer IDs | × | × | ✓ |
| Currency conversion | × | × | ✓ |
| Self-describing values | ✓ | ✓ | × |
| Component | FLINT | CHESS | DAIL/DIN | MAC-SQL | Chase-SQL | FlexSQL | ReFoRCE |
|---|---|---|---|---|---|---|---|
| Entity linking | ✓ | × ∗ | ✓ | × † | × | ✓ | × |
| Lookup agent | ✓ | × | ✓ | × † | × | × | × |
| Schema linking | ✓ | ✓ | ✓ | LLM | × | ✓ | × |
| Similar query retrieval | ✓ | × | ✓ | × | × | ✓ | ✓ |
| Reflection / retry | ✓ | × | DIN | Refiner | Fixer | ✓ | ✓ |
| DB exploration | × | × | × | ✓ | × | × | ✓ |
| Financials | Transactions | |||
|---|---|---|---|---|
| Method | ID Acc. | Fail ID | ID Acc. | Fail ID |
| FLINT (full) | 94% | 13% | 75% | 28% |
| w/o Lookup Agent | 10% | 93% | 7% | 94% |
| CHESS ( ) | 46% | 64% | 58% | 61% |
| MAC-SQL | 30% | 76% | 39% | 62% |
| DAIL-SQL | 21% | 83% | 28% | 79% |
| Financials | Transactions | |||
|---|---|---|---|---|
| Difficulty | n / N | Acc. | n / N | Acc. |
| Simple (1–3 joins) | 14/22 | 64 | 25/38 | 66 |
| Moderate (4–6 joins) | 107/142 | 75 | 47/66 | 71 |
| Complex (7+ / CTE) | 31/57 | 54 | 18/34 | 53 |
| Overall | 152/221 | 69 | 90/138 | 65 |
| Dataset | Median | 90% match | Closest (min TED) |
|---|---|---|---|
| Financials | 0.78 | 10.6% | 0.023 |
| Transactions | 0.62 | 0 0.0% | 0.111 |
| SM3-Text-to-Query | ||
|---|---|---|
| Method | All (n=2000) | Hard (n=631) |
| Zero-shot | 77.8 | 58.2 |
| Few-shot ( ) | 92.3 | 85.3 |
| FLINT | 95.7 | 96.5 |
Text-to-SQL
Text-to-SQL translates natural-language questions into executable database queries, linking user intent to schemas, values, and SQL logic.
See all 169 papers