cs.AIAug 28, 2025

Re4: Scientific Computing Agent with Rewriting, Resolution, Review and Revision

Authors: Ao Cheng, Lei Zhang, Guowei He

Organizations: The State Key Laboratory of Nonlinear Mechanics, Institute of Mechanics, Chinese Academy of Sciences, Beijing 100190, China · School of Engineering Science, University of Chinese Academy of Sciences, Beijing 100049, China

Abstract

Large language models (LLMs) have demonstrated abilities to perform complex tasks in multiple domains, including mathematical and scientific reasoning. In this work, we construct a novel agent framework for solving representative problems in scientific computing. The proposed agent incorporates a "rewriting-resolution-review-revision" logical chain via three reasoning LLMs (the Consultant, Reviewer, and Programmer) in a collaborative and interactive manner. The Consultant module enables knowledge transfer to link problems to professional domain insights, thereby rewriting problem descriptions through text augmentation. The Programmer module generates and executes well-structured code to solve problems. The Reviewer module enables self-debugging and self-refinement through interactive feedback with code runtime outputs. Through the end-to-end review mechanism, the Programmer's executable code undergoes iterative revision. We comprehensively evaluate the framework on typical partial differential equations (PDEs), engineering-oriented flow past a cylinder, ill-conditioned linear systems, and data-driven physical analysis problems. Compared with a single-model approach, this collaborative framework significantly improves the bug-free code generation rate and reduces non-physical solutions, establishing a reliable framework for autonomous code generation from natural language descriptions. The review mechanism improved the average execution success (bug-free code and non-NaN solutions) rate of DeepSeek R1 from 59% to 82%, while ChatGPT 4.1-mini improved from 66% to 87% and Gemini-2.5 improved from 60% to 84%. Automatic code generation and review provide a promising workflow for scientific computing; analysis of solver-development trajectories further reveals recurring implementation difficulties in boundary treatment, array indexing, and the preservation of numerical constraints.

Figures & tables

Appendix figures & tables11 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. SciWalker: Synthesizing Scientific Coding Problems with Operator Graphs and Execution Feedback

    Sep 24, 2026Chenxi Li, Wenxuan Zeng, Yun Luo +4Execution-Guided Code GenerationScientific Code Generation

  2. ATHENA: Agentic Team for Hierarchical Evolutionary Numerical Algorithms

    Dec 3, 2025Juan Diego Toscano, Daniel T. Chen, George Em KarniadakisScientific Code GenerationScientific ML

  3. No Test Cases, No Problem: Distillation-Driven Code Generation for Scientific Workflows

    Apr 25, 2026Siddeshwar Raghavan, Tanwi MallickMulti-Agent LLM SystemsCode Generation