TL;DR
This paper introduces the first Counterexample-Guided Inductive Synthesis (CEGIS) framework tailored for finite-state probabilistic programs. By leveraging program-level counterexamples, the approach automatically fills in the "holes" of a program sketch to satisfy complex quantitative specifications, successfully exploring design spaces with millions of candidates using only a few thousand verification queries.
What Problem Does This Paper Address?
Probabilistic programs are essential for designing systems that operate under uncertainty, such as autonomous controllers or adaptive software. However, writing these programs is notoriously difficult and error-prone because developers must reason about a massive number of alternative designs and their exact quantitative probabilities.
While existing techniques like parameter synthesis can automatically tune transition probabilities, they require the control structure—the underlying topology of the program—to be completely fixed. This paper addresses the challenge of synthesizing the structural topology of a probabilistic program. The authors use a "sketching" approach, where a developer provides a high-level template with unspecified components ("holes"), and the framework automatically finds a valid implementation (a "realisation") that satisfies strict probabilistic constraints and budget limits.
Methods
The authors adapt the classic Counterexample-Guided Inductive Synthesis (CEGIS) loop to the probabilistic domain, as illustrated in Figure 1.
The framework consists of two main components interacting in a loop:
- The Synthesiser: Built on the Z3 SMT solver, it searches the design space for a candidate program realization that satisfies user-defined structural constraints and cost budgets.
- The Verifier: Built on the Storm model checker, it evaluates whether the candidate realization satisfies the quantitative specifications (expressed in Probabilistic Computational Tree Logic, or PCTL).
If a candidate violates the specification, the verifier doesn't just reject it; it generates a program-level counterexample (CE). This counterexample identifies the specific set of commands causing the failure. The synthesizer then uses this conflict to prune not just the failed candidate, but all other potential realizations in the design space that share those problematic commands. The paper extends this loop to handle safety properties, liveness properties (lower bounds on probabilities), and expected rewards.
Datasets
The framework was evaluated using three distinct case studies modeled in the PRISM language:
- Dynamic Power Management (DPM): A controller design problem aimed at trading off power consumption for performance. The sketch contained 9 holes, resulting in 260,000 possible realizations.
- Intrusion: A network security benchmark where a controller attempts to infect a target node via intermediate paths. This represents a massive design space with 26 holes and 6.8 million realizations.
- Grid: A classical benchmark for solving Partially Observable Markov Decision Processes (POMDPs), featuring 6 holes and 1,800 realizations, but with much larger individual state spaces (around 100,000 states).
Key Insights and Ideas
- Program-Level vs. State-Level Pruning: Traditional probabilistic model checking generates counterexamples at the state-graph level. By lifting counterexamples to the program level (focusing on guards and commands), a single verification failure can eliminate massive blocks of the design space simultaneously.
- The Power of Constraints: Allowing developers to add propositional constraints to the sketching language (e.g., forbidding certain combinations of choices) drastically reduces the search space up front. In the Intrusion case study, constraints allowed the solver to discard over 99.99% of invalid realizations before verification even began.
- The Threshold Effect: The performance of the CEGIS loop is highly dependent on the strictness of the specification thresholds. When a specification is highly "unsatisfiable," the verifier finds smaller, tighter counterexamples, which leads to much faster pruning and massive speedups.
Key Results
The CEGIS approach demonstrated remarkable scalability compared to a standard enumerative baseline that checks designs one by one:
- For the DPM benchmark, the framework achieved a 23x to 100x speedup over the baseline, fully exploring the 260k design space in just a few thousand iterations.
- For the Intrusion benchmark, the framework achieved up to a 2,200x speedup, proving highly effective for large numbers of holes.
- The speedup was shown to be largely independent of the size of the underlying Markov chain's state space, meaning the method scales well even as the individual candidate models grow larger.
Limitations and Future Work
A core limitation of the CEGIS approach is its "single-realization blindness." Because the verifier only evaluates one concrete program at a time, it cannot easily exploit global properties that might be obvious if it looked at multiple options simultaneously. For instance, if every single option for a specific hole leads to failure, CEGIS will still evaluate them iteratively rather than discarding the hole immediately.
Additionally, computing the absolute minimal counterexample is an NP-hard problem, which introduces computational overhead when conflicts are large. The authors suggest that future work should focus on optimizing the MaxSat solver formulations to compute near-minimal counterexamples more cheaply and exploring hybrid approaches that combine CEGIS with abstraction-refinement techniques.
Summary updated