A Semantic-Layer-Mediated Agent for Natural Language to SQL over Heterogeneous Enterprise Databases
Ha Jeong Kim, Saksonita Khoeurn, Ye Ji Yoon
Abstract
Natural language-to-SQL (NL2SQL) over real-world enterprise databases remains significantly more challenging than on academic benchmarks. Enterprise schemas often contain hundreds of physical tables with cryptic column names, heterogeneous SQL dialects, and complex analytical workloads requiring nested aggregations, temporal reasoning, and multi-table joins. We present a semantic-layer-mediated NL2SQL agent that decouples semantic intent from physical SQL execution. Rather than generating SQL directly over raw schemas, the agent reasons over a curated semantic layer through a compact intermediate representation called the Semantic Model Query (SMQ). A deterministic compiler translates each SMQ into dialect-specific SQL, providing verified building blocks that the agent composes into the final query. The system employs a constrained think-act loop, supports SQLite, BigQuery, and Snowflake backends, and is integrated into an end-to-end evaluation framework. Using Gemini 3 Pro, the system achieves 94.15% execution accuracy on the 547-task Spider2-snow benchmark, ranking third on the official leaderboard and substantially outperforming schema-only approaches. We describe the system architecture, SMQ representation, agent workflow, evaluation results, and discuss semantic-layer quality and the trade-off between improved grounding and overfitting.
Create a lesson
Related papers
Non-Expanding Gated Continued Fraction Architecture for Feedforward Layers in Language Models
Shared title terminology · Amit Dhurandhar, Vijil Chenthamarakshan, Karthikeyan Natesan Ramamurthy et al.
What Helps Language-Model Agents Review Violent Video? A Controlled Comparison with a Human Evidence Reference
Shared title terminology · Mohammed El Amine Mokhtari, Matei Mancas, Virginie Vandenbulcke
Language-Oriented Semantic Modeling for Target Language Extraction
Shared title terminology · Mehmet Sinan Yıldırım, Ke Zhang, Shuai Wang et al.
Large Language Models or AI Agents for English to Arabic Translation? An assessment on WikiEn-Ar190
Shared title terminology · Fatima Zahra Iguenfer, Yousra Chtouki
Precision Recall Controllable Radiology Report Generation via Hybrid Natural Language and Clinical Reward Learning
Shared title terminology · Ling Chen, Ruinan Jin, Jun Luo et al.
Multilingual Prompt Localization for Agent-as-a-Judge: Language and Backbone Sensitivity in Requirement-Level Evaluation
Shared title terminology · Alhasan Mahmood, Samir Abdaljalil, Hasan Kurban