Dual Contrastive Learning Framework for Incremental Text Classification

Yigong Wang, Zhuoyi Wang, Yu Lin, Jinghui Guo, Sadaf Md. Halim, Latifur KhanEMNLP 2023

Introduction

In the rapidly evolving landscape of online content, machine learning models must continuously adapt to new data streams. However, standard fine-tuning of large language models (LLMs) often leads to catastrophic forgetting, where the model's performance on previously learned tasks degrades as it acquires new knowledge. This challenge is central to incremental (or continual) learning.

Presented at EMNLP 2023, the Dual Contrastive Learning (DCL) framework addresses this by building a generalized embedding space that distinguishes between task-agnostic global features and task-specific local features. Unlike traditional regularization or simple experience replay, DCL structures the representation space to remain robust against domain shifts.

The DCL Framework Architecture

The core innovation of DCL is its dual-stream approach to representation learning, which separates general linguistic knowledge from specialized task expertise.

Overview of the Dual Contrastive Learning (DCL) framework architecture, illustrating the parallel Global and Task-specific modules.

1. Global Contrastive Learning (GCL)

The GCL module focuses on learning task-agnostic features. Utilizing an unsupervised contrastive learning objective (similar to SimCSE), the model is trained to recognize that different "views" of the same sentence—generated via varying dropout masks—should have similar embeddings. This process encourages the model to maintain a stable, general-purpose understanding of language that is not tied to any single classification task.

2. Task-specific Contrastive Attention (TCA)

The TCA module learns task-specific weights through a supervised contrastive approach. It ensures that sentences belonging to the same task share similar attention vectors. This acts as a feature-selection mechanism, allowing the model to highlight relevant portions of the global embedding for the current task without overwriting the underlying global representations. The final classification is derived from the element-wise product of the GCL and TCA outputs.

Experimental Setup

The researchers evaluated DCL across five prominent web text classification benchmarks: AGNews, Yelp, Amazon, DBPedia, and Yahoo, covering a total of 33 classes. To ensure robustness, the model was tested on multiple task sequences to account for potential order-dependent biases.

To further stabilize the learning process, DCL incorporates a minimal memory buffer (storing only 1% of previous data) for experience replay and a regularization loss to prevent significant drift in embeddings between tasks.

Key Results and Discussion

DCL consistently outperformed state-of-the-art (SOTA) baselines such as IDBR and LAMOL. In experiments using full datasets with five-task sequences, DCL achieved an average incremental accuracy of 77.3%, surpassing IDBR's 76.3%.

Average forgetting measures for different task orders (a) and a direct comparison between DCL and the IDBR baseline (b).

Beyond raw accuracy, DCL demonstrated superior resistance to forgetting. As shown in the experimental results, the "forgetting measure" for DCL remained significantly lower than that of IDBR as the number of trained tasks increased. Furthermore, ablation studies confirmed that the synergy between GCL and TCA is vital; performance improved significantly when global features were directly fed into the task-specific attention blocks.

Conclusion and Future Work

The Dual Contrastive Learning framework provides a robust solution for incremental text classification by decoupling global and task-specific knowledge. While the current model relies on a small memory buffer, which may raise data privacy concerns in sensitive domains, future work aims to explore prompt-based representations to eliminate the need for raw data storage. DCL represents a significant step toward creating LLMs that can learn continuously without losing their foundational knowledge.

Summary updated

BibTeX
@inproceedings{wang2023dual,
  author = {Yigong Wang and Zhuoyi Wang and Yu Lin and Jinghui Guo and Sadaf Md. Halim and Latifur Khan},
  title = {{Dual Contrastive Learning Framework for Incremental Text Classification}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.15},
}
Figure