In Bayesian machine learning, researchers frequently need to compare multiple versions of a model—for example, when evaluating different expert-suggested priors or navigating complex posterior landscapes. Traditionally, this process is computationally expensive. While Variational Inference (VI) and its amortized variants (like those used in VAEs) have improved speed, they are typically hard-coded to a single set of model parameters. If the model changes, the encoder must be retrained from scratch.
This paper introduces the Any Parameter Encoder (APE), a framework that generalizes amortized inference across the model space, enabling near-instant evaluation of thousands of candidate models.
The APE Framework
The core innovation of APE is a shift in perspective: rather than amortizing only over data $x$, APE amortizes over the joint space of data and model parameters $\theta$. By treating $\theta$ as an additional input feature, a single neural network can predict posteriors for a wide variety of model configurations.
Model-Aware Architectures
To handle high-dimensional inputs (such as large vocabularies in topic models), the authors developed a model-aware architecture. Instead of a naive concatenation of $x$ and $\theta$, they leverage the generative process of the underlying probabilistic model. For a Logistic Normal topic model, they found that feeding the encoder a transformed input ($\theta^T x$) provides a powerful inductive bias. This dimensionality reduction allows the network to learn the relationship between data and hidden variables far more efficiently than a black-box approach.
Experimental Results
The researchers evaluated APE on synthetic "Toy Bars" and a real-world dataset of ~6,300 product reviews. The results demonstrate that APE serves as both a high-fidelity inference tool and a powerful "warm start" for traditional optimization methods.
Speed and Fidelity
APE achieves inference in under 20 milliseconds, representing a 100x to 1000x speedup over traditional VI and MCMC methods. Despite this speed, it maintains high fidelity to the true posterior. In model comparison tasks, APE’s ranking of candidate models agreed with gold-standard VI results 75% of the time on real-world data, a massive improvement over the 29% agreement achieved by standard encoders.
Conclusion and Future Work
APE demonstrates that inductive biases derived from probabilistic models can significantly enhance the performance of neural encoders. While currently optimized for topic models, the framework suggests a path toward general "model-aware" recipes for various latent variable models. Future work aims to extend this approach to Bayesian nonparametric models, where the dimensionality of the parameter vector itself may change.
Summary updated