The Challenge of Declarative Knowledge in Inference
In standard Bayesian inference, probabilistic models are typically conditioned on observed data (e.g., "the sensor reading is 5.0"). However, real-world expertise often comes in the form of declarative knowledge—rules about what should be true rather than what was explicitly measured. For example, in medical modeling, we might know a patient is "hypoglycemic" (blood sugar is below a certain threshold), or in computer graphics, we know that two solid objects cannot occupy the same physical space.
Existing inference methods struggle to incorporate these declarative predicates for two main reasons:
- Intractability: Predicates often involve deterministic transformations of variables, leading to likelihood functions that are impossible to calculate or normalize analytically.
- Hard Constraints: Logical predicates are binary (true or false). If a proposed state in a simulation slightly misses a "true" condition, the likelihood drops to zero. This creates a "needle in a haystack" problem, making it nearly impossible for standard sampling algorithms to find valid regions of the parameter space.
Introducing Predicate Exchange
To solve this, the authors introduce a novel two-part framework called Predicate Exchange, which allows probabilistic models to be conditioned directly on complex, declarative rules.
1. Predicate Relaxation (Softening)
The first step is transforming "hard" Boolean predicates (0 or 1) into "soft" predicates that return continuous values in the interval $[0, 1]$. Using distance-based kernels, the framework evaluates how close a state is to satisfying a rule, rather than just rejecting it outright.
A major technical hurdle here is logical consistency. Standard fuzzy logic negation (e.g., $1 - P$) fails certain consistency axioms required for valid probabilistic inference. To address this, the authors developed "two-sided" soft primitives that track both the degree of satisfaction and dissatisfaction simultaneously, ensuring the approximation remains faithful to the original rule.
2. Replica Exchange MCMC
To sample from the resulting posterior distribution, the framework employs a parallel Markov Chain Monte Carlo (MCMC) technique. It runs multiple "replicas" of the model at different "temperatures." * High-temperature chains use very "soft" versions of the predicates, allowing the sampler to freely explore the parameter space. * Low-temperature chains enforce "harder," more accurate constraints.
By periodically swapping states between these chains, the algorithm can successfully navigate complex, multi-modal distributions that would otherwise trap a standard sampler.
Key Insights
- Declarative vs. Constructive: It is often much easier to describe a constraint (e.g., "bodies don't intersect") than to write a generative program that inherently satisfies that constraint from the ground up. Predicate Exchange bridges this gap.
- Language Agnosticism: The method acts as a "nonstandard execution" of a program. By redefining basic operators (like
rand,cond, and comparison operators), Predicate Exchange can be applied to existing probabilistic programming languages (PPLs) without requiring researchers to rewrite their underlying models. - Balancing Constraints: When multiple rules are applied, their scales might differ drastically. The paper introduces a weighting mechanism to balance these constraints so that one rule doesn't accidentally dominate the inference process.
Results and Applications
The authors evaluated Predicate Exchange across several challenging domains, demonstrating significant improvements over baseline methods like Rejection Sampling and Sequential Monte Carlo (SMC), which often timed out or failed on high-dimensional tasks.
- Medical Modeling: When a Recurrent Neural Network (RNN) for glucose prediction was conditioned on physiological constraints, it produced significantly more realistic and physically plausible patient trajectories compared to an unconstrained model, especially in scenarios with sparse data.
- Inverse Rendering: In a procedural scene generation task, the model had to infer the positions of spheres based on an image. By applying a simple "no-intersection" predicate, Predicate Exchange successfully eliminated overlapping spheres in the generated scenes—a physical constraint that standard "observe-only" models completely failed to respect.
Limitations and Future Work
While powerful, the framework has a few limitations:
- Zero-Measure Equalities: Strict equalities (e.g., $x = y$) on continuous variables remain difficult because the probability of randomly "hitting" the exact value is zero. In these cases, the inference remains an approximation.
- Control Flow: If a predicate's value dictates which branch of code is executed (the "path explosion" problem), the "soft" execution might miss important parts of the state space.
- Metric Selection: The softening process relies on a distance metric. Choosing the right metric for complex, non-numerical data types remains an open area for future research.
Summary updated