On the Computation of the Fisher Information in Continual Learning

Gido M van de Ven

TL;DR

This blog post highlights that the way the Fisher Information matrix is computed significantly impacts the performance of Elastic Weight Consolidation (EWC) in continual learning. The authors empirically compare several common implementations, revealing that simpler approximations, often used in practice, can lead to suboptimal results compared to more exact methods. This work urges researchers to be more transparent about their Fisher Information computation and suggests that exact computation, or at least unbiased estimates, are preferable.

What Problem Does This Paper Address?

Continual learning aims to enable neural networks to learn new tasks sequentially without forgetting previously acquired knowledge, a phenomenon known as catastrophic forgetting. Elastic Weight Consolidation (EWC) is a popular method to combat this by penalizing changes to parameters deemed important for previous tasks. The importance of these parameters is typically quantified using the Fisher Information matrix. However, the original EWC paper lacked precise details on its computation, leading to a variety of implementations found online. This paper addresses the critical gap of understanding how these different computational approaches to the Fisher Information affect EWC's performance, suggesting that many reported EWC results might be inflated due to these implementation choices.

Methods

The paper delves into the computation of the Fisher Information matrix, specifically its diagonal elements, which are crucial for EWC. The authors define the "EXACT" method as the theoretical ideal, involving expectations over both the data distribution and the model's output distribution. They then present and analyze several approximations and variations:

  • EXACT (n=500): Estimates the outer expectation by sampling a subset of the old training data, while still computing the inner expectation exactly for each sample.
  • SAMPLE: Uses Monte Carlo sampling to estimate the inner expectation by sampling a single class for each data point. This provides an unbiased estimate of the true Fisher.
  • EMPIRICAL: Computes the squared gradient only for the ground-truth class of each sample. This is a common approximation but has been cautioned against in optimization literature.
  • BATCHED (b=128): A practical approximation often found in libraries, which squares aggregated gradients from mini-batches. This is an approximate version of the empirical Fisher and is computationally efficient but can be less accurate.

The authors then empirically compare these methods on two standard continual learning benchmarks.

Datasets

The paper uses the following datasets for evaluation:

  • Split MNIST: The original MNIST dataset is split into five tasks, with each task containing two classes. A fully connected network with two hidden layers is used.
  • Split CIFAR-10: The original CIFAR-10 dataset is split into five tasks, with each task containing two classes. A reduced ResNet-18 architecture is employed.

These are standard benchmarks for evaluating continual learning methods.

Key Insights and Ideas

  • Fisher Information computation matters significantly: The choice of how to compute the Fisher Information matrix has a substantial impact on EWC's performance, even more so than the choice of hyperparameter $\lambda$.
  • Common approximations can be detrimental: Methods like EMPIRICAL and BATCHED, while computationally convenient, can lead to worse performance, especially on more challenging tasks like Split CIFAR-10.
  • Unbiased estimates are better: The SAMPLE method, which provides an unbiased estimate of the true Fisher, performs better than the EMPIRICAL and BATCHED approximations, though not as well as the EXACT method.
  • Task difficulty reveals differences: The differences between computational methods become more pronounced on harder benchmarks like Split CIFAR-10, suggesting that simpler tasks might mask these implementation issues.
  • Transparency is crucial: Researchers should clearly document how they compute the Fisher Information to ensure reproducibility and accurate comparisons.

Key Results

  • Split MNIST: While all methods achieved high accuracy (around 99%), the range of hyperparameters for which EWC performed well varied significantly. The BATCHED method required much larger hyperparameter values.
  • Split CIFAR-10: This more challenging benchmark showed clearer performance differences. The EXACT and EXACT (n=500) methods achieved the highest average test accuracies (around 84.9% and 84.5% respectively). The SAMPLE method performed reasonably well (83.77%), while EMPIRICAL and BATCHED lagged behind (around 83.28% and 83.38%). The "None" (no EWC) baseline performed poorly (69.53%).
  • Training Time: The BATCHED and SAMPLE methods were significantly faster than the EXACT method, highlighting the trade-off between computational cost and performance.

Limitations and Future Work

  • Computational Cost: The primary limitation of the "EXACT" method is its high computational cost, making it impractical for large models or datasets.
  • Hyperparameter Sensitivity: The study shows that different Fisher computation methods have varying sensitivities to the hyperparameter $\lambda$, which controls the strength of the EWC penalty.
  • Future Work: The authors recommend that researchers be more transparent about their Fisher Information computation methods. They also suggest that when computational resources are limited, it's better to reduce the number of training samples used for computation (like in EXACT (n=500)) rather than resorting to cruder approximations. Further research could explore more efficient and accurate methods for computing the Fisher Information in continual learning.

Summary updated

Abstract

One of the most popular methods for continual learning with deep neural networks is Elastic Weight Consolidation (EWC), which involves computing the Fisher Information. The exact way in which the Fisher Information is computed is however rarely described, and multiple different implementations for it can be found online. This blog post discusses and empirically compares several often-used implementations, which highlights that many currently reported results for EWC could likely be improved by changing the way the Fisher Information is computed.
BibTeX
@inproceedings{ven2025computation,
  author = {Gido M van de Ven},
  title = {{On the Computation of the Fisher Information in Continual Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=mFzh95dClk},
}
Figure