Certificate-driven method boosts scientific code porting and speed

Towards Certificate-Driven Software Porting: A Self-Improving Agentic Harness for Scientific Program Optimization

Artificial IntelligenceProgramming LanguagesSoftware Engineering

Summary

Upgrading large scientific programs to run better on new hardware is very hard. The authors created a method called Certificate-Driven Evolutionary Search (CDES) that helps computers fix errors during automatic code translation by learning from past mistakes. They tested CDES by converting physics simulation functions from running on CPUs to GPUs, making the programs run up to 23 times faster. Their approach increased correct outputs from less than 60% to 90%, showing it can improve software porting and speed.

What this means in practice

  • For scientific software engineers: Improve legacy scientific code translation to GPUs with higher correctness and performance using certificate-driven repair during optimization.
  • For high performance computing teams: Enhance GPU porting of complex physics simulations by rejecting faulty code changes and ensuring passes of physics and safety checks.

Authors

Piyush Jha, Aishik Ghosh, Vijay Ganesh

Abstract

The upgrade and rewriting of large scientific codebases has traditionally been a major challenge. While evolutionary search with large language models (LLMs) can port and accelerate legacy code, repair feedback in prompts alone does not prevent subsequent candidates from repeating the same errors. We introduce Certificate-Driven Evolutionary Search (CDES), which extends evolutionary search with enforceable restrictions derived from failed candidates, recorded as certificates of assumptions, checker evidence, and justified restrictions. Its control logic enforces these restrictions through rejection, backtracking, and targeted repair while preserving compatible edits. We apply CDES to CPU-to-GPU translation of two particle-simulation functions from the Geant4 toolkit, evaluated with a harness that goes beyond unit tests to combine formal checks, numerical comparisons, physics checks, and GPU safety tests. Generated implementations achieve 13.78x and 23.54x function-level speedups over CPU code, including data conversion and transfers; for one function, GPU throughput exceeds an expert implementation by 14.9%, reaching 16.1% when complementary components are combined. In an ablation over execution settings, certificate feedback increases the fraction of candidates passing required correctness checks from 55% to 90%.