← Back to blogs

Probabilistic Deep Learning Foundations: Tractability versus Generality

Exact inference, intractability, and approximation

Thesis. Probabilistic inference cannot be separated from the learning algorithm and its scalability constraints. Classical graphical models (HMMs, Kalman filters, LDA) solve inference exactly, but only for special structures. When neural networks are used as model components, structural constraints dissolve and inference becomes intractable. That intractability is not a side-effect to be engineered away: it is the organizing pressure that forces variational objectives (the ELBO), approximate inference families (amortized encoders, score matching), and ultimately changes what "inference" even means. The field did not merely apply neural nets to probabilistic models; intractability reshaped the objectives and the notion of inference itself.

The four families below follow the arc that pressure created: exact-but-structured (classical graphical models); general-but-intractable (neural model components); approximation-as-necessity (ELBO, variational families, score matching); and new objectives and meanings (amortized inference, implicit models, denoising) (Figure 1).

Exact Inference under Structural Constraints

The Bayesian formalism was systematized for data analysis by (Gelman et al. 2013 Ch 1-2), building on a philosophical foundation laid out by (Jaynes 2003) that frames probability as extended logic rather than as long-run frequency. The contemporary pedagogical synthesis is (Murphy 2022 Ch 4-5), which unifies frequentist maximum-likelihood, MAP estimation, and fully Bayesian inference within a single probabilistic-graphical-model vocabulary. Earlier textbook treatments include (Bishop 2006) and (MacKay 2003); the latter is notable for weaving Bayesian inference, information theory, and coding theory into a single narrative.

Structured probabilistic modeling was codified in (Koller and Friedman 2009), which remains the canonical reference for directed and undirected graphical models, exact inference (variable elimination, junction trees), approximate inference (loopy belief propagation, MCMC), and learning. The dominant classical latent-variable models preceding deep learning are hidden Markov models, systematized for speech recognition by (Rabiner 1989); linear-Gaussian state-space models, introduced by (Kalman 1960) for linear filtering and control; and latent Dirichlet allocation, developed for document topic modeling by (Blei et al. 2003). Discriminative structured prediction is represented by conditional random fields (Lafferty et al. 2001), which sidestep the locally-normalized exposure-bias issue of maximum-entropy Markov models.

What these models share is a structural assumption that makes the posterior integral tractable: the chain topology for HMMs and Kalman filters (enabling forward-backward and Kalman recursion), and Dirichlet-Multinomial conjugacy for LDA (enabling closed-form coordinate-ascent VI). The inference algorithm and the model structure are inseparable. This inseparability is the constraint that the neural-network era dissolves, and that dissolution is what forces the rest of the arc.

Neural Generality and the Emergence of Intractability

The bridge from classical Bayesian statistics to neural networks was built in the early 1990s. (MacKay 1992) introduced the Laplace-approximation evidence framework, showing that weight-decay regularization has a principled Bayesian interpretation and that hyperparameters such as decay constants can themselves be optimized by maximizing the marginal likelihood. (Neal 1996) extended this to full-posterior inference via Hamiltonian Monte Carlo and, in the same monograph, proved that a one-hidden-layer network with Gaussian weights converges to a Gaussian process in the infinite-width limit. This result anchors the modern NNGP/NTK literature and is revisited in the Bayesian-deep-learning part of this book.

The problem is visible immediately in MacKay's and Neal's settings: the posterior over neural-network weights is no longer Gaussian, the Hessian is no longer positive-definite by construction, and the marginal likelihood integral ∫p(𝒟∣θ)p(θ)dθ\int p(\mathcal{D} \mid \theta) p(\theta) d\theta has no closed form for nonlinear activation functions. MacKay used the Laplace approximation as a stand-in; Neal used HMC on networks with at most a few hundred parameters. Neither scales to modern architectures. Generality was purchased at the exact price of tractability, and what followed was a decades-long search for the right currency with which to pay that price.

