Lune

ACL Findings2026

Improving LLM Code Reasoning via Semantic Equivalence Self-Play with Formal Verification

Poon Tsz Nok, Antonio Valerio Miceli Barone

Abstract

We introduce a self-play framework for semantic equivalence in Haskell, utilizing formal verification to guide adversarial training between a generator and an evaluator. The framework leverages Liquid Haskell proofs for validating equivalence and execution-based counterexamples for inequivalence, organized via a difficulty-aware curriculum. To facilitate this, we release OpInstruct-HSx, a synthetic dataset of ≈28k validated Haskell programs. Empirical experiments show that our evaluator transfers effectively to downstream tasks, achieving up to 13.3pp accuracy gain on EquiBench and consistent gains on PySecDB. Ablation studies on the SEQ-SINQ regimes indicate that while inequivalence supervision provides data volume, equivalence proofs are uniquely responsible for the model's reasoning capabilities. The entire training pipeline and dataset are publicly released on GitHub and Hugging Face respectively.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

Questions to start from

Lune can draw on

the full paper · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Self-play with Execution Feedback: Improving Instruction-following Capabilities of Large Language Models cites Training language models to follow instructions with human feedback
  • EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence Checking cites ARDiff: scaling program equivalence checking via iterative abstraction and refinement of common code
Builds onCited byLeft to right by year; the more cited, the higher.

Builds on4

  1. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  2. ARDiff: scaling program equivalence checking via iterative abstraction and refinement of common codeSahar Badihi, Faridah Akinotcho, Yi Li, Julia RubinFSE 2020 · 44 citations
  3. Self-play with Execution Feedback: Improving Instruction-following Capabilities of Large Language ModelsGuanting Dong, Keming Lu, Chengpeng Li, Tingyu Xia et al.ICLR 2025 · 4 citations
  4. EquiBench: Benchmarking Large Language Models' Reasoning about Program Semantics via Equivalence CheckingAnjiang Wei, Jiannan Cao, Ran Li, Hongyu Chen et al.EMNLP 2025

Related papers

  1. Checking equivalence in a non-strict languageJohn C. Kolesar, Ruzica Piskac, William T. HallahanOOPSLA 2022 · 3 citations
  2. Liquidate your assets: reasoning about resource usage in liquid HaskellMartin A. T. Handley, Niki Vazou, Graham HuttonPOPL 2020 · 38 citations
  3. VeriEquivBench: An Equivalence Score for Ground-Truth-Free Evaluation of Formally Verifiable CodeLingfei Zeng, Fengdi Che, Xuhan Huang, Fei Ye et al.ICLR 2026 · 8 citations
  4. Propose, Solve, Verify: Self-Play Through Formal VerificationAlex Wilf, Pranjal Aggarwal, Bryan Parno, Daniel Fried et al.ICML 2026 · 6 citations
  5. STP: Self-play LLM Theorem Provers with Iterative Conjecturing and ProvingKefan Dong, Tengyu MaICML 2025
Dusk over the sea between two cliffs drawn in fine vertical lines