Abstract
We present DeGAS, a differentiable Gaussian approximate semantics for loopless probabilistic programs that enables sample-free, gradient-based optimization in models with both continuous and discrete components. DeGAS evaluates programs under a Gaussian-mixture semantics and replaces measure-zero predicates and discrete branches with a vanishing smoothing, yielding closed-form expressions for posterior and path probabilities. We prove differentiability of these quantities with respect to program parameters, enabling end-to-end optimization via standard automatic differentiation, without Monte Carlo estimators. On thirteen benchmark programs, DeGAS achieves accuracy and runtime competitive with variational inference and MCMC. Importantly, it reliably tackles optimization problems where sampling-based baselines fail to converge due to conditioning involving continuous variables.
Introduction
Probabilistic programming languages (PPLs) have become essential tools for modeling complex stochastic systems, ranging from randomized algorithms to cyber-physical systems (CPS). A central challenge in using these languages is parameter optimization—tuning a model to maximize likelihood, satisfy safety constraints, or calibrate uncertainty.
Traditionally, this optimization relies on sampling-based inference methods like Markov Chain Monte Carlo (MCMC) or Variational Inference (VI). However, these methods possess a significant weakness: they struggle with discontinuous objectives. When a program contains a branch conditioned on a continuous variable (e.g., if temperature > 20.0), it creates a "hard cliff" in the probability space. This discontinuity breaks the smoothness assumptions required for gradient-based VI and often prevents MCMC from converging, leading to high-variance gradients and unreliable results. DeGAS (Differentiable Gaussian Approximate Semantics) addresses this by asking: Can we compute gradients for probabilistic program objectives without sampling at all?
The DeGAS Framework
DeGAS provides a sample-free, analytical alternative to traditional inference. It builds upon the SOGA framework, which tracks the state of a probabilistic program using Gaussian Mixtures (GMs). While GMs offer a powerful analytical representation, standard PPL operations—such as discrete distributions or deterministic assignments—often create singular (degenerate) covariance matrices that break automatic differentiation.
To overcome this, DeGAS introduces a principled vanishing smoothing technique:
- Noise Injection: A small amount of Gaussian noise (parameterized by $\epsilon$) is injected into deterministic assignments and discrete distributions. This ensures that covariance matrices never collapse to zero, maintaining differentiability.
- Predicate Relaxation: Strict Boolean predicates (e.g.,
x == c) are relaxed into narrow, open intervals.
By representing the entire program's posterior distribution as a smooth, closed-form Gaussian Mixture, DeGAS allows for the use of standard Automatic Differentiation (AD) in frameworks like PyTorch. This enables the computation of deterministic gradients without the noise inherent in Monte Carlo estimators.
Experimental Evaluation
The authors evaluated DeGAS across two distinct categories of tasks:
- Standard PPL Benchmarks: Thirteen classic programs, including Burglary, TrueSkills, and Grass, were used to assess accuracy and runtime against established baselines.
- Cyber-Physical Systems (CPS): Four models featuring continuous control dynamics—a PID controller, a Thermostat, a Car Gearbox, and a Controlled Bouncing Ball—were used to test parameter synthesis for complex reachability and safety objectives.
Key Results and Insights
DeGAS demonstrated performance competitive with standard VI and MCMC implementations (using Pyro) on the thirteen standard benchmarks. However, its true strength appeared in the CPS models where traditional methods failed. In scenarios involving continuous control and discontinuous conditions, MCMC often failed to converge (R-hat $\gg$ 1), and VI loss curves exhibited extreme oscillation.
In contrast, DeGAS successfully and smoothly optimized parameters for these models. For instance, it tuned a simulated car gearbox to maximize the probability of maintaining a velocity under a specific threshold and synthesized spring/damper parameters for a bouncing ball to reach a target height. These results highlight DeGAS's ability to handle non-likelihood objectives, such as reachability, which are notoriously difficult for sampling-based engines.
Theoretical Foundations and Limitations
The authors provide mathematical proofs ensuring that their smoothed semantics are strictly differentiable. Furthermore, they demonstrate that as the noise parameter $\epsilon$ approaches zero, the DeGAS semantics safely converge back to the original, unsmoothed SOGA semantics, ensuring theoretical consistency.
Despite these strengths, DeGAS has limitations:
- Loop-free Restriction: Inherited from the SOGA architecture, the current implementation is limited to loop-free programs.
- Component Explosion: Programs with highly nested logic (e.g., many
ifstatements) can lead to an exponential increase in Gaussian mixture components. While pruning strategies can mitigate this, it remains a computational consideration for complex branching logic.
Conclusion
DeGAS represents a significant shift in PPL optimization by bypassing the Monte Carlo bottleneck. By smoothing the "rough edges" of probabilistic programs and maintaining an analytical state, it enables stable, gradient-based optimization even in the presence of discontinuities. Future work may extend this "vanishing smoothing" philosophy to other tractable semantics, such as probabilistic circuits, to further broaden the scope of sample-free optimization.
Summary updated