Functionally Equivalent or Not? Graph-Grounded Differential Surrogate Execution for Code Equivalence
Abstract
Determining whether two programs are functionally equivalent is central to code modernization, patch validation, refactoring, and code-generation evaluation. Yet the usual signals are incomplete: tests cover only finite inputs, textual similarity confuses implementation with behavior, and unconstrained LLM judgments are difficult to audit. Direct execution is often impossible when a program depends on an obsolete, licensed, unavailable, or unsafe environment. We introduce FEAgent, a selective equivalence assessor agent that combines typed program-graph evidence with differential surrogate execution. FEAgent first aligns public interfaces and behaviorally relevant graph anchors, then issues bounded queries over call-flow, control-flow, data-flow, type, import, and effect relations. Next, a branch-aware generator agent proposes discriminating inputs, and two blinded LLM surrogates independently predict source and target observables. Every claim and predicted divergence is recorded in an evidence ledger. A deterministic reconciler then returns EQUIVALENT, INEQUIVALENT, or UNCLEAR rather than forcing a verdict when paths are uncovered or evidence conflicts. We evaluate FEAgent on function-level equivalence and repository-level bug patches, where the existing oracle is a benchmark label or a passing test suite. Every disagreement with that oracle is adjudicated by direct execution, revealing errors in benchmark labels and behavioral divergences missed by unit-test-only scoring. On EquiBench, execution confirms FEAgent's disagreements with published labels on 216 of 1,200 evaluated pairs (18.0%); on SWE-bench Verified, 94 of 331 test-passing agent patches (28.4%) diverge from the reference patch. FEAgent thus serves as an audit layer between testing and formal verification, keeping its evidence reviewable and its uncertainty explicit without claiming a proof of equivalence.
Create a lesson
Metadata
- Categories
- cs.AI, cs.SE
- Comments
- 14 pages, 5 figures, 4 tables, accepted by NeurIPS 2026 Workshop on AI for Verifiable Coding
Related papers
Proof-Grounded Patient-Specific Clinical Explanations from Knowledge-Graph Reasoning
Shared title terminologycs.AISurajit Das
CodeForge-MA: Execution-Verified Multi-Agent Learning with Language-Conditioned LoRA for Multilingual Code Generation
Shared title terminologycs.AIZhizhou Gu, Xianting Wu, Siyu Gu et al.
Why, Where, How: Taxonomy-guided Error Grounding for Code Repair in NL2SQL
Shared title terminologycs.AISuchan Lee, Woomin Song, Hwanjo Yu et al.
PyINE: A Framework for Scalable Elicitation and Oversight via Code Execution
Shared title terminologycs.AIPierre-Luc St-Charles, Alessandro Palmas, Damiano Fornasiere et al.
Explainable Deep Learning for Malaria Parasite Detection and Species Differentiation in Thick Blood Smear Images: A Pilot Feasibility Study
Shared title terminologycs.AIHaimanot Bitew, Ayisheshim Almaw, Habtamu Zegeye et al.
Compressible Representations: Functional Spines in Deep Neural Networks
Shared title terminologycs.AINiranjan Rajesh, Meenakshi Khosla