Tracking Universal Features Through Fine-Tuning and Model Merging

Niels Nielsen Horn, Desmond ElliottNAACL 2025

TL;DR

This paper tackles the significant memory overhead of fine-tuning large language models (LLMs) by proposing a novel method called Partial Embedding Matrix Adaptation (PEMA). PEMA leverages the observation that many downstream tasks only utilize a fraction of an LLM's vocabulary, drastically reducing memory requirements without sacrificing performance.

What Problem Does This Paper Address?

Fine-tuning large language models (LLMs) has become a cornerstone of natural language processing (NLP) research and application. However, these models possess massive embedding matrices that represent extensive vocabularies, consuming a substantial portion of the model's parameters and, consequently, requiring significant computational resources (memory and processing power) for fine-tuning. This high resource demand hinders the democratization of NLP, making it difficult for researchers and practitioners with limited budgets or consumer-grade hardware to work with these powerful models. While previous work has focused on reducing the number of trainable parameters, the memory footprint of the embedding matrix itself has remained largely unexplored.

Methods

The core of the paper's contribution is the Partial Embedding Matrix Adaptation (PEMA) method. The approach is based on the observation that during fine-tuning on specific downstream tasks, a significant portion of the LLM's vocabulary often remains unused. PEMA exploits this by:

  1. Identifying the Partial Vocabulary: Before fine-tuning, the method first determines the subset of tokens (the "partial vocabulary") that are actually present in the fine-tuning dataset.
  2. Constructing a Partial Embedding Matrix: A new, smaller embedding matrix is created, containing only the embeddings for the tokens in the identified partial vocabulary.
  3. Adapting the Dataset: The input data is then re-indexed to map the original token IDs to the new, contiguous IDs of the partial vocabulary.
  4. Fine-tuning: The LLM is fine-tuned using this reduced embedding matrix and the re-indexed dataset. Crucially, only the embeddings in this partial matrix are updated, and the unused embeddings from the original matrix are not touched.
  5. Merging Back: After fine-tuning, the learned embeddings from the partial matrix are merged back into the original, full embedding matrix. This ensures that the model retains its complete vocabulary representation for future use, making the process non-destructive and allowing for seamless integration with other tasks.

This method is orthogonal to other parameter-efficient fine-tuning (PEFT) techniques, meaning it can be combined with them for even greater efficiency.

Datasets

The paper primarily uses datasets from the GLUE benchmark for evaluation. These include:

  • CoLA (Linguistic acceptability)
  • MNLI (Natural language inference)
  • MRPC (Paraphrasing/sentence similarity)
  • QNLI (Natural language inference)
  • QQP (Paraphrasing/sentence similarity)
  • RTE (Natural language inference)
  • SST-2 (Sentiment analysis)
  • STS-B (Sentence similarity)
  • WNLI (Natural language inference)

Additionally, XNLI (a multilingual extension of MNLI) is used to evaluate the approach on multilingual data.

Key Insights and Ideas

  • Vocabulary Underutilization: The most striking insight is that many standard fine-tuning datasets utilize only a small fraction of the LLM's total vocabulary. This is not just a minor observation; it's the fundamental premise that PEMA is built upon.
  • Embedding Matrix as a Memory Bottleneck: The paper clearly demonstrates that the embedding matrix is a significant contributor to the memory footprint during fine-tuning, often more so than other model parameters.
  • PEMA's Simplicity and Effectiveness: The proposed PEMA method is remarkably simple yet yields substantial memory savings without compromising downstream task performance. This suggests that the "unused" parts of the embedding matrix are indeed not critical for fine-tuning on specific tasks.
  • Orthogonality to Other PEFT Methods: PEMA can be combined with existing parameter-efficient fine-tuning techniques, offering a synergistic approach to memory reduction.
  • Multilingual Models Benefit Most: Multilingual models, with their inherently larger vocabularies, show the most dramatic memory savings when PEMA is applied.

Key Results

PEMA achieves significant memory reductions across various models and datasets:

  • Embedding Parameter Reduction: The paper reports substantial reductions in embedding parameters. For instance, an average reduction of 47.3% for BERT, 52.1% for RoBERTa, and 72.4% for DeBERTaV3 is achieved on the GLUE benchmark.
  • Dataset-Specific Savings: Savings vary by dataset. For BERT, the embedding matrix can be reduced by 94.3% for WNLI but only 11.5% for QQP.
  • Model Size Matters: Larger models (e.g., DeBERTaV3) benefit more from PEMA due to their larger embedding dimensions.
  • Multilingual Gains: Multilingual models like mBERT, XLM-RoBERTa, and XLM-V show average reductions of 44.2%, 64.3%, and 85.7% respectively. Even when fine-tuning on all fifteen XNLI languages, savings range from 23.0% to 58.4%.
  • No Performance Degradation: Crucially, the paper demonstrates that PEMA does not negatively impact downstream task performance. In fact, in some cases, it performs fractionally better or worse than the baseline, but the overall trend shows consistency.
  • Runtime Impact: Applying PEMA itself is very fast, taking less than half a second for most GLUE datasets and less than 1% of the fine-tuning duration.

Limitations and Future Work

  • Runtime Cost of Dataset Analysis: The paper acknowledges that processing the fine-tuning dataset to assess vocabulary usage incurs a runtime cost. However, they state this cost is "negligible" and provide a detailed analysis in Appendix F.
  • Dual-Use Concerns: The authors recognize the dual-use nature of LLMs and that improving efficiency could lower the barrier to entry for their misuse.
  • Future Work: The authors express interest in extending their approach to the output embedding matrix to achieve further memory savings.

Summary updated

BibTeX
@inproceedings{horn2025tracking,
  author = {Niels Nielsen Horn and Desmond Elliott},
  title = {{Tracking Universal Features Through Fine-Tuning and Model Merging}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
}
Figure