AI Summary • Published on Oct 14, 2025
The paper identifies key challenges in using large language models (LLMs) to directly answer natural language queries for financial data. These include LLMs' knowledge cutoffs, which make them unable to access live data, leading to temporal inaccuracies. Additionally, free-form SQL generation by LLMs can lead to hallucinations regarding field names or filters, which is a major concern in regulated financial environments requiring deterministic and auditable results. Finally, generic text-to-SQL pipelines often produce verbose or invalid queries, increasing latency and operational costs while still needing extensive error handling.
To overcome these problems, the FinAI Data Assistant integrates an LLM with the OpenAI Function Calling API and a curated set of parameterized SQL templates designed for common financial data tasks, such as retrieving market prices and company fundamentals. Instead of generating full SQL queries from scratch, the LLM classifies the user's intent and extracts necessary arguments. These arguments are then passed to trusted linking functions that instantiate and execute the appropriate pre-vetted SQL query. This architecture centralizes complexity within a small, auditable query library, ensuring stable latency, predictable costs, and a reduced likelihood of errors, while retaining the user-friendliness of natural language interaction. The methodology also includes evaluating LLMs' ability to recall temporal financial information, map company names to stock tickers, and comparing the function-calling approach against a text-to-SQL baseline in terms of accuracy, latency, and cost.
The evaluation yielded several key findings. Firstly, LLM-only predictions for financial time series (stock prices and fundamentals) exhibited non-negligible errors, indicating that LLMs cannot reliably retrieve exact financial values from short histories without external database access. Furthermore, a look-ahead bias was primarily observed for stock prices concerning the models' knowledge cutoffs. Secondly, OpenAI LLMs demonstrated near-perfect accuracy in mapping company names to stock ticker symbols for NASDAQ-100 constituents and high accuracy for S&P 500 firms, suggesting robust entity knowledge. Thirdly, the FinAI Data Assistant, employing the function-calling approach, consistently achieved lower latency, reduced cost, and higher reliability (perfect task completion in their test suite) compared to a traditional text-to-SQL baseline for end-to-end database query processing.
The FinAI Data Assistant presents a practical and effective architecture for enabling natural language access to financial databases. The findings highlight the critical need for explicit database integration when dealing with time-varying financial values, as LLMs alone are insufficient for accurate recall and are susceptible to look-ahead bias. The strong performance in ticker mapping validates the LLMs' utility for entity resolution in financial workflows. By prioritizing a reusable, parameterized query library over generative text-to-SQL, the system significantly improves reliability, reduces operational costs, and minimizes latency. This approach offers a robust solution for financial analysts and operations teams seeking dependable and efficient access to structured financial data via natural language.