Posterior Inference: From Joint Distributions to the Inference Bottleneck A developer explains the fundamentals of posterior inference in probabilistic models, detailing how joint distributions lead to conditional posteriors and how the EM algorithm leverages these posteriors for learning. The post highlights the computational challenges posed by high-dimensional latent spaces and complex posterior forms. A probabilistic model can describe more than the data you observe. It can also include hidden variables that capture structure you cannot observe directly. But defining that model is only the beginning. Once an observation x is available, the practical question changes: Given this x , what does the model imply about the hidden variable z ? That is the central problem of Posterior Inference . The notation is compact, but the computation is not always easy. High-dimensional latent spaces, complex posterior distributions, and interactions among hidden variables can make both the posterior itself and expectations under that posterior difficult to compute. Suppose a probabilistic model contains an observed variable x and a hidden or latent variable z . The model does not treat them as unrelated quantities. Instead, it represents their probabilistic relationship through a Joint Distribution : This joint distribution describes how the observed data and the hidden variable fit together inside a single probability structure. Once x is observed, however, the question becomes conditional. We are no longer asking only how x and z relate in general. We want to know how the possible values of z are distributed given the particular observation x . That conditional distribution is the posterior. The Posterior Distribution is The numerator p z,x contains the probabilistic relationship between the latent variable and the observation. The denominator p x normalizes those values so that the result becomes a conditional probability distribution over z . The distinction is important: In that sense, the posterior connects the model with actual data. Posterior Inference is not limited to obtaining the posterior distribution itself. One task is to compute which answers the question: how should probability be distributed across possible latent states after observing x ? The other task is to compute an expectation under that posterior . In this case, the posterior is used to average a quantity required for later analysis or learning. This distinction matters because some learning procedures use the posterior inside another computation. The EM Algorithm is a representative example. Consider a model with a latent variable z . Because z is unobserved, the Complete-Data Log-Likelihood cannot be used directly as though both x and z were known. The Expectation-Maximization EM Algorithm instead uses the posterior distribution under the current model parameters to compute its expectation over the possible latent states: Here, θold denotes the current model parameters, while θ denotes the parameters being evaluated. The calculation can be understood in three steps: For each possible latent state, the Complete-Data Log-Likelihood is weighted by that state's posterior probability. So Q θ,θold is not merely an arbitrary weighted sum. It is the Complete-Data Log-Likelihood averaged under the posterior distribution of the latent variable. This gives a useful implementation-level mental model: Posterior Inference determines how latent states are weighted, and learning uses those weights to construct the quantity it needs. Posterior Inference is therefore connected directly to model learning, not only to analyzing a probabilistic model. The conceptual process seems simple: define p z,x , observe x , obtain p z∣x , and then compute any required posterior expectation. The difficulty is that the last two computations are not always tractable. As the dimensionality of the latent space increases, the space of possible latent states becomes harder to handle directly. The challenge is not merely that z is hidden. A high-dimensional latent variable can create a large state space that must be considered during inference. The posterior itself may also have a complicated form. When that happens, required expectations under p z∣x may not be available through an analytical calculation. This creates two related computational questions: Difficulty in either calculation can make inference a bottleneck. Deep Learning can add another source of difficulty through interactions among hidden variables. When hidden variables appear across multiple layers, the state of one variable can be affected by relationships involving other variables and layers. The resulting posterior structure must reflect those interactions. The inference problem therefore becomes difficult for several reasons at once: This is why the Challenge of Inference cannot be explained simply by saying that latent variables are unobserved. The real difficulty comes from the structure of the inference problem. As the latent structure becomes more complicated, exact computation of the posterior and its expectations can become difficult enough to limit model learning and use. A useful mental model is to separate the probability model from the inference problem. The modeling question is: What joint probability structure describes the observed and hidden variables? That structure is represented by The inference question is: Given an actual observation x , what does that model imply about the hidden variable z ? That target is A later learning or analysis step may then require a quantity computed under that posterior, such as Defining a probabilistic model does not automatically mean that every quantity implied by that model can be computed easily. The probability structure may be well defined while exact inference remains computationally difficult. If exact Posterior Inference were always tractable, no additional solution would be needed. But complex probabilistic models cannot always rely on exact computation of the posterior distribution or the required posterior expectations. That is where Approximate Posterior Inference becomes necessary. The important point here is not a particular approximation method. It is the reason approximation is needed in the first place. As latent structure becomes more complicated, exact posterior computation becomes harder. A complex posterior can also make the expectations required for learning difficult to evaluate. When those computations become impractical, inference itself becomes a computational limitation. Approximate Posterior Inference is the next step for dealing with that limitation. When reading a latent-variable model, separate three pieces. First, identify the joint model: Then identify the posterior inference target: Finally, determine whether the algorithm needs the posterior itself or a quantity computed under it, such as the posterior expectation used by EM: That makes the practical question much clearer: Can the required posterior computation be performed exactly, or has inference itself become the computational problem? Posterior Inference connects a probabilistic model with observed data and asks what the model implies about its hidden variables after that data is available. The conceptual progression is straightforward: start from the joint distribution p z,x , condition on the observed x to obtain p z∣x , and then use that posterior directly or compute expectations under it when learning requires them. The difficulty is computational. High-dimensional latent spaces, complex posterior distributions, and interactions among hidden variables can make exact Posterior Inference difficult. That computational limitation is what motivates Approximate Posterior Inference. Originally published at zeromathai.com. Original article: https://zeromathai.com/en/posterior-inference-course-en/ https://zeromathai.com/en/posterior-inference-course-en/