Accelerating Direct Preference Optimization with Prefix Sharing
Abstract
Offline paired preference optimization algorithms have become a popular approach for fine-tuning on preference data, outperforming traditional supervised fine-tuning in various tasks. However, traditional implementations often involve redundant computations, especially for tasks with long shared prompts. We introduce prefix sharing for preference tuning, a novel technique that processes chosen and rejected responses as one sequence with a shared prefix. To prevent cross-response contamination, we use a custom block-sparse attention mask. Our method achieves 1.1-1.5times improvement in training throughput on popular DPO datasets, without any effect on convergence. When combined with sequence packing, we observe consistent 1.3-1.6times speedups, benefiting even datasets with smaller sequence lengths. While we focus on Direct Preference Optimization (DPO), our approach is applicable to other paired preference tuning methods. By enhancing computational efficiency, our work contributes to making preference-based fine-tuning more accessible for a wider range of applications and model sizes. We open-source our code at https://github.com/frankxwang/dpo-prefix-sharing.
Community
Speed up your DPO training with zero compromises using ✨prefix sharing✨!
Prefix sharing speeds up training by 1.2-1.6x 🚀across the datasets we tested and is numerically identical to standard DPO training.
Paper: https://arxiv.org/abs/2410.20305
Code: https://github.com/frankxwang/dpo-prefix-sharing
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- SparsePO: Controlling Preference Alignment of LLMs via Sparse Token Masks (2024)
- A Little Goes a Long Way: Efficient Long Context Training and Inference with Partial Contexts (2024)
- Correlation-Aware Select and Merge Attention for Efficient Fine-Tuning and Context Length Extension (2024)
- Reward-Augmented Data Enhances Direct Preference Alignment of LLMs (2024)
- As Simple as Fine-tuning: LLM Alignment via Bidirectional Negative Feedback Loss (2024)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper