Daily Tech Briefing
AI 科技速览

每天 5 分钟内学习 AI。获取最新的人工智能新闻,理解其重要性,并学习如何将其应用于您的工作。

AI 快讯
arXiv AI · 2026/7/28 04:00:00

Schema-Aware Localisation (SAL): Live Schema Grounding and Hallucination Validation for Oracle NL2SQL

AI 中文解读
核心亮点:一项名为SAL的新技术让AI在Oracle数据库上写SQL语句的准确率从可怜的2.2%飙升至62.6%,而且全程不需要人工整理表格信息。 通俗解读:以前让AI从自然语言生成SQL查询时,它经常“瞎编”不存在的列名或表名,导致数据库报错。SAL就像一个聪明的“数据库导游”:它先自动查清楚数据库里到底有哪些表格和字段,把这些真实信息喂给AI;等AI写出SQL后,它还会逐条检查有没有乱写的变量名,一旦发现错误就自动修正并让AI重试。整个过程完全自动化,不需要人工提前整理数据库结构。 实际影响:对企业来说,员工以后可以直接用普通话查数据库,比如问“上个月销售额前三的产品”,AI就能准确给出结果,不再动不动报错。这能大幅降低企业使用数据库的门槛,让非技术人员也能轻松获取数据,同时减少IT支持人员的排查负担。对于普通上班族,这意味着以后用聊天式数据查询工具会变得更可靠、更省心。
arXiv:2607.22572v1 Announce Type: new Abstract: Large language models can generate fluent SQL from natural language, but on real enterprise Oracle databases they frequently fail at execution time: columns and aliases are hallucinated and dialect-specific syntax is missed, leading to ORA-00904 invalid-identifier errors. In this setting, failures are primarily due to missing schema grounding: the model cannot know which tables and columns actually exist. This paper introduces Schema-Aware Localisation (SAL), a lightweight middleware layer for Oracle NL2SQL that requires no model retraining. SAL queries Oracle's USER_TAB_COLUMNS catalog to build a live schema map, selects a relevant table subset for each question (falling back to the full schema for multi-table queries), and injects this ground-truth context into the LLM prompt. Generated SQL is then checked by the Hallucination Index (Hidx), which validates every alias.column reference against the live catalog, automatically rewrites predictable prefix errors, and otherwise triggers a structured retry with itemised corrections. We evaluate SAL on 500 TPC-H natural language questions executed against a live Oracle Autonomous Database 23c instance using GPT-4o-mini. Without any schema grounding, execution-grounded truth (EGT; executes and matches the reference result set) is 2.2% (12/500). A hand-written static schema hint brings EGT to 62.0%. SAL, with no manual schema curation, achieves 62.6% EGT (96% simple, 95% medium, 40.7% complex) while reducing execution failures from 97.6% to 2.6%.
分享
阅读原文