DOE OSTI · 3377179
Towards Automated Reasoning Chains for Verification of LLM-Generated Scientific Code
Abstract
With the rise of Large Language Model (LLM) generated code, including in domains like scientific computing, ensuring not only syntactical, but also mathematical correctness, has become a critical task. Traditional formal methods approaches often struggle with the ambiguity of floating-point code, and full symbolic execution is extremely costly and limited. We propose a chain-of-reasoning approach that iteratively lifts basic semantics from code into the SPIRAL system and then establishes numerical equivalency to the desired mathematical operation. Here, we leverage the ample mathematical knowledge already formalized in SPIRAL to enable the system to recognize not just different implementations of the same algorithm but fully separate approaches to solving the given problem. The chain establishes tight error bounds on the output of given code with respect to the true continuous solution it approximates, quantifying all sources of error. We demonstrate this approach by establishing the correctness of a pseudospectral solver for a simple 1-dimensional Poisson problem.
Keep this discovery
Explore connections, maps & timelines
Oschatz, Quentin [Carnegie Mellon University,Pittsburgh,USA], Zhang, Naifeng [Carnegie Mellon University,Pittsburgh,USA], Franusich, Mike [SpiralGen, Inc.,Pittsburgh,USA], Franchetti, Franz [Carnegie Mellon University,Pittsburgh,USA]. 2025-09-15. Towards Automated Reasoning Chains for Verification of LLM-Generated Scientific Code. https://doi.org/10.1109/hpec67600.2025.11196666
Cite the original work for its findings. Save a collection to share your selection of sources.