用大模型让天文学家用自然语言查天文数据库,准确率超90%。
Querying an astronomical database using large language models: the ALeRCE text-to-SQL system

- 分步生成框架:先链接数据结构,再分类查询,拆解提示,最后自纠错。
- 简单查询时,识别对象和列的准确率达97%和94%,复杂查询仍保持59%以上。
- 适合天文学家快速检索海量天文事件数据,无需学SQL。
我们基于大语言模型(LLMs)构建了一个文本转SQL系统,利用上下文学习技术应用于自动事件分类与快速响应中心(ALeRCE)天文数据库。ALeRCE是齐克里瞬变设施和薇拉·C·鲁宾天文台的社区数据枢纽。该系统使用户能以自然语言查询数据库,并生成可执行的SQL语句。为开发与评估系统,我们构建了110对自然语言/SQL样本组成的语料库。提出四模块分步生成框架:模式链接、查询分类、提示分解和自纠错。通过上下文学习与提示工程评估13个大模型性能。使用精确匹配(PM)率评估行标识符(如对象标识符)和列标识符(即列名)的表现。所提分步框架持续优于直接推理基线,自纠错模块显著降低执行错误。对于Claude Opus 4.6,简单查询在行(列)标识符上的PM表现分别为0.97(0.94),中等复杂度下降至0.44(0.72),高复杂度降至0.59(0.49)。在13个模型中,表现最佳者为Claude Opus 4.6、Gemini 2.5 Pro、Gemini 3 Flash和GPT-5.2-Codex。
原文摘要 · Abstract (English)
We develop a text-to-SQL (structured query language) system based on large language models (LLMs) using in-context learning and apply it to the Automatic Learning for the Rapid Classification of Events (ALeRCE) astronomical database. ALeRCE is a community broker for the Zwicky Transient Facility and the Vera C. Rubin Observatory. The system enables users to query the database in natural language (NL) and generates executable SQL queries. To develop and evaluate the system, we constructed a dataset of 110 NL/SQL pairs. We propose a step-by-step generation framework comprising four modules: schema linking, query classification, prompt decomposition, and self-correction. The performance of thirteen LLMs is evaluated using in-context learning and prompt engineering techniques. Text-to-SQL performance is assessed using the perfect-match (PM) rate for row identifiers (e.g., object identifiers) and column identifiers (i.e., column names). The proposed step-by-step framework consistently outperforms a direct-inference baseline, while the self-correction module consistently reduces execution errors. For Claude Opus 4.6, PM performance on row (column) identifiers is high for simple queries, reaching 0.97 (0.94), and decreases with query complexity to 0.44 (0.72) for medium queries and 0.59 (0.49) for hard queries. Among the thirteen evaluated models, the best-performing LLMs for the text-to-SQL task are Claude Opus 4.6, Gemini 2.5 Pro, Gemini 3 Flash, and GPT-5.2-Codex.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。