Learning Simple Interpolants for Linear Integer Arithmetic

Minchao Wu, Naoki KobayashiNeurIPS 2025

Overview

Researchers have developed a lightweight machine learning framework that guides Satisfiability Modulo Theories (SMT) solvers to produce significantly simpler Craig interpolants for Linear Integer Arithmetic (LIA). By using a Graph Neural Network (GNN) to "lazily sample" only the most relevant parts of a logical problem, the approach reduces interpolant complexity by up to 47% for modern solvers like Z3, and nearly 70% for legacy tools.

The Conciseness Gap in Formal Verification

In formal verification, Craig interpolation is a workhorse technique used to find "invariants"—logical properties that prove a program is safe. Given two sets of states, $A$ (reachable states) and $B$ (error states), that do not overlap, an interpolant $I$ is a formula that covers all of $A$ but none of $B$.

The challenge in Linear Integer Arithmetic (LIA) is that traditional logical solvers often produce "messy" interpolants: formulas with massive coefficients and convoluted structures. In the world of verification, a complex interpolant is akin to a machine learning model that overfits; it describes the specific problem too closely and fails to generalize as a useful program invariant. This paper tackles this "conciseness gap"—the difficulty of generating simple, interpretable, and generalizable interpolants.

A Learning-Based Approach to Lazy Sampling

To address this, the authors propose a "top-down" learning-based approach to Lazy Sampling. Instead of iteratively asking a solver to refine a formula—which is computationally expensive—they use a neural network to predict a minimal subset of the input formulas that is "just enough" to generate a valid interpolant.

The architecture consists of two main components:

  1. GNN Encoder: LIA formulas are converted into Abstract Syntax Trees (ASTs). A message-passing Graph Neural Network encodes the structural and semantic information of these trees into vector embeddings.
  2. Attention-Based Selector: These embeddings are fed into a self-attention mechanism. This allows the model to look at all parts of the input problem simultaneously and rank which "disjuncts" (logical components) are most likely to lead to a simple interpolant.
The high-level computation flow: encoding formulas via GNN and selecting subsets via an attention-based network.

Once the model selects a subset, the actual SMT solver (like Z3) is called only once on that simplified subset.

Dataset Generation: Interp(4, 4)

Because no standard benchmark for LIA interpolation existed, the authors created a new dataset called Interp(4, 4). It contains approximately 66,000 interpolation problems generated by extracting execution traces from a real-world software verification tool (MoCHi) and combining disjoint formulas. The dataset includes a wide range of constant values and variable counts, ensuring the model learns general heuristics rather than memorizing specific patterns.

Key Insights

  • ML as a Heuristic Guide: The model does not replace the logical solver; it acts as a "scout" that identifies the essential parts of a problem. This preserves the formal soundness of the solver while benefiting from neural pattern matching.
  • Internalizing Solver Behavior: To be effective, the model must "learn" the quirks of the target solver. Different solvers (like Z3 vs. CSIsat) might prefer different subsets to produce simple results.
  • Simplicity Equals Generality: By forcing the solver to work with fewer inputs, the resulting interpolant is naturally more concise. This is analogous to regularization in traditional ML, preventing the "overfitting" of invariants to specific program traces.

Results and Performance

The researchers integrated their model with several solvers and found dramatic improvements in the quality of the generated logic:

  • Z3 (Modern Solver): When guided by the model, Z3 produced interpolants that were 47.3% less complex (measured by logical connectives) and computed faster.
  • CSIsat (Legacy Solver): For older solvers, the complexity reduction reached 69.1%, effectively reviving legacy tools to modern performance standards.
  • Robustness: While the model has a ~73% success rate in picking a valid subset on the first try, the system includes a fallback mechanism to the original solver, ensuring it never fails to find a solution if one exists.
Performance comparison showing Z3 guided by the model vs. original Z3.

Limitations and Future Work

The authors acknowledge a few areas for future growth:

  • Defining Complexity: Currently, "simplicity" is defined primarily by the number of logical connectives. Future versions could optimize for the size of constants or the number of variables used.
  • Beyond LIA: The current work is limited to linear integer arithmetic. Expanding this to non-linear arithmetic or array theories would broaden its impact on hardware and software verification.
  • End-to-End Integration: The next step is to plug this framework directly into full-scale model checkers to see how much it accelerates the discovery of complex program invariants in the wild.

Summary updated

BibTeX
@inproceedings{wu2025learning,
  author = {Minchao Wu and Naoki Kobayashi},
  title = {{Learning Simple Interpolants for Linear Integer Arithmetic}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=mQlX8ZF6vW},
}
Figure