单元物理链:一种以基础原理为中心的科学代码合成方法
Chain of Unit-Physics: A Primitive-Centric Approach to Scientific Code Synthesis
AI总结:
本研究提出单元物理链框架,通过以基础原理为中心的多代理系统,有效解决科学代码生成中的可靠性问题,实现高精度和高效能的代码生成。
摘要:
代理式大语言模型被提出作为自主的科学计算代码生成器,但其在高风险问题中的可靠性仍存疑。开发从自然语言查询生成计算科学软件仍然具有挑战性,原因包括(a)在训练过程中领域代码的稀疏表示,以及(b)小型专家社区中强化学习与人类反馈的可行性有限。为了解决这些限制,本工作提出了代码设计的逆向方法,体现在单元物理链框架中:一种以基础原理(或原始单元)为中心的多代理系统,在其中人类专家知识被编码为单元物理测试,这些测试明确约束代码生成。该框架在非平凡的燃烧任务上进行了评估,此处作为科学问题的代表基准,具有现实的物理约束。封闭权重系统和以代码为中心的代理变种无法生成正确的端到端求解器,尽管拥有工具和网络访问,表现出四个反复出现的错误类别:接口(语法/API)幻觉、过度自信的假设、数值/物理不一致性和配置脆弱性。具有链式思考(CoT)解码的开放权重模型减少了接口错误,但仍会产生不正确的解决方案。在该基准任务中,所提出的框架在5-6次迭代内收敛,与人类专家实现(均方误差为$3.1\times10^{-3}$ %)相匹配,运行时间快约33.4%,内存使用效率高约30%,成本与中型商业API相当,提供了一种实用的物理基础科学代码生成模板。随着数据集和模型的发展,零样本代码准确性将提高;然而,单元物理链框架进一步通过嵌入基础原理分析,这是科学代码的基础。
英文摘要:
Agentic large language models are proposed as autonomous code generators for scientific computing, yet their reliability in high-stakes problems remains unclear. Developing computational scientific software from natural-language queries remains challenging broadly due to (a) sparse representation of domain codes during training and (b) the limited feasibility of RLHF with a small expert community. To address these limitations, this work conceptualizes an inverse approach to code design, embodied in the Chain of Unit-Physics framework: a first-principles (or primitives)-centric, multi-agent system in which human expert knowledge is encoded as unit-physics tests that explicitly constrain code generation. The framework is evaluated on a nontrivial combustion task, used here as a representative benchmark for scientific problem with realistic physical constraints. Closed-weight systems and code-focused agentic variants fail to produce correct end-to-end solvers, despite tool and web access, exhibiting four recurrent error classes: interface (syntax/API) hallucinations, overconfident assumptions, numerical/physical incoherence, and configuration fragility. Open-weight models with chain-of-thought (CoT) decoding reduce interface errors but still yield incorrect solutions. On the benchmark task, the proposed framework converges within 5-6 iterations, matches the human-expert implementation (mean error of $3.1\times10^{-3}$ %), with a $\sim$33.4 % faster runtime and a $\sim$30 % efficient memory usage at a cost comparable to mid-sized commercial APIs, yielding a practical template for physics-grounded scientific code generation. As datasets and models evolve, zero-shot code accuracy will improve; however, the Chain of Unit-Physics framework goes further by embedding first-principles analysis that is foundational to scientific codes.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。