[algo] fix: remove torch.quantile-based percentile metrics to resolve tensor size limit error #3810
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3787 by removing
torch.quantile()-based percentile metrics (rollout_is_p25,rollout_is_p50,rollout_is_p75) that causedRuntimeError: quantile() input tensor is too largewhen using large batch sizes or response lengths.Problem
When using configurations with large tensor sizes (e.g.,
max_response_length: 32k,rollout.n: 16,train_batch_size: 16), thetorch.quantile()function fails with a runtime error due to PyTorch's internal tensor size limitations (~2^24 to 2^27 elements depending on version, GPU memory, and dtype).The error occurred in
verl/trainer/ppo/mismatch_helper.py:Solution
Removed the three quantile-based percentile metrics from the Rollout IS framework. The remaining metrics (
rollout_is_mean,rollout_is_std,rollout_is_min,rollout_is_max,rollout_is_eff_sample_size, etc.) provide sufficient monitoring capabilities for importance sampling health without triggering tensor size limitations.Changes
rollout_is_p25,rollout_is_p50,rollout_is_p75metric calculationsTesting
Verified that:
Resolves #3787