Abstract
Aligning large language models (LLMs) with human preferences typically requires resource-intensive fine-tuning methods like Direct Preference Optimization (DPO) or Reinforcement Learning from Human Feedback (RLHF). This paper introduces In-Context Direct Preference Optimization (ICDPO), a tuning-free framework that achieves instant alignment by leveraging In-Context Learning (ICL) and a contrastive scoring mechanism. By treating demonstrations as a form of "virtual" fine-tuning, ICDPO matches or exceeds the performance of traditional alignment methods without updating model parameters.
Introduction
Traditional alignment techniques, while effective, demand substantial computational resources and high-quality datasets for weight updates. Existing tuning-free alternatives often struggle with inference speed or fail to capture the nuanced behavior of fine-tuned experts. ICDPO addresses these challenges by reframing the DPO objective through the lens of ICL, allowing base models to adopt "expert" policies on the fly. This approach enables "instant fine-tuning" by providing a few demonstrations and using a contrastive scoring mechanism to select optimal responses.
Methodology
ICDPO operates on the principle that the disparity between a model with context (the "expert") and without context (the "amateur") is a more reliable indicator of human preference than the raw output of either model alone.
- ICL as Instant Fine-Tuning: The authors treat demonstrations as a meta-optimization step, shifting the base model ($\pi_0$) toward an expert policy ($\pi^*$).
- Contrastive Scoring: Drawing from DPO's mathematical derivation, the reward of a response is estimated by the difference in log-probabilities between the expert and amateur models. This filters out inherent linguistic biases.
- Upgraded Scorer ($\hat{S}$): To sharpen the signal, a "bad" policy using rejected demonstrations is introduced. The final score compares the probability under the "good" context versus the "bad" context.
- Two-Stage Retrieval ($R$): To ensure relevance, a coarse-to-fine strategy is used: BM25 for structural similarity followed by SBERT for semantic re-ranking.
Experimental Setup
The authors evaluated ICDPO across several standard benchmarks using base models like LLaMA, LLaMA-2, and Mistral:
- HH-RLHF (Anthropic): Focused on harmlessness and helpfulness in multi-turn dialogues.
- AlpacaEval: Measures instruction-following capabilities.
- Arena-Hard: A challenging benchmark derived from Chatbot Arena.
- MMLU: Measures intrinsic reasoning capacity.
Results and Discussion
ICDPO demonstrates significant performance gains over zero-shot baselines and other tuning-free methods like URIAL and RAIN.
- Benchmark Performance: On the HH-RLHF benchmark, Mistral with ICDPO+$\hat{S}R$ achieved a "Total" score of 73.59, compared to -11.82 for the zero-shot base model. On AlpacaEval, it improved LLaMA-2's performance by nearly 3 points over the best baseline.
- Efficiency: By using techniques like Prefix Caching (caching KV states of demonstrations) and State Space Models (like Mamba), the computational overhead of long ICL prompts is significantly reduced, making the method practical for real-time inference.
- Quality Over Quantity: Retrieval ($R$) proved crucial; the model performed better with two retrieved examples than with five random ones, highlighting that relevance is more impactful than volume.
Conclusion and Future Work
ICDPO offers a compelling, resource-efficient alternative to fine-tuning, competing with standard SFT and DPO on specific benchmarks. However, it requires access to model logits, making it difficult to use with black-box APIs. It is also constrained by the model's context window. Future directions include exploring more sophisticated retrieval methods and investigating how ICDPO scales with larger models (70B+) or different modalities like vision-language models.
Summary updated