Bayesian deep learning, at DTU PhD schoolWe can characterize these manifoldsthrough the full-data GGN(aka the Fisher-Rao metric)In practiceA toy-exampleConsider the (absurdly) simple neural networkA toy-exampleConsider the (absurdly) simple neural networkNote that we can write this asThis implies that the weightsandcorrespond to the same function.Let's look at this in weight space:A toy-exampleConsider the (absurdly) simple neural networkNote that we can write this asThis implies that the weightsandcorrespond to the same function.Let's look at this in weight space:Let's look at this in weight space:Now, apply your favorite Bayesian approximation...Let's look at this in weight space:Now, apply your favorite Bayesian approximation...Unlikely under posteriorLikely under posteriorUnlikely under posteriorLikely under posteriorLet's look at this in weight space:Let's look at this in weight space:Now, apply your favorite Bayesian approximation...At this point, our approximate posteriorviolates the basic rules of probability:it assigns multiple densitiy values to asingle function, such that the posteriorprobability density function (pdf) is nota function...WTF ?!At this point, our approximate posteriorviolates the basic rules of probability:it assigns multiple densitiy values to asingle function, such that the posteriorprobability density function (pdf) is nota function...You can show that... (but I won't have time)Consider a (smooth) overparametrizedmodel. At parameter , the spaceof parameters locally decompose intotwo Riemannian manifolds:You can show that... (but I won't have time)Consider a (smooth) overparametrizedmodel. At parameter , the spaceof parameters locally decompose intotwo Riemannian manifolds:the kernel manifold: a smoothlyconnected set of parameters thatyield identical functions.You can show that... (but I won't have time)Consider a (smooth) overparametrizedmodel. At parameter , the spaceof parameters locally decompose intotwo Riemannian manifolds:the image manifold: a smoothlythe kernel manifold: a smoothlyconnected set of parameters thatyield identical functions.connected set of parameters thatyield strictly different functions.You can show that... (but I won't have time)Consider a (smooth) overparametrizedmodel. At parameter , the spaceof parameters locally decompose intotwo Riemannian manifolds:the image manifold: a smoothlythe kernel manifold: a smoothlyconnected set of parameters thatyield identical functions.connected set of parameters thatyield strictly different functions.If you change these manifoldschange as well.You can show that... (but I won't have time)You can show that... (but I won't have time)An eigen-decomposition of this yieldsYou can show that... (but I won't have time)An eigen-decomposition of this yieldswhereis tangential to the kernelmanifloldYou can show that... (but I won't have time)An eigen-decomposition of this yieldswhereis tangential to the kernelmanifloldis tangential to the imagemanifloldYou can show that... (but I won't have time)An eigen-decomposition of this yieldswhereis tangential to the kernelmanifloldis tangential to the imagemanifloldIn essence:we can get a coordinate systemin which some dimensions neverchange the function, while theothers always change the function.In practice, things are slightly differentIf we replace the full-data GGNwith an average over the training datathis changes things.the image manifold: a smoothlythe kernel manifold: a smoothlyconnected set of parameters thatyield identical functions.connected set of parameters thatyield strictly different functions.the image manifold: a smoothlythe kernel manifold: a smoothlyconnected set of parameters thatyield identical predictions on thetraining data.connected set of parameters thatyield strictly different predictionson the training data.(points in the kernel manifold retain predictionson training data)the image manifold: a smoothlythe kernel manifold: a smoothlyconnected set of parameters thatyield identical predictions on thetraining data.connected set of parameters thatyield strictly different predictionson the training data.(points in the kernel manifold retain predictionson training data)Our eigen-decompositionnow gives a coordinate systemwherechanges the function every-where except at the trainingdata.changes the function every-where.the image manifold: a smoothlythe kernel manifold: a smoothlyconnected set of parameters thatyield identical predictions on thetraining data.connected set of parameters thatyield strictly different predictionson the training data.(points in the kernel manifold retain predictionson training data)Our eigen-decompositionnow gives a coordinate systemwherechanges the function every-where except at the trainingdata.changes the function every-where.can be estimated from datathe image manifold: a smoothlythe kernel manifold: a smoothlyconnected set of parameters thatyield identical predictions on thetraining data.connected set of parameters thatyield strictly different predictionson the training data.(points in the kernel manifold retain predictionson training data)Our eigen-decompositionnow gives a coordinate systemwherechanges the function every-where except at the trainingdata.changes the function every-where.these cannotThe dumbest Bayesian approximationCompute the empirical Gauss Newton matrix1The dumbest Bayesian approximationCompute the empirical Gauss Newton matrix1Compute its eigenvectors2The dumbest Bayesian approximationCompute the empirical Gauss Newton matrix1Compute its eigenvectors2Define an approximate posterior with covariance3The dumbest Bayesian approximationCompute the empirical Gauss Newton matrix1Compute its eigenvectors23(if low-noise data)The dumbest Bayesian approximationCompute the empirical Gauss Newton matrix1Compute its eigenvectors23(if low-noise data)Define an approximate posterior with covarianceCOMPUTATIONALGigantic!Cubic complexityvon Neumann to the rescue!Fortunately, we only care about the kernel (null space)of the generalized Gauss Newton (GGN) matrixJohn von Neumannfrom a Danish perspectivevon Neumann to the rescue!Fortunately, we only care about the kernel (null space)of the generalized Gauss Newton (GGN) matrixJohn von Neumannfrom a Danish perspectiveThis kernel is the intersection of the kernelsof mini-batched GGN estimatesvon Neumann to the rescue!Fortunately, we only care about the kernel (null space)of the generalized Gauss Newton (GGN) matrixJohn von Neumannfrom a Danish perspectiveThis kernel is the intersection of the kernelsof mini-batched GGN estimatesvon Neumann's alternating projections algorithmcan then project to the GGN kernel. This can be implemented in (with some Jax tricks)space complexity, andtime complexity.modelparametersnumber ofdataThis scales to large models!iterationcounterIt actually works (even if it's clearly dumb)Standard tests on in-distribution performance.In-distribution performance is unchanged.It actually works (even if it's clearly dumb)Standard tests on out-of-distribution performance (AUROC, bigger is better).Seems to be best in class. In all experiments, in-distribution performanceis unchanged.Boldly goes where Bayes barely goesScales to contemporary models and dataset.Improves out-of-distribution performance.SWIN transformer (28 million params) trained on ImageNet-1K;tested on Places365.Boldly goes where Bayes barely goesScales to contemporary models and datasets (AUROC).Improves out-of-distribution performance.Visual Attention Network (VAN, 4 million params) trained on CelebA.Boldly goes where Bayes barely goesScales to image generative modelsCan flag OoD image contentOriginalReconstructMSEUncertaintyPerceptual VAE (50 million params) trained on Fitzpatrick17k.MSEA: LightB: MixedC: DarkA: LightB: MixedC: DarkUncertaintyStrong correlation between uncertainty and reconstruction error(you should be paying attention if you use generative models to create training data)Correlation: 0.92MSEUncertaintySimilar trends when testing on out-of-distribution data (PASSION)Summary: uncertainty is an excellent proxy for accuracy; here potentiallyuseful for revealing bias in model/data.Define an approximate posterior with covarianceIn theoryThe space of model parametersalways decompose intothe image manifold: a smoothlythe kernel manifold: a smoothlyconnected set of parameters thatyield identical predictions on thetraining data.connected set of parameters thatyield strictly different predictionson the training data.Disregarding this structure breaksthe usual Bayesian approximations.Summary (and stuff I didn't tell you)Scalable algorithms allowsyou to project onto the tangentspaces of these manifolds.This is enough to build (locally)reparametrization invariantapproximate posteriors.And it even works pretty well.Summary (and stuff I didn't tell you)I didn't have time to tell you that:You can say a lot of fun thingsabout the geometry of theimage and kernel manifolds.Using Riemannian diffusion youcan build better models (but it'stoo expensive to be worth it).You can do full variational trainingof our approximate posterior(and it works).You can use techniques from matrix sketching to get evenfaster algorithms (logarithmicin number of parameters for some tasks).Selected referencesVIKING: Deep variational inference with stochasticprojections. Fadel, Roy, Krämer, Zainchkovskyy,Syrota, Valverde Mahou, Ek, and Hauberg.NeurIPS 2025.Bayes without Underfitting: Fully Correlated DeepLearning Posteriors via Alternating Projections.Marco Miani, Hrittik Roy and Søren Hauberg.AISTATS 2025.Gradients of Functions of Large Matrices.Nicholas Krämer, Pablo Moreno-Muñoz,Hrittik Roy and Søren Hauberg.NeurIPS 2024.Reparameterization invariance in approximateBayesian inference. Hrittik Roy, Marco Miani,Carl Henrik Ek, Philipp Hennig, Marvin Pförtner,Lukas Tatzel and Søren Hauberg.NeurIPS 2024.Sketched Lanczos uncertainty score: a low-memory summary of the Fisher information.Marco Miani, Lorenzo Beretta and Søren Hauberg.NeurIPS 2024.Summary (and stuff I didn't tell you)I didn't have time to tell you that:You can say a lot of fun thingsabout the geometry of theimage and kernel manifolds.Using Riemannian diffusion youcan build better models (but it'stoo expensive to be worth it).You can do full variational trainingof our approximate posterior(and it works).You can use techniques from matrix sketching to get evenfaster algorithms (logarithmicin number of parameters for some tasks).Selected referencesVIKING: Deep variational inference with stochasticprojections. Fadel, Roy, Krämer, Zainchkovskyy,Syrota, Valverde Mahou, Ek, and Hauberg.NeurIPS 2025.Bayes without Underfitting: Fully Correlated DeepLearning Posteriors via Alternating Projections.Marco Miani, Hrittik Roy and Søren Hauberg.AISTATS 2025.Gradients of Functions of Large Matrices.Nicholas Krämer, Pablo Moreno-Muñoz,Hrittik Roy and Søren Hauberg.NeurIPS 2024.Reparameterization invariance in approximateBayesian inference. Hrittik Roy, Marco Miani,Carl Henrik Ek, Philipp Hennig, Marvin Pförtner,Lukas Tatzel and Søren Hauberg.NeurIPS 2024.Sketched Lanczos uncertainty score: a low-memory summary of the Fisher information.Marco Miani, Lorenzo Beretta and Søren Hauberg.NeurIPS 2024.The dumbest Bayesian approximationCompute the empirical Gauss Newton matrix1Compute its eigenvectors23(if low-noise data)Define an approximate posterior with covarianceJust requires us to drawa Gaussian sampleThe dumbest Bayesian approximationCompute the empirical Gauss Newton matrix1Compute its eigenvectors23(if low-noise data)Define an approximate posterior with covarianceJust requires us to drawa Gaussian sample andprojecting this to thekernel dimensionsBayesian training works as wellWe can also estimate by directly maximizing the usual ELBO lower of the marginal likelihoodThis can be evaluated stochastically with the projection algorithm.Empirically, this stabilize training, allows you to automatically inferprior precision (regularization strength) and posterior variances.Bayesian training works as wellWe can also estimate by directly maximizing the usual ELBO lower of the marginal likelihoodThis can be evaluated stochastically with the projection algorithm.Empirically, this stabilize training, allows you to automatically inferprior precision (regularization strength) and posterior variances.Bayesian training works as wellIt even applies to not-too-tiny models...(to those of you who know my work on latent space geometries, you willknow that I link uncertainty to topology, which is kinda why I'm doing this stuff...)Part threeIn which we see the underlying problem...Here's a funny observation...Recall the generalized Gauss-Newton Hessian approximationHere's a funny observation...Recall the generalized Gauss-Newton Hessian approximationJacobian of neural network atHere's a funny observation...Recall the generalized Gauss-Newton Hessian approximationJacobian of neural network atAnother intepretation of the associated Laplace approximation appearsby linearizing the neural network with respect to the weights (but not x)Under this approximation, the neural network Hessian is the GGN,i.e., if we allow ourselves to linearize the neural network (wrt. weights)then we don't have to approximate the Hessian.Here's a funny observation...Recall the generalized Gauss-Newton Hessian approximationJacobian of neural network atAnother intepretation of the associated Laplace approximation appearsby linearizing the neural network with respect to the weights (but not x)Under this approximation, the neural network Hessian is the GGN,i.e., if we allow ourselves to linearize the neural network (wrt. weights)then we don't have to approximate the Hessian.But really...who cares???A subtle implication is that now we should also linearize the network when makingposterior predictions, i.e., Here's a funny observation...This should blow your mind!Replacing the neural network with a linearized version(without having a mathematical need!)makes predictions better!This is also seems to work with large networks.This is freakin' weird! I demand an explanation!Starting with linear functionsConsider the linear (in parameters) functionand the 'reparametrization function'Starting with linear functionsConsider the linear (in parameters) functionand the 'reparametrization function'We then say thatandare equivalent ifWe write thisStarting with linear functionsConsider the linear (in parameters) functionand the 'reparametrization function'We then say thatandare equivalent ifWe write thisStarting with linear functionsConsider the linear (in parameters) functionand the 'reparametrization function'We then say thatandare equivalent ifWe write thisnullspaceStarting with linear functionsConsider the linear (in parameters) functionand the 'reparametrization function'We then say thatandare equivalent ifWe write thisnullspaceLinearized neural networksConsider a linearized neural networkwhere we evaluate at the entire training set, i.e.(i.e. x is a stacking of all observations)Linearized neural networksConsider a linearized neural networkWe then say thatandare equivalent ifWe write thisnullspacewhere we evaluate at the entire training set, i.e.(i.e. x is a stacking of all observations)Linearized neural networksConsider a linearized neural networkWe then say thatandare equivalent ifWe write thisnullspacewhere we evaluate at the entire training set, i.e.(i.e. x is a stacking of all observations)If we now reintroducewe see thatWhy Linearized Laplace worksWith our basic understanding of linear reparametrizations, we can understandwhy Linearized Laplace works better than 'classic' Laplace.Why Linearized Laplace worksWith our basic understanding of linear reparametrizations, we can understandwhy Linearized Laplace works better than 'classic' Laplace.LaplaceLinearizedLaplaceRecallWhy Linearized Laplace worksWith our basic understanding of linear reparametrizations, we can understandwhy Linearized Laplace works better than 'classic' Laplace.LaplaceLinearizedLaplaceRecallIf we make an eigendecompositionAny sample from q can then be decomposedimage contributionkernel contributionIn Linearized Laplace we see that the kernel part of the sample disappears(it is absorbed into the Jacobian nullspace)such that reparametrizations disappear under the linear model.Linearized Laplace is, thus, invariant to reparametrizations (of the linear function).FMINST with 10,000 observationNumber of parametersEffective number of parameters (%)((Laplace only fails when reparametrizations dominate;less so for linearized LaplaceRecall that the GGN rankgives the dimension of theeffective space of functions,while the remaining dimensionsare reparametrizations.As we add more parametersto our neural nets, we increasingly emphasizereparametrizations.Linearized Laplace is, thus, invariant to reparametrizations (of the linear function).Who cares?Summary: Laplace works fine when reparametrizations are not a big deal(e.g. in non-neural models), but as we increase neural model capacity,we increase the reparametrization issue. Linearization gets rid ofreparametrizations infinitesimally, which helps quite a bit.We can characterize these manifoldsthrough the full-data GGN(aka the Fisher-Rao metric)We can characterize these manifoldsthrough the full-data GGN(aka the Fisher-Rao metric)We can characterize these manifoldsthrough the full-data GGN(aka the Fisher-Rao metric)We can characterize these manifoldsthrough the full-data GGN(aka the Fisher-Rao metric)The dumbest Bayesian approximationCompute the empirical Gauss Newton matrix1Compute its eigenvectors23(if low-noise data)Define an approximate posterior with covarianceJust requires us to drawa Gaussian sample andprojecting this to thekernel dimensionsThe dumbest Bayesian approximationCompute the empirical Gauss Newton matrix1Compute its eigenvectors23(if low-noise data)Define an approximate posterior with covarianceJust requires us to drawa Gaussian sample andprojecting this to thekernel dimensionsSummary (and stuff I didn't tell you)Summary (and stuff I didn't tell you)I'm not trying to sell you a method (we currently do notrecommend our own stuff). I'm telling you that theproblem is hard. Be skeptical of sales people in this field!Summary (and stuff I didn't tell you)Standard point estimates (max. likelihood and MAP) allow you to reason aboutdata uncertainty, but not model uncertainty (which is what you usually want).Summary (and stuff I didn't tell you)Standard point estimates (max. likelihood and MAP) allow you to reason aboutdata uncertainty, but not model uncertainty (which is what you usually want).Bayesian approaches gives you model uncertainty, but they require (sometimes pretty crazy)approximations (which fail most of the time).Summary (and stuff I didn't tell you)Standard point estimates (max. likelihood and MAP) allow you to reason aboutdata uncertainty, but not model uncertainty (which is what you usually want).Bayesian approaches gives you model uncertainty, but they require (sometimes pretty crazy)approximations (which fail most of the time).Point estimates work, but doesn't give you what you want!Bayesian methods give you what you want, but they don't work.Upcoming bookPrimer on the underlying geometry;to appear with Cambridge Uni Press.www2.compute.dtu.dk/~sohau/weekendwithbernie/ Summary (and stuff I didn't tell you)I didn't have time to tell you that:You can say a lot of fun thingsabout the geometry of theimage and kernel manifolds.Using Riemannian diffusion youcan build better models (but it'stoo expensive to be worth it).You can do full variational trainingof our approximate posterior(and it works).You can use techniques from matrix sketching to get evenfaster algorithms (logarithmicin number of parameters for some tasks).Selected referencesVIKING: Deep variational inference with stochasticprojections. Fadel, Roy, Krämer, Zainchkovskyy,Syrota, Valverde Mahou, Ek, and Hauberg.NeurIPS 2025.Bayes without Underfitting: Fully Correlated DeepLearning Posteriors via Alternating Projections.Marco Miani, Hrittik Roy and Søren Hauberg.AISTATS 2025.Gradients of Functions of Large Matrices.Nicholas Krämer, Pablo Moreno-Muñoz,Hrittik Roy and Søren Hauberg.NeurIPS 2024.Reparameterization invariance in approximateBayesian inference. Hrittik Roy, Marco Miani,Carl Henrik Ek, Philipp Hennig, Marvin Pförtner,Lukas Tatzel and Søren Hauberg.NeurIPS 2024.Sketched Lanczos uncertainty score: a low-memory summary of the Fisher information.Marco Miani, Lorenzo Beretta and Søren Hauberg.NeurIPS 2024.Upcoming bookPrimer on the underlying geometry;to appear with Cambridge Uni Press.www2.compute.dtu.dk/~sohau/weekendwithbernie/ Thanks for the attention!Bayesian deep learning, at DTU PhD schoolAugust 2026Søren Hauberg
1