Ternary Feature Masks: Zero-Forgetting for Task-Incremental Learning

Marc Masana, Tinne Tuytelaars, Joost van de Weijer

Abstract

Continual learning in neural networks often suffers from catastrophic forgetting, where learning new tasks overwrites knowledge from previous ones. This paper introduces Ternary Feature Masks (TFM), a novel approach that achieves a zero-forgetting guarantee by applying masks to features (activations) rather than weights. By utilizing ternary states and task-specific normalization, TFM achieves state-of-the-art performance with a memory overhead three orders of magnitude smaller than traditional weight-masking methods.

Introduction

A primary challenge in artificial intelligence is Continual Learning, where models must learn new tasks sequentially without losing performance on previously learned ones. Existing solutions like Elastic Weight Consolidation (EWC) use regularization to penalize weight changes but often still permit some forgetting. Alternatively, weight-masking methods like PackNet freeze specific weights to prevent forgetting but suffer from extreme memory overhead, as they require storing masks for every weight in the network (often tens of millions).

Methodology: Ternary Feature Masks

The core innovation of TFM is shifting the masking target from network weights to features (neuron activations). Since typical networks have significantly fewer features than weights—for example, AlexNet has approximately 60 million weights but fewer than 10,000 features—this shift drastically reduces parameter overhead.

Ternary Masking Logic

TFM employs three distinct states for each feature to balance knowledge reuse and stability:

  • Forward-only: Features from previous tasks are used for forward propagation to aid the current task (knowledge reuse), but their underlying weights are frozen during backpropagation to ensure zero forgetting.
  • Normal: Features are fully learnable (active in both forward and backward passes), typically used for new neurons added for the current task.
  • Masked: Features are completely inactive, used during inference to isolate task-specific knowledge.
Ternary Feature Masking mechanism showing the three states: Masked, Forward-only, and Normal.

Task-specific Feature Normalization (FN)

To allow frozen features to adapt to new contexts, TFM introduces a lightweight normalization layer. This layer learns task-specific scale ($\gamma$) and shift ($\beta$) parameters for each feature, enabling the model to repurpose existing knowledge without modifying the original weights.

Experimental Results

The authors evaluated TFM across diverse benchmarks, including ImageNet, tiny ImageNet, and fine-grained datasets like Oxford 102 Flowers and CUB Birds.

Memory Efficiency

A standout result is TFM's scalability. While weight-masking methods like PackNet exhibit linear growth in memory consumption as tasks are added, TFM's overhead remains nearly flat on a log scale. On ImageNet with AlexNet, TFM's memory requirement is approximately 1,000x smaller than weight-based alternatives.

Memory overhead comparison across tasks. TFM maintains a significantly lower overhead compared to weight-masking methods like PackNet.

Performance and Ablation

TFM consistently matches or exceeds state-of-the-art performance. On the CUB Birds dataset, TFM achieved 46.2% average accuracy, significantly outperforming PackNet (42.1%) and HAT (24.4%). Ablation studies confirmed the importance of Feature Normalization; for instance, on the Flowers dataset, adding FN improved average accuracy from 42.0% to 43.3%.

Conclusion and Future Work

Ternary Feature Masks provide a mathematically guaranteed zero-forgetting solution that is exceptionally memory-efficient. However, the method currently operates in the task-incremental setting, requiring a task label at inference time. Future research aims to adapt mask-based approaches to the more challenging class-incremental setting, where task labels are unknown during evaluation.

Summary updated

BibTeX
@inproceedings{masana2021ternary,
  author = {Marc Masana and Tinne Tuytelaars and Joost van de Weijer},
  title = {{Ternary Feature Masks: Zero-Forgetting for Task-Incremental Learning}},
  booktitle = {Workshops @ CVPR},
  year = {2021},
  doi = {10.1109/cvprw53098.2021.00396},
}
Figure