You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CISPOLoss drops out-of-range token gradients instead of detaching IS weights #4664
CISPOLoss differentiates through the clamped importance ratio, which zeroes the policy gradient whenever a token's ratio is outside the clip interval. This contradicts CISPO's defining purpose of preserving those token updates.
A real trainable two-class linear token policy, wrapped as a TensorDictModuleBase with a TensorDictModule and native LLMMaskedCategorical, emits probabilities [0.2, 0.8]. Score token 0 with advantage 1, one valid token and clip_epsilon=0.2. Public CISPOLoss(policy, entropy_bonus=False)(data) and backward produce:
Current/behavior ratio
Actual logit gradient
Equation 4 gradient
0.5
[0, 0]
[-0.64, +0.64]
1.0
[-0.8, +0.8]
[-0.8, +0.8]
2.0
[0, 0]
[-0.96, +0.96]
This uses real distribution scoring and autograd, not a mocked loss or fixed log-probability echo. Python 3.12, PyTorch 2.15.0+cpu, TensorDict 0.15.4. The unavailable optional C++ extension is not used by this path.
Focused fix plan
Pass the already-computed current token log-probabilities into the private objective hook. CISPO detaches clipped importance weights and multiplies them by current log-probabilities and advantages. Keep ordinary GRPO/DAPO clipping, masks, KL terms and aggregation unchanged. Add native trainable-policy regressions comparing both loss and parameter gradients with equation 4, covering clipped/unclipped ratios, advantage signs and padding.
Related open GSPO work #4652/#4653 adds a different objective; its patch does not repair CISPO. Merged #4164 only strengthened forward-value tests, which do not detect this gradient error. No duplicate fix or specific ownership claim was found in the searched issues/PRs.
I supervised and checked the AI-assisted work as it progressed. AI assistance was used for investigation and reproduction. No maintainer review or approval is claimed. No CLA has been signed by an agent; any required acceptance remains an account-holder action.
Activity