Skip to content

feat(inspect): add an Environment Server that runs one Inspect sample per episode - #6930

Draft
cwing-nvidia wants to merge 1 commit into
cwing/inspect/task-preparefrom
cwing/inspect/environment-server
Draft

cwing-nvidia wants to merge 1 commit into
cwing/inspect/task-preparefrom
cwing/inspect/environment-server

Conversation

@cwing-nvidia

@cwing-nvidia cwing-nvidia commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Goal of the stack (#6683): run an eval written for Inspect AI in Gym without porting it. The eval's dataset, solver and scorer run as written; Gym serves the model and records every model call.

PR 3 of 5. This PR runs the samples. It is the large one; environment_servers/inspect/README.md is the guide to it.

What

  • environment_servers/inspect: the server, a pool of workers, and a relay that sends each worker's model calls to the Model Server under its episode.
  • The eval's dataset, solver and scorer run as written. No per-eval code.

How samples are scored

What happened Result
Scored Reward is the first scorer's value
A model call failed Masked
Scorer returned no value Masked, counted as unscored, as in Inspect
The eval's code raised The episode fails
An error every sample would hit (rejected key, unrouted model) The run stops

The eval's own metrics are computed by Inspect, once per repeat.

Validation

  • pytest environment_servers/inspect/tests: 127 passed. Real workers and a real server, stub model endpoint.
  • Same 8 BBQ samples through Gym and through inspect eval against one stub: scores and metrics identical.
  • pre-commit run --all-files passes.

Rollout evidence: real-model runs are in PR 5.

Compatibility: additive. Not supported: evals that need a sandbox, streamed model replies, more than one server process.

@copy-pr-bot

copy-pr-bot Bot commented Nov 30, 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.

@cwing-nvidia
cwing-nvidia added this pull request to stack #6933 November 30, 2026 04:50
@cwing-nvidia cwing-nvidia added area:env-infra Shared environment framework, lifecycle, registry, scaffolding, and validation feature New capabilities, enhancements, or enablement work labels Nov 30, 2026
@cwing-nvidia

Copy link
Copy Markdown
Contributor Author

/ok to test d036dde

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:high Autobot PR risk: high label Nov 30, 2026
… per episode

Adds environment_servers/inspect: the server, a pool of long-lived Inspect workers, and a relay that sends every model call of a worker to the Model Server under the episode it belongs to.

A worker loads its task once and runs samples one after another. Each model request names its episode: through an Inspect hook for calls made with an Inspect model, and through the OpenAI SDK for calls the eval's code makes itself. The server relays the request to the Model Server of the model under test, of a judge, or of a model role, so the captured calls are the episode's trajectory.

Reward is the first scorer's value, reduced over epochs with the task's reducer. The task's own metrics are computed by Inspect once per repeat. A failed model call masks the sample, an error in the eval's code fails the episode, and a refused model request, a changed sample or a model call that is not routed to Gym stops the run. Rows that arrive after a stop are not charged an attempt.

The tests run real workers against a real server over HTTP, with a stub model endpoint.

A sample its reward scorer returned no value for (Inspect's NaN, as when a judge's reply holds no grade) is a
masked result with failure kind inspect:unscored, not a failure: Inspect keeps such a sample, leaves it out of
the scorer's metrics and counts it. Its row still goes to Inspect for the task's metrics, and the count is
reported as inspect/<task>/<scorer>/unscored_samples. reward_if_unscored gives the sample a reward in place of
the mask. A reward scorer the sample has no numeric score for still fails the episode.

The task's metrics are computed from the loaded task's own metric objects, not rebuilt from the names a log
header records: Inspect's registry holds one metric per name, so two evals of a package that each define a
metric of one name resolve to whichever was registered last. A metrics step that fails is reported as
inspect/metrics_error in the aggregate metrics.

An unscored row has no reward, so Gym's coverage counts it as unscored. Tools sent through Inspect's
OpenAI-compatible provider are not marked strict unless strict_tools is set, for the model under test and for
judges alike: that provider turns it on by default, and an endpoint that follows OpenAI's strict mode then
refuses a tool with an optional parameter.

The strict_tools and send-once defaults are applied before the task loads, so a judge built at load is covered.

Samples are handed to Inspect in dataset order, not in the order rows were written, so a metric that sums
floating-point numbers is the same on every run of the same samples.

Signed-off-by: Chris Wing <cwing@nvidia.com>
@cwing-nvidia
cwing-nvidia force-pushed the cwing/inspect/environment-server branch from d036dde to 6a417dc Compare November 30, 2026 17:22
@cwing-nvidia

Copy link
Copy Markdown
Contributor Author

/ok to test 6a417dc

@copy-pr-bot

copy-pr-bot Bot commented Nov 30, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

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:env-infra Shared environment framework, lifecycle, registry, scaffolding, and validation feature New capabilities, enhancements, or enablement work risk:high Autobot PR risk: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants