← Latest papers
💬 NLP

A Semantic-Layer-Mediated Agent for Natural Language to SQL over Heterogeneous Enterprise Databases

This paper presents a semantic-layer-mediated agent that decouples natural language intent from physical SQL execution via a Semantic Model Query (SMQ) intermediate representation and a deterministic compiler, achieving 94.15% execution accuracy on the Spider2-snow benchmark and significantly outperforming schema-only approaches for heterogeneous enterprise databases.

Original authors: Ha Jeong Kim, Saksonita Khoeurn, Ye Ji Yoon

Published 2026-07-01
📖 4 min read☕ Coffee break read

Original authors: Ha Jeong Kim, Saksonita Khoeurn, Ye Ji Yoon

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to ask a very smart, but slightly literal, librarian (the AI) for a specific book from a massive, chaotic warehouse.

The Problem: The "Raw Warehouse"

In a typical enterprise database, the "warehouse" is a mess. It has hundreds of shelves (tables) with labels written in code like tbl_992_x instead of "Sales." The books inside have cryptic titles, and the rules for how to find them change depending on which building you are in (different database engines like Snowflake or BigQuery).

If you ask the librarian, "Show me the sales for last month," and just hand them a map of this messy warehouse, they often get overwhelmed. They might guess the wrong shelf, mix up the rules, or write a request that the warehouse manager rejects. This is what happens when you ask an AI to write database queries directly: it tries to do everything at once and often fails.

The Solution: The "Business Translator"

This paper introduces a new system that acts like a professional translator between your question and the messy warehouse. Instead of letting the AI look at the raw, confusing shelves, the system first puts everything into a Semantic Layer.

Think of the Semantic Layer as a clean, business-friendly catalog created by humans.

  • Instead of tbl_992_x, the catalog says "Retail Sales."
  • Instead of col_442, it says "Revenue."
  • It also includes a "Join Map" that tells the system exactly how "Retail Sales" connects to "Customer Data" without the AI having to guess.

How the System Works: The "Two-Step Dance"

The system uses a clever agent (a smart AI worker) that follows a strict routine, which the authors call a "Think-Act Loop." Here is the process:

  1. The Translation Request (SMQ):
    The AI doesn't write the final, complex database command immediately. Instead, it writes a simple, structured note called a Semantic Model Query (SMQ).

    • Analogy: Imagine the AI writing a shopping list in plain English: "I need the 'Revenue' from the 'Retail Sales' catalog, filtered by 'Daily'."
    • This note is simple and uses the clean business names, not the messy code names.
  2. The Deterministic Engine (The Compiler):
    A separate, robotic engine takes that simple shopping list and instantly translates it into the exact correct technical language for the specific warehouse (e.g., Snowflake or BigQuery).

    • Analogy: A robot takes your "Revenue" note and instantly converts it into the precise, legal code the warehouse manager understands, including the correct shelf numbers and connection rules.
    • Crucially, this step is deterministic, meaning it never guesses. If the catalog says "Revenue," the robot knows exactly which code column that is.
  3. The Final Assembly:
    The AI looks at the robot's translation. It sees the correct shelf names and connection rules. It then uses this verified information to build the final, complex answer, adding any extra steps the simple shopping list couldn't handle (like complex math or time calculations).

The Results: A Massive Win

The authors tested this system on Spider2-snow, a very difficult benchmark designed to mimic real-world enterprise problems.

  • The Challenge: The benchmark has 547 complex questions. Previous methods (just asking the AI to look at the raw warehouse) scored very low, often below 30%.
  • The Result: This new system, using the "Business Translator" approach, got 94.15% of the answers correct.
  • The Ranking: This placed them third on the official leaderboard, far ahead of everyone else who tried to solve the problem without this translation layer.

Why It Matters (and Its Limits)

The paper argues that the secret sauce isn't just a smarter AI, but better organization. By forcing the AI to work through a clean, human-curated catalog first, the system avoids the most common mistakes (like looking at the wrong shelf).

However, the authors are honest about the catch: The catalog must be perfect.

  • If the human-made catalog is missing a piece of information, the system can't find it.
  • There is a risk that if you make the catalog too detailed just to pass a specific test, the system might become "overfitted"—meaning it memorizes the test answers rather than learning to be generally smart. The paper suggests treating the catalog like code that needs careful review to ensure it remains useful for new, unseen questions.

In short: The paper shows that if you want an AI to navigate a messy corporate database, don't let it wander the aisles alone. Give it a clean, human-written map first, and let a robot handle the translation to the final destination.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →