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

ForTress:为大语言模型驱动的Fortran到Python翻译提供保证与确定性

ForTress: Bringing Assurance and Determinism for LLM-Driven Fortran-to-Python Translation

University of Colorado Boulder(科罗拉多大学博尔德分校);University of Utah(犹他大学);Tufts University(塔夫茨大学)

Qinrun Dai, Ruitong Liu, Chien-Wei Huang, Guanhong Tao, Guannan Wei, Yueqi Chen

AI总结:

ForTress将LLM翻译决策固化为带保护的可执行规则,在Lean中审计语义,在15个科学软件的17个基准上实现高保真翻译,复用率超90%且LLM使用成本降低44.2%。

摘要:

将成熟的科学软件从Fortran现代化为Python可提升其可访问性及与现代计算工具的集成度,但手动重写成本高昂。大语言模型(LLM)使翻译更具可行性,不过生成的代码可能通过回归测试却违背源语言语义,且上下文修正可能在后续翻译中无法保留。我们提出ForTress,它将大语言模型的重复翻译决策固化为带保护的可执行规则以实现确定性复用,并为这些规则的非平凡子集提供语义保证。其大语言模型辅助的审计过程在Lean中对机械化的Fortran和Python语义表达全称量化的保留义务,人类专家审查语义保真度及与生产规则的对应关系,Lean的内核在显式假设下检查证明与反证。这些审计记录揭示支持正确性的条件或识别失败案例。我们在来自15个科学软件的17个基准上评估ForTress,在记录的执行与初始化配置下,翻译后的程序在所有评估测试中与原生Fortran实现逐位一致。针对这些软件,ForTress累计193条可执行规则和188条审计记录,其中121条已通过健全性证明检查,包括31条经反例引导细化后确立的规则。15个软件中有14个的跨软件复用率超过90%,即便增加了保证与确定性,大语言模型的使用成本仍比直接大语言模型翻译低44.2%。

英文摘要:

Modernizing mature scientific software from Fortran to Python can improve accessibility and integration with modern computing tools, but manual rewriting is expensive. Large language models (LLMs) make translation more practical, yet generated code can pass regression tests while violating source-language semantics, and contextual corrections may not persist across subsequent translations. We present ForTress, which solidifies recurring LLM translation decisions into guarded executable rules for deterministic reuse and provides semantic assurance for a non-trivial subset of these rules. Its LLM-assisted auditing process expresses universally quantified preservation obligations over mechanized Fortran and Python semantics in Lean. Human experts review semantic fidelity and correspondence with production rules, and Lean's kernel checks proofs and refutations under explicit assumptions. These audit records expose the conditions either supporting correctness or identifying failure cases. We evaluate ForTress on 17 benchmarks from 15 scientific software spanning diverse domains. The translated programs achieve bitwise-identical with native Fortran on all evaluated tests under the recorded execution and initialization configurations. Against these software, ForTress accumulates 193 executable rules and 188 audit records, of which 121 have checked soundness proofs, including 31 established after counterexample-guided refinement. Cross-software reuse exceeds 90% for 14 of the 15 software. Even with additional assurance and determinism, the LLM usage cost is 44.2% lower than direct LLM translation.

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

↑