Dual-Attention Transformers for Class-Incremental Learning: A Tale of Two Memories
Class-incremental learning (Class-IL) aims to continuously learn a model from a sequence of tasks, which suffers from the issue of catastrophic forgetting. Recently, a few transformer based methods are proposed to address this issue by transferring self-attention into task-specific attention. However, these methods utilize shared task-specific attention modules across the whole incremental learning process, and are unable to achieve the balance between consolidation and plasticity, i.e., to remember the knowledge learned from previous tasks and absorb the knowledge from the current task simultaneously. Motivated by the mechanism of LSTM and hippocampus memory, we point out that dual attention on long and short-term memories can handle the consolidation-plasticity dilemma of Class-IL. Typically, we propose Dual-Attention Transformers (DAFormer) to learn external attention and internal attention. The former utilizes sample-dependent keys which exclusively focused on the new tasks, while the latter consolidates the knowledge from previous tasks by using sample-agnostic keys. We present two editions of DAFormer: DAFormer-S and DAFormer-M: the former utilizes shared external keys and maintains a small parameter size, while the latter utilizes multiple external keys and enhances the long-term memory. Furthermore, we propose the <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"><tex-math notation="LaTeX">$K$</tex-math></inline-formula>-nearest neighbor invariant based distillation scheme, which distills knowledge from previous tasks to current task by maintaining the same neighborhood relationship of each sample over old and new models. Experimental results on <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">CIFAR-100</i>, <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">ImageNet-subset</i> and <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">ImageNet-full</i> demonstrate that DAFormer significantly outperforms all the state-of-the-art parameter-static and parameter-growing methods.
Authors
- Zhiyong Wang (ORCID: https://orcid.org/0000-0001-5546-6666)
- Shaofan Wang (ORCID: https://orcid.org/0000-0002-3045-624X)
- Boyue Wang (ORCID: https://orcid.org/0000-0002-2677-8342)
- Weixing Wang (ORCID: https://orcid.org/0000-0001-9415-1560)
- Baocai Yin (ORCID: https://orcid.org/0000-0002-8125-4648)
- Yanfeng Sun
Institutions
- The University of Sydney (AU)
- Beijing University of Technology (CN)
Publication Details
- Journal
- IEEE Transactions on Multimedia
- Published
- 2025-01-01
- DOI
- https://doi.org/10.1109/tmm.2025.3607800
- Primary Topic
- Domain Adaptation and Few-Shot Learning
- Type
- article
- Field-Weighted Citation Impact
- 0.00