verl icon indicating copy to clipboard operation
verl copied to clipboard

[sglang, rollout] fix: use right padding for response_position_ids

Open JobQiu opened this issue 2 months ago • 0 comments

Fixes #4159

  • Changed response_position_ids padding from left to right
  • Ensures alignment with response_ids for variable-length sequences
  • Critical for 2D position_ids in multimodal models (e.g., Qwen2-VL)
  • Added comprehensive unit tests covering 1D and 2D cases

The bug caused misalignment when batch contained sequences of different lengths, as response_ids used right padding but response_position_ids used left padding.

JobQiu avatar Nov 23 '25 04:11 JobQiu