← 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).

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}

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}

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

Inference tractability versus model generality for the probabilistic model families covered in this book. The horizontal axis runs from structurally constrained models (conjugate priors, chain-topology graphical models) toward architecturally unconstrained neural models; the vertical axis runs from exact closed-form posteriors downward through deterministic approximations to stochastic and implicit inference. The green region (top-left) holds models whose exact posteriors follow from exponential-family conjugacy or from dynamic-programming recursions on restricted graph topologies: conjugate Bayesian updates, the Kalman filter, the HMM forward-backward algorithm, and LDA's Dirichlet-Multinomial mean-field coordinate ascent. The blue band (middle) holds models where the posterior is approximated deterministically: MacKay's Laplace BNN replaces the intractable Gaussian weight posterior with a second-order Taylor expansion; the DBM uses mean-field plus persistent contrastive divergence; Neal's HMC BNN is exact up to Monte Carlo error but requires O(parameter-count) gradient evaluations per sample. The orange region (bottom-right) holds models where inference is inherently approximate or implicit: the VAE replaces the E-step with an amortized encoder network, normalizing flows define inference through an invertible change of variables, and score-based / diffusion models define the model only through its score function and sample via Langevin dynamics, bypassing the partition function entirely. The two diagonal arrows mark the historical pressure that drove each transition: neural generality dissolved the structural constraints that made exact inference tractable, and the resulting intractability forced the field to develop new objectives (the ELBO, score matching) and new meanings of inference (amortized, implicit).

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

The following table organises the model families along the arc above, making explicit for each family whether inference is exact or approximate, what approximation is used when inference is intractable, and how scalability is achieved. Citations outside cells per convention.

Probabilistic model families ordered along the exact-to-approximate arc. "Inference" reports whether the posterior or partition function is tractable. "Approximation used" names the surrogate when inference is intractable. "Scalability" describes the practical scaling bottleneck or the technique that overcomes it. Citations: 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); DBN (Hinton et al. 2006); 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. Stochastic VI 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 Intractable beyond ∼\sim1k params 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

The table makes four structural points. First, exact inference is available only when graph topology (chain for HMM/Kalman/CRF) or algebraic structure (Gaussian-Gaussian, Dirichlet-Multinomial) provides closed-form posteriors; introducing a single neural component into any of these models destroys closure. Second, 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. Third, amortized inference (VAE) shifts the computational burden from per-datum optimization to an encoder training cost, paid once and amortized across all data. Fourth, 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 row responds to the limitation of the row above it.

Empirical Benchmark: Classical and Deep Models on MNIST

The inference-mechanism table above is qualitative. The quantitative companion below records where each family actually landed on a common benchmark (MNIST) alongside its native task. What the rows support is narrower than the usual summary. On MNIST the generatively pretrained models and the discriminative convolutional network land within a few tenths of a point of each other, and the discriminative turn of the early 2010s was settled on larger image benchmarks (Krizhevsky et al. 2012) rather than on this one.

Classical-to-deep probabilistic models on MNIST and their native tasks. "MNIST err." is classification test error where the model was used discriminatively; "Gen. NLL" is generative negative log-likelihood in nats as given in the source; "n/r" marks a benchmark not reported in the primary reference because the model was not evaluated on it. Citations: 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 fine-tuning (Hinton et al. 2012); CNN (Murphy 2022). Each citation names the source of the row's model and figure, not a common evaluation protocol: the rows were measured by different authors at different dates and are not a controlled head-to-head comparison.
Model family Year Native task MNIST err. Gen. 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
Deep Boltzmann Machine (500-1000) 2009 Gen. digit model 0.95 % ~85
SPEN (deep energy, gradient inference) 2016 Multi-label / seq. n/r n/r
DBM + dropout fine-tuning 2012 Gen. pretrain + disc. 0.79 % n/r
CNN (LeNet-5 style) 1998 Discriminative 0.95 % n/r

This benchmark makes the point the inference-mechanism table cannot. The deep generative graphical models (DBN, DBM) reach competitive MNIST classification once their learned features are fine-tuned with a discriminative head (1.25 % and 0.95 %), and the lowest error in the table, 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. 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) carry "n/r" because they target distinct problem shapes (time series, topic discovery, sequence labeling) and were never evaluated as MNIST classifiers.

The remainder of this chapter develops each row in order, following the historical sequence rather than the table ordering, culminating in the deep variants that motivate the rest of the book.

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.
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.
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.