Abstract
Hypernetworks mitigate forgetting in continual learning (CL) by generating task-dependent weights and penalizing weight changes at a meta-model level. Unfortunately, generating all weights is not only computationally expensive for larger architectures, but also, it is not well understood whether generating all model weights is necessary. Inspired by latent replay methods in CL, we propose partial weight generation for the final layers of a model using hypernetworks while freezing the initial layers. With this objective, we first answer the question of how many layers can be frozen without compromising the final performance. Through several experiments, we empirically show that the number of layers that can be frozen is proportional to the distributional similarity in the CL stream. Then, to demonstrate the effectiveness of hypernetworks, we show that noisy streams can significantly impact the performance of latent replay methods, leading to increased forgetting when features from noisy experiences are replayed with old samples. In contrast, partial hypernetworks are more robust to noise by maintaining accuracy on previous experiences. Finally, we conduct experiments on the split CIFAR-100 and TinyImagenet benchmarks and compare different versions of partial hypernetworks to latent replay methods. We conclude that partial weight generation using hypernetworks is a promising solution to the problem of forgetting in neural networks. It can provide an effective balance between computation and final test accuracy in CL streams.
Introduction
In Continual Learning (CL), neural networks face the challenge of "catastrophic forgetting"—the tendency to lose knowledge of previous tasks when learning new ones. Two prominent strategies have emerged to combat this: Hypernetworks (HNs) and Latent Replay (LR).
Hypernetworks act as meta-models that generate the weights for a primary model based on a task identifier. While highly effective at preventing forgetting, generating the entire weight set for modern, deep architectures is computationally prohibitive. Conversely, Latent Replay freezes early feature-extraction layers and replays stored activations. While efficient, LR is notoriously sensitive to noise; if a data stream becomes corrupted (e.g., through blurring or color shifts), replaying those noisy features can degrade the performance of older, clean tasks. This paper introduces Partial Hypernetworks, an approach that combines the efficiency of latent replay with the robustness of hypernetworks.
Methodology
The core proposal is Partial Weight Generation. Instead of generating all weights, the authors decompose a standard network into two distinct components:
- Stateful/Frozen Layers ($g_\phi$): The initial layers that serve as a fixed feature extractor, typically trained on the first task in the sequence.
- Stateless/Generated Layers ($h_\omega$): The subsequent layers whose weights are generated dynamically by a Hypernetwork ($H_\psi$) based on the current task ID.
This decomposition allows the model to leverage stable low-level features while adapting high-level representations to specific tasks. To maintain stability across the task stream, the system employs a look-ahead gradient mechanism. The hypernetwork "virtually" updates its parameters to assess how changes for a new task might affect its ability to generate weights for previous tasks. The final update is a balanced mean of the current task gradient and a "forgetting-prevention" gradient, ensuring the meta-model remains a reliable weight generator for the entire experience history.
Key Insights and Results
The Freezing Depth Rule
A critical finding of this research is that the "freezing depth"—how many layers can be safely kept frozen—is directly proportional to the distributional similarity between tasks. For example, when transitioning between similar natural image datasets like CIFAR-10 and CIFAR-100, a large portion of the network can be frozen without performance loss. However, when tasks are dissimilar (e.g., transitioning from traffic signs to natural objects), freezing too many layers significantly hampers accuracy.
Robustness to Noise
Partial Hypernetworks act as effective noise filters. Unlike Latent Replay, which uses a shared set of filters for all tasks, Partial HNs generate unique filters for each task. This adaptability allows the model to handle noisy experiences (e.g., blurred images in Task 3) without corrupting the weights or replayed features used for earlier, clean tasks (e.g., Task 1).
Performance Benchmarks
The effectiveness of this approach was validated on standard benchmarks:
- Split CIFAR-100: Partial HNs (specifically the HN-4 variant) achieved 73.6% Average Classification Accuracy (ACA), vastly outperforming the equivalent Latent Replay (LR-4) at 51.4%.
- Split TinyImagenet: The forgetting rate for the HN-2 variant was only 10.2%, a massive improvement over the 38.8% forgetting rate seen in LR-2.
- Efficiency: The HN-2 configuration (freezing the first two blocks of a ResNet) achieved accuracy comparable to a full hypernetwork while reducing training time by approximately 50%.
Conclusion and Future Work
Partial Hypernetworks offer a promising middle ground for Continual Learning, providing the robustness of meta-modeling with the efficiency of feature freezing. While they significantly reduce forgetting and handle noisy data better than replay-based methods, they currently face challenges such as lower initial learning accuracy and increased optimization complexity. Future research may explore adaptive layers that allow the "frozen" portion of the model to evolve slightly over time, further enhancing the model's flexibility without inducing catastrophic interference.
Summary updated