提升核电厂数据检索的准确性与可维护性:一种基于函数调用 LLM 的 NL-to-SQL 替代方法
Enhancing Accuracy and Maintainability in Nuclear Plant Data Retrieval: A Function-Calling LLM Approach Over NL-to-SQL
AI总结:
针对核电厂运行数据检索中 NL-to-SQL 难验证、遗留数据库复杂的问题,提出由 LLM 调用预批准函数并封装专家验证 SQL 的框架,提升准确性与可维护性。
摘要:
从核电厂检索运行数据需要极高的准确性和透明度,因为这些数据支持的决策具有关键性。传统上,人们探索使用自然语言转 SQL(NL-to-SQL)方法来查询此类数据。尽管 NL-to-SQL 有望带来易用性,但它也带来显著风险:最终用户无法轻松验证生成的 SQL 查询,而且遗留的核电厂数据库通常结构复杂且设计不佳,经过数十年的增量修改后,会使查询生成更加困难。这些挑战增加了出现不准确结果的可能性,并降低了人们对该方法的信任。在本研究中,我们提出一种替代范式:利用支持函数调用的大型语言模型(LLM)来应对这些挑战。我们并不直接生成 SQL 查询,而是定义一组预先批准、面向特定用途的函数,用于表示常见用例。查询通过调用这些函数来处理,而函数内部封装了经过验证的 SQL 逻辑。这种混合方法通过确保 SQL 查询在部署前由专家审查和优化,降低了与直接 NL-to-SQL 转换相关的风险。尽管该策略会带来开发和维护函数库的前期成本,但我们展示了 NL-to-SQL 工具如何协助函数代码的初始生成,使专家能够专注于验证而非创建。我们的研究包括对直接 NL-to-SQL 生成与所提出的基于函数的方法进行性能比较,突出了其在准确性和可维护性方面的改进。本工作强调了在用户可访问性与运行安全之间取得平衡的重要性,并为关键系统中的稳健数据检索提供了一个新颖、可落地的框架。
英文摘要:
Retrieving operational data from nuclear power plants requires exceptional accuracy and transparency due to the criticality of the decisions it supports. Traditionally, natural language to SQL (NL-to-SQL) approaches have been explored for querying such data. While NL-to-SQL promises ease of use, it poses significant risks: end-users cannot easily validate generated SQL queries, and legacy nuclear plant databases -- often complex and poorly structured -- complicate query generation due to decades of incremental modifications. These challenges increase the likelihood of inaccuracies and reduce trust in the approach. In this work, we propose an alternative paradigm: leveraging function-calling large language models (LLMs) to address these challenges. Instead of directly generating SQL queries, we define a set of pre-approved, purpose-specific functions representing common use cases. Queries are processed by invoking these functions, which encapsulate validated SQL logic. This hybrid approach mitigates the risks associated with direct NL-to-SQL translations by ensuring that SQL queries are reviewed and optimized by experts before deployment. While this strategy introduces the upfront cost of developing and maintaining the function library, we demonstrate how NL-to-SQL tools can assist in the initial generation of function code, allowing experts to focus on validation rather than creation. Our study includes a performance comparison between direct NL-to-SQL generation and the proposed function-based approach, highlighting improvements in accuracy and maintainability. This work underscores the importance of balancing user accessibility with operational safety and provides a novel, actionable framework for robust data retrieval in critical systems.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。