Lune

OOPSLA2025Top-tier venue

Tuning Random Generators: Property-Based Testing as Probabilistic Programming

Ryan Tjoa, Poorva Garg, Harrison Goldstein, Todd D. Millstein, Benjamin C. Pierce, Guy Van den Broeck

Abstract

Property-based testing validates software against an executable specification by evaluating it on randomly generated inputs. The standard way that PBT users generate test inputs is via generators that describe how to sample test inputs through random choices. To achieve a good distribution over test inputs, users must tune their generators, i.e., decide on the weights of these individual random choices. Unfortunately, it is very difficult to understand how to choose individual generator weights in order to achieve a desired distribution, so today this process is tedious and limits the distributions that can be practically achieved.

In this paper, we develop techniques for the automatic and offline tuning of generators. Given a generator with undetermined symbolic weights and an objective function, our approach automatically learns values for these weights that optimize for the objective. We describe useful objective functions that allow users to ( 1) target desired distributions and (2) improve the diversity and validity of their test cases. We have implemented our approach in a novel discrete probabilistic programming system, Loaded Dice, that supports differentiation and parameter learning, and use it as a language for generators. We empirically demonstrate that our approach is effective at optimizing generator distributions according to the specified objective functions. We also perform a thorough evaluation on PBT benchmarks, demonstrating that, when automatically tuned for diversity and validity, the generators exhibit a 3.1-7.4× speedup in bug finding.

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.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • GradInf: Gradient Estimation as Probabilistic Inference cites Automatic Differentiation of Programs with Discrete Randomness
  • GradInf: Gradient Estimation as Probabilistic Inference cites Scaling exact inference for discrete probabilistic programs
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. GradInf: Gradient Estimation as Probabilistic InferenceGaurav Arya, Mathieu Huot, Moritz Schauer, Alexander K. Lew et al.PLDI 2026
  2. Testing Theorems, Fully AutomaticallySegev Elazar Mittelman, Harrison Goldstein, Leonidas LampropoulosOOPSLA 2026

Builds on11

  1. Scaling exact inference for discrete probabilistic programsSteven Holtzen, Guy Van den Broeck, Todd D. MillsteinOOPSLA 2020 · 85 citations
  2. Automatic Differentiation of Programs with Discrete RandomnessGaurav Arya, Moritz Schauer, Frank Schäfer, Christopher RackauckasNeurIPS 2022 · 56 citations
  3. Input invariantsDominic Steinhöfel, Andreas ZellerFSE 2022 · 47 citations
  4. Scallop: A Language for Neurosymbolic ProgrammingZiyang Li, Jiani Huang, Mayur NaikPLDI 2023 · 38 citations
  5. Quickly generating diverse valid test inputs with reinforcement learningSameer Reddy, Caroline Lemieux, Rohan Padhye, Koushik SenICSE 2020 · 30 citations

Related papers

  1. Fail Faster: Staging and Fast Randomness for High-Performance PBTCynthia Richey, Joseph W. Cutler, Harrison Goldstein, Benjamin C. PierceOOPSLA 2026 · 1 citation
  2. The Search for Constrained Random GeneratorsHarrison Goldstein, Hila Peleg, Cassia Torczon, Daniel Sainati et al.PLDI 2026 · 1 citation
  3. Does a Program Yield the Right Distribution? - Verifying Probabilistic Programs via Generating FunctionsMingshuai Chen, Joost-Pieter Katoen, Lutz Klinkenberg, Tobias WinklerCAV 2022 · 14 citations
  4. Programming and execution models for parallel bounded exhaustive testingNader Al Awar, Kush Jain, Christopher J. Rossbach, Milos GligoricOOPSLA 2021 · 4 citations
  5. Bennet: Randomized Specification Testing for Heap-Manipulating ProgramsZain K. Aamer, Benjamin C. PierceOOPSLA 2025 · 4 citations
Dusk over the sea between two cliffs drawn in fine vertical lines