Skip to content

Add BenchFlow environment and SkillsBench benchmark - #1870

Draft
ludwig-n wants to merge 43 commits into
mainfrom
ludwig-n/benchflow
Draft

ludwig-n wants to merge 43 commits into
mainfrom
ludwig-n/benchflow

Conversation

@ludwig-n

@ludwig-n ludwig-n commented Jul 1, 2026

Copy link
Copy Markdown

Adds a new benchflow_agent agent server integrating the BenchFlow framework into NeMo-Gym, and adds the SkillsBench benchmark that runs through it.

Supports running BenchFlow through Singularity/Apptainer containers via a custom fork of BenchFlow that adds support for Singularity.

For details on how to run, see the README for benchflow_agent.

Evaluation results compared to the official SkillsBench leaderboard:

Model Skills Run 1 Run 2 Run 3 Run 4 Run 5 Avg of 5 Leaderboard
MiniMax-M2.7 With Skills 36.0 33.4 31.6 38.0 29.4 33.7 34.9
MiniMax-M2.7 No Skills 17.0 13.2 17.1 19.9 20.1 17.4 18.1

Note that the leaderboard reports an average over 3 runs. Both my runs and the official runs use OpenHands as the harness. To adapt for the cluster hardware setup, I increased the memory limit to 128 MB and disabled the timeout on the agent rollout for all tasks.

ludwig-n added 30 commits June 15, 2026 22:17
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
ludwig-n added 4 commits July 1, 2026 19:22
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
Signed-off-by: Nikolai Ludwig <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Jul 1, 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.

Signed-off-by: Nikolai Ludwig <[email protected]>
@ritaneves ritaneves linked an issue Jul 2, 2026 that may be closed by this pull request
ludwig-n added 3 commits July 3, 2026 18:21
Signed-off-by: Nikolai Ludwig <[email protected]>
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Jul 17, 2026
@cmunley1

Copy link
Copy Markdown
Contributor

/claude review

@cmunley1 cmunley1 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.

@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

SHIP — no reliability concerns.

New benchflow_agent responses-API agent + skillsbench benchmark. Reviewed against the on-call bar (verifier/scorer correctness, async correctness, public-API compatibility, config/dep hygiene, coverage). It faithfully mirrors the established harbor_agent in every load-bearing way, so the risky surfaces are already patterned:

  • Scorer correctness. extract_reward is defensive: non-dict / missing / non-numeric reward → 0.0, otherwise float(reward). Reward is computed independently of trajectory extraction — a trajectory-parse failure is caught and only zeroes output, never the reward (app.py:411, covered by test_run_trajectory_extraction_error_is_swallowed). Total-failure path returns reward=0.0 with global_error metadata, same convention as harbor_agent.
  • Async correctness. /run is async, bounded by asyncio.Semaphore(concurrency). await evaluation.run() is properly awaited (no bare-coroutine footgun). No httpx.AsyncClient, no ray.get() in async context. Heavy benchflow import is lazy (inside _run_evaluation), so the core lib stays importable without it — declared in the agent's own requirements.txt per the harbor pattern.
  • Public API. Subclasses SimpleResponsesAPIAgent, implements responses() (raises NotImplementedError, acceptable for a run-only agent) and run(). No base-class surface removed or renamed.
  • Config hygiene. Pydantic defaults are duplicated in the exemplar YAML (configs/benchflow_agent.yaml), matching harbor_agent's convention. container_formatter/task_config_overrides merge logic is deep-copied (no config mutation — test_build_task_config_overrides_does_not_mutate_config) and container path wins over task.md.
  • Coverage. 575-line test suite exercises reward/usage/trajectory extraction, frontmatter merge, temp-copy isolation, and all run() branches. Good.

Two NOTE-level trajectory-extraction fragilities posted inline (structured content parts → KeyError; tail subprocess dependency + no errors="replace"). Both are contained by the try/except around extract_trajectory, so worst case is a dropped training trajectory, not a corrupted score — author's call.


for message in messages:
if isinstance(message.get("content"), list):
message["content"] = "".join(elem["text"] for elem in message["content"])

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.

NOTE: "".join(elem["text"] for elem in message["content"]) assumes every list element is a dict with a "text" key. BenchFlow/vLLM content parts can include non-text types (e.g. image_url, tool-result blocks, or {"type": "text", ...} variants that store the string elsewhere) — any such part raises KeyError/TypeError.

BLAST RADIUS: contained — extract_trajectory is called inside a try/except in run() (app.py:411), so a raised exception only drops the trajectory to []; reward and usage still come through. Not a scoring bug, but it silently zeroes out training-signal trajectories for any task whose final exchange has structured content.

FIX: guard the extraction, e.g. "".join(e.get("text", "") for e in message["content"] if isinstance(e, dict)).

if not trajectory_file.is_file():
return []

last_line = subprocess.check_output(["tail", "-1", str(trajectory_file)], text=True).strip()

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.

NOTE: extract_trajectory shells out to tail -1 via subprocess.check_output(["tail", ...]). This adds a hard dependency on the tail binary being on PATH (fine on Linux, but a needless external process per rollout) and does not decode with errors="replace", so a non-UTF8 byte in the trajectory file raises UnicodeDecodeError. Reading the last line in pure Python (or text=True, errors="replace") avoids both. Contained by the try/except in run(), so worst case is a dropped trajectory, not a bad reward.

@staticmethod
def _parse_task_name(instance_id: str) -> str:
"""Extracts the task name from an instance id of form '<alias>::<task>' or '<task>'."""
head, sep, tail = instance_id.partition("::")

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.

This accepts absolute paths and .. components, and task_name is later used in job_name and filesystem joins. Can we restrict it to a task-directory basename and verify the resolved task path remains under tasks_dir

response["output"] = []
metadata["global_error"] = error_message

return BenchFlowVerifyResponse(

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.

should it preserve instance_id and any other extra input row fields

@@ -0,0 +1,4 @@
-e nemo-gym[dev] @ ../../
# Fork based on BenchFlow v0.6.3. Branch: `gym`
benchflow @ git+https://github.com/ludwig-n/benchflow@a7ccd891e4fb924f616777b49ddebc295c4c2570

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.

The pinned fork uses host-side httpx.AsyncClient in its Singularity and ACP transports. Gym requires async HTTP to use the shared aiohttp transport because httpx pooling can hang under concurrency. Could we adapt these transports if possible

@cmunley1 cmunley1 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.

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Aug 17, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Oct 20, 2026
@yaoyu-33
yaoyu-33 marked this pull request as draft November 18, 2026 02:13
@yaoyu-33

Copy link
Copy Markdown
Contributor

We’re doing some cleanup of the open PR list. This PR has had no activity for over a month, so I’ve moved it back to draft.

If this change is still needed, please resolve any merge conflicts and mark the PR ready for review again when it’s ready to merge. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants