Composing Parameter-Efficient Modules with Arithmetic Operations

Jinghan Zhang, Shiqi Chen, Junteng Liu, Junxian HearXiv 2023 · DOI

Introduction

Adapting Large Language Models (LLMs) via full fine-tuning is prohibitively expensive due to the massive computational resources required. Parameter-Efficient Fine-Tuning (PEFT), such as LoRA or (IA)³, addresses this by training small, specialized modules—often comprising less than 1% of the total parameters—while keeping the base model frozen. However, this success has led to a "fragmentation" problem: a proliferation of thousands of specialized modules for specific tasks, domains, or styles.

This research, presented at NeurIPS 2023, explores a novel solution: instead of training new models to combine these skills, why not perform simple arithmetic on their weights? The authors demonstrate that these modules can be composed in the weight space using addition and negation without any additional training, enabling highly flexible and efficient model editing.

Overview of training-free composition of Parameter-Efficient Modules (PEMs).

Methods: Arithmetic in Parameter Space

The core insight of this work is that PEFT modules represent small "deltas" (changes) to a frozen base model and behave linearly in the parameter space. This allows for the definition of two fundamental operators:

  1. Addition ($\\oplus$): This operator merges two or more modules by performing a weighted averaging of their weights. It is primarily used for multi-tasking or improving a model's generalization across different data distributions.
  2. Negation ($\\ominus$): This involves surgically reversing the transformation a module applies to the model's hidden states. For LoRA, this means negating the $B$ matrix ($h \\leftarrow h - BAx$). For (IA)³, which scales activations by a vector $l$, the negation is defined as $2 - l$.

By combining these operators, researchers can perform complex "analogy" operations similar to those found in word embeddings. For example, domain transfer can be formalized as: Target Task = Source Task - Source Domain + Target Domain. This allows for the creation of a model for a specific task in a new domain without ever training on labeled data from that domain.

Summary of arithmetic operations for different model editing settings.

Experimental Evaluation

The authors conducted a comprehensive evaluation across several benchmarks, including the GLUE benchmark for multi-tasking and distribution generalization, and the Civil Comments dataset for unlearning toxicity. They also demonstrated the practical utility of this approach by detoxifying modern, instruction-tuned LLMs like Alpaca-LoRA.

Key Insights and Results

  • Surgical Detoxification: By negating a module trained on toxic content, the researchers reduced toxicity scores by up to 10x. Remarkably, this was achieved while barely affecting the model's general linguistic proficiency, as measured by perplexity. Human evaluators noted that the "detoxified" model became more helpful, learning to refuse insulting prompts rather than generating toxic responses.
  • Distribution Generalization: Merging modules trained on different subsets of a dataset consistently outperformed individual modules. For instance, merging two modules on the MNLI task yielded a +2.3 point performance gain.
  • Zero-Shot Domain Transfer: Using the analogy operation (Sentiment_Amazon - LM_Amazon + LM_Yelp), the team successfully created a Yelp sentiment classifier that outperformed standard transfer baselines, despite never seeing a Yelp-specific sentiment label during training.

Conclusion and Future Work

This work moves the field closer to a paradigm of Modular Deep Learning, where we don't "train models" so much as we "assemble capabilities" from a library of pre-computed parts. This training-free composition allows for rapid model editing on consumer-grade hardware.

However, limitations remain. The method currently requires modules to share the same architecture and benefits from shared initialization. Future research may focus on automating the tuning of the scaling factor ($\\lambda$) and developing techniques to compose modules across different architectures.

Summary updated

BibTeX
@misc{zhang2023composing,
  author = {Jinghan Zhang and Shiqi Chen and Junteng Liu and Junxian He},
  title = {{Composing Parameter-Efficient Modules with Arithmetic Operations}},
  year = {2023},
  eprint = {2306.14870},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.14870},
}
Figure