Deep variants of the classical graphical-model archetypes (deep belief networks (Hinton et al. 2006), deep Boltzmann machines (Salakhutdinov and Hinton 2009), and structured-prediction energy networks, SPENs, (Belanger and McCallum 2016)) encountered the same barrier. Replacing the compatibility function of a CRF with a neural energy (SPEN) makes exact partition-function computation intractable; the SPEN performs inference by gradient descent on the energy instead. Replacing the Gaussian emissions of an RBM with deeper nonlinear layers (DBM) destroys the bipartite block-Gibbs tractability and forces mean-field variational approximations for the positive phase. In each case the neural component was the source of generality and the source of intractability simultaneously.

Approximation as Necessity: ELBO, Variational Families, Score Matching

The unifying response to intractability was the evidence lower bound. (Dempster et al. 1977) unified a scattered collection of iterative maximum-likelihood procedures (the Baum-Welch algorithm for hidden Markov models, Lindley and Smith's variance-component estimation, Hartley's incomplete-data MLE) under a single expectation-maximization (EM) scheme and proved monotone ascent of the incomplete-data log-likelihood. (Neal and Hinton 1998) subsequently recast EM as coordinate ascent on a free-energy functional:

F(q,θ)=𝔼q(z)[log⁡p(x,z∣θ)]+ℍ[q]=log⁡p(x∣θ)−KL(q(z)∥p(z∣x,θ)),\begin{equation} \label{eq:rw-elbo} F(q, \theta) = \mathbb{E}_{q(z)}[\log p(x, z \mid \theta)] + \mathbb{H}[q] = \log p(x \mid \theta) - \mathrm{KL}(q(z) \,\|\, p(z \mid x, \theta)), \end{equation}(1)

which is tight when qq equals the true posterior and is a lower bound on the log-evidence otherwise. This free-energy lens subsumes wake-sleep (Hinton et al. 1995), variational Bayes (Attias 1999), mean-field VI for graphical models (Jordan et al. 1999), and the review of modern variational methods in (Blei et al. 2017). The ELBO is not merely one of many inference techniques; it is the universal surrogate that becomes necessary precisely when the posterior integral in Bayes' theorem has no closed form.

A parallel response to the partition-function problem in undirected models is score matching. (Hyvärinen 2005) proposed minimizing the expected squared difference between the model score ∇xlog⁡pθ(x)\nabla_x \log p_\theta(x) and the data score, so bypassing the partition function entirely:

J(θ)=𝔼pdata[12∥∇xlogpθ(x)∥2+tr(∇x2logpθ(x))].\begin{equation} \label{eq:rw-score-matching} J(\theta) = \mathbb{E}_{p_{\mathrm{data}}}\!\left[\tfrac{1}{2}\|\nabla_x \log p_\theta(x)\|^2 + \mathrm{tr}(\nabla_x^2 \log p_\theta(x))\right]. \end{equation}(2)

The minimizer of J(θ)J(\theta) equals the true model score under the data distribution whenever pθp_\theta and the data density share support, with no requirement to compute or approximate Z(θ)Z(\theta). Score matching is the direct conceptual ancestor of denoising score matching and modern diffusion generative models, which train a neural score network sθ(x)≈∇xlog⁡p(x)s_\theta(x) \approx \nabla_x \log p(x) by denoising rather than by evaluating the partition-function gradient.

New Objectives and New Meanings of Inference

The ELBO and score matching do not merely approximate classical inference; they change its meaning. In the amortized variational inference (VAE) framework of (Kingma and Welling 2014), the E-step of EM is replaced by a neural encoder qϕ(z∣x)q_\phi(z \mid x) that outputs variational parameters in a single forward pass, shared across all data points. Inference is no longer per-datum optimization; it is a function learned jointly with the model. The meaning of "posterior" shifts from "the exact posterior under this model" to "the variational approximation that maximizes the ELBO under this encoder family." These are not the same object, and the amortization gap (the residual optimality gap between the amortized qϕ(z∣x)q_\phi(z \mid x) and the per-datum optimal q⋆(z)q^\star(z)) is a concrete measure of how far the new definition departs from the old one.

Score-based implicit models make the departure more radical. When a model is defined only through its score function sθ(x)=∇xlog⁡pθ(x)s_\theta(x) = \nabla_x \log p_\theta(x), there is no explicit density, no partition function, and no marginal likelihood to lower-bound. The concept of "inference" in this setting refers to sampling via Langevin dynamics xt+1=xt+ϵsθ(xt)+2ϵξtx_{t+1} = x_t + \epsilon s_\theta(x_t) + \sqrt{2\epsilon}\, \xi_t rather than computing a posterior. The model family, the inference procedure, and the training objective are inseparable in a way that has no counterpart in the classical graphical-model view.

The comparison summarized below shows that by the mid-2010s purely discriminative deep classifiers had displaced generative pretraining on the large image benchmarks (Krizhevsky et al. 2012), though generative and structured models retained advantages in small-data, interpretable, and structured-output settings that motivate the renewed interest in probabilistic deep learning covered in the remainder of this book.

Inference Tractability vs Model Generality: The Landscape

Figure 1. Probabilistic model families placed by generality (horizontal) and by how their inference is done (vertical): exact (green), deterministic approximation (blue), stochastic or implicit (orange). Arrows mark the two transitions traced in the text.

State-of-the-Art Table: Inference Mechanisms Across Model Families

Table 1. Model families in the order of the exact-to-approximate arc. Sources: HMM (Rabiner 1989); Kalman (Kalman 1960); LDA (Blei et al. 2003); CRF (Lafferty et al. 2001); MacKay BNN (MacKay 1992); Neal HMC BNN (Neal 1996); DBM (Salakhutdinov and Hinton 2009); SPEN (Belanger and McCallum 2016); VAE (Kingma and Welling 2014); score matching (Hyvärinen 2005).
Model family Inference (exact/approx.) Approximation used Scalability Arc position
HMM Exact (forward-backward) None needed O(TK2)O(TK^2); scales to hundreds of states Exact, chain-structured
Kalman / linear-Gaussian Exact (Gaussian filter) None needed O(Tdz3)O(Td_z^3); diagonal/low-rank variants Exact, linear-Gaussian
LDA (mean-field VB) Approx. (variational) Mean-field ELBO; closed-form coord. asc. SVI (Hoffman et al. 2013) scales to millions of docs Approx., conjugate structure
Linear-chain CRF Exact marginals (Z(x)Z(x)) None for marginals; approx. for decoding O(TK2)O(TK^2) forward-backward Exact, discriminative
MacKay Laplace BNN Approx. (Laplace) Second-order Taylor at MAP; GGN Hessian KFAC / last-layer approximation Approx., tractable at small scale
Neal HMC BNN Stochastic (≤\leq MC err.) HMC trajectory; leapfrog integrator Run on networks of a few hundred weights Stochastic, exact in limit
DBM + mean-field Approx. (mean-field + PCD) Factored Bernoulli MF; persistent chain Requires PCD; fragile training Approx. undirected
SPEN Approx. (gradient descent) Gradient descent on yy; SSVM loss Scales in label-space dim., not seq. len Approx., neural energy
VAE (amortized VI) Approx. (ELBO + encoder) Amortized qϕ(z∣x)q_\phi(z \mid x); reparam. Scales to large datasets / dim. latents Amortized, new meaning
Score matching / EBM Implicit (no density) Score matching / NCE; Langevin sampling Scales via denoising (diffusion) Implicit, partition-free

Exact inference is available only when graph topology (chain for HMM/Kalman/CRF) or algebraic structure (Gaussian-Gaussian, Dirichlet-Multinomial) provides closed-form posteriors (Table 1); introducing a single neural component into any of these models destroys closure. The Laplace approximation (MacKay) and mean-field VI (LDA, DBM) are the two classical deterministic surrogates, differing in whether the posterior is approximated by a Gaussian at the mode or by a factorized product. Amortized inference (VAE) shifts the computational burden from per-datum optimization to an encoder training cost, paid once and amortized across all data. Score matching and diffusion models bypass the posterior concept entirely: inference is sampling, not density evaluation, and the training objective does not require log⁡Z(θ)\log Z(\theta) at any step. Each family responds to the limitation of the one before it.

Empirical Benchmark: Classical and Deep Models on MNIST

Table 2. Each family's native task, MNIST test error and test negative log-likelihood in nats (an AIS-estimated bound); n/r: not reported. Sources: HMM (Rabiner 1989); Kalman (Kalman 1960); LDA (Blei et al. 2003); CRF (Lafferty et al. 2001); DBN (Hinton et al. 2006); DBM (Salakhutdinov and Hinton 2009); SPEN (Belanger and McCallum 2016); DBM with dropout (Hinton et al. 2012); CNN (LeCun et al. 1998). Only the CNN uses unpermuted images.
Model family Year Native task Test error NLL (nats)
HMM (discrete-state, Gaussian obs.) 1989 Speech phoneme seq. n/r n/r
Kalman filter (linear-Gaussian SSM) 1960 Control, tracking n/r n/r
LDA (100 topics, batch VB) 2003 Text topic discovery n/r n/r
Linear-chain CRF 2001 POS tagging, NER n/r n/r
Deep Belief Net (500-500-2000) 2006 Gen. digit model 1.25 % 86.22 (500-2000 DBN, greedy) (Salakhutdinov and Murray 2008)
Deep Boltzmann Machine (500-1000) 2009 Gen. digit model 0.95 % 84.62
SPEN (deep energy, gradient inference) 2016 Multi-label n/r n/r
DBM + dropout fine-tuning 2012 Gen. pretrain + disc. 0.79 % n/r
CNN (LeNet-5) 1998 Discriminative 0.95 % n/r

The deep generative graphical models (DBN, DBM) reach competitive MNIST classification after up-down (DBN) and discriminative (DBM) fine-tuning (1.25 % and 0.95 % test error, Table 2), and the lowest error, the 0.79 % of (Hinton et al. 2012), was itself obtained by dropout fine-tuning of a generatively pretrained Boltzmann machine rather than by a network trained discriminatively from a random initialization. MNIST therefore does not record the discriminative turn. It records that on a small and nearly saturated benchmark the two traditions were hard to separate, which is why the argument had to be settled elsewhere, on larger image benchmarks (Krizhevsky et al. 2012). The CRF-to-SPEN and HMM-to-DBM transitions are the same move in two settings: replace a hand-designed compatibility or energy function with a neural network, keeping the probabilistic semantics while gaining representational capacity. The classical latent-variable models (HMM, Kalman, LDA, CRF) target distinct problem shapes (time series, topic discovery, sequence labeling) and were never evaluated as MNIST classifiers.

References

Attias, Hagai. 1999. "Inferring Parameters and Structure of Latent Variable Models by Variational Bayes." UAI, 21-30.
Belanger, David, and Andrew McCallum. 2016. "Structured Prediction Energy Networks." ICML, 983-92.
Bishop, Christopher M. 2006. Pattern Recognition and Machine Learning. Springer.
Blei, David M., Alp Kucukelbir, and Jon D. McAuliffe. 2017. "Variational Inference: A Review for Statisticians." Journal of the American Statistical Association 112 (518): 859-77.
Blei, David M., Andrew Y. Ng, and Michael I. Jordan. 2003. "Latent Dirichlet Allocation." Journal of Machine Learning Research 3: 993-1022.
Dempster, A. P., N. M. Laird, and D. B. Rubin. 1977. "Maximum Likelihood from Incomplete Data via the EM Algorithm." Journal of the Royal Statistical Society, Series B 39 (1): 1-38.
Gelman, Andrew, John B. Carlin, Hal S. Stern, David B. Dunson, Aki Vehtari, and Donald B. Rubin. 2013. Bayesian Data Analysis. Third. Chapman; Hall/CRC.
Hinton, Geoffrey E., Peter Dayan, Brendan J. Frey, and Radford M. Neal. 1995. "The Wake-Sleep Algorithm for Unsupervised Neural Networks." Science 268 (5214): 1158-61.
Hinton, Geoffrey E., Simon Osindero, and Yee-Whye Teh. 2006. "A Fast Learning Algorithm for Deep Belief Nets." Neural Computation 18 (7): 1527-54.
Hinton, Geoffrey E., Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. 2012. "Improving Neural Networks by Preventing Co-Adaptation of Feature Detectors." arXiv:1207.0580.
Hoffman, Matthew D., David M. Blei, Chong Wang, and John Paisley. 2013. "Stochastic Variational Inference." Journal of Machine Learning Research 14 (1): 1303-47.
Hyvärinen, Aapo. 2005. "Estimation of Non-Normalized Statistical Models by Score Matching." Journal of Machine Learning Research 6: 695-709.
Jaynes, E. T. 2003. Probability Theory: The Logic of Science. Edited by G. Larry Bretthorst. Cambridge University Press.
Jordan, Michael I., Zoubin Ghahramani, Tommi S. Jaakkola, and Lawrence K. Saul. 1999. "An Introduction to Variational Methods for Graphical Models." Machine Learning 37 (2): 183-233.
Kalman, R. E. 1960. "A New Approach to Linear Filtering and Prediction Problems." Journal of Basic Engineering 82 (1): 35-45.
Kingma, Diederik P., and Max Welling. 2014. "Auto-Encoding Variational Bayes." ICLR.
Koller, Daphne, and Nir Friedman. 2009. Probabilistic Graphical Models: Principles and Techniques. MIT Press.
Krizhevsky, Alex, Ilya Sutskever, and Geoffrey E. Hinton. 2012. "ImageNet Classification with Deep Convolutional Neural Networks." NeurIPS, 1097-105.
Lafferty, John D., Andrew McCallum, and Fernando C. N. Pereira. 2001. "Conditional Random Fields: Probabilistic Models for Segmenting and Labeling Sequence Data." Proceedings of the Eighteenth International Conference on Machine Learning (ICML), 282-89.
LeCun, Yann, Léon Bottou, Yoshua Bengio, and Patrick Haffner. 1998. "Gradient-Based Learning Applied to Document Recognition." Proceedings of the IEEE 86 (11): 2278-324. https://doi.org/10.1109/5.726791.
MacKay, David J. C. 1992. "A Practical Bayesian Framework for Backpropagation Networks." Neural Computation 4 (3): 448-72.
MacKay, David J. C. 2003. Information Theory, Inference, and Learning Algorithms. Cambridge University Press.
Murphy, Kevin P. 2022. Probabilistic Machine Learning: An Introduction. MIT Press. https://probml.github.io/pml-book/book1.html.
Neal, Radford M. 1996. Bayesian Learning for Neural Networks. Springer.
Neal, Radford M., and Geoffrey E. Hinton. 1998. "A View of the EM Algorithm That Justifies Incremental, Sparse, and Other Variants." In Learning in Graphical Models. Kluwer Academic Publishers.
Rabiner, Lawrence R. 1989. "A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition." Proceedings of the IEEE 77 (2): 257-86.
Salakhutdinov, Ruslan, and Geoffrey E. Hinton. 2009. "Deep Boltzmann Machines." AISTATS, 448-55.
Salakhutdinov, Ruslan, and Iain Murray. 2008. "On the Quantitative Analysis of Deep Belief Networks." Proceedings of the 25th International Conference on Machine Learning (ICML), 872-79. https://doi.org/10.1145/1390156.1390266.