Skip to content
Open access

Two-Layer RAG for Value Grounding and Schema Linking in LLM-Based Text-to-SQL Systems

Sep 2026 · Brazilian Symposium on Databases · 0 citations · 12 references

Abstract

Large Language Models translate natural language into SQL. In environments with dynamic schemas, models hallucinate column names and filter values absent from the target database. We present a two-layer Retrieval-Augmented Generation architecture that addresses schema linking and value grounding within an orchestration pipeline. The structural layer retrieves validated SQL examples via cosine similarity over dense embeddings, while the semantic layer extracts entities from the user query and matches them against real column values through a MinHash-then-Embedding cascade. The architecture improved Execution Accuracy from 23.6% to 42.5%. By successfully grounding filter values, the semantic layer reduced the Empty Result Rate from 26.4% to 7.5%.

Read PDF

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.