Repository navigation
feat(eval): report timed-out rollouts in the run health summary #4841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
AdamRajfer
merged 27 commits into
NVIDIA-NeMo:main
from
AdamRajfer:eval/time-limit-detection
Oct 27, 2026
Merged
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
623d7d7
feat(eval): count rollouts that ran out of time in the aggregate metrics
AdamRajfer 7a4900c
fix(eval): write the time-limit section atomically
AdamRajfer 025cc39
Merge main into eval/time-limit-detection
AdamRajfer e34f2ca
feat(eval): report timed-out rollouts in the run health summary
AdamRajfer 46ff2ed
docs(eval): document run.stats.timeouts on the rollout health page
AdamRajfer e321fc3
refactor(eval): rework the timeouts section of the run health summary
AdamRajfer a440c9f
docs(eval): describe the typed timeout record by what it is
AdamRajfer 40c754a
fix(health): keep the timeouts section safe on malformed rows and ove…
AdamRajfer 0c58077
docs(health): a typed timeout event goes on the row
AdamRajfer cb1a6f8
Merge main into the PR branch
AdamRajfer b2b90e8
fix(health): time a failed rollout from its capture file
AdamRajfer 807cbe7
fix(health): one timeout classifier and a safe, linear capture join
AdamRajfer 5ef88a4
fix(health): read gap codes safely, and count unread transcripts and …
AdamRajfer fae3eec
fix(health): leave tool time unknown when an agent observed no tools,…
AdamRajfer 96f9297
fix(health): leave the time split unknown when part of its evidence w…
AdamRajfer d10106d
fix(health): count a malformed timeouts value, and leave an unidentif…
AdamRajfer b4709b6
Merge main into eval/time-limit-detection
AdamRajfer 66cc37d
fix(health): leave tool time unknown when OpenCode drops a tool for i…
AdamRajfer 87b123c
test(health): move the agent-parser timeout tests to the agents' suites
AdamRajfer fe4e9a4
fix(health): count a Terminus 2 rollout stopped by its run budget as …
AdamRajfer b1bffd4
fix(anyswe): parse colored R2E pytest summaries
svcnemo-autobot f194f10
Merge main into eval/time-limit-detection
AdamRajfer 7244137
fix(health): preserve configured policy identity in timeout timing
AdamRajfer 6cdb72e
fix(health): classify episode timeouts consistently in live timing
AdamRajfer ed7e5db
Merge main into timeout diagnostics and verify shard rechecks
AdamRajfer 9590ba0
Merge main into timeout diagnostics
AdamRajfer dec7c37
Merge branch 'main' into eval/time-limit-detection
AdamRajfer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| """Count the rollouts of a run that ran out of time, and how long they took. | ||
|
|
||
| A rollout that runs out of time scores as a failure of the evaluated model, whatever made it slow. | ||
| This module reads what a run already recorded about each rollout (its failure labels, its timeout | ||
| flags and its wall clock) into a ``time_limit`` section of the aggregate metrics. It only reads rows: | ||
| it changes no classification, reward or row. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import math | ||
| from typing import Any, Iterable, Mapping, Optional | ||
|
|
||
| from nemo_gym.metrics_config import Stat | ||
| from nemo_gym.reward_profile import _stat | ||
|
|
||
|
|
||
| # Collector key with the `/run` wall clock of one rollout, success or failure, in seconds. | ||
| NG_ELAPSED_S_KEY = "_ng_elapsed_s" | ||
|
|
||
| # Labels that already say a rollout ran out of time. | ||
| _TIMEOUT_LABELS = frozenset({"timeout_exceeded", "agent_timeout", "transport_timeout"}) | ||
| # The failure an environment server's own episode deadline records (BaseEnvironmentServer). | ||
| _EPISODE_DEADLINE_REASON = "Episode timed out" | ||
| # Agent flags that already say the agent, the task or a test run ran out of time. | ||
| _TIMEOUT_FLAGS = ("timed_out", "agent_timed_out", "_ng_agent_timed_out", "agent_timeout_error", "eval_timed_out") | ||
|
|
||
|
|
||
| def _number(value: Any) -> Optional[float]: | ||
| if isinstance(value, bool) or not isinstance(value, (int, float)): | ||
| return None | ||
| value = float(value) | ||
| return value if math.isfinite(value) else None | ||
|
|
||
|
|
||
| def _round(value: Optional[float]) -> Optional[float]: | ||
| return None if value is None else round(value, 4) | ||
|
|
||
|
|
||
| def _quantile(values: list[float], stat: str) -> Optional[float]: | ||
| return _round(_stat(values, stat)) if values else None | ||
|
|
||
|
|
||
| def rollout_elapsed_s(row: Mapping[str, Any]) -> Optional[float]: | ||
| """The `/run` wall clock rollout collection stamped on this row, in seconds.""" | ||
| value = _number(row.get(NG_ELAPSED_S_KEY)) | ||
| return value if value is not None and value > 0 else None | ||
|
|
||
|
|
||
| def _policy_call_timed_out(row: Mapping[str, Any]) -> bool: | ||
| capture = row.get("ng_model_call_capture") | ||
| calls = capture.get("calls") if isinstance(capture, Mapping) else None | ||
| return any(isinstance(call, Mapping) and call.get("error_category") == "timeout" for call in calls or []) | ||
|
|
||
|
|
||
| def ran_out_of_time(row: Mapping[str, Any]) -> bool: | ||
| """Whether a label, flag or termination record the row already carries says it ran out of time. | ||
|
|
||
| A failed rollout one of whose captured model calls timed out counts too. | ||
| """ | ||
| failed = isinstance(row.get("_ng_failure_class"), str) | ||
| labels = {row.get("_ng_failure_class"), row.get("failure_kind")} | ||
| termination = row.get("termination") | ||
| return ( | ||
| bool(labels & _TIMEOUT_LABELS) | ||
| or (failed and row.get("_ng_failure_message") == _EPISODE_DEADLINE_REASON) | ||
| or any(bool(row.get(name)) and _number(row.get(name)) != 0 for name in _TIMEOUT_FLAGS) | ||
| # A sandboxed agent's own termination record, as Terminal-Bench writes it. | ||
| or (isinstance(termination, Mapping) and termination.get("reason") == "timeout") | ||
| or (failed and _policy_call_timed_out(row)) | ||
| ) | ||
|
|
||
|
|
||
| def summarize_time_limits(rows: Iterable[Mapping[str, Any]]) -> dict[str, Any]: | ||
| """Count the rollouts that ran out of time and summarize their wall clock. | ||
|
|
||
| ``rows`` are the final record of every rollout: the scored rows and the last failures-sidecar | ||
| attempt of each rollout that never succeeded. | ||
| """ | ||
| rows = list(rows) | ||
| timed_out = [row for row in rows if ran_out_of_time(row)] | ||
| elapsed = [value for value in map(rollout_elapsed_s, timed_out) if value is not None] | ||
| return { | ||
| "timed_out": len(timed_out), | ||
| "timed_out_share": _round(len(timed_out) / len(rows)) if rows else None, | ||
| "timed_out_elapsed_s_p50": _quantile(elapsed, Stat.MEDIAN), | ||
| "timed_out_elapsed_s_p95": _quantile(elapsed, "p95"), | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.