skoro v0.0.0

The Laplace approximation

A Laplace approximation replaces a density near a point by a Gaussian in the chart there; taken in a chart it approximates the density times the chart's volume, its mean, marginals, draws and evidence are computations on the linearization's rows, and its covariance omits curvature of the order of the noise's variance on a curved space.

Updated 2026-11-25 · 10 min read

Once a mode has been found, the question is how sure the answer is: the spread of the density around the mode, the spread of a few of its coordinates with the rest integrated out, the total mass under it. Each is an integral that has no closed form for anything but a Gaussian. A Laplace approximation replaces the density by a Gaussian fitted at a point, and reads the answers off the Gaussian. This note fits it from the linearization, says what each answer costs to compute, and measures what the fitted covariance leaves out when the space is curved.

Throughout, ff is the negative log-density (2) of a point x\point of a product of manifolds, against the product ν\nu of their reference measures, x^\hat \point is the point of approximation, and JJ is the stacked Jacobian of the residuals there.

The integral, in a chart#

The integrals in question are against ν\nu, and a Gaussian lives on a vector space. The chart at x^\hat \point connects them, and it brings its volume with it. By (3), for a chart that is full,

∫e−f dν=∫Ux^e−f(x^⊕v)+λx^(v) dv,(1) \int e^{-f} \, \dd \nu = \int_{U_{\hat \point}} e^{-f(\hat \point \oplus \tangent) + \lambda_{\hat \point}(\tangent)} \, \dd \tangent , \tag{1}
(1)

with λx^\lambda_{\hat \point} the log-volume of the chart at x^\hat \point. What is approximated by a Gaussian in v\tangent is therefore the chart objective f(x^⊕v)−λx^(v)f(\hat \point \oplus \tangent) - \lambda_{\hat \point}(\tangent) of (4), and not ff alone. Its linearization, the chart linearization, has the rows of the linearization of ff, with η−∇λx^(0)\eta - \nabla \lambda_{\hat \point}(0) and c0−λx^(0)c_0 - \lambda_{\hat \point}(0) in place of η\eta and c0c_0. The difference shows in two places.

  • The centre. The Gaussian is centred at v=0\tangent = 0 when x^\hat \point is a stationary point of the chart objective, where g=∇λx^(0)g = \nabla \lambda_{\hat \point}(0), and not of ff. On a Euclidean space λ=0\lambda = 0. On a group whose chart translates the identity’s, as the Cayley chart of the rotations does, the log-volume is the same at every point and even in v\tangent, as the stereographic chart’s of the sphere is, so its gradient at 00 is zero: on these spaces the centre is a mode of ff. On a positive space ∇λx^(0)=1\nabla \lambda_{\hat \point}(0) = 1 in each coordinate, and the centre is the mode in the logarithmic chart. For a log-normal of median μ\mu it is μ\mu itself, where log⁡x\log \randomPoint is centred, while the mode with respect to Lebesgue measure is μ e−σ2\mu\, e^{-\sigma^2}, below it. A Gaussian in the tangent coordinates is a Gaussian in the logarithms, and is centred where they are.
  • The constant. λx^(0)\lambda_{\hat \point}(0) is ∑ilog⁡x^i\sum_i \log \hat \point_i on a positive space and zero where the reference measure is the one the retraction normalizes: the volume of the reference measure near x^\hat \point.

What it gives#

When the rows of the chart linearization mm have full rank, e−me^{-m} is a constant times a normal density on Rd\R^\dimension, and everything asked of the approximation is a computation on the rows by elimination, with RR the triangular root the elimination leaves and v∗\tangent^* the minimizer of mm.

asked forcomputed by
the mean, in the tangent at x^\hat \pointthe minimizer v∗\tangent^*, zero at the centre
the covariance, and its marginal on some variables KKpartial elimination of the others (Corollary 13), and the triangular root WW of what is left on KK: W−1W−⊤W^{-1} W^{-\top}
a drawx^⊕(v∗+R−1z)\hat \point \oplus (\tangent^* + R^{-1} z), with zz standard normal
the evidencelog⁡∫e−fdν≈d2log⁡2π−m(v∗)−∑ilog⁡∣Rii∣\log \int e^{-f} \dd \nu \approx \tfrac{\dimension}{2} \log 2\pi - m(\tangent^*) - \sum_i \log \lvert R_{ii} \rvert, by (12)

No covariance matrix is formed for any of them. A marginal on one variable is a normal in the chart at that variable’s estimate, with a whitening of its own, and costs one partial elimination. A draw lies in the chart’s domain on every space whose chart is global. Where the chart is not global, the Gaussian’s mass outside its domain is an error of its own, apart from those below.

What the covariance leaves out#

