In standard Bayesian inference, we typically assume our model has a fixed number of parameters. We might estimate the weights of a neural network or the mean of a distribution, but the structure of the model—the number of hidden units or the number of clusters—is usually decided beforehand.
However, real-world data rarely tells us its complexity upfront. If we are clustering data, how many clusters are there? If we are detecting change points in a time series, how many shifts occurred? Trans-dimensional Markov Chain Monte Carlo (MCMC) provides a framework for the sampler to "jump" between parameter spaces of different dimensions, allowing the model to learn its own complexity directly from the data.
The Challenge of Changing Dimensions
Standard MCMC algorithms like Metropolis-Hastings work by exploring a state space of fixed dimensionality. If you try to move from a 2D space to a 3D space, the standard transition rules break because the probability densities in different dimensions are not directly comparable.
As Christophe Andrieu, Nando de Freitas, and Michael I. Jordan explain in An Introduction to MCMC for Machine Learning, trans-dimensional MCMC treats the model index (and thus its dimensionality) as just another random variable to be sampled. This allows for simultaneous model selection and parameter estimation. Instead of running ten different models with 1 to 10 clusters and comparing them, a single trans-dimensional chain can explore all of them, spending more time in the models that best fit the data.
Reversible Jumps and Dimension Matching
The most common mechanism for these transitions is Reversible-Jump MCMC (RJMCMC). To move between a model with $k$ parameters and one with $k+1$ parameters, we must maintain "detailed balance"—ensuring the probability of jumping "up" is balanced by the probability of jumping "back."
The key intuition, applied by Alan D. Marrs in An Application of Reversible-Jump MCMC to Multivariate Spherical Gaussian Mixtures, is dimension matching. When jumping to a higher dimension, we generate auxiliary random variables to "pad" the lower-dimensional space until the dimensions match. This transformation must be differentiable and reversible (a bijection), allowing us to calculate a Jacobian term that corrects the acceptance probability for the change in volume between spaces.
Common Moves: Birth, Death, Split, and Merge
To navigate these varying landscapes, researchers design specific "moves" that propose changes to the model structure:
- Birth and Death: Proposing the addition of a new component (like a new hidden unit in a network) or the removal of an existing one. Emily Fox and colleagues use this in Sharing Features among Dynamical Systems with Beta Processes to discover an unknown number of shared behaviors across time series.
- Split and Merge: Taking one cluster and splitting it into two, or merging two into one. Nicholas A. Heard and Francesco Sanna Passino utilize these moves in Bayesian estimation of the latent dimension and communities in stochastic blockmodels to automatically find the number of communities in a network.
- Change-Point Moves: Adding or deleting markers in time. In Bayesian SIR model with change points, Guosheng Yin and Jiaqi Gu use these to identify shifts in pandemic dynamics.
Improving Efficiency with Pseudo-Priors
A major hurdle in trans-dimensional sampling is the "rejection problem." If you jump into a high-dimensional space with random parameters, the new model will likely fit the data poorly and be rejected, leaving the chain stuck.
To solve this, Seonghyun Jeong, Taeyoung Park, and David A. van Dyk in Bayesian model selection in additive partial linear models via locally adaptive splines employ pseudo-priors. These are proposal distributions for the "inactive" parameters. By carefully choosing these pseudo-priors to be near the likely posterior values, the sampler can propose "sensible" jumps that are much more likely to be accepted.
Beyond Metropolis: Slice and Hamiltonian Jumps
While RJMCMC is the standard, newer methods adapt more powerful samplers to trans-dimensional spaces:
- Transdimensional Slice Sampling: Razvan Ranca introduced this in StocPy to handle probabilistic programs where the number of random variables changes during execution.
- Nonparametric Hamiltonian Monte Carlo (NP-HMC): Carol Mak and Luke Ong developed Nonparametric Involutive MCMC, which uses "dynamic padding" with noise to make execution traces of different lengths dimensionally compatible. This allows gradient-based HMC to work even when the number of variables is unknown.
Why It Works: The Automatic Occam's Razor
Trans-dimensional MCMC works because it inherently respects Occam's Razor. In a Bayesian framework, higher-dimensional models are "penalized" because their prior probability mass is spread over a much larger volume.
As shown by Gergo Orbán and Máté Lengyel in Bayesian model learning in human visual perception, this allows the system to discover the simplest structure that explains the data. By treating the model architecture itself as a parameter, we move from "fitting a model to data" to "letting the data build the model."