Skip to content

fix(rollout): guard round(None) in zero-std metric aggregation#2

Closed
DavidBellamy wants to merge 1 commit intomainfrom
fix/guard-round-none-in-zero-std-metrics
Closed

fix(rollout): guard round(None) in zero-std metric aggregation#2
DavidBellamy wants to merge 1 commit intomainfrom
fix/guard-round-none-in-zero-std-metrics

Conversation

@DavidBellamy
Copy link
Copy Markdown
Collaborator

Problem

_compute_zero_std_metrics in miles/ray/rollout.py crashes RolloutManager.generate() with a TypeError when any zero-std group's leading sample has a None reward:

ray.exceptions.RayTaskError(TypeError): ray::RolloutManager.generate()
  File "/root/miles/miles/ray/rollout.py", line 1266, in _compute_zero_std_metrics
    interesting_rewards = [str(round(g[0].get_reward_value(args), 1)) for g in interesting_sample_groups]
TypeError: type NoneType doesn't define __round__ method

This fires inside _log_rollout_data, after rollout collection and dynamic_sampling_filter have already accepted the batch. The trainer actor never receives the batch, so optimizer.step() never runs and async RL silently stalls.

Samples with Status.ABORTED carry reward=None (Daytona sandbox timeout, tool-invocation loops, agent LimitsExceeded, etc.), so any grouping of aborted trials triggers this path on GRPO-style runs.

Fix

Extract a small _reward_label helper that buckets None rewards under a dedicated "none" label instead of passing None to round(). Keeps the metric informative (zero_std/count_none shows the aborted-group count) and preserves existing behavior for numeric rewards.

Test

Smoke-checked the helper locally against numeric, float-rounding, and None cases:

assert _reward_label(MockSample(0.7)) == '0.7'
assert _reward_label(MockSample(0.0)) == '0.0'
assert _reward_label(MockSample(None)) == 'none'
assert _reward_label(MockSample(0.456)) == '0.5'

Context

Observed on LLM360/RL360#76 FAST_ITER smoke runs (GLM-4.7-Flash, agentic terminal-bench tasks) on M2. Multiple iter jobs (1559799, 1559800) reached Finish rollout successfully but crashed at this exact call site during metric aggregation. Post-fix, the trainer should receive the collected batch and fire optimizer.step() as expected.

_compute_zero_std_metrics crashes with TypeError when any zero-std group's
leading sample has a None reward (typical for Status.ABORTED trials):

  File "miles/ray/rollout.py", line 1266, in _compute_zero_std_metrics
    interesting_rewards = [str(round(g[0].get_reward_value(args), 1)) ...]
  TypeError: type NoneType doesn't define __round__ method

This crash fires on RolloutManager.generate() inside _log_rollout_data,
after the rollout collection + dynamic sampling filter have already
accepted the batch. With agentic tasks where some trials routinely abort
(Daytona sandbox timeout, tool-invocation loops, etc.), the trainer never
receives the batch and optimizer.step() never fires, so async RL training
silently stalls.

Fix: extract a _reward_label helper that buckets None-reward samples under
a dedicated 'none' label instead of passing None to round(). This keeps
the metric informative (zero_std/count_none shows the aborted-group count)
and preserves the existing behavior for numeric rewards.

Observed on LLM360/RL360 radixark#76 FAST_ITER smoke runs (job 1559799) with
GLM-4.7-Flash on agentic terminal-bench tasks.
@DavidBellamy
Copy link
Copy Markdown
Collaborator Author

Re-opening against radixark/miles:main so the LLM360/miles deploy branch auto-builder picks it up (the workflow at .github/workflows/maintain-deploy.yml queries PRs on the radixark upstream with LLM360 head branches). Same branch, same diff.

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