arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2604.04854cs.SE
收藏

评估大语言模型在科学软件中稳定数值表达式的能力

Assessing Large Language Models for Stabilizing Numerical Expressions in Scientific Software

Virginia Tech(弗吉尼亚理工大学)

Tien Nguyen, Kirshanthan Sundararajah, Muhammad Ali Gulzar

AI总结:

本文评估大语言模型在数值稳定性任务中的表现,发现其在检测和稳定不稳定的计算方面与传统方法相当,并在某些情况下表现更优,但对控制流和高精度字面量处理较弱。

摘要:

科学软件依赖高精度计算,但有限的浮点表示可能引入精度误差,尤其在安全关键领域。尽管大语言模型(LLMs)在科学应用中日益普及,但其在处理浮点数数值稳定性方面的可靠性尚未系统评估。本文通过两个数值稳定性任务评估LLMs的推理能力:(1)通过生成引发错误的输入检测不稳定的数值表达式(检测),(2)重写表达式以提高数值稳定性(稳定化)。利用流行的数值基准,我们评估了六个LLMs对近2470个数值结构的性能,包括嵌套条件、高精度字面量和多变量算术。结果表明,LLMs在检测和稳定不稳定的计算方面与最先进的传统方法同样有效。更值得注意的是,LLMs在基线方法失败的17.4%(431)个表达式中成功稳定了422(97.9%)个,且在65.4%(1615)的所有表达式中稳定性优于基线。然而,LLMs在处理控制流和高精度字面量时表现较差,倾向于移除这些结构而非推理其数值影响,而他们在纯符号表达式上表现显著更好。这些发现表明,LLMs能够稳定传统方法无法处理的表达式,但在需要精确推理确切数值大小和控制流语义时表现不佳,因为此类具体模式在训练中很少遇到。

英文摘要:

Scientific software relies on high-precision computation, yet finite floating-point representations introduce precision errors that propagate in safety-critical domains. Despite growing use of large language models (LLMs) in scientific applications, their reliability in handling floating-point numerical stability has not been systematically evaluated. This paper evaluates LLMs' reasoning through two tasks: (1) detecting instability in numerical expressions by generating error-inducing inputs (detection), and (2) rewriting expressions to improve numerical stability (stabilization). Building on popular numerical benchmarks, we assess 4 state-of-the-art LLMs on 2,037numerical structures, including nested conditionals, high-precision literals, and multi-variable arithmetic, across 469,000 tasks. Our results show that LLMs complement traditional approaches in detecting and stabilizing numerically unstable computations. Notably, LLMs outperform baseline methods precisely where the latter fail, stabilizing 61.2% of expressions the baseline fails to improve. More broadly, however, traditional baselines outperform LLMs: Herbie stabilizes 93.7% of the expressions compared to 67.2% by LLMs, and on expressions that both stabilize, Herbie achieves higher accuracy in 42.7% of cases. LLMs struggle with control flow and high-precision literals, consistently removing such structures rather than reasoning about their numerical implications, while performing substantially better on purely symbolic expressions. Even when LLMs preserve structure, their numerical reasoning falters, yielding semantically inequivalent expressions in over 46% of cases. These findings suggest LLMs are effective at stabilizing expressions that classical techniques cannot, yet struggle when high-precision magnitudes and control-flow semantics demand precise reasoning, since such concrete patterns are rarely seen during training.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