希望在RL和SFT中支持ptx loss
Describe the feature 在Kimi K2报告中提到,为了防止RL过程对预训练知识的遗忘,采用和InstructGPT中PPO-ptx一样的策略:在RL的目标函数中添加了额外的一项PT的loss,kimi k2中说对模型的泛化性很有帮助(“ This augmentation substantially improves the model’s generalization across a broader range of domains”)。因此希望添加对PTX的支持。
Paste any useful information Kimi ptx loss: https://arxiv.org/pdf/2507.20534 的13页 InstructGPT ptx loss: https://arxiv.org/pdf/2203.02155 第9页
Additional context ms-swift已实现CHORD算法,在RL目标函数中添加了额外的一项SFT的loss,将其换成PT loss即可。此外,也希望支持SFT时添加PT loss,应该也能提升SFT时的泛化性。
请问有计划支持SFT和RL时加入ptx loss训练么?
You can easily implement it in both SFT and GRPO, as DFT/CHORD is encapsulated within a separate function:
https://github.com/modelscope/ms-swift/blob/011676992ee33805b0f3a32f75294d508c47f58f/swift/trainers/utils.py#L94-L109
https://github.com/modelscope/ms-swift/blob/011676992ee33805b0f3a32f75294d508c47f58f/swift/trainers/rlhf_trainer/utils.py#L484-L526
@hjh0119 感谢指出路径,后续我自己尝试实现一下吧:)
This issue has been inactive for over 3 months and will be automatically closed in 7 days. If this issue is still relevant, please reply to this message.