arXiv:2507.09592cs.DBcs.AI2025-07

让非技术人员用自然语言直接查询企业数据库,自动转成安全的SQL并返回可读结果。

THOR: Transformer Heuristics for On-Demand Retrieval

  • 分层代理架构:问题路由、动态表结构注入、SQL生成与只读保护
  • 支持最多5次LLM重试,自动修复空结果或执行错误
  • 适合需要零代码访问数据的业务人员,尤其金融、销售等场景

我们提出THOR(Transformer Heuristics for On-Demand Retrieval)模块,由eSapiens安全可扩展引擎实现,将自然语言问题转化为经验证的只读SQL分析查询,用于企业数据库。Text-to-SQL模块采用解耦式编排/执行架构:监督代理负责路由,模式检索动态注入表与列元数据,SQL生成代理输出单条SELECT语句,并受只读防护机制保护。集成自校正与评分循环可捕获空结果、执行错误或低质量输出,并触发最多五次大模型驱动的重生成。最终,结果解析代理生成简洁易懂的洞察,原始数据行则交付给智能洞察引擎用于可视化或预测。在财务、销售和运营场景的烟雾测试表明,系统具备可靠的即兴查询能力与自动化周期报告功能。通过嵌入模式感知、容错执行和合规防护机制,THOR模块使非技术用户以零SQL方式访问实时数据,兼具简单性与企业级安全性。

原文摘要 · Abstract (English)

We introduce the THOR (Transformer Heuristics for On-Demand Retrieval) Module, designed and implemented by eSapiens, a secure, scalable engine that transforms natural-language questions into verified, read-only SQL analytics for enterprise databases. The Text-to-SQL module follows a decoupled orchestration/execution architecture: a Supervisor Agent routes queries, Schema Retrieval dynamically injects table and column metadata, and a SQL Generation Agent emits single-statement SELECT queries protected by a read-only guardrail. An integrated Self-Correction & Rating loop captures empty results, execution errors, or low-quality outputs and triggers up to five LLM-driven regeneration attempts. Finally, a Result Interpretation Agent produces concise, human-readable insights and hands raw rows to the Insight & Intelligence engine for visualization or forecasting. Smoke tests across finance, sales, and operations scenarios demonstrate reliable ad-hoc querying and automated periodic reporting. By embedding schema awareness, fault-tolerant execution, and compliance guardrails, the THOR Module empowers non-technical users to access live data with zero-SQL simplicity and enterprise-grade safety.

自然语言查询Text-to-SQL企业数据LLM应用

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。