Composing Parameter-Efficient Modules with Arithmetic Operation

Jinghan Zhang, Shiqi Chen, Junteng Liu, Junxian He

Introduction

As Large Language Models (LLMs) grow, full fine-tuning becomes prohibitively expensive. Parameter-efficient fine-tuning (PEFT) methods, such as LoRA, have emerged as the standard solution, creating small, task-specific "plug-in" modules. However, this often results in a fragmented library of isolated modules.

The challenge is combining the diverse skills captured in these separate modules. Previous attempts usually required "fusion" training or complex routing mechanisms. This paper investigates whether we can bypass extra training entirely and achieve a better model by performing linear arithmetic directly on the module weights. The authors demonstrate that PEFT modules can be combined using simple weight-space arithmetic (addition and negation) without any additional training, achieving impressive results in multi-tasking, domain transfer, and model detoxification.

Methodology: Weight-Space Arithmetic

The authors focus on two popular PEFT architectures: LoRA and (IA)³. They treat these modules as composable building blocks and define two fundamental operators:

  1. Addition ($\oplus$): Merging skills by adding weights element-wise. This is primarily used for distribution generalization and multi-tasking.
  2. Negation ($\ominus$): Removing specific behaviors. Crucially, this isn't just multiplying by -1. For LoRA, they negate the $B$ matrix; for (IA)³, they transform the scaling vector $l$ into $2-l$.
An overview of the proposed training-free composition of PEMs for various tasks.

These operators allow for complex "analogy" compositions. For example, to transfer a sentiment classifier from restaurant reviews to product reviews without new labels, they use the formula: $$\theta_{target} = \theta_{source\_task} \ominus \theta_{source\_domain} \oplus \theta_{target\_domain}$$

The only "tuning" involved is finding the optimal scalar weight ($\lambda$) for the interpolation, which is done on a small validation set.

Experiments and Key Insights

The study evaluates its approach across several benchmarks, including the GLUE Benchmark (for distribution generalization and multi-tasking), Civil Comments (for unlearning/detoxification), Amazon & Yelp Reviews (for domain transfer), and Alpaca-LoRA (to demonstrate scalability to modern LLMs).

Linear Connectivity and Weight Sensitivity

The success of weight arithmetic suggests that PEFT modules trained from the same pretrained checkpoint inhabit the same "error basin." This allows them to be merged linearly without losing performance. However, the performance of merged modules is highly sensitive to the mixing coefficient $\lambda$; accuracy on different tasks can shift dramatically with small changes to this weight.

Key Results

  • Distribution Generalization: Merged modules consistently outperformed the average of their individual components across all GLUE tasks, often approaching the performance of models trained on the full combined dataset.
  • Multi-tasking: LoRA merging achieved a higher average accuracy across tasks compared to individual task-specific modules, proving that skills can be aggregated without interference.
  • Detoxification (Negation as a Scalpel): Negation proved to be a powerful tool for AI safety. By training a module to be intentionally toxic and then negating it, the authors created a "detoxifier" that made the base model cleaner than its original state. Negated LoRA reduced the toxicity score of GPT-2 from 0.10 to 0.01, significantly better than the results achieved by negating a fully fine-tuned model (0.04).
Toxicity scores and perplexity (PPL) for various negation methods.

Limitations and Future Work

While highly effective, the method has constraints:

  • Architectural Constraints: Modules must share the same architecture (e.g., a LoRA module cannot be directly merged with an (IA)³ module).
  • Initialization: The method performs best when modules share the same initialization, though it can work with different random seeds.
  • Manual Hyperparameters: Finding the best $\lambda$ still requires a validation set. Future work could involve automated methods for calculating these weights.
  • Safety Risks: While negation helps detoxification, the "black-box" nature of these compositions could potentially introduce unforeseen biases.

Summary updated

BibTeX
@inproceedings{zhang2023composing,
  author = {Jinghan Zhang and Shiqi Chen and Junteng Liu and Junxian He},
  title = {{Composing Parameter-Efficient Modules with Arithmetic Operation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=5r3e27I9Gy},
}
Figure