Smart prompt reuse in preference training cuts computation time without compromising quality.
Prefix sharing eliminates redundant prompt processing in preference tuning, boosting training speed by 1.5Γ
π https://arxiv.org/abs/2410.20305
π€ Original Problem:
Training LLMs with preference data currently wastes computation by processing shared prompts twice - once for chosen response and once for rejected response. This redundancy particularly impacts tasks with long prompts like summarization and mathematics.
-----
π§ Solution in this Paper:
β Introduces "prefix sharing" that processes chosen and rejected responses as one sequence with a shared prefix
β Uses custom block-sparse attention mask to prevent cross-response contamination
β Leverages FlexAttention's block sparsity to skip computation of masked regions
β Implements sequence packing for prefix-shared inputs to further boost efficiency
-----
π‘ Key Insights:
β Most gains come from reducing total training tokens rather than attention optimizations
β Performance boost increases with longer sequence lengths and higher prefix-to-completion ratios
β Sequence packing provides additional efficiency gains especially for shorter sequences
β Method is compatible with any paired preference tuning approach
-----
π Results:
β Achieves 1.1-1.5Γ speedup on DPO datasets without affecting convergence
β Combined with sequence packing, delivers consistent 1.3-1.6Γ speedups
β Shows 1.5Γ speedup for datasets with long prefixes and high prefix-to-completion ratios
β Even datasets with low prefix-to-completion ratios see modest 1.1Γ improvements










