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

Antonio Valerio Miceli Barone, Poon Tsz Nok
4/18/2026
cs.CLcs.AIcs.LG

No confident code implementation found for this paper.

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.

Show full abstract

To facilitate this, we release \textbf{OpInstruct-HSx}, a synthetic dataset of $\approx$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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{barone2026improving,
  title  = {Improving LLM Code Reasoning via Semantic Equivalence Self-Play with Formal Verification},
  author = {Antonio Valerio Miceli Barone and Poon Tsz Nok},
  year   = {2026},
  eprint = {2604.17010},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2604.17010v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2604.17010.svg)](https://codeofpaper.com/paper/2604.17010)

Discussion