[Question] How to add a custom auxiliary SFT loss to the GRPO training loop (Chord)?

Open
#1,843 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
python

Research direction

No source file, test, or entry point is named in the issue. Start by locating the GRPO loss computation and routing-replay implementation, then determine how an SFT forward pass would interact with both; done would be a maintainer-confirmed design for combining the losses and handling SFT routing.

Written by the indexing model from the issue text.

Description

question
Your Question

How to add a custom auxiliary SFT loss to the GRPO training loop?

I'm training DeepSeek-V3.2 on 128×H200 with GRPO and would like to mix in an SFT loss term during training, similar to CHORD (https://arxiv.org/abs/2508.11408):

$$\mathcal{L} = (1 - \mu) \cdot \mathcal{L}{\text{GRPO}} + \mu \cdot \mathcal{L}{\text{SFT}}$$

Could you point me to where in the codebase the GRPO loss is computed so I can add the SFT forward pass and combine the two losses?

Also, one question about MoE: routing replay forces the same expert routing from rollout during training, but SFT data has no corresponding rollout. Should I just skip routing replay for the SFT forward pass and use live routing?

Thanks!

What I've Tried

Verified CHORD on smaller models using ms-swift, but ms-swift only supports vLLM for GRPO rollout and lacks routing replay / off-policy sequence masking, so it doesn't work for DeepSeek-V3.2 at this scale.

Environment (if relevant)
  • slime version:
  • Python version:
  • PyTorch version:
  • CUDA/ROCm version:
  • GPU type and count:
  • OS:
Additional Context

No response

Pre-submission Checklist
Dominant language
Python
Stars
8.8k
Forks
1.3k
Avg merge
20h 16m
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from THUDM/slime

All issues in THUDM/slime

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.