Text to sql system improves queries on complex financial databases
From Benchmarks to Production: A Text-to-SQL System for Complex Financial Data
Artificial IntelligenceDatabasesMachine Learning
Summary
Text-to-SQL systems let people ask questions in plain English and get answers from databases by turning the questions into SQL queries. However, financial databases are tricky because they use coded IDs instead of readable names and have complex table connections that confuse regular systems. The authors created FLINT, a system designed for finance that uses smart ways to understand and connect the question with the right database parts. FLINT works better than other methods on real financial data and is already used in a financial data service.
What this means in practice
- •For financial data engineers: Generate accurate SQL queries from plain language questions over complex financial databases with opaque identifiers.$Commercial implications: Enables financial firms to offer user-friendly query services for complex data, improving client access and reducing manual querying.
- •For business intelligence teams: Simplify data retrieval by linking natural language inputs to relevant database schema in complex relational data environments.
Authors
Arijit Sehanobish, Bruno Gomes Coelho, Guillaume Michel, Sophia Zhi, Valerie Faucon-Morin, Kristen Howell
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.