Особенности использования метода эластичного закрепления весов в прикладных задачах машинного обучения

А.а. Куталев, Alisa LapinaSovremennye 2021

Abstract

This research investigates the practical application of Elastic Weight Consolidation (EWC) for sequential training of neural networks across multiple datasets. We provide a rigorous comparison of weight importance methodologies, including Memory Aware Synapses (MAS), Synaptic Intelligence (SI), and the Fisher information matrix approach. Our analysis covers deep neural networks with fully connected, convolutional, and self-attention layers. We identify critical stability issues in complex architectures, such as gradient explosion and information loss during gradient clipping. To address these, we propose a Stabilized EWC method that ensures training stability without sacrificing skill retention. Finally, we explore the relationship between weight importance metrics and neural network pruning, revealing surprising discrepancies in their effectiveness.

Introduction

A fundamental challenge in artificial intelligence is "catastrophic forgetting"—the tendency of neural networks to overwrite knowledge from previous tasks when learning new ones. Elastic Weight Consolidation (EWC) has emerged as a leading solution, adding a regularization penalty that anchors important weights to their optimal values for prior tasks. However, applying EWC to modern, deep architectures reveals significant gaps in hyperparameter optimization and numerical stability. This paper addresses these gaps by benchmarking importance metrics and introducing a stabilization technique suitable for large-scale models like Transformers.

Methodology

Weight Importance Metrics

The core of EWC is the calculation of a weight importance value ($\Omega_i$) for every parameter in the network. We compared three primary methodologies:

  1. Fisher Information Matrix: The original EWC approach, which uses the second-order derivative of the log-likelihood to estimate importance.
  2. Memory Aware Synapses (MAS): Calculates importance based on the sensitivity of the network's output function to changes in weight values.
  3. Synaptic Intelligence (SI): Estimates importance by tracking the path integral of the gradient over the entire training trajectory.

The Challenge of Architectural Instability

In deep networks, particularly those with convolutional or self-attention layers, weight importance values can vary by several orders of magnitude. In standard EWC, a few "super-important" weights can cause the regularization term to dominate the gradient, leading to numerical instability or "gradient explosion." While gradient clipping can prevent crashes, it often destroys the meaningful training signal required to learn the new task.

Stabilized EWC

To resolve this, we propose a modified regularization term that utilizes a saturating function to bound the gradient contribution:

$$L_{reg} = \sum_i \frac{\lambda}{2} \frac{\Omega_i}{\alpha \lambda \Omega_i + 1} (w_i - w_i^*)^2$$

In this formulation, even as $\Omega_i$ approaches infinity, the resulting gradient remains bounded. This ensures that the "anchoring" force never becomes so large that it prevents the model from learning or causes numerical overflow.

Experimental Evaluation

Datasets and Models

We evaluated the methodologies using:

  • Permuted and Rotated MNIST/Fashion-MNIST: Standard benchmarks for sequential task learning.
  • Russian GPT-2: A complex Transformer-based language model used to test the stabilization method during fine-tuning on dialogue datasets.

Results

Our benchmarks revealed that Memory Aware Synapses (MAS) is the most effective metric for fully connected networks, achieving a mean accuracy of 95.53%, compared to 95.05% for Fisher and 94.32% for SI. For convolutional networks, MAS (60.12%) and Fisher (58.46%) performed similarly, while SI significantly underperformed (50.68%).

In the GPT-2 experiments, standard EWC frequently led to training collapse. However, our Stabilized EWC allowed for successful fine-tuning, resulting in a 7-point improvement in perplexity (19 vs. 26) when evaluated on the original pre-training distribution. This confirms that the model retained its general language capabilities while acquiring new dialogue skills.

Discussion: Importance vs. Prunability

An interesting finding of this study is that EWC importance metrics are poor indicators for neural network pruning. Magnitude-based pruning (removing weights with the smallest absolute values) consistently outperformed pruning based on EWC importance. This suggests that EWC importance is a local metric, valid only in the immediate neighborhood of the current weight value, and does not accurately reflect a weight's global necessity if it were to be removed entirely.

Conclusion

While EWC is a powerful tool for continual learning, its standard implementation is often too unstable for modern deep learning architectures. By employing the MAS importance metric and our proposed stabilization function, researchers can apply weight consolidation to complex models like Transformers and CNNs with greater reliability. Future work will focus on scaling these methods to even larger architectures and investigating the limits of network capacity in long-term sequential learning.

Summary updated

BibTeX
@inproceedings{2021,
  author = {А.А. Куталев and Alisa Lapina},
  title = {{Особенности использования метода эластичного закрепления весов в прикладных задачах машинного обучения}},
  booktitle = {Sovremennye},
  year = {2021},
  doi = {10.25559/sitito.17.202102.345-354},
}
Figure