From Queries to Insights: Agentic LLM Pipelines for Spatio-Temporal Text-to-SQL
Manu Redd, Tao Zhe, Dongjie Wang

TL;DR
This paper introduces an agentic pipeline that enhances natural-language-to-SQL systems with planning and reasoning capabilities, significantly improving accuracy and usability for complex spatio-temporal database queries.
Contribution
The paper presents a novel agentic orchestration approach that extends a basic text-to-SQL model with planning, decomposition, and schema inspection, enabling better handling of complex queries.
Findings
Achieved 91.4% accuracy on complex spatio-temporal queries.
Significantly outperformed naive baseline with 28.6% accuracy.
Enhanced user interaction through maps, plots, and summaries.
Abstract
Natural-language-to-SQL (NL-to-SQL) systems hold promise for democratizing access to structured data, allowing users to query databases without learning SQL. Yet existing systems struggle with realistic spatio-temporal queries, where success requires aligning vague user phrasing with schema-specific categories, handling temporal reasoning, and choosing appropriate outputs. We present an agentic pipeline that extends a naive text-to-SQL baseline (llama-3-sqlcoder-8b) with orchestration by a Mistral-based ReAct agent. The agent can plan, decompose, and adapt queries through schema inspection, SQL generation, execution, and visualization tools. We evaluate on 35 natural-language queries over the NYC and Tokyo check-in dataset, covering spatial, temporal, and multi-dataset reasoning. The agent achieves substantially higher accuracy than the naive baseline 91.4% vs. 28.6% and enhances…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
