Skip to content

feat(browsecomp): per-rollout wall-clock limit and run timing summary - #4174

Merged
mjmikulski merged 15 commits into
mainfrom
mmikulski/browsecomp-rollout-timeout
Oct 15, 2026
Merged

mjmikulski merged 15 commits into
mainfrom
mmikulski/browsecomp-rollout-timeout

Conversation

@mjmikulski

@mjmikulski mjmikulski commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Why

BrowseComp rollouts have a long tail: a few samples run for many hours, so a run either cannot fit a fixed job allocation (we target 4 h per benchmark) or ends with samples never finished. This PR gives every rollout a hard wall-clock budget and makes it visible when the budget, rather than the model, shaped the score.

  • Hard per-rollout deadline (browsecomp_agent.rollout_timeout_s): covers model calls, tool calls and /tokenize, including response bodies. A rollout past the deadline stops, is scored 0 without a judge call and is stamped timed_out. Abandoning the in-flight call aborts the request in vLLM, so the GPU is freed.
  • Run timing summary (rollout_collection, opt-in): a small table, printed every timing_summary_interval_s, at the end and on SIGTERM. It flags runs where rollouts started late, hit the deadline too often, ran close to it, or queued on the model servers. Purely diagnostic: it never stops the run.

Validation

  • Unit tests: tests/unit_tests/test_run_timing.py, responses_api_agents/browsecomp_agent/tests (incl. stalled model/tool/body//tokenize cases); tests/unit_tests/test_rollout_collection.py unchanged and green. pre-commit clean, DCO signed.
  • Full BrowseComp (1266 samples), Nemotron Super 3.5, 8 × vLLM TP4, rollout_timeout_s=10800:
Run Score Hit limit Started by Runtime
Gym-native (this PR) 0.787 0.6% (7) 3.6 min 3h11
Same model, previous harness, no limit 0.794 – – 3h25

The 7 deadline hits produced Aborted request lines in the vLLM logs at the deadline.

Compatibility

No behaviour change unless rollout_timeout_s / dispatch_start_report_within_s are set (both default off).

@copy-pr-bot

copy-pr-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Comment thread nemo_gym/rollout_collection.py Resolved
@mjmikulski
mjmikulski marked this pull request as ready for review October 13, 2026 15:44
@mjmikulski
mjmikulski requested a review from ritugala October 13, 2026 15:44
@yaoyu-33 yaoyu-33 added area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters complexity:high Cross-component or shared-contract change with a large review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Oct 13, 2026
mjmikulski and others added 14 commits October 14, 2026 09:31
BrowseComp runs finish all but a handful of samples inside a 4 h Slurm
allocation; the stragglers (samples at the 400-step cap) force a requeue
that spends another allocation on a few rollouts. This adds the pieces for a
simpler methodology: every rollout gets a wall-clock budget and a rollout
that overruns it is scored wrong.

- browsecomp_agent: `rollout_timeout_s` stops the loop once the budget
  (measured from the first model call) is spent; the response carries
  `timed_out` and the agent does not retry such a rollout.
- browsecomp harness: a timed-out response is scored 0 without a judge call
  and reported as `timed_out` next to `num_tool_calls`, so the share of
  timed-out samples is visible in the aggregate metrics.
- rollout_collection: opt-in start-coverage report
  (`dispatch_start_report_within_s`, default threshold 99 %) logged when the
  window passes and in the end-of-run summary, plus a two-row timing table
  (this run vs healthy): all rollouts started by, started within the window,
  ended by wall-clock limit, longer than `long_rollout_s`. Diagnostic only;
  nothing is aborted.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
…nd on exit

A run killed at its allocation limit never reached the end-of-run summary,
which is exactly when the timing table matters. Print it every
timing_summary_interval_s (default 10 min, only when a start window or long
rollout threshold is configured) and move the final summary into the finally
block so a failed collection still reports it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
…eing dispatched

The timing table claimed "all rollouts started by" the time of the latest
start even when most rollouts had not started, and flagged the start window
as failed before it had elapsed. Until every rollout has started, report the
count started so far and mark the window open; judge it once the window is
over.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
…SIGTERM

- dispatch_all_started_within_s: separate deadline for the last rollout start
  (defaults to the start window), so a run can expect 98% of starts within
  30 min and every start within 45 min.
- On SIGTERM (Slurm time limit) print the timing summary before terminating;
  Python's default SIGTERM exits without unwinding, so the summary in the
  collection's finally never printed on a time-limit kill.
- Start-coverage line reads PENDING while its window is still open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
…n the agent

Review follow-up, same behaviour with a smaller footprint:
- The agent scores a timed-out rollout 0 itself and skips /verify, so the
  resources server is untouched; every row carries timed_out (0/1).
- The run timing table lives in a small RunTimingReport helper instead of
  extending DispatchLatencyTracker, which is back to its main version.
  The one-off live start warning is dropped; the periodic table covers it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
…onses

Through an Environment Server, /run returns a BaseEpisodeResponse with the
agent's result nested under 'result', so the timing summary saw no
timed_out flag and reported 0% while the stored rows (built after
unwrapping) carried it. Found on a 12-node GLM BrowseComp run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
…ode responses"

This reverts commit 4a9a0cc.

Signed-off-by: MJ Mikulski <[email protected]>
…ol calls

The wall-clock limit was only checked between steps, so a model or tool call
that hung kept its rollout running past the limit; on a 12-node GLM run 39
rollouts were still stuck in a single call when the 4h allocation ended (one
never finished its first model call). Each model and tool call now gets the
remaining budget; when it runs out the call is abandoned and the rollout ends
as timed out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
stdout is block-buffered when the driver writes to a log file, so the
periodic table only appeared when the buffer happened to fill; on a gym-native
BrowseComp run none of the tables showed up during the first 1h40.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
With server_queue_metrics_urls (the policy base_url list), collection polls
each vLLM server's /metrics every 30 s and reports summed waiting over summed
running requests across the run, with its peak, against
server_queue_max_waiting_ratio (default 0.1).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
Codex review: the deadline wrapped only server_client.post(), which returns
after headers, so a server stalling mid-body, or a stalled /tokenize call,
could keep a rollout past rollout_timeout_s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
@mjmikulski
mjmikulski force-pushed the mmikulski/browsecomp-rollout-timeout branch from 2ba8351 to 11b9f16 Compare October 14, 2026 07:32
@mjmikulski

Copy link
Copy Markdown
Contributor Author

/ok to test 11b9f16

@giuliolovisotto giuliolovisotto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two timeout-handling points below: distinguish the rollout deadline from a downstream timeout, and report an incomplete agent response when the deadline fires.

Source review at 11b9f161; tests not run.

try:
return await asyncio.wait_for(awaitable, max(0.0, deadline - time.monotonic()))
except asyncio.TimeoutError as e:
raise _RolloutDeadline() from e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait_for also propagates a TimeoutError raised by the wrapped call. This therefore turns a model/tool/tokenizer timeout into _RolloutDeadline even when the rollout still has budget, setting timed_out and taking the zero-without-judging path. Use an owned asyncio.timeout context and check .expired() before translating the exception; otherwise re-raise the original error. Please cover an immediate inner TimeoutError with a distant rollout deadline.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bf99f33: own asyncio.timeout, checked with .expired(); inner TimeoutError is re-raised. Test added for an immediate inner timeout with a distant deadline.

model_response.reset_count = reset_count
model_response.num_tool_calls = num_tool_calls
model_response.pre_reset_warning_steps = pre_reset_warning_steps
model_response.timed_out = timed_out

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A rollout that times out after a successful model call can retain that call's status="completed"; a timeout before the first reply leaves the constructed response's status unset. Set model_response.status = "incomplete" whenever timed_out is true, including the first-call case. Please test both paths so the timeout flag and standard response status agree.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bf99f33: status="incomplete" whenever timed_out, incl. the first-call case. Both paths tested.

…; mark cut rollouts incomplete

A TimeoutError raised inside a model, tool or /tokenize call no longer turns
into a rollout deadline while budget remains; it propagates as before
(infrastructure failure path). A timed-out rollout now always returns
status="incomplete", also when it is cut before the first model reply.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: MJ Mikulski <[email protected]>
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Oct 14, 2026
@mjmikulski

Copy link
Copy Markdown
Contributor Author

/ok to test bf99f33

@mjmikulski
mjmikulski added this pull request to the merge queue Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38721594302

Merged via the queue into main with commit ad2b0c3 Oct 15, 2026
52 checks passed
@mjmikulski
mjmikulski deleted the mmikulski/browsecomp-rollout-timeout branch October 15, 2026 10:55
ritugala pushed a commit that referenced this pull request Oct 19, 2026
…#4174)

## Why

BrowseComp rollouts have a long tail: a few samples run for many hours,
so a run either cannot fit a fixed job allocation (we target 4 h per
benchmark) or ends with samples never finished. This PR gives every
rollout a hard wall-clock budget and makes it visible when the budget,
rather than the model, shaped the score.

- **Hard per-rollout deadline** (`browsecomp_agent.rollout_timeout_s`):
covers model calls, tool calls and `/tokenize`, including response
bodies. A rollout past the deadline stops, is scored 0 without a judge
call and is stamped `timed_out`. Abandoning the in-flight call aborts
the request in vLLM, so the GPU is freed.
- **Run timing summary** (`rollout_collection`, opt-in): a small table,
printed every `timing_summary_interval_s`, at the end and on SIGTERM. It
flags runs where rollouts started late, hit the deadline too often, ran
close to it, or queued on the model servers. Purely diagnostic: it never
stops the run.

## Validation

- Unit tests: `tests/unit_tests/test_run_timing.py`,
`responses_api_agents/browsecomp_agent/tests` (incl. stalled
model/tool/body/`/tokenize` cases);
`tests/unit_tests/test_rollout_collection.py` unchanged and green.
`pre-commit` clean, DCO signed.
- Full BrowseComp (1266 samples), Nemotron Super 3.5, 8 × vLLM TP4,
`rollout_timeout_s=10800`:

| Run | Score | Hit limit | Started by | Runtime |
|---|---|---|---|---|
| Gym-native (this PR) | 0.787 | 0.6% (7) | 3.6 min | 3h11 |
| Same model, previous harness, no limit | 0.794 | – | – | 3h25 |

The 7 deadline hits produced `Aborted request` lines in the vLLM logs at
the deadline.

## Compatibility

No behaviour change unless `rollout_timeout_s` /
`dispatch_start_report_within_s` are set (both default off).

---------

Signed-off-by: MJ Mikulski <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
(cherry picked from commit ad2b0c3)
HeyyyyyyG pushed a commit that referenced this pull request Oct 19, 2026
…#4174)

## Why

BrowseComp rollouts have a long tail: a few samples run for many hours,
so a run either cannot fit a fixed job allocation (we target 4 h per
benchmark) or ends with samples never finished. This PR gives every
rollout a hard wall-clock budget and makes it visible when the budget,
rather than the model, shaped the score.

- **Hard per-rollout deadline** (`browsecomp_agent.rollout_timeout_s`):
covers model calls, tool calls and `/tokenize`, including response
bodies. A rollout past the deadline stops, is scored 0 without a judge
call and is stamped `timed_out`. Abandoning the in-flight call aborts
the request in vLLM, so the GPU is freed.
- **Run timing summary** (`rollout_collection`, opt-in): a small table,
printed every `timing_summary_interval_s`, at the end and on SIGTERM. It
flags runs where rollouts started late, hit the deadline too often, ran
close to it, or queued on the model servers. Purely diagnostic: it never
stops the run.

## Validation

- Unit tests: `tests/unit_tests/test_run_timing.py`,
`responses_api_agents/browsecomp_agent/tests` (incl. stalled
model/tool/body/`/tokenize` cases);
`tests/unit_tests/test_rollout_collection.py` unchanged and green.
`pre-commit` clean, DCO signed.
- Full BrowseComp (1266 samples), Nemotron Super 3.5, 8 × vLLM TP4,
`rollout_timeout_s=10800`:

| Run | Score | Hit limit | Started by | Runtime |
|---|---|---|---|---|
| Gym-native (this PR) | 0.787 | 0.6% (7) | 3.6 min | 3h11 |
| Same model, previous harness, no limit | 0.794 | – | – | 3h25 |

The 7 deadline hits produced `Aborted request` lines in the vLLM logs at
the deadline.

## Compatibility

No behaviour change unless `rollout_timeout_s` /
`dispatch_start_report_within_s` are set (both default off).

---------

Signed-off-by: MJ Mikulski <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
(cherry picked from commit ad2b0c3)
(cherry picked from commit 8e94199)

This branch was previously deployed

1 inactive deployment
public — bf99f335 Deployed Oct 14, 2026 by copy-pr-bot[bot] via release / finalize / notify #5305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters complexity:high Cross-component or shared-contract change with a large review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants