Repository navigation
feat(inspect): add an Environment Server that runs one Inspect sample per episode - #6930
Draft
cwing-nvidia wants to merge 1 commit into
Draft
cwing-nvidia wants to merge 1 commit into
cwing-nvidia wants to merge 1 commit into
Conversation
Contributor
Author
|
/ok to test d036dde |
… 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
force-pushed
the
cwing/inspect/environment-server
branch
from
November 30, 2026 17:22
d036dde to
6a417dc
Compare
Contributor
Author
|
/ok to test 6a417dc |
|
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
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.mdis 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.How samples are scored
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.inspect evalagainst one stub: scores and metrics identical.pre-commit run --all-filespasses.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.