Scaling Structured Inference with Randomization
TL;DR This paper introduces Randomized Dynamic Programming (RDP), a framework that scales structured models (like CRFs and PCFGs) from hundreds of latent states to tens of thousands. By combining "Top-K" truncation with importance sampling, RDP achieves orders-of-magnitude reductions in memory and computation while maintaining the differentiability required for modern deep learning.
The Bottleneck in Structured Inference
Structured models capture complex dependencies between variables, such as words in a sentence or nodes in a parse tree. These models rely heavily on Dynamic Programming (DP) for inference. However, classical DP algorithms, like the Forward-Backward algorithm, have a computational complexity that scales quadratically ($O(N^2)$) with the number of latent states $N$.
In the context of deep learning, this quadratic scaling is a severe bottleneck. Automatic Differentiation (AD) frameworks like PyTorch must store every intermediate computation to calculate gradients, leading to massive memory consumption. Consequently, researchers typically limit themselves to fewer than 100 states. This "capacity ceiling" prevents structured models from leveraging the massive latent spaces that have driven the success of other deep learning architectures.
Introducing Randomized Dynamic Programming (RDP)
To break this ceiling, the authors propose Randomized Dynamic Programming (RDP). The core idea is to approximate the massive sums found in DP recursions by calculating only a small subset of the most likely paths and a random sample of the rest.
The RDP framework relies on several key components:
- Randomized Summation: Instead of summing over all $N$ states, RDP takes the top $K_1$ states (exploitation) and a random sample of $K_2$ states from the remaining "tail" (exploration).
- Bias Correction: Simply cutting off the tail introduces severe bias. RDP uses Importance Sampling (IS) to reweight the sampled states, ensuring the estimator remains mathematically unbiased.
- Variance Reduction: The method applies Rao-Blackwellization, leveraging the deterministic Top-K portion to significantly lower the variance of the estimate compared to pure random sampling.
- Differentiability: The entire process is compatible with backpropagation. The authors provide randomized versions of the Forward algorithm (for chains), the Inside algorithm (for trees), and second-order operations like entropy estimation and Gumbel-style reparameterized sampling.
Key Insights and Performance
By restricting computation to a small subset of nodes, RDP drops memory complexity from $O(TN^2)$ to $O(TK^2)$. In practice, using just 1% of the full state index yields highly accurate results. The authors successfully ran models with $N=10,000$ states—a scale that would cause immediate memory overflow on a standard 16GB GPU using traditional exact DP.
The Exploration-Exploitation Tradeoff The ratio of $K_1$ (Top-K) to $K_2$ (Sampled) acts as a crucial control knob. $K_1$ focuses on what the model already knows, while $K_2$ forces the model to explore less certain states.
Preventing Posterior Collapse When training a Structured Variational Autoencoder (VAE) on the MSCOCO dataset, the authors found that the randomization in RDP naturally encourages the model to use more of its latent capacity. In standard VAEs, the model often ignores the latent space (collapsing to a single state). RDP effectively prevents this collapse. Furthermore, as the number of states $N$ increased from 100 to 2,000, the VAE's Negative Log-Likelihood (NLL) continued to improve, proving that scaling the latent space directly benefits performance.
Limitations and Future Work
While highly effective, RDP has a few limitations:
- Log-Space Bias: While the estimator is unbiased in the original probability space, implementing it in "log-space" (which is standard for numerical stability) introduces a small bias due to Jensen's Inequality. However, this bias is significantly smaller than that of deterministic truncation.
- Proposal Quality: The efficiency of importance sampling depends on having a good "proposal" distribution to select the $K_2$ samples. The authors suggest a "local-global" principle, but more complex models might require sophisticated proposal strategies.
- General Graphs: The theoretical framework applies to general graphs via the sum-product algorithm, but experiments primarily focused on chains and trees. Testing RDP on loopy graphs remains an open direction for future research.
Summary updated