接頭辞共有を利用した直接的な選好最適化の加速化
Accelerating Direct Preference Optimization with Prefix Sharing
October 27, 2024
著者: Franklin Wang, Sumanth Hegde
cs.AI
要旨
オフラインのペア選好最適化アルゴリズムは、選好データの微調整において、従来の教師あり微調整を凌駕することで、さまざまなタスクで人気を博しています。しかしながら、従来の実装は、共有プロンプトが長いタスクにおいて特に冗長な計算を必要とすることがよくあります。我々は、選好調整のためのプレフィックス共有という新しい技術を導入します。これは、選択された応答と拒否された応答を共有プレフィックスを持つ1つのシーケンスとして処理するものです。クロス応答の混入を防ぐために、カスタムブロック疎な注意マスクを使用しています。当該手法は、人気のあるDPOデータセットにおいてトレーニングスループットが1.1〜1.5倍改善され、収束には影響を与えません。シーケンスパッキングと組み合わせると、一貫して1.3〜1.6倍の高速化が観測され、シーケンス長が短いデータセットでも恩恵を受けます。私たちは直接選好最適化(DPO)に焦点を当てていますが、当該手法は他のペア選好調整方法にも適用可能です。計算効率を向上させることで、我々の研究は、幅広いアプリケーションやモデルサイズにおいて選好ベースの微調整をより利用しやすくすることに貢献しています。当該コードは、https://github.com/frankxwang/dpo-prefix-sharing でオープンソースとして公開しています。
English
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.Summary
AI-Generated Summary