NumericalDiff: Numerical Program Differencing via Value-Based Trace Alignment and Intervention
Xiang Chen, Huanhuan Xia
Key points
From the paper's conclusion- The results show that value-based trace alignment and reexecution can delimit propagated numerical differences across heterogeneous implementations.
Abstract
Numerical programs implementing the same computational task can exhibit different numerical behavior because of their execution stacks, program representations, or program logic. Source text and final outputs alone provide limited diagnostic information: numerical differences can propagate through corresponding computations, while distinct executions can produce equal outputs. We present NumericalDiff, an execution-based method that records assignment-level numerical events, aligns traces using a tolerance-aware longest common subsequence independent of variable names and source locations, and optionally reexecutes after replacing one intermediate value with its counterpart. Among the original and all single-intervention executions, it lexicographically maximizes matched events and minimizes unmatched events. NumericalDiff supports code comparison across language and framework front ends, currently including NumPy, PyTorch, JAX, C, C++, Fortran, and Octave. We evaluate NumericalDiff on 36 controlled cases comprising 675 pair/input instances: 36 execution-stack, 588 program-representation, and 51 program-logic instances. All 24 operator-injection instances expose trace differences, including three with tolerance-equal final outputs, while complete trace alignment is achieved for all 441 canonical cross-representation instances. Within the 51 program-logic instances, intervention improves 24 alignments and raises macro-average matching coverage from 0.4210 to 0.6513. The results show that value-based trace alignment and reexecution can delimit propagated numerical differences across heterogeneous implementations.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Racer: Hunting GPU Kernel Bugs with Symbolic Equivalence CheckingarXiv · 2026
- Pattern-Guided Graph Synthesis for Suppressing Known Defects in DL Compiler FuzzingarXiv · 2026
- On the Limits of Execution Traces for Repairing Assertion Failures in LLM-Generated CodearXiv · 2026
- InspectCoder: Dynamic Analysis-Driven Self Repair through Interactive LLM-Debugger CollaborationProceedings of the ACM on Programming Languages · 2026
- Accepted but Wrong: Silent Failures of LLM Code Repairs after API MigrationsarXiv · 2026
- MLIRBench - A Benchmark and Dataset for Compiler and Hardware-Aware ReasoningarXiv · 2026