Selective Prefix Tuning for Pre-trained Language Models

Hongyi Zhang, Zuchao Li, Ping Wang, Hai Zhao

Introduction

Fine-tuning massive pre-trained language models (PLMs) for downstream tasks is computationally expensive, often requiring the update of millions or billions of parameters. Prefix Tuning has emerged as a prominent Parameter-Efficient Fine-Tuning (PEFT) strategy. It involves adding a small set of learnable "prefix tokens" to Transformer layers while keeping the backbone model frozen.

However, standard Prefix Tuning often treats all prefix tokens as equally significant, failing to ensure they capture unique or task-specific information. Research indicates that many learned tokens are redundant or irrelevant. To address this, we present Selective Prefix Tuning (SPT), a method designed to make soft prompts more specialized and diverse without adding any new parameters.

Methodology

SPT enhances the standard Prefix Tuning framework through two primary mechanisms: the Selective Mask and the Selective Loss.

Architecture of Selective Prefix Tuning (SPT) showing the selection mechanism for diversified prefix tokens.

Selective Mask (SM)

The Selective Mask mechanism is inspired by selective self-attention. It applies a soft mask to the attention scores between the input text and the prefix tokens. By utilizing a sigmoid-based function controlled by an amplifier factor ($\alpha$), the model learns to suppress prefix tokens that exhibit low similarity to the current input. This forces the model to prioritize the most relevant contextual cues provided by the prefix, effectively reducing noise.

Selective Loss (SL)

To ensure that prefix tokens do not become redundant, SPT introduces a regularization term called Selective Loss. This term calculates the average absolute cosine similarity between all pairs of prefix tokens. By minimizing this loss, the model is incentivized to maintain orthogonality among prefix tokens, ensuring that each token captures distinct and non-overlapping information.

Experimental Evaluation

The performance of SPT was evaluated across multiple architectures, including BERT-base, BERT-large, and RoBERTa-large, on two major benchmarks: SuperGLUE and Named Entity Recognition (NER).

Results on SuperGLUE

SPT demonstrated consistent improvements over the strong P-Tuning-v2 baseline:

  • BERT-base: 1.4% improvement in average score.
  • BERT-large: 1.8% improvement in average score.
  • RoBERTa-large: Achieved an average score of 80.9, outperforming P-Tuning-v2 and coming within 0.4 points of full fine-tuning.

Results on NER Tasks

In token-level classification tasks using the CoNLL04 dataset, SPT (85.3 F1) outperformed both P-Tuning-v2 (84.5 F1) and full fine-tuning (85.6 F1) when implemented with BERT-large, showcasing its robustness in specialized NLU tasks.

Key Insights and Discussion

The success of SPT highlights the importance of specialization and diversity in parameter-efficient tuning. By masking irrelevant tokens, the model focuses on high-impact cues. Simultaneously, the diversity enforced by the Selective Loss prevents the prefix from collapsing into repetitive patterns.

Sensitivity analysis of the amplifier factor alpha on model accuracy and training loss.

As illustrated in the sensitivity analysis, the amplifier factor ($\alpha$) plays a critical role. A higher $\alpha$ creates a steeper mask, which helps the model achieve lower training loss and better generalization by strictly bounding the influence of irrelevant tokens. Ablation studies further confirmed that the combination of SM and SL is particularly effective for complex tasks like Natural Language Inference (RTE), where it provided a 3% accuracy boost over the baseline.

Conclusion and Future Work

Selective Prefix Tuning offers a highly efficient way to improve PLM fine-tuning by optimizing the utility of learned prefixes. It achieves state-of-the-art PEFT performance with zero additional parameters. Future research will explore the application of SPT to large-scale decoder-only models and its behavior in multi-modal settings, such as vision-language tasks.

Summary updated

BibTeX
@inproceedings{zhang2024selective,
  author = {Hongyi Zhang and Zuchao Li and Ping Wang and Hai Zhao},
  title = {{Selective Prefix Tuning for Pre-trained Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.164},
}
Figure