The Gaussian’s precision is the rows’, J⊤JJ\transpose J. The Hessian of the chart objective at the centre is that and

D=∑t∑i(rt)i ∇2(rt)i+∑t∇2λt−∇2λx^(0),(2) D = \sum_t \sum_i (r_t)_i\, \nabla^2 (r_t)_i + \sum_t \nabla^2 \lambda_t - \nabla^2 \lambda_{\hat \point}(0) , \tag{2}
(2)

the curvature of the residuals, of the terms’ log-volumes and of the chart’s log-volume: the part of (3) that the linearization omits, with the chart’s term added. For linear-Gaussian terms D=0D = 0 (Proposition 7), and the approximation is exact. Otherwise, on Euclidean and positive spaces, only the first sum remains, the curvature that every Gauss–Newton method leaves out. On a curved space all three parts are of the same order. Each is of order one, while J⊤JJ\transpose J is of the order of the terms’ precisions, so each changes the covariance by a relative amount of the order of the noise’s variance, σ2\sigma^2.

  • The chart’s part is positive. For the Cayley chart of the rotations and the stereographic chart of the sphere, the log-volume is −2log⁡(1+∣v∣2/4)-2 \log(1 + \lvert \tangent \rvert^2 / 4), whose Hessian at zero is −I-I. So the chart adds +I+I on each such variable that is integrated over.
  • The terms’ part is negative. Let GtG_t be the derivative of a term’s tangent coordinate x⊖μ\point \ominus \mu with respect to v\tangent. The term’s log-volume adds about −Gt⊤Gt-G_t\transpose G_t, against the Gt⊤ΛtGtG_t\transpose \Lambda_t G_t that its rows keep: the replacement of Λ\Lambda by Λ−I\Lambda - I that a measurement on a curved space shows.
  • The residuals’ part is not small, even at the mode. Along the retraction, the second derivative of x⊖μ\point \ominus \mu is of first order in the residual. The first sum of (2) is therefore quadratic in the residuals, of order one like the others, and it vanishes only where the residuals do. For a rotation measured in the Cayley chart, it averages about +12I+\tfrac12 I over the noise, against the log-volume’s −I-I, as computed numerically from 4000 draws at σ=0.1\sigma = 0.1.

The sign is not fixed. One covariance is smaller than another exactly when its precision is larger, and then every marginal of it is smaller too. So the rows’ covariance is smaller than the second-order covariance (J⊤J+D)−1(J\transpose J + D)^{-1} in every direction when DD is negative semidefinite, and larger in every direction when DD is positive semidefinite. Neither holds in general: the chart’s part is positive, the terms’ log-volumes negative, and the residuals’ part can be of either sign.

What a covariance is meant to describe, though, is the density itself, and the second-order approximation is itself in error on a curved space, at the same relative order σ2\sigma^2. Two examples on the rotations, in the Cayley chart with an isotropic σ\sigma, show how the three covariances compare with the true one. Both were computed numerically: the true covariance in the chart at the mode by importance sampling, or exactly from the chain that generates it.

The first example is a rotation with a prior of fixed mean and kk measurements of it, approximated at the mode. The table gives the trace of each covariance divided by the true one, averaged over six data sets.

σ\sigmakkrowsrows and log-volumesfull Hessian
0.30.3110.9760.9761.0211.0211.0041.004
0.30.3330.9710.9711.0381.0381.0031.003
0.150.15110.9930.9931.0041.0041.0001.000
0.150.15330.9920.9921.0081.0080.9990.999

The rows are over-confident by about half of the σ2k/(k+1)\sigma^2 k / (k + 1) that the log-volumes alone would predict. Adding the log-volumes’ curvature overshoots, to an under-confidence of about the same size, because the residuals’ curvature cancels about half of it. The full Hessian is close to the truth.

The second example is a chain: x0\randomPoint_0 with a prior of fixed mean, and x1=x0⊕ε\randomPoint_1 = \randomPoint_0 \oplus \varepsilon, with nothing observed. It is approximated at its mode, where every residual is zero. The residuals’ curvature therefore vanishes, and the rows with the log-volumes’ curvature are the full Hessian. The variance of x1\randomPoint_1, per axis, is as follows.

σ\sigmarowsfull Hessiantrue
0.30.30.1800.1800.1590.1590.1940.194
0.150.150.04500.04500.04350.04350.04570.0457

Both approximations are over-confident here, and the rows are the closer. They are exact on x0\randomPoint_0, where the full Hessian gives 0.0830.083 against 0.090.09 at σ=0.3\sigma = 0.3. The second-order approximation matches the curvature at the mode exactly, and that does not match the spread: the law is a Gaussian in the chart of x0\randomPoint_0 and in that of the transition, and not in the joint chart at the mode.

So, on a curved variable:

  • Confidence. Compared with the second-order approximation, the rows’ covariance may be over- or under-confident, depending on the direction. Compared with the truth, it was slightly over-confident in every case computed here: by 11 to 2 %2\,\% at σ=0.15\sigma = 0.15 rad and 33 to 7 %7\,\% at σ=0.3\sigma = 0.3 rad. No argument shows that it must be. On Euclidean and positive spaces with linear-Gaussian terms it is exact.
  • Consistency. Adding the log-volumes’ curvature to a marginal is not the consistent choice. It adds one of three parts of the same order and leaves out the residuals’, which in the first example cancels about half of it. Added on the kept variables alone, it also leaves out the curvature on the eliminated ones, which reaches the marginal through their conditionals. To first order in DD, the marginal precision on KK changes by P⊤DPP\transpose D P, not by DKKD_{KK}, where PP lifts a tangent vector on KK to the whole tangent by the conditionals of the eliminated variables EE, with the right-hand sides set to zero: with Λ=J⊤J\Lambda = J\transpose J in blocks, P=(I,−ΛEE−1ΛEK)P = (I, -\Lambda_{EE}^{-1} \Lambda_{EK}). The consistent second-order approximation is the full Hessian. It needs second derivatives, it can be indefinite, and in the second example it is no closer to the truth.
  • Definiteness. The rows’ precision is positive definite whenever the rows determine every direction. With the log-volumes’ curvature, the terms’ and the chart’s parts sum to about ∑tGt⊤(Λt−I)Gt+I\sum_t G_t\transpose (\Lambda_t - I) G_t + I on the curved blocks, which is positive definite whenever every Λt−I\Lambda_t - I is, that is, when every curved term’s noise is less than one in its chart’s coordinates. This is the condition under which a normal’s mean is a mode of its density. Definiteness is lost only where the normals themselves are broad, and the residuals’ part can still move this boundary.

The rows’ precision is thus a sum of squares, positive definite by construction, obtained from first derivatives and one elimination, and in error on a curved variable by a relative amount of order σ2\sigma^2. Adding part of the omitted curvature buys no consistency that the rows lack, and the full second-order approximation is not reliably closer. A covariance of a curved variable reported from the rows should be reported with the order of its error.

A marginal kept as a Gaussian#

Integrating variables out by elimination of the linearization leaves an improper Gaussian factor on the variables that remain, by what elimination leaves, anchored at the point of linearization. For linear-Gaussian terms it is the exact marginal. Otherwise it approximates the logarithm of the marginal density, and it differs from the marginal of a Laplace approximation in two ways. The chart’s part of (2) is there only for the variables integrated over, so nothing offsets the terms’ log-volumes on the variables kept. And the factor is a function on the manifold, not a Gaussian in a chart of it, so whoever integrates against it later applies the chart’s volume to it again.

The chain of the second example shows both, read as integrating x0\randomPoint_0 out and keeping x1\randomPoint_1. The exact factor is the logarithm of the marginal density of x1\randomPoint_1, whose curvature at the anchor was computed numerically from draws of x0\randomPoint_0. These are precisions per axis.

σ\sigmarowswith (2)with (2) and the log-determinantexact
0.30.35.5565.5565.2945.2945.4575.4575.4555.455
0.150.1522.2222.2221.9721.9722.1022.1022.1022.10

The rows are over-confident at the anchor, by 2 %2\,\% at σ=0.3\sigma = 0.3 and 0.6 %0.6\,\% at 0.150.15. The second-order Schur complement overshoots, by about as much, the other way. The exact curvature needs one more term: how the log-determinant of the eliminated block’s Hessian varies with the variables kept, the correction of Laplace’s method of the next order.

The larger cost lies elsewhere. The exact marginal is not a Gaussian in the anchor’s chart, whatever its curvature, and the departure is of the order of the marginal’s own variance. With the exact curvature, the factor alone gives x1\randomPoint_1 the variance 0.1590.159 per axis, against the 0.1930.193 of the exact marginal at σ=0.3\sigma = 0.3, and 0.04350.0435 against 0.04580.0458 at σ=0.15\sigma = 0.15. A filter that predicts without measuring integrates one state out after another, and its factor’s variance grows. Its error grows with it. At σ=0.15\sigma = 0.15, after kk such steps along the chain, the variance that the factor gives the newest state, divided by the exact one, is as follows.

kk1122334455
rows0.940.940.910.910.880.880.850.850.820.82
with (2)0.940.940.900.900.840.840.770.770.710.71

This is the over-confidence of an extended Kalman filter on a curved state. It is a cost of keeping a marginal as a Gaussian in one chart, and not of the omitted curvature: adding the curvature makes it worse after the first step. Measurements bound the factor’s variance, and with it this error.

Built on by