Skip to content

[Fix] Document rollout IS thresholds as (upper, lower) pairs - #2329

Open
matrix72c wants to merge 1 commit into
InternLM:mainfrom
matrix72c:fix/rollout-is-docstring
Open

matrix72c wants to merge 1 commit into
InternLM:mainfrom
matrix72c:fix/rollout-is-docstring

Conversation

@matrix72c

Copy link
Copy Markdown
Contributor

Root Cause

The RolloutImportanceSampling docstring describes rollout_is_threshold, rollout_is_mask_threshold and rollout_is_veto_threshold as (lower, upper) pairs. compute_rollout_importance_weights actually unpacks them as upper, lower = threshold and asserts upper > lower, so the documented example rollout_is_threshold=(0.8, 1.2) fails on the first training step with AssertionError: upper_threshold must be greater than lower_threshold. The docstring also says the veto rejects "a rollout group", but the veto mask is per sequence: a sequence with any token outside the veto thresholds is dropped, and the other sequences are kept.

Fix

This is a documentation-only change; behavior is unchanged.

  • Describe all three thresholds as (upper, lower), and document that None disables IS, that a None mask threshold falls back to rollout_is_threshold, and that a None veto threshold disables the veto.
  • List the valid level values (token / sequence / geometric) and mode values (truncate / mask / both).
  • Change the example to (1.2, 0.8).
  • Change the module summary line from "per-token veto" to "per-sequence veto".

Test Plan

New file tests/loss/test_rollout_is_thresholds.py:

  • The documented example clamps token weights to [0.8, 1.2].
  • A (lower, upper) pair is rejected.
  • The veto drops only the sequence that contains an outlier token.

pytest tests/loss/test_rollout_is_thresholds.py tests/loss/test_rollout_is_out_of_place.py passes on CPU, and ruff check / ruff format --check are clean.

ProduceBatchResult impact: not affected (docstring and tests only).

The RolloutImportanceSampling docstring described every threshold as a
(lower, upper) pair and its example used (0.8, 1.2), which trips the
upper > lower assertion in compute_rollout_importance_weights. It also
described the veto as rejecting a rollout group, while it drops single
sequences.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant