Support `loss_type="cispo"` for GRPO loss (TRL GRPOTrainer + `use_liger_kernel=True`)
🚀 The feature, motivation and pitch
Summary
TRL's GRPOTrainer supports loss_type="cispo", but Liger-Kernel currently does not, which causes errors when using use_liger_kernel=True together with loss_type="cispo".
Related PR: https://github.com/linkedin/Liger-Kernel/pull/1054
Background / Motivation
CISPO (Clipped Importance Sampling Policy Optimization) is a loss variant proposed in the MiniMax-M1 technical report. It clips the importance sampling ratio with only an upper bound and detaches it from gradient computation.
TRL added loss_type="cispo" to GRPOTrainer, but Liger-Kernel did not support it, causing errors when using use_liger_kernel=True with loss_type="cispo".
Current Behavior
Using TRL GRPO with:
use_liger_kernel=Trueloss_type="cispo"
fails because Liger-Kernel does not currently implement CISPO for GRPO loss.
Expected Behavior
Liger-Kernel should support loss_type="cispo" for GRPO loss (at least via the chunked loss path), matching TRL's reference implementation.
Proposed Fix (PR #1054)
PR: https://github.com/linkedin/Liger-Kernel/pull/1054
Changes in the PR
src/liger_kernel/chunked_loss/grpo_loss.py
- Add CISPO loss matching TRL's implementation
- Clip importance sampling ratio with upper bound only and detach:
clamped_ratios = torch.clamp(coef_1, max=epsilon_high).detach()
- Clip importance sampling ratio with upper bound only and detach:
- Use DAPO-style normalization for CISPO reduction (consistent with TRL)
- Add CISPO-specific clip metric for logging compatibility:
- Count tokens where
(coef_1 > epsilon_high) & (advantages > 0)
- Count tokens where
src/liger_kernel/transformers/grpo_loss.py
- Add CISPO reduction logic (uses same normalizer as DAPO)
- Raise explicit error for Triton GRPO loss path (CISPO not supported there)
ops/grpo_loss (Triton fused path)
- CISPO is not implemented in
ops/grpo_lossin the PR loss_type="cispo"is only supported via chunked loss path (Triton fused support can be follow-up)
test/chunked_loss/test_grpo_loss.py
- Add CISPO to torch reference implementation (
TorchLMHeadGRPO) - Add
"cispo"to parameterized test cases to verify parity with reference
Testing Done (PR #1054)
- Hardware: RTX3090 24GB (NVIDIA Ampere)
- [x]
make test - [x]
make checkstyle - [x]
make test-convergence
Notes / Ask
- Could maintainers confirm whether accepting CISPO support via chunked loss path first is acceptable?
- On the PR, GitHub Actions runs show “Workflow runs completed with no jobs” (no CI executed). If maintainer approval is required for running workflows on external PRs, could you please approve / re-run CI for PR #1054?
References
- MiniMax-M1 (CISPO): https://arxiv.org/abs/2506.13585
- DAPO (normalization / reduction): https://arxiv.org/abs/2503.14476
- TRL CISPO implementation: https://github.com/huggingface/trl/blob/035c3ff151b953ca72cdfe0ee966bc1469a26fde/trl/trainer/grpo_trainer.py#L2030
Alternatives
No response
Additional context
No response
@Tcc0403
Hi, I opened this issue to track adding loss_type="cispo" support for GRPO (to match TRL’s GRPOTrainer).
I also opened PR #1054 with a proposed fix: CISPO is implemented via the chunked loss path.
Could you please confirm whether it’s acceptable to merge CISPO support via the chunked loss path first?
Thanks!
Thanks for the contribution!
Could maintainers confirm whether accepting CISPO support via chunked loss path first is acceptable? Sure, triton path can be in a follow-up PR.
On the PR, GitHub Actions runs show “Workflow runs completed with no jobs” (no CI executed). If maintainer approval is required for running workflows on external PRs, could you please approve / re-run CI for PR https://github.com/linkedin/Liger-Kernel/pull/1054?
Don't worry about the ci, I'll test it for you.
I'll review it soon, but maybe @Mecoli1219 can do a quick review first.
I haven't had a chance to run this on a GPU yet, but I've looked through the code and the papers. Overall, LGTM.
I left a few small notes on the files—mostly just checking some reference links and that ValueError logic. Once those are cleared up, @Tcc0403, would you mind testing it out?
@Mecoli1219
Thanks for the review! I've addressed the comments regarding the reference links. As for the ValueError, I've left a reply explaining why it's necessary (mainly because the Triton kernel doesn't support the CISPO per-token loss formula yet).