LESSER: Post-Training Data Selection with Output-Layer Gradients

LLM SFT RLHF
2026年10月02日
大语言模型在预训练后所选用的数据,会显著影响其下游任务的性能表现。基于梯度的数据筛选是一种主流方法,其核心思想是:依据各训练样本梯度与一个小规模验证集梯度之间的对齐程度,对训练数据进行排序。然而,若采用全参数梯度进行排序,则需对每个候选样本执行一次完整的反向传播计算,当候选数据池规模庞大时,该过程的计算开销将变得难以承受。由此引出一个自然的问题:我们能否以远低于全参数梯度的计算成本,近似获得具有同等判别能力的梯度特征?值得庆幸的是,我们发现仅使用输出层梯度便足以实现高效的数据筛选;而输出层梯度的计算仅需前向传播,成本显著更低。我们据此提出 LESSER——一种即插即用式的数据筛选方法封装器:它将监督微调(SFT)任务中特征提取所需的浮点运算量(FLOP)降低至原来的 1/9.7,强化学习(RL)基准任务中则降低至原来的 1/3.0,同时在各类下游任务上的实际性能仍能紧密追踪全参数梯度方法的表现。实验结果进一步表明:尽管输出层梯度与全参数梯度对单个样本的排序结果可能存在差异,但二者所选出的数据批次,其整体梯度方向却高度一致。
The choice of post-training data for large language models substantially affects downstream performance. Gradient-based data selection is a popular approach that ranks training data by how well their gradients align with those of a small validation set. However, ranking with full-parameter gradients requires an expensive backward pass on every sample, making computation intractable for large candidate pools. This raises a natural question: can we approximate full-gradient features at a fraction of the cost? Conveniently, we find that output-layer gradients suffice for effective data selection, yet require only the cheaper forward pass. We implement this as LESSER, a drop-in wrapper for selection methods that reduces the feature-extraction FLOP cost by $9.7\times$ for SFT and $3.0\times$ for RL benchmarks, while tracking full-gradient performance on downstream tasks. Empirically, we find that even when output-layer and full gradients rank individual samples differently, they select batches with aligned gradients.
许愿