Leveraging Importance Sampling to Detach Alignment Modules from Large Language Models

Yi Liu, Dianqing Liu, Mingye Zhu, Junbo Guo, Yongdong Zhang, Zhendong Mao

Introduction

Aligning Large Language Models (LLMs) with human values or specific domain requirements typically necessitates Supervised Fine-Tuning (SFT) or Reinforcement Learning from Human Feedback (RLHF). For models with tens or hundreds of billions of parameters, this process is computationally prohibitive and inflexible; updating alignment goals often requires retraining the entire massive base model.

Existing modular "aligner" models attempted to address this by using a separate module to post-process the base model's output. However, these methods suffer from significant first-token latency, as they often require substantial context from the base model before corrections can begin. Furthermore, they frequently encounter out-of-distribution issues when the base model's output deviates from the aligner's training data. This paper introduces the Residual Alignment Model (RAM), a framework that detaches alignment from core language capabilities using importance sampling.

The Residual Alignment Model (RAM)

RAM frames the alignment process as a secondary sampling step. In this framework, the large base model acts as a frozen "Proposal Module" ($P_M$), while a much smaller, trainable "Residual Aligner" ($Q_\theta$) provides the alignment logic. The aligned probability is mathematically defined as the product of these two components, effectively decoupling the alignment process from the underlying language model.

The RAM architecture and the Propose-Align-Reduce Sampling (PARS) mechanism.

Proposing-Aligning-Reducing Sampling (PARS)

To overcome the latency bottlenecks of previous modular methods, RAM employs a token-by-token decoding strategy called Propose-Align-Reduce Sampling (PARS):

  1. Propose: The frozen base model suggests $n$ candidate tokens.
  2. Align: The small Residual Aligner assigns an "importance weight" to each candidate token.
  3. Reduce: The system samples a final token based on these weights and feeds it back into both models for the next step.

This approach reduces first-token latency from over 10 seconds in traditional aligner methods to approximately 0.31 seconds, making it comparable to standard SFT models.

Experimental Results

The researchers evaluated RAM across three tasks: Instruction Following (UltraChat), Domain Adaptation (TL;DR Summarization), and Preference Optimization (Anthropic-HH). Evaluation was conducted using the AlpacaEval 2 framework, with GPT-4 and Qwen2.5-72B serving as judges to calculate win rates against baselines.

Performance comparison of RAM against SFT and previous Aligner methods across UltraChat and TL;DR Summarization datasets.

Key Insights

  • Efficiency and Scalability: RAM demonstrates that a small aligner (e.g., 1B or 3B parameters) can effectively steer a much larger base model (8B or 14B). This modularity leads to a 4x increase in training efficiency for SFT and a 13.33x increase for Direct Preference Optimization (DPO) compared to full-model tuning.
  • Superior Performance: On the UltraChat dataset, a RAM configuration (Llama 3.1-8B base + 1B aligner) achieved a win rate of 10.57%, outperforming the standard SFT 8B baseline (8.64%) and previous modular aligners (2.82%).
  • Robustness: The model incorporates a "safety valve" using KL divergence. If the Residual Aligner's distribution diverges too sharply from the base model, the system reverts to the base model's distribution to ensure fluency.

Limitations and Future Work

Despite its advantages, RAM has specific requirements: the Proposal Module and the Residual Aligner must share the same vocabulary, and the system requires access to the base model's logits. This currently limits its application to open-source models rather than black-box APIs. Future research will focus on bridging models with different vocabularies and integrating speculative sampling to further enhance decoding speeds.

Summary updated

BibTeX
@inproceedings{liu2025leveraging,
  author = {Yi Liu and Dianqing Liu and Mingye Zhu and Junbo Guo and Yongdong Zhang and Zhendong Mao},
  title = {{Leveraging Importance Sampling to Detach Alignment Modules from Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=ctJxU8v3bY},
}
Figure