Reinforcement Learning2025

CISPO

MiniMax-M1 / CISPO: Clipped Importance Sampling Policy Optimization MiniMax Team arXiv

CISPO lets useful tokens keep contributing when GRPO would stop reinforcing them.

Why it mattered

PPO and GRPO clip the objective via min⁡(rtAt, clip⁡(rt)At)\min(r_t A_t,\, \operatorname{clip}(r_t) A_t), which sets the gradient to exactly zero on any token whose ratio crosses the clip boundary. MiniMax-M1 noticed that low-probability reasoning pivot tokens ('Wait', 'However', 'Let me double check') get clipped out early and stop learning — especially when rollouts arrive 1 step behind the latest weights.

Core insight

Apply a stop-gradient clipped importance weight directly to the policy gradient: LCISPO(θ)=−E ⁣[sg⁡ ⁣(clip⁡(rt,1−εlow,1+εhigh))Atlog⁡πθ(yt∣x,y<t)]\mathcal{L}_{\text{CISPO}}(\theta) = -\mathbb{E}\!\left[\operatorname{sg}\!\left(\operatorname{clip}(r_t, 1 - \varepsilon_{\text{low}}, 1 + \varepsilon_{\text{high}})\right) A_t \log \pi_\theta(y_t \mid x, y_{<t})\right] Every token still contributes a bounded gradient, keeping reasoning diversity intact while a background worker overlaps rollouts with GPU updates.

losses.CISPO(clip_low=0.2, clip_high=0.28) is a built-in Trainer loss — pair it with trainer.snapshot() and a 1-slot ThreadPoolExecutor to overlap sampling with GPU backward/optim steps and release snapshots cleanly.

When to use

Choose CISPO when running asynchronous or slightly off-policy RL loops where PPO's hard clip zeroes out gradients on crucial reflection tokens (like 'Wait' or 'Check'). If your rollout staleness exceeds 2 to 4 steps, fall back to standard clipped PPO for safety.

Step-by-step walkthrough

  1. 01

    Pin a snapshot and prefetch next-step rollouts in a background thread

    Call trainer.snapshot() and submit env.rollout_groups(snap, ...) to a 1-worker ThreadPoolExecutor so rollouts overlap with the GPU backward pass. Overlapping rollout generation with GPU backward hides sampling latency behind gradient computation.

    snap = trainer.snapshot(); pending = pool.submit(env.rollout_groups, snap, tasks=next_chunk, group_size=8)
  2. 02

    Step with built-in losses.CISPO()

    Pass losses.CISPO(clip_low=0.2, clip_high=0.28) — stop-gradient clipped importance weights preserve gradients on low-probability reflection tokens. Stop-gradient clipping caps weight magnitude without erasing the log-probability gradient on rare pivot tokens.

    trainer.forward_backward(batch, loss=losses.CISPO(clip_low=0.2, clip_high=0.28))
  3. 03

    Release old snapshots as soon as rollouts finish

    Call old_snap.release() after awaiting its rollouts so the trainer never hits max_snapshots. Releasing each snapshot immediately after its batch completes keeps the trainer's snapshot pool uncluttered.

    old_snap.release()

Implementation

train.py
from concurrent.futures import ThreadPoolExecutor
import grad
from grad import Environment, Grad, Rubric, Scorer, Task, adapters, advantages, losses, optim, validators

client = Grad()
ds = client.datasets.from_hf("openai/gsm8k", config="main", split="train", prompt="question", answer="answer", limit=2560)
tasks = [Task(id=str(i), prompt=r["messages"][0]["content"], expected_output=r["expected_output"]) for i, r in enumerate(ds.records())]
batches = [tasks[i : i + 32] for i in range(0, len(tasks), 32)]
env = Environment(
    rubric=Rubric([Scorer("math", fn=validators.MathEquivalence())]),
    max_turns=1,
    system_prompt="Solve step by step and end with \\boxed{...}.",
)

with (
    client.trainers.create(
        model="qwen/qwen3-8b",
        name="cispo-async",
        adapter=adapters.LoRA(rank=32),
        total_steps=len(batches),
        max_cost_usd=10.0,
    ) as trainer,
    ThreadPoolExecutor(max_workers=1) as pool,
):
    cur_snap = trainer.snapshot()
    pending = pool.submit(env.rollout_groups, cur_snap, tasks=batches[0], group_size=8, max_tokens=1024, temperature=1.0)
    for step in range(1, len(batches) + 1):
        groups, old_snap = pending.result(), cur_snap
        if step < len(batches):
            cur_snap = trainer.snapshot()
            pending = pool.submit(env.rollout_groups, cur_snap, tasks=batches[step], group_size=8, max_tokens=1024, temperature=1.0)
        old_snap.release()
        batch = grad.with_advantages(groups, advantages.GroupStd())
        if not batch:
            continue
        fb = trainer.forward_backward(batch, loss=losses.CISPO(clip_low=0.2, clip_high=0.28))
        opt = trainer.optim_step(optim.AdamW(lr="auto", objective="rl"))
        fb_res, opt_res = fb.result(), opt.result()
        trainer.log_metrics(opt_res.step, {"reward": grad.mean_reward(groups), "loss": fb_res.loss})
    cur_snap.release()
    artifact = trainer.export(name="cispo-async").result().artifact

Benchmarks

Reported results from the original paper compared against its baseline.

AIME 2024 pass@1Qwen2.5-32B RL (CISPO vs. DAPO at matched compute)
+6.2 pts
DAPO (matched steps)49%
CISPO55.2%
Training convergence speedSteps to target reasoning score (CISPO vs. DAPO)
2.0× faster
DAPO baseline1×
CISPO2×

Models & datasets

ModelDurationEst. cost
Qwen3 8Brecommendedqwen/qwen3-8b
~20 min~$1.60
Qwen3 4Bfast smoke runqwen/qwen3-4b
~10 min~$0.80
Qwen3.5 9Bqwen/qwen3.5-9b
~24 min~$1.95
DatasetSourceSize
GSM8K MathHugging Face7,473 train / 1,319 test

Practical gotchas

  • Keep off-policy staleness tight (lag=1\text{lag} = 1 step). For heavily stale async rollout pools (>2–4> 2\text{–}4 steps behind), prefer losses.PPO() so extreme importance weights are hard-clipped.
  • Always release finished snapshots (snap.release()) or set max_snapshots on client.trainers.create() to keep GPU snapshot slots free.
  • Log clip_fraction alongside reward in grad runs watch: if more than 25% of tokens hit the stop-gradient cap, tighten lr or reduce rollout lag to 1 step so off-policy drift does not accumulate.

grad primitives