{"id":238745,"date":"2025-11-02T01:07:35","date_gmt":"2025-11-02T01:07:35","guid":{"rendered":"https:\/\/www.newsbeep.com\/uk\/238745\/"},"modified":"2025-11-02T01:07:35","modified_gmt":"2025-11-02T01:07:35","slug":"bayesian-continual-learning-and-forgetting-in-neural-networks","status":"publish","type":"post","link":"https:\/\/www.newsbeep.com\/uk\/238745\/","title":{"rendered":"Bayesian continual learning and forgetting in neural networks"},"content":{"rendered":"<p>Description of the variational inference framework<\/p>\n<p>Exact computation of the truncated posterior (Eq. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>)) becomes intractable as the number of parameters in the network grows, necessitating approximation methods. Here, we use variational inference (VI), which tackles this challenge by restricting the posterior to a parameterized distribution, known as the variational distribution. We choose a multivariate Gaussian \\({q}_{{{\\boldsymbol{\\theta }}}_{t}}({\\boldsymbol{\\omega }})\\).<\/p>\n<p>To reduce complexity, we adopt the mean-field approximation<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 40\" title=\"Hinton, G. &amp; van Camp, D. Keeping the neural networks simple by minimizing the description length of the weights. In Proc. Sixth Annual Conference on Computational Learning Theory&#x2014;COLT 93 (ACM Press, 1993).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR40\" id=\"ref-link-section-d238773390e8084\" rel=\"nofollow noopener\" target=\"_blank\">40<\/a>, modeling each synaptic weight as an independent Gaussian:<\/p>\n<p>$${q}_{{{\\boldsymbol{\\theta }}}_{t}}({\\boldsymbol{\\omega }})=\\mathop{\\prod }\\limits_{i=1}^{s}{q}_{{\\theta }_{t,i}}({\\omega }_{i})\\Rightarrow {q}_{{{\\boldsymbol{\\theta }}}_{t}}({\\boldsymbol{\\omega }})={\\mathcal{N}}({\\boldsymbol{\\omega }};{{\\boldsymbol{\\mu }}}_{t},{\\rm{diag}}({{\\boldsymbol{\\sigma }}}_{t}^{2})),$$<\/p>\n<p>where s is the total number of synapses, and each \u03c9i is modeled by \\({q}_{{\\theta }_{t,i}}({\\omega }_{i})={\\mathcal{N}}({\\omega }_{i};{\\mu }_{i},{\\sigma }_{i}^{2})\\). Our goal is for \\({q}_{{{\\boldsymbol{\\theta }}}_{t}}({\\boldsymbol{\\omega }})\\) to approximate the true truncated posterior \\(p({\\boldsymbol{\\omega }}\\,| \\,{{\\mathcal{D}}}_{t-N},\\ldots,{{\\mathcal{D}}}_{t})\\).<\/p>\n<p>Following standard VI practice<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 9\" title=\"Blundell, C., Cornebise, J., Kavukcuoglu, K. &amp; Wierstra, D. Weight uncertainty in neural networks. In Proc. International Conference on Machine Learning, 1613&#x2013;1622 (PMLR, 2015).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR9\" id=\"ref-link-section-d238773390e8604\" rel=\"nofollow noopener\" target=\"_blank\">9<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 18\" title=\"Nguyen, C. V., Li, Y., Bui, T. D. &amp; Turner, R. E. Variational continual learning. In Proc. International Conference on Learning Representations (ICLR, 2017).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR18\" id=\"ref-link-section-d238773390e8607\" rel=\"nofollow noopener\" target=\"_blank\">18<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Blei, D. M., Kucukelbir, A. &amp; McAuliffe, J. D. Variational inference: a review for statisticians. J. Am. Stat. Assoc. 112, 859&#x2013;877 (2017).\" href=\"#ref-CR41\" id=\"ref-link-section-d238773390e8610\">41<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Friston, K., Mattout, J., Trujillo-Barreto, N., Ashburner, J. &amp; Penny, W. Variational free energy and the Laplace approximation. Neuroimage 34, 220&#x2013;234 (2007).\" href=\"#ref-CR42\" id=\"ref-link-section-d238773390e8610_1\">42<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 43\" title=\"Neal, R. M. &amp; Hinton, G. E. A view of the em algorithm that justifies incremental, sparse, and other variants. In Proc. Learning in Graphical Models, 355&#x2013;368 (Springer, 1998).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR43\" id=\"ref-link-section-d238773390e8613\" rel=\"nofollow noopener\" target=\"_blank\">43<\/a>, we minimize the Kullback\u2013Leibler (KL) divergence between \\({q}_{{{\\boldsymbol{\\theta }}}_{t}}({\\boldsymbol{\\omega }})\\) and the target posterior:<\/p>\n<p>$${\\boldsymbol{\\theta}}_t \\, =\\, \\arg\\min_{{\\boldsymbol{\\theta}}} \\; D_{KL}\\!\\left[ q_{{\\boldsymbol{\\theta}}}({\\boldsymbol{\\omega}}) \\;\\|\\; p\\bigl({\\boldsymbol{\\omega}}\\!\\mid\\!{\\mathcal{D}}_{t-N},\\ldots,{\\mathcal{D}}_{t}\\bigr) \\right].$$<\/p>\n<p>\n                    (20)\n                <\/p>\n<p>Variational free energy<\/p>\n<p>Starting from Eq. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ20\" rel=\"nofollow noopener\" target=\"_blank\">20<\/a>), we rewrite the target posterior \\(p({\\boldsymbol{\\omega }}\\,| \\,{{\\mathcal{D}}}_{t-N},\\ldots,{{\\mathcal{D}}}_{t})\\) using Bayes\u2019 rule:<\/p>\n<p>$$p({\\boldsymbol{\\omega }}\\,| \\,{{\\mathcal{D}}}_{t-N},\\ldots,{{\\mathcal{D}}}_{t})=\\frac{p({{\\mathcal{D}}}_{t}\\,| \\,{\\boldsymbol{\\omega }})\\,p({\\boldsymbol{\\omega }}\\,| \\,{{\\mathcal{D}}}_{t-N-1},\\ldots,{{\\mathcal{D}}}_{t-1})}{p({{\\mathcal{D}}}_{t})}\\times \\frac{p({{\\mathcal{D}}}_{t-N-1})}{p({{\\mathcal{D}}}_{t-N-1}\\,| \\,{\\boldsymbol{\\omega }})}.$$<\/p>\n<p>Applying the KL divergence definition \\(\\,{D}_{KL}[Q\\,| \\,| P]\\,=\\,{{\\mathbb{E}}}_{Q}[\\log (Q\/P)]\\) and ignoring terms independent of \u03b8, we obtain:<\/p>\n<p>$${{\\boldsymbol{\\theta }}}_{t}=\t\\arg \\mathop{\\min }\\limits_{{\\boldsymbol{\\theta }}}{{\\mathbb{E}}}_{{q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})}\\,\\left[\\log (\\frac{{q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})}{p({\\boldsymbol{\\omega }}\\,| \\,{{\\mathcal{D}}}_{t-N-1},\\ldots,{{\\mathcal{D}}}_{t-1})})\\right.\\\\ \t\\left.-\\log p({{\\mathcal{D}}}_{t}\\,| \\,{\\boldsymbol{\\omega }})+ \\log p({{\\mathcal{D}}}_{t-N-1}\\,| \\,{\\boldsymbol{\\omega }})\\right].$$<\/p>\n<p>\n                    (21)\n                <\/p>\n<p>As explained in the main text, we further approximate \\(\\,p({\\boldsymbol{\\omega }}\\,| \\,{{\\mathcal{D}}}_{t-N-1},\\ldots,{{\\mathcal{D}}}_{t-1})\\approx {q}_{{{\\boldsymbol{\\theta }}}_{t-1}}({\\boldsymbol{\\omega }})\\), which yields<\/p>\n<p>$${{\\boldsymbol{\\theta }}}_{t}=\t\\arg \\mathop{\\min }\\limits_{{\\boldsymbol{\\theta }}}\\left[{D}_{KL}({q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})\\,\\parallel \\,{q}_{{{\\boldsymbol{\\theta }}}_{t-1}}({\\boldsymbol{\\omega }}))-{{\\mathbb{E}}}_{{q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})}\\,[\\log p({{\\mathcal{D}}}_{t}\\,| \\,{\\boldsymbol{\\omega }})]\\right.\\\\ \t \\left.+ {{\\mathbb{E}}}_{{q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})}\\,[\\log p({{\\mathcal{D}}}_{t-N-1}\\,| \\,{\\boldsymbol{\\omega }})]\\right].$$<\/p>\n<p>\n                    (22)\n                <\/p>\n<p>Defining the function \\({{\\mathcal{F}}}_{t}\\) (the variational free energy<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 42\" title=\"Friston, K., Mattout, J., Trujillo-Barreto, N., Ashburner, J. &amp; Penny, W. Variational free energy and the Laplace approximation. Neuroimage 34, 220&#x2013;234 (2007).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR42\" id=\"ref-link-section-d238773390e10179\" rel=\"nofollow noopener\" target=\"_blank\">42<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 43\" title=\"Neal, R. M. &amp; Hinton, G. E. A view of the em algorithm that justifies incremental, sparse, and other variants. In Proc. Learning in Graphical Models, 355&#x2013;368 (Springer, 1998).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR43\" id=\"ref-link-section-d238773390e10182\" rel=\"nofollow noopener\" target=\"_blank\">43<\/a>) as:<\/p>\n<p>$${\\mathcal{F}}_t \\,=\t\\, \\underbrace{ D_{KL}\\bigl[q_{{\\boldsymbol{\\theta}}_t}({\\boldsymbol{\\omega}})\\,\\|\\, q_{{\\boldsymbol{\\theta}}_{t-1}}({\\boldsymbol{\\omega}})\\bigr] \\,-\\, {\\mathbb{E}}_{q_{{\\boldsymbol{\\theta}}}({\\boldsymbol{\\omega}})}\\!\\bigl[\\log p({\\mathcal{D}}_t\\,\\mid\\,{\\boldsymbol{\\omega}})\\bigr] }_{{\\text{Learning}}} \\,\\\\ \t+\\, \\underbrace{ {\\mathbb{E}}_{q_{{\\boldsymbol{\\theta}}}({\\boldsymbol{\\omega}})}\\!\\bigl[\\log p({\\mathcal{D}}_{t-N-1}\\,\\mid\\,{\\boldsymbol{\\omega}})\\bigr] }_{{\\text{Forgetting}}},$$<\/p>\n<p>We recover the expression from the main text (Eq. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>)), which explicitly separates the learning term (adapting to the current task) from the forgetting term (downweighting information from older tasks).<\/p>\n<p>Forgetting term approximation<\/p>\n<p>From Eq. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>) in the main text, the main challenge lies in computing the \u201cforgetting\u201d term \\(\\,{{\\mathbb{E}}}_{{q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})}\\,[\\log p({{\\mathcal{D}}}_{t-N-1}| {\\boldsymbol{\\omega }})]\\). For this purpose, we assume each dataset \\({{\\mathcal{D}}}_{i}\\) has equal marginal likelihood, so<\/p>\n<p>$$p({{\\mathcal{D}}}_{t-N-1},\\ldots,{{\\mathcal{D}}}_{t-1}| {\\boldsymbol{\\omega }})=\\mathop{\\prod }\\limits_{i=t-N-1}^{t-1}p({{\\mathcal{D}}}_{i}| {\\boldsymbol{\\omega }})={[p({{\\mathcal{D}}}_{t-N-1}| {\\boldsymbol{\\omega }})]}^{N},$$<\/p>\n<p>thus weighting each dataset in the memory window equally. Because our variational and prior distributions are Gaussians, this assumption leads to a closed-form expression for the forgetting likelihood.<\/p>\n<p>Lemma 1: Let \\({q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})\\approx p({\\boldsymbol{\\omega }}| {\\mathcal{D}})\\) be a mean-field Gaussian for a BNN, where \u03b8\u2009=\u2009(\u03bc,\u00a0\u03c3) and \u03c9\u2009=\u2009\u03bc\u2009+\u2009\u03f5 \u22c5 \u03c3, \\({\\boldsymbol{\\epsilon }} \\sim {\\mathcal{N}}(\\overrightarrow{0},{{\\bf{I}}}_{s})\\). If the prior is \\(p({\\boldsymbol{\\omega }})={\\mathcal{N}}({\\boldsymbol{\\omega }};{{\\boldsymbol{\\mu }}}_{{\\rm{prior}}},{\\rm{diag}}({{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}))\\), then \\(p({\\mathcal{D}}| {\\boldsymbol{\\omega }})\\propto {q}_{L}({\\boldsymbol{\\omega }})={\\mathcal{N}}({\\boldsymbol{\\omega }};{{\\boldsymbol{\\mu }}}_{L},{\\rm{diag}}({{\\boldsymbol{\\sigma }}}_{L}^{2})),\\) and the negative log-likelihood takes a quadratic form: \\({\\mathcal{L}}({\\boldsymbol{\\omega }})=\\frac{{({\\boldsymbol{\\omega }}-{{\\boldsymbol{\\mu }}}_{L})}^{2}}{2\\,{{\\boldsymbol{\\sigma }}}_{L}^{2}}+ \\frac{1}{2}\\,\\log (2\\pi \\,{{\\boldsymbol{\\sigma }}}_{L}^{2}),\\) where \\(\\frac{1}{{{\\boldsymbol{\\sigma }}}^{2}}=\\frac{1}{{{\\boldsymbol{\\sigma }}}_{L}^{2}}+\\frac{1}{{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}\\) and \\({\\boldsymbol{\\mu }}=\\frac{{{\\boldsymbol{\\mu }}}_{L}\\,{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}+{{\\boldsymbol{\\mu }}}_{{\\rm{prior}}}\\,{{\\boldsymbol{\\sigma }}}_{L}^{2}}{{{\\boldsymbol{\\sigma }}}_{L}^{2}+{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}.\\)<\/p>\n<p>A full proof of Lemma 1 appears in Supplementary Note\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>. It uses Bayes\u2019 rule for Gaussian posteriors and priors to link \u03bcL and \u03c3L to \u03bc and \u03c3. In our truncated-posterior setting, \\(p({{\\mathcal{D}}}_{t-N-1}| {\\boldsymbol{\\omega }})\\propto {q}_{{L}_{t-1}}{({\\boldsymbol{\\omega }})}^{\\frac{1}{N}},\\) yielding<\/p>\n<p>$${\\mathcal{F}}_t \\,=\\, \\underbrace{\\left[ D_{KL}\\bigl(q_{{\\boldsymbol{\\theta}}_t}\\|\\,q_{{\\boldsymbol{\\theta}}_{t-1}}\\bigr) \\,+\\, {\\mathcal{C}}_t \\right]}_{{\\text{Learning}}} \\,+\\, \\underbrace{\\frac{1}{N}\\left[ -\\,\\frac{\\bigl({\\boldsymbol{\\mu}}_t &#8211; {\\boldsymbol{\\mu}}_{L_{t-1}}\\bigr)^2}{2\\,{\\boldsymbol{\\sigma}}_{L_{t-1}}^2} \\,-\\, \\frac{{\\boldsymbol{\\sigma}}_t^2}{{\\boldsymbol{\\sigma}}_{L_{t-1}}^2} \\right]}_{{\\text{Forgetting}}},$$<\/p>\n<p>\n                    (23)\n                <\/p>\n<p>where \\({{\\mathcal{C}}}_{t}=-\\,{{\\mathbb{E}}}_{{q}_{{{\\boldsymbol{\\theta }}}_{t}}({\\boldsymbol{\\omega }})}[\\log p({{\\mathcal{D}}}_{t}| {\\boldsymbol{\\omega }})].\\) the forgetting term thus \u201cde-consolidates\u201d each synapse, nudging it toward the prior to free capacity for new tasks.<\/p>\n<p>Update rules<\/p>\n<p>To approximate the true posterior distribution at time t, we seek to minimize the free energy \\({{\\mathcal{F}}}_{t}\\). The Kullback\u2013Leibler term in \\({{\\mathcal{F}}}_{t}\\) between two diagonal Gaussians has a known closed form:<\/p>\n<p>$${D}_{KL}[{q}_{{{\\boldsymbol{\\theta }}}_{t}}({\\boldsymbol{\\omega }})\\parallel {q}_{{{\\boldsymbol{\\theta }}}_{t-1}}({\\boldsymbol{\\omega }})]=\\mathop{\\sum }\\limits_{i=1}^{s}\\log \\left(\\frac{{\\sigma }_{i,t-1}}{{\\sigma }_{i,t}}\\right)+ \\frac{{\\sigma }_{i,t}^{2}+{({\\mu }_{i,t-1}-{\\mu }_{i,t})}^{2}}{2\\,{\\sigma }_{i,t-1}^{2}}-\\frac{1}{2}.$$<\/p>\n<p>\n                    (24)\n                <\/p>\n<p>Taking derivatives of \\({{\\mathcal{F}}}_{t}\\) with regards to \u03bct and \u03c3t yields the implicit equations:<\/p>\n<p>$$\\frac{\\partial {{\\mathcal{F}}}_{t}}{\\partial {{\\boldsymbol{\\mu }}}_{t}} = \\frac{\\Delta {\\boldsymbol{\\mu }}}{{{\\boldsymbol{\\sigma }}}_{t-1}^{2}}+ \\frac{\\partial {{\\mathcal{C}}}_{t}}{\\partial {{\\boldsymbol{\\mu }}}_{t}}-\\frac{{{\\boldsymbol{\\mu }}}_{t}-{{\\boldsymbol{\\mu }}}_{{L}_{t-1}}}{N\\,{{\\boldsymbol{\\sigma }}}_{{L}_{t-1}}^{2}}= \\overrightarrow{0},$$<\/p>\n<p>\n                    (25)\n                <\/p>\n<p>$$\\frac{\\partial {{\\mathcal{F}}}_{t}}{\\partial {{\\boldsymbol{\\sigma }}}_{t}}=-\\,\\frac{1}{{{\\boldsymbol{\\sigma }}}_{t-1}+\\Delta {\\boldsymbol{\\sigma }}}+ \\frac{{{\\boldsymbol{\\sigma }}}_{t-1}+\\Delta {\\boldsymbol{\\sigma }}}{{{\\boldsymbol{\\sigma }}}_{t-1}^{2}}+ \\frac{\\partial {{\\mathcal{C}}}_{t}}{\\partial {{\\boldsymbol{\\sigma }}}_{t}}-\\frac{2\\,({{\\boldsymbol{\\sigma }}}_{t-1}+\\Delta {\\boldsymbol{\\sigma }})}{N\\,{{\\boldsymbol{\\sigma }}}_{{L}_{t-1}}^{2}}=\\overrightarrow{0},$$<\/p>\n<p>\n                    (26)\n                <\/p>\n<p>where \u0394\u03bc\u2009=\u2009\u03bct\u00a0\u2212\u00a0\u03bct\u22121 and \u0394\u03c3\u2009=\u2009\u03c3t\u00a0\u2212\u00a0\u03c3t\u22121. Solving these leads to the MESU update rule:<\/p>\n<p>Theorem 1: Consider a stream of data \\({\\{{{\\mathcal{D}}}_{i}\\}}_{i=0}^{t}\\). Let \\({q}_{{{\\boldsymbol{\\theta }}}_{t}}({\\boldsymbol{\\omega }})\\) be a mean-field Gaussian for a BNN at time t, with \u03b8t\u2009=\u2009(\u03bct,\u00a0\u03c3t) and samples \\({\\boldsymbol{\\omega }}={{\\boldsymbol{\\mu }}}_{t}+{\\boldsymbol{\\epsilon }}\\cdot {{\\boldsymbol{\\sigma }}}_{t},{\\boldsymbol{\\epsilon }}\\, \\sim \\,{\\mathcal{N}}(\\overrightarrow{0},{\\bf{I}})\\). Suppose \\({q}_{{{\\boldsymbol{\\theta }}}_{t-1}}({\\boldsymbol{\\omega }})\\approx p({\\boldsymbol{\\omega }}\\,| \\,{{\\mathcal{D}}}_{t-N-1},\\ldots,{{\\mathcal{D}}}_{t-1})\\), and that each dataset \\({{\\mathcal{D}}}_{i}\\) has equal marginal likelihood. Under a second-order expansion of \\({{\\mathcal{C}}}_{t}\\) around \u03bct\u22121 and \u03c3t\u22121, and the small-update assumption \\(| \\frac{\\Delta {\\sigma }_{i}}{{\\sigma }_{i,t-1}}| \\ll 1\\), the parameter updates become:<\/p>\n<p>$$\\Delta {\\boldsymbol{\\sigma }}=-\\frac{{{\\boldsymbol{\\sigma }}}_{t-1}^{2}}{2}\\,\\frac{\\partial {{\\mathcal{C}}}_{t}}{\\partial {{\\boldsymbol{\\sigma }}}_{t-1}}+ \\frac{{{\\boldsymbol{\\sigma }}}_{t-1}}{2\\,N\\,{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}({{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}-{{\\boldsymbol{\\sigma }}}_{t-1}^{2}),$$<\/p>\n<p>\n                    (27)\n                <\/p>\n<p>$$\\Delta {\\boldsymbol{\\mu }}=-{{\\boldsymbol{\\sigma }}}_{t-1}^{2}\\,\\frac{\\partial {{\\mathcal{C}}}_{t}}{\\partial {{\\boldsymbol{\\mu }}}_{t-1}}+ \\frac{{{\\boldsymbol{\\sigma }}}_{t-1}^{2}}{N\\,{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}({{\\boldsymbol{\\mu }}}_{{\\rm{prior}}}-{{\\boldsymbol{\\mu }}}_{t-1}).$$<\/p>\n<p>\n                    (28)\n                <\/p>\n<p>A full proof (Supplementary Note\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>) uses a second-order Taylor expansion to handle the implicit dependence of \u03bct and \u03c3t. Under \\(| \\frac{\\Delta {\\boldsymbol{\\sigma }}}{{{\\boldsymbol{\\sigma }}}_{t-1}}| \\ll 1\\), these updates simplify to Eqs. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ27\" rel=\"nofollow noopener\" target=\"_blank\">27<\/a>)\u2013(<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ28\" rel=\"nofollow noopener\" target=\"_blank\">28<\/a>), balancing learning and forgetting in a single, efficient step.<\/p>\n<p>Links with Newton\u2019s method<\/p>\n<p>We have thus far derived MESU by minimizing the KL divergence between a variational posterior q\u03b8(\u03c9) and the (truncated) true posterior \\(p({\\boldsymbol{\\omega }}| {{\\mathcal{D}}}_{t-N},\\ldots,{{\\mathcal{D}}}_{t})\\). Here, we show how a similar update can emerge from Newton\u2019s method if we treat the free energy as the loss function to be minimized in a non-continual setting.<\/p>\n<p>Newton\u2019s method states that for a parameter \u03c9 inducing loss \\({\\mathcal{L}}\\), the update is \\(\\Delta {\\boldsymbol{\\omega }}=-\\,\\gamma \\,{\\left(\\frac{{\\partial }^{2}{\\mathcal{L}}}{\\partial {{\\boldsymbol{\\omega }}}^{2}}\\right)}^{-1}\\,\\,\\frac{\\partial {\\mathcal{L}}}{\\partial {\\boldsymbol{\\omega }}},\\) where \u03b3 is a step size. Let \\({\\mathcal{F}}\\) be the KL divergence between two multivariate Gaussians: a variational posterior \\({q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})={\\mathcal{N}}({\\boldsymbol{\\omega }};{\\boldsymbol{\\mu }},{\\rm{diag}}({{\\boldsymbol{\\sigma }}}^{2}))\\) and a true posterior \\(p({\\boldsymbol{\\omega }}| {\\mathcal{D}})\\). If the true posterior is itself an (approximate) mean-field Gaussian \\(\\,p({\\boldsymbol{\\omega }}| {\\mathcal{D}})\\approx {q}_{{\\rm{post}}}({\\boldsymbol{\\omega }})={\\mathcal{N}}({\\boldsymbol{\\omega }};{{\\boldsymbol{\\mu }}}_{{\\rm{post}}},{\\rm{diag}}({{\\boldsymbol{\\sigma }}}_{\\,\\text{post}\\,}^{2})),\\), then<\/p>\n<p>$${\\mathcal{F}}={D}_{KL}[{q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})\\parallel p({\\boldsymbol{\\omega }}| {\\mathcal{D}})]=\\log \\left(\\frac{{{\\boldsymbol{\\sigma }}}_{{\\rm{post}}}}{{\\boldsymbol{\\sigma }}}\\right)+ \\frac{{{\\boldsymbol{\\sigma }}}^{2}+{({\\boldsymbol{\\mu }}-{{\\boldsymbol{\\mu }}}_{{\\rm{post}}})}^{2}}{2\\,{{\\boldsymbol{\\sigma }}}_{\\,\\text{post}\\,}^{2}}-\\frac{1}{2}.$$<\/p>\n<p>\n                    (29)\n                <\/p>\n<p>To find \u03bcpost and \u03c3post, we apply Bayes\u2019 rule with a Gaussian prior \\(p({\\boldsymbol{\\omega }})={\\mathcal{N}}({\\boldsymbol{\\omega }};{{\\boldsymbol{\\mu }}}_{{\\rm{prior}}},{\\rm{diag}}({{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}))\\) and a Gaussian likelihood \\(p({\\mathcal{D}}| {\\boldsymbol{\\omega }})\\propto {q}_{L}({\\boldsymbol{\\omega }})={\\mathcal{N}}({\\boldsymbol{\\omega }};{{\\boldsymbol{\\mu }}}_{L},{\\rm{diag}}({{\\boldsymbol{\\sigma }}}_{L}^{2}))\\) (cf. Lemma 1). This yields:<\/p>\n<p>$$\\frac{1}{{{\\boldsymbol{\\sigma }}}_{\\,\\text{post}\\,}^{2}}=\\frac{1}{{{\\boldsymbol{\\sigma }}}_{L}^{2}}+ \\frac{1}{{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}},\\qquad {{\\boldsymbol{\\mu }}}_{{\\rm{post}}}=\\frac{{{\\boldsymbol{\\mu }}}_{L}\\,{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}+{{\\boldsymbol{\\mu }}}_{{\\rm{prior}}}\\,{{\\boldsymbol{\\sigma }}}_{L}^{2}}{{{\\boldsymbol{\\sigma }}}_{L}^{2}+{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}.$$<\/p>\n<p>\n                    (30)\n                <\/p>\n<p>Substituting these into (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ29\" rel=\"nofollow noopener\" target=\"_blank\">29<\/a>) gives explicit forms for \\(\\partial {\\mathcal{F}}\/\\partial {\\boldsymbol{\\mu }}\\), \\(\\partial {\\mathcal{F}}\/\\partial {\\boldsymbol{\\sigma }}\\), and their second derivatives. In particular,<\/p>\n<p>$$\\frac{{\\partial }^{2}{\\mathcal{F}}}{\\partial {{\\boldsymbol{\\mu }}}^{2}}=\\frac{1}{{{\\boldsymbol{\\sigma }}}_{L}^{2}}+\\frac{1}{{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}=\\frac{1}{{{\\boldsymbol{\\sigma }}}_{\\,\\text{post}\\,}^{2}},\\qquad \\frac{{\\partial }^{2}{\\mathcal{F}}}{\\partial {{\\boldsymbol{\\sigma }}}^{2}}=\\frac{1}{{{\\boldsymbol{\\sigma }}}^{2}}+ \\frac{1}{{{\\boldsymbol{\\sigma }}}_{L}^{2}}+ \\frac{1}{{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}.$$<\/p>\n<p>\n                    (31)\n                <\/p>\n<p>Lemma 2: For a mean-field Gaussian q\u03b8(\u03c9) describing a BNN, with \u03c9\u2009=\u2009\u03bc\u2009+\u2009\u03f5 \u22c5 \u03c3, \\({\\boldsymbol{\\epsilon }} \\sim {\\mathcal{N}}(\\overrightarrow{0},{{\\bf{I}}}_{s})\\), the expected Hessian of the negative log-likelihood \\({\\mathcal{L}}\\) satisfies<\/p>\n<p>$${H}_{D}({\\boldsymbol{\\mu }})={{\\mathbb{E}}}_{{\\boldsymbol{\\epsilon }}}\\left[\\frac{{\\partial }^{2}{\\mathcal{L}}}{\\partial {{\\boldsymbol{\\omega }}}^{2}}\\right]=\\frac{1}{{\\boldsymbol{\\sigma }}}\\frac{\\partial {\\mathcal{C}}}{\\partial {\\boldsymbol{\\sigma }}},$$<\/p>\n<p>where \\({\\mathcal{C}}={{\\mathbb{E}}}_{{\\boldsymbol{\\epsilon }}}\\,[{\\mathcal{L}}({\\boldsymbol{\\omega }})]\\).<\/p>\n<p>By Lemma 2, we have \\(\\,1\/{{\\boldsymbol{\\sigma }}}_{L}^{2}=(1\/{\\boldsymbol{\\sigma }})\\,(\\partial {\\mathcal{C}}\/\\partial {\\boldsymbol{\\sigma }})\\), and under N i.i.d. mini-batches, \\(\\,1\/{{\\boldsymbol{\\sigma }}}_{L}^{2}=(N\/{\\boldsymbol{\\sigma }})\\,(\\partial {\\mathcal{C}}\/\\partial {\\boldsymbol{\\sigma }})=N\\,{H}_{D}({\\boldsymbol{\\mu }}).\\) applying Newton\u2019s method then yields:<\/p>\n<p>Theorem 2: Let \\({q}_{{\\boldsymbol{\\theta }}}({\\boldsymbol{\\omega }})={\\mathcal{N}}({\\boldsymbol{\\omega }};{\\boldsymbol{\\mu }},{\\rm{diag}}({{\\boldsymbol{\\sigma }}}^{2}))\\) be a mean-field Gaussian for a BNN, with \u03c9\u2009=\u2009\u03bc\u2009+\u2009\u03f5 \u22c5 \u03c3, \\({\\boldsymbol{\\epsilon }} \\sim {\\mathcal{N}}(\\overrightarrow{0},{{\\bf{I}}}_{s})\\), and with a prior \\(p({\\boldsymbol{\\omega }})={\\mathcal{N}}({\\boldsymbol{\\omega }};{{\\boldsymbol{\\mu }}}_{{\\rm{prior}}},{\\rm{diag}}({{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}))\\). Given \\({\\mathcal{D}}\\) split into N i.i.d. mini-batches, and defining \\({\\mathcal{C}}={{\\mathbb{E}}}_{{\\boldsymbol{\\epsilon }}}[{\\mathcal{L}}({\\boldsymbol{\\omega }})]\\), a diagonal Newton update for \u03c3 and \u03bc with learning rate \u03b3 and \u03c3\u00a0\u2248\u00a0\u03c3post becomes:<\/p>\n<p>$$\\Delta {\\boldsymbol{\\sigma }}=\\frac{\\gamma N}{2}\\,\\left[-\\,{{\\boldsymbol{\\sigma }}}^{2}\\,\\frac{\\partial {\\mathcal{C}}}{\\partial {\\boldsymbol{\\sigma }}}+ \\frac{{\\boldsymbol{\\sigma }}}{N\\,{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}({{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}-{{\\boldsymbol{\\sigma }}}^{2})\\right],$$<\/p>\n<p>\n                    (32)\n                <\/p>\n<p>$$\\Delta {\\boldsymbol{\\mu }}=\\gamma N\\left[-\\,{{\\boldsymbol{\\sigma }}}^{2}\\,\\frac{\\partial {\\mathcal{C}}}{\\partial {\\boldsymbol{\\mu }}}+ \\frac{{{\\boldsymbol{\\sigma }}}^{2}}{N\\,{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}({{\\boldsymbol{\\mu }}}_{{\\rm{prior}}}-{\\boldsymbol{\\mu }})\\right].$$<\/p>\n<p>\n                    (33)\n                <\/p>\n<p>A full proof appears in Supplementary Note\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>. Notice the close similarity to MESU\u2019s update rules, especially when \u03b3\u2009=\u20091\/N. This shows how Bayesian learning (with forgetting) can be viewed through the lens of second-order optimization, linking our framework both to biological synapse models and to Newton\u2019s method in variational inference.<\/p>\n<p>Dynamics of standard deviations in the i.i.d. scenario<\/p>\n<p>We now examine the evolution of each standard deviation \u03c3 under an i.i.d. data assumption, isolating its role as an adaptive learning rate. Starting from<\/p>\n<p>$$\\Delta {\\boldsymbol{\\sigma }}=\\gamma \\left[-\\,{{\\boldsymbol{\\sigma }}}_{t-1}^{2}\\,\\frac{\\partial {{\\mathcal{C}}}_{t}}{\\partial {{\\boldsymbol{\\sigma }}}_{t-1}}+ \\frac{{{\\boldsymbol{\\sigma }}}_{t-1}}{N\\,{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}\\,({{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}-{{\\boldsymbol{\\sigma }}}_{t-1}^{2})\\right],$$<\/p>\n<p>\n                    (34)\n                <\/p>\n<p>We note that \u03b3 need not be fixed at 0.5 as in our continual-learning derivation\u2014other interpretations (e.g., tempered posteriors<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 44\" title=\"Wenzel, F. et al. How good is the Bayes posterior in deep neural networks really? In Proc. 37th International Conference on Machine Learning Daume, H. &amp; Singh, A. (eds.), 10248&#x2013;10259 (PMLR, 2020).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR44\" id=\"ref-link-section-d238773390e17766\" rel=\"nofollow noopener\" target=\"_blank\">44<\/a> or simple Newton steps) can alter its value.<\/p>\n<p>Under Lemmas 1 and 2, we have \\(\\,\\frac{1}{{{\\boldsymbol{\\sigma }}}_{L}^{2}}=\\frac{N}{{\\boldsymbol{\\sigma }}}\\frac{\\partial {\\mathcal{C}}}{\\partial {\\boldsymbol{\\sigma }}}=N\\,{H}_{D}({\\boldsymbol{\\mu }})\\). Treating \u03c3 as a function of discrete time (iteration) t, we obtain a Bernoulli differential equation of the form<\/p>\n<p>$${\\boldsymbol{\\sigma }}{\\prime} (t)+ a(t)\\,{\\boldsymbol{\\sigma }}(t)=b(t)\\,{\\boldsymbol{\\sigma }}{(t)}^{n},$$<\/p>\n<p>\n                    (35)\n                <\/p>\n<p>with n\u2009=\u20093, \\(a(t)=-\\frac{\\gamma }{N}\\), and \\(b(t)=-\\frac{\\gamma }{N}(N{H}_{D}({{\\boldsymbol{\\mu }}}_{0})+\\frac{1}{{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}).\\) Solving this via Leibniz substitution yields:<\/p>\n<p>Proposition 1: Consider the Bernoulli differential equation \\(\\sigma {\\prime} (t)+a(t)\\,\\sigma (t)=b(t)\\,\\sigma {(t)}^{n}\\) under \\({\\sigma }_{\\,\\text{prior}\\,}^{2}\\ge \\sigma (0) &gt; 0\\), n\u2009=\u20093, \\(a(t)=-\\frac{\\gamma }{N}\\), and \\(b(t)=-\\frac{\\gamma }{N}(N\\,{H}_{D}({\\mu }_{0})+\\frac{1}{{\\sigma }_{\\,\\text{prior}\\,}^{2}})\\). Its solution is:<\/p>\n<p>$$\\sigma (t)=\\frac{{\\sigma }_{0}\\,{e}^{\\frac{\\gamma t}{N}}}{\\sqrt{\\,1+ N\\,{\\sigma }_{0}^{2}({H}_{D}({\\mu }_{0})\\,+\\,1N\\,{\\sigma }_{\\,\\text{prior}\\,}^{2})\\,({e}^{2\\gamma tN}-1)}},$$<\/p>\n<p>where \u03c30\u2009=\u2009\u03c3(0).<\/p>\n<p>From this closed-form, one sees that the convergence timescale \\({t}_{c}=\\frac{N}{\\gamma }\\) does not directly depend on \u03c30. As t\u00a0\u2192\u00a0\u221e,<\/p>\n<p>$$\\mathop{\\lim }\\limits_{t\\to \\infty }\\,{\\boldsymbol{\\sigma }}{(t)}^{2}=\\frac{1}{N}\\frac{1}{\\,{H}_{D}({{\\boldsymbol{\\mu }}}_{0})+ 1N\\,{{\\boldsymbol{\\sigma }}}_{\\,\\text{prior}\\,}^{2}}.$$<\/p>\n<p>\n                    (36)\n                <\/p>\n<p>Thus, \u03c3(t)2 becomes inversely proportional to the Hessian diagonal (plus a small residual term), aligning well with the intuition that \u03c3 encodes synapse importance.<\/p>\n<p>In practice, mini-batches only approximate i.i.d. data, adding stochasticity to the curvature estimate \\(\\,\\frac{1}{{\\boldsymbol{\\sigma }}}\\,\\frac{\\partial {\\mathcal{C}}}{\\partial {\\boldsymbol{\\sigma }}}\\).<\/p>\n<p>Case \u2009N\u00a0\u2192\u00a0\u221e<\/p>\n<p>When N is infinite, forgetting disappears, and the update rule reduces to \\(\\,{\\sigma }_{t+1}={\\sigma }_{t}(1-\\frac{{\\sigma }_{t}^{2}}{2\\,{\\sigma }_{L}^{2}})\\). Setting \\({\\alpha }_{t}=\\frac{{\\sigma }_{t}}{\\sqrt{2}\\,{\\sigma }_{L}}\\) yields the recurrence \\(\\,{\\alpha }_{t+1}={\\alpha }_{t}(1-{\\alpha }_{t}^{2})\\), which converges to zero but at a rate such that \\(\\,\\mathop{\\lim }\\limits_{t\\to \\infty }{\\alpha }_{t}\\sqrt{2t}=1\\) (the proof is available in Supplementary Note\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>). Hence,<\/p>\n<p>$$N=\\infty \\Rightarrow \\mathop{\\lim }\\limits_{t\\to \\infty }t\\,{\\boldsymbol{\\sigma }}{(t)}^{2}=\\frac{1}{{H}_{D}({{\\boldsymbol{\\mu }}}_{0})}.$$<\/p>\n<p>\n                    (37)\n                <\/p>\n<p>In this regime, \u03c3(t)2 eventually collapses, reflecting overconfidence and vanishing plasticity\u2014mirroring phenomena seen in FOO-VB Diagonal. By contrast, any finite N preserves a stable nonzero variance, maintaining EU and ensuring that crucial weights are not overconstrained. This highlights the need for a controlled forgetting mechanism in continual learning.<\/p>\n<p>Uncertainty in neural networks<\/p>\n<p>In our experiments, we measure both aleatoric and epistemic uncertainties following the approach of Smith and Gal<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 25\" title=\"Smith, L. &amp; Gal, Y. Understanding measures of uncertainty for adversarial example detection. In Proc. Uncertainty in Artificial Intelligence (UAI, 2018).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR25\" id=\"ref-link-section-d238773390e19601\" rel=\"nofollow noopener\" target=\"_blank\">25<\/a>. They decompose the total uncertainty (TU) of a prediction into two parts: AU and EU. Formally, they use the mutual information between a model\u2019s parameters \u03c9 and a label y conditioned on input x and dataset \\({\\mathcal{D}}\\):<\/p>\n<p>$${\\mathcal{I}}({\\boldsymbol{\\omega }},y| {\\mathcal{D}},x)=H[\\,p(\\,y| x,{\\mathcal{D}})]-{{\\mathbb{E}}}_{p({\\boldsymbol{\\omega }}| {\\mathcal{D}})}\\,H[\\,p(\\,y| x,{\\boldsymbol{\\omega }})],$$<\/p>\n<p>\n                    (38)\n                <\/p>\n<p>$$\\,\\text{EU}\\,=\\,\\text{TU}\\,-\\,\\text{AU}\\,.$$<\/p>\n<p>\n                    (39)\n                <\/p>\n<p>Here, H is the Shannon entropy<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 45\" title=\"Shannon, C. E. A mathematical theory of communication. Bell Syst. Tech. J. 27, 379&#x2013;423 (1948).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR45\" id=\"ref-link-section-d238773390e19855\" rel=\"nofollow noopener\" target=\"_blank\">45<\/a>, and \\(p(y| x,{\\mathcal{D}})\\) is the predictive distribution obtained by averaging over Monte Carlo samples of \u03c9 from \\(p({\\boldsymbol{\\omega }}| {\\mathcal{D}})\\). Concretely, one samples weights \\({{\\boldsymbol{\\omega }}}_{i} \\sim p({\\boldsymbol{\\omega }}| {\\mathcal{D}})\\) to compute p(y\u2223x,\u00a0\u03c9i), then averages these distributions over i.<\/p>\n<p>In this framework, AU captures the irreducible noise in the data or measurement process, while EU reflects uncertainty about the model\u2019s parameters. EU tends to decrease as the model gathers more evidence or restricts the effective memory window (as in MESU), thereby limiting overconfidence. This separation of uncertainties has been widely adopted in the literature<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 11\" title=\"Abdar, M. et al. A review of uncertainty quantification in deep learning: techniques, applications and challenges. Inf. Fusion 76, 243&#x2013;297 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR11\" id=\"ref-link-section-d238773390e20010\" rel=\"nofollow noopener\" target=\"_blank\">11<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 23\" title=\"H&#xFC;llermeier, E. &amp; Waegeman, W. Aleatoric and epistemic uncertainty in machine learning: an introduction to concepts and methods. Mach. Learn. 110, 457&#x2013;506 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR23\" id=\"ref-link-section-d238773390e20013\" rel=\"nofollow noopener\" target=\"_blank\">23<\/a>, allowing a more nuanced evaluation of model predictions and their reliability.<\/p>\n<p>MNIST and Permuted MNIST studies (Figs.\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>)<\/p>\n<p>We use the standard MNIST dataset<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 26\" title=\"LeCun, Y. The MNIST database of handwritten digits. &#010;                  http:\/\/yann.lecun.com\/exdb\/mnist\/&#010;                  &#010;                 (1998).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR26\" id=\"ref-link-section-d238773390e20032\" rel=\"nofollow noopener\" target=\"_blank\">26<\/a>, consisting of 28\u2009\u00d7\u200928 grayscale images. All images are standardized by subtracting the global mean and dividing by the global standard deviation. For Permuted MNIST, each image\u2019s pixels are permuted in a fixed, unique manner to create multiple tasks.<\/p>\n<p>Architecture<\/p>\n<p>All networks displayed in Fig.\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a> have 50 hidden rectified linear unit (ReLU) neurons, with 784 input neurons for the images and 10 output neurons for each class.<\/p>\n<p>Training procedure<\/p>\n<p>Supplementary Note\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a> describes the steps of the training algorithm. Training was conducted with a single image per batch and a single epoch per task across the entire dataset. For Permuted MNIST (Fig.\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>), accuracy on all permutations was recorded at each task trained upon. For MNIST (Fig.\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>), accuracy was recorded after each epoch. Each algorithm was tested over five runs with varying random seeds to account for initialization randomness.<\/p>\n<p>Neural network initialization<\/p>\n<p>The neural network weights were initialized differently depending on the algorithm. For SGD, SI, Online EWC Online as well as EWC Stream, weights were initialized using Kaiming initialization. Specifically, for a layer l with input dimension nl and output dimension ml, the weights \u03c9l were sampled according to:<\/p>\n<p>$${\\omega }_{i,l} \\sim {\\mathcal{U}}\\left(-\\frac{1}{\\sqrt{{n}_{l}}},\\frac{1}{\\sqrt{{n}_{l}}}\\right).$$<\/p>\n<p>\n                    (40)\n                <\/p>\n<p>For MESU and FOO-VB Diagonal algorithms, mean parameters \u03bci,l were initialized using a reweighted Kaiming initialization and \u03c3i,l were initialized as a constant value:<\/p>\n<p>$${\\mu }_{i,l} \\sim {\\mathcal{U}}\\left(-\\frac{4}{\\sqrt{{n}_{l}}},\\frac{4}{\\sqrt{{n}_{l}}}\\right),{\\sigma }_{i,l}=\\frac{2}{\\sqrt{{n}_{l}}}.$$<\/p>\n<p>\n                    (41)\n                <\/p>\n<p>For Bayesian models, the choice of initial variance strongly influences the posterior\u2019s exploration range during the first few updates, and we therefore treated the initialization scale as a hyper-parameter. The parameters in Eq. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ41\" rel=\"nofollow noopener\" target=\"_blank\">41<\/a>) were obtained by grid search.<\/p>\n<p>Algorithm parameters<\/p>\n<p>Hyperparameters for SGD, EWC Online, and SI were obtained by doing a grid search to maximize accuracy on the first ten tasks of the 200-task Permuted MNIST. MESU uses Eqs. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ10\" rel=\"nofollow noopener\" target=\"_blank\">10<\/a>) and (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ11\" rel=\"nofollow noopener\" target=\"_blank\">11<\/a>) directly, which have no learning rate: No tuning of the learning rate is performed (the same is true for FOO-VB Diagonal). For MESU, the memory window N was set to 300,000 to remember about five tasks of Permuted MNIST. The prior distribution for each synapse of MESU is set to \\({\\mathcal{N}}(0,0.06)\\) for MNIST and \\({\\mathcal{N}}(0,1)\\) Permuted MNIST. Table\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Tab1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a> lists the specific parameter values used for each algorithm considered.<\/p>\n<p>Table 1 Hyper-parameter values for each algorithm of Figs.\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a> and <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>Model-width ablation<\/p>\n<p>All protocols above were repeated with four network widths (50, 256, 512, 1024 hidden ReLU units) so as to disentangle the roles of capacity and memory window N. The full results, together with the corresponding uncertainty curves and variance histograms, are provided in Supplementary Note\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a>.<\/p>\n<p>CIFAR studies (Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>)<\/p>\n<p>We use the standard CIFAR-10 dataset<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 29\" title=\"Krizhevsky, A. Learning multiple layers of features from tiny images, Technical report, University of Toronto (2009).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR29\" id=\"ref-link-section-d238773390e20926\" rel=\"nofollow noopener\" target=\"_blank\">29<\/a>, consisting of 32\u2009\u00d7\u200932 RGB images. All images are normalized by dividing by 255. Our network comprises four convolutional layers followed by two fully connected layers with ReLU activations (see Table\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Tab2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>).<\/p>\n<p>Table 2 CIFAR-10\/100 model architecture and dropout parameters. m: number of tasksTraining procedure<\/p>\n<p>In the single-split setting, we first train on CIFAR-10 (Task 1). We then sequentially train new tasks, each comprising ten classes of CIFAR-100 (which we follow consecutively). A multi-head strategy is used: each new task adds ten units (one \u201chead\u201d) to the final layer, and during training, the loss is computed only at the head corresponding to the current task. For testing, we use the head associated with the relevant task. Each task is trained for 60 epochs with a mini-batch size of 200, and dropout is applied (see Table\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Tab2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>).<\/p>\n<p>When splits are introduced, each task from the single-split procedure is subdivided into splits (sub-tasks). The network first learns the initial split of each task in sequence, and this process is repeated for subsequent splits.<\/p>\n<p>Neural network initialization<\/p>\n<p>The neural network weights were initialized differently depending on the algorithm. For Adam, SI, and EWC weights were initialized using Kaiming initialization, as described in the previous section. For MESU, mean parameters \u03bci,l were initialized using a reweighted Kaiming initialization, and \u03c3i,l were initialized as a constant value. Specifically, for a layer l with input dimension nl and output dimension ml:<\/p>\n<p>$${\\mu }_{i,l} \\sim {\\mathcal{U}}\\left(-\\frac{\\sqrt{2}}{\\sqrt{{n}_{l}}},\\frac{\\sqrt{2}}{\\sqrt{{n}_{l}}}\\right),{\\sigma }_{i,l}=\\frac{1}{2\\sqrt{{m}_{l}}}.$$<\/p>\n<p>\n                    (42)\n                <\/p>\n<p>As in the Permuted MNIST case, the parameters in Eq. (<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Equ42\" rel=\"nofollow noopener\" target=\"_blank\">42<\/a>) were obtained by grid search.<\/p>\n<p>Algorithm parameters<\/p>\n<p>To determine the best \u03bb parameter for EWC, we performed the experiment with 1 split for different value, with 0.1\u2009\u2264\u2009\u03bb\u2009\u2264\u200910. Adam is the special case of EWC where \u03bb\u2009=\u20090. To determine the best c parameter for SI, we performed the experiment with one split for different value, with 0.02\u2009\u2264\u2009c\u2009\u2264\u20090.5. Furthermore, as in the original paper<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 14\" title=\"Zenke, F., Poole, B. &amp; Ganguli, S. Continual learning through synaptic intelligence. In Proc. International Conference on Machine Learning, 3987&#x2013;3995 (PMLR, 2017).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR14\" id=\"ref-link-section-d238773390e21643\" rel=\"nofollow noopener\" target=\"_blank\">14<\/a>, the optimizer is reset at each new task. We set \u03b1\u03bc (for MESU) by choosing the smallest value that maximized test accuracy on the first CIFAR-10 task. Meanwhile, \u03b1\u03c3 (for MESU) was determined based on our theoretical analysis of standard-deviation dynamics in the i.i.d. scenario (see the related \u201cTheoretical Results and Methods\u201d sections). Specifically, as \u03c3 converges on a timescale \\({t}_{c}=\\frac{N}{{\\alpha }_{\\sigma }}\\), we selected \u03b1\u03c3 so that by the end of training on the first task, at least two of these timescales had elapsed, ensuring that the standard deviations had sufficient time to converge. Table\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Tab3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a> lists the specific parameter values used for each algorithm considered.<\/p>\n<p>Table 3 Hyper-parameter values for each algorithm of Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>Animals-dataset studies (Fig.\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>)<\/p>\n<p>This study is based on a subset of the \u201cAnimals Detection Images Dataset\u201d from Kaggle<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 46\" title=\"Animals detection images dataset. &#010;                  https:\/\/www.kaggle.com\/datasets\/antoreepjana\/animals-detection-images-dataset&#010;                  &#010;                 (2023).\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#ref-CR46\" id=\"ref-link-section-d238773390e22018\" rel=\"nofollow noopener\" target=\"_blank\">46<\/a>. We used a ResNet18 model trained on ImageNet from PyTorch and removed its final fully connected layer to extract 512-dimensional feature vectors for each image. Training was conducted for five epochs per task with a batch size of one image. The neural network weights were initialized in the same way as in the CIFAR experiment. We then set the learning rates \u03b1 (for SGD) and \u03b1\u03bc,\u00a0\u03b1\u03c3 (for MESU) following the same procedure described for the CIFAR experiment. Table\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Tab4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a> lists the specific parameters used for each algorithm.<\/p>\n<p>Table 4 Hyper-parameter values for each algorithm of Fig.\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>Architecture<\/p>\n<p>All networks displayed in Fig.\u2009<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41467-025-64601-w#Fig2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a> have 64 hidden ReLU neurons, with 512 input neurons for the images and five output neurons for each class.<\/p>\n","protected":false},"excerpt":{"rendered":"Description of the variational inference framework Exact computation of the truncated posterior (Eq. (4)) becomes intractable as the&hellip;\n","protected":false},"author":2,"featured_media":238746,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[554,733,4308,11958,6112,4230,4231,90,86,56,54,55],"class_list":["post-238745","post","type-post","status-publish","format-standard","has-post-thumbnail","category-artificial-intelligence","tag-ai","tag-artificial-intelligence","tag-artificialintelligence","tag-computational-science","tag-computer-science","tag-humanities-and-social-sciences","tag-multidisciplinary","tag-science","tag-technology","tag-uk","tag-united-kingdom","tag-unitedkingdom"],"_links":{"self":[{"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/posts\/238745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/comments?post=238745"}],"version-history":[{"count":0,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/posts\/238745\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/media\/238746"}],"wp:attachment":[{"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/media?parent=238745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/categories?post=238745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.newsbeep.com\/uk\/wp-json\/wp\/v2\/tags?post=238745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}