NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Trace abstraction modulo probability

Calvin Smith, Justin Hsu, Aws Albarghouthi · DOI

TL;DR

Verifying that randomized algorithms are "mostly accurate" is notoriously difficult due to infinite state spaces and complex probability distributions. This paper introduces Trace Abstraction Modulo Probability, a technique that automatically proves high-probability accuracy guarantees by reducing probabilistic reasoning to standard logical reasoning. By overapproximating program behaviors with "failure automata," the authors can leverage powerful off-the-shelf SMT solvers to verify sophisticated algorithms from the differential privacy literature.

What Problem Does This Paper Address?

Randomized algorithms are everywhere—from protecting user privacy in databases to improving efficiency in machine learning. Unlike standard programs, these algorithms aren't expected to be correct 100% of the time; instead, they provide accuracy guarantees (e.g., "the result is within 5% of the truth with 99% probability").

Existing verification tools struggle with these programs because they often rely on numerical methods that require fixed inputs or finite state spaces. They fail when faced with symbolic parameters (like a variable failure probability $\beta$) or programs that sample from continuous distributions over infinite ranges. The challenge is to create a fully automated way to prove these "high-probability" properties for general, imperative programs.

Methods

The authors extend a classic verification technique called Trace Abstraction. In the non-probabilistic world, trace abstraction proves a program correct by covering all its possible execution paths (traces) with a set of automata.

The "Modulo Probability" extension adds several key innovations:

  • Failure Automata: These are finite-state automata where each node is labeled with two things: a logical predicate (what we know about the variables) and a failure probability (an upper bound on the chance that the predicate doesn't hold).
  • Distribution Axioms: To avoid complex measure theory, the authors treat random sampling as a logical "black box." They define "axiom families" for common distributions (Bernoulli, Laplace, Gaussian). For example, a Laplace axiom might say: "The sampled noise is small, except with probability $p$."
  • Constraint-Based Synthesis: The tool automatically chooses the "best" axiom for each sampling statement. It sets up a synthesis problem: "Find a function $f$ such that the resulting logical formula is valid."
  • Craig Interpolation: Once a specific trace is proven correct using a synthesized axiom, the tool uses Craig interpolation to "generalize" that proof. This allows a single proof for one trace to cover an infinite set of similar traces (e.g., all possible iterations of a loop).
  • The Union Bound: The core logic relies on the union bound ($Pr(A \cup B) \le Pr(A) + Pr(B)$). This allows the tool to simply sum up the failure probabilities of individual steps to get a total failure bound for the whole program.

Datasets

The authors evaluated their implementation on a suite of randomized algorithms drawn from two main areas:

  1. Differential Privacy: Classic mechanisms including randResp (Randomized Response), noisySum, noisyMax, expMech (Exponential Mechanism), aboveT (Above Threshold), and sparseVec (Sparse Vector Mechanism).
  2. Approximate Computing: The searchRef program from the Rely system, which implements a pixel-block search algorithm designed to run on unreliable hardware with probabilistic faults.

Key Insights and Ideas

  • Decoupling Logic from Probability: The "Aha!" moment is that you don't need to reason about probability distributions directly during the main proof. By tracking a single "failure budget" variable ($\omega$) alongside standard program variables, probabilistic verification becomes a standard safety verification problem.
  • Symbolic Trade-offs: Because the method is logic-based, it can prove properties involving symbolic variables. It doesn't just prove "accuracy is 0.5 for $\beta=0.01$"; it can establish the relationship between accuracy and confidence as a formula, which is much more useful for algorithm designers.
  • Automation via Synthesis: Choosing how much "failure probability" to assign to each line of code is a search problem. By framing this as axiom synthesis, the authors can plug in modern SMT solvers (like Z3) to do the heavy lifting.

Key Results

  • First of its kind: To the authors' knowledge, this is the first approach to automatically establish accuracy properties for this range of complex randomized algorithms.
  • Efficiency: Most benchmarks were verified in under 100 seconds (see Table 3). For instance, the complex sparseVec algorithm was verified in 97 seconds, involving nearly 1,000 synthesized axioms.
  • Handling Loops: The tool successfully generated inductive invariants for loops, proving that failure probabilities often grow linearly with the number of iterations ($p \cdot n$), a common pattern in randomized algorithms.

Limitations and Future Work

  • Conservative Bounds: The reliance on the union bound is a double-edged sword. While it simplifies the logic, it is mathematically conservative because it assumes the worst-case correlation between failures. It cannot currently exploit independence between random variables to get tighter "concentration bounds" (like Chernoff or Hoeffding bounds).
  • Axiom Library: The system's power is limited by the library of distribution axioms provided to it. If an algorithm requires a very subtle property of a distribution not covered by the axioms, the proof will fail.
  • Future Directions: The authors suggest extending the logic to handle expectations (average-case behavior) and integrating the technique into more standard abstract interpretation frameworks.

Summary updated

BibTeX
@article{smith2019trace,
  author = {Calvin Smith and Justin Hsu and Aws Albarghouthi},
  title = {{Trace abstraction modulo probability}},
  journal = {Proc. ACM Program. Lang.},
  year = {2019},
  doi = {10.1145/3290352},
}
Figure