Run a Gym Evaluation to Its Result
Select an execution path
- For a local run or an existing model endpoint, follow local and API-endpoint runs.
It covers pip preview installation, built-in benchmarks, and Responses, Chat Completions and vLLM clients.
- To evaluate an agent Gym already supports, first read supported agents
for harness selection and model wiring, then follow the matching local or cluster path.
- For tasks already in Gym's task-folder format, follow task folders.
- For a submitted Slurm run or a self-hosted model on a cluster, follow the existing procedure below,
including model configuration when needed.
Finish direct runs with the saved-result checks: require complete coverage,
read health and grading evidence, and reconcile the reported score with the saved benchmark aggregate.
Evaluation against Gym servers already started with gym env start follows supported agents;
the authoring links below apply when building a benchmark or harness.
The remaining sections describe submitted Slurm evaluations; direct runs use the references above.
The Gym pages are the reference; when they and this skill disagree, the pages win:
Configuration,
Resumable Runs,
Job Records and
Resume. For servers you started yourself
(gym env start, then gym eval run --no-serve) and for reading health while you build a benchmark or
a harness, follow add-benchmark and add-harness.
The page links point into a full Gym checkout (fern/...); a copy of this skill installed on its own does not
contain those pages, so read them in the Gym repository.
How to act
- No config yet: compose it (section 0) in the same task; the user does not call a second skill.
- Submit pinned and resumable (section 1), a small smoke first.
- Inspect, never guess (section 3): read
decision.action and gate_task.status.
- Do the one action the table names (section 4): run the same command without
--inspect, or add the
one option the row names, with its reason. A decision with no row, or a STOP you cannot explain:
stop and report it.
- Never use plain
gym eval resubmit or gym job resubmit, edit a run's files, or regenerate a saved answer.
- Done only when the inspect says
SUCCESS (section 6). Report the health, the corrections of
section 7 and every operator action with its reason.
0. No config yet: compose it
A request such as "run evaluations on model Y on benchmark Z with serving params X" often comes without a
config. Then write it yourself before section 1: read add-model-eval-config
and follow its sections 1 to 5 (the model card, the policy service with the serving params the request gives,
the reasoning toggle, each benchmark's own config from benchmarks/<name>/, validation without GPUs). A
quantized export of a model that also runs unquantized follows its section 9. Ask the user only for what that
skill says to ask for (the cluster and its login host, the account and partition, the images, the checkpoint
path, the output directory), never for a second skill to be run. Its smoke (section 6) is the smoke of
section 1 here; then continue with section 1. A config the user hands you is used as it is: do not re-derive
its model settings. A deployment handed over as a services.policy block is used as it is too
(add-model-eval-config, section 2).
1. Submit
The gym commands below need the gym CLI on the host you submit from. Install it at the commit in the
config's driver.gym_install.ref, in a directory that persists (not /tmp), with uv on PATH:
SHA=<the full 40-character commit>
git clone -q https://github.com/NVIDIA-NeMo/Gym.git ~/gym-${SHA:0:12} && cd ~/gym-${SHA:0:12} && git checkout -q $SHA && uv venv --seed .venv && . .venv/bin/activate && uv pip install -e ".[mlflow]" && gym --help
Without uv, install it with curl -LsSf https://astral.sh/uv/install.sh | sh and
export PATH="$HOME/.local/bin:$PATH". The submitted run installs its own extras and ray; the launcher
needs only the mlflow extra, which the MLflow delivery check in --inspect uses.
Submit with gym eval submit --config <config> [overrides]; the config may be a Hydra defaults document
that carries its own hydra.searchpath; overrides are Hydra (++k=v set, +k=v add, ~k delete, e.g.
'~cluster' when an imported fragment brings a key the submit config rejects); --json prints the
submission record.
gym eval submit --config submit.yaml --resolve-only # the resolved config, validated
gym eval submit --config submit.yaml --dry-run # the job scripts it would queue
gym eval submit --config submit.yaml # --select a,b submits only those
The job id is gym_job_id in the run directory's gym-job.json. The Run directory: line ends with it
but wraps when stdout is not a terminal. The same file has each benchmark's Slurm job_id and the Gym
commit that submitted the run.
Before you submit, check the config has:
- Gym pinned:
driver.gym_install.ref is a full commit, not a branch. Recovery refuses an unpinned ref.
- Every long benchmark resumable under
driver.benchmarks.<name>: resumable: true, or
resumable: {max_retries: N, max_walltime: "D-HH:MM:SS"}, where max_walltime is the whole chain's
budget (for example 3 x compute.cluster.walltime), not one job's.
- A small smoke first:
run: {limit: 5, num_repeats: 1}. --limit counts tasks, so rows = tasks ×
repeats. A smoke that must stay in one allocation also sets resumable: {max_retries: 0, max_walltime: <the walltime>}. A named, versioned subset runs with run: {task_ids_fpath: <file, one id per line>}
(or task_ids: [...]) instead: it keeps every copy of the named tasks, the run writes
rollouts_task_selection.json (source, ids, sha256) when it starts, resume and recover keep it, and the
inspect (task_selection), the MLflow run (gym_task_selection=subset) and gym eval compare label the
score a subset score.
- From a machine that is not the login node:
compute.cluster.hostname, and every runtime: credential
in compute.cluster.forward_env; only listed names reach the job. Site #SBATCH directives go in
compute.cluster.extra_args without leading dashes ({qos: <qos>, exclude: <node>}).
mlflow_tracking_required: false in each benchmark's run when the run is not tracked in MLflow on
purpose; the delivery state is then not_required.
- A raised
run.server_spinup_timeout_seconds (default 600 s) for a large model, a fresh install or a
loaded cluster; a spin-up timeout is an infra stop, never a zero (section 4).
2. Let the chain run
A resumable benchmark is a chain of Slurm jobs. Each job queues its successor (afternotok) and a
sentinel (afterany), then reads its predecessor's final state:
| Predecessor ended |
The chain |
TIMEOUT |
Continues from the saved rows, within max_walltime. A rollout in flight when an allocation ends is rerun from the start: the first such end of an in-flight rollout is free; from the second end on, each one charges the affected rows one attempt (rollout_allocation_ended, evaluation-side, counted in health; retried under the attempt cap, and final at it). The Store cannot tell a walltime cut from a preemption or a node failure, so the rule covers any ended allocation. |
PREEMPTED, NODE_FAIL, BOOT_FAIL |
Retries, spending one of max_retries. |
COMPLETED |
Ends. The job that finishes the run cancels the follow-up and sentinel it queued itself and journals both in chain-end-journal.jsonl. The sentinel its predecessor queued for it is not cancelled: it starts once the job ends and exits with nothing to do. |
FAILED |
The saved evidence decides: a driver that exited 75 (unfinished work) after saving progress continues as after a TIMEOUT; a retryable saved failure spends one of max_retries; anything else stops. |
CANCELLED, OUT_OF_MEMORY, DEADLINE, unknown accounting |
Stops. A segment the scheduler requeued has unknown elapsed time and stops this way. |
TIMEOUT before the task inventory was written |
Stops and names the fresh-restart command. |
The chain is over when none of its jobs is PENDING or RUNNING (squeue --me); a leftover pending
sentinel may be cancelled.
An empty sacct reply for the previous job is retried: the job asks up to 6 times, 10 seconds apart,
and then stops the chain with accounting unknown instead of resuming. A scheduler whose accounting lags
by about a minute therefore stops chains. The stop's log line names the continuation,
gym eval resubmit <id> <benchmark> --recover --max-walltime HH:MM:SS --walltime-reason TEXT, adding
--extend-retries N when the retries are spent, and gym eval resubmit --recover --inspect (section 3)
reports it too; the .gym_chain_incomplete marker keeps the bare reason.
When sbatch reports the scheduler's refusal of the follow-up (for example a QOS limit on submitted jobs),
the chain records follow_up_submission_refused: sbatch exited <rc>: <error lines> in
.gym_chain_incomplete, queues nothing, and its log line says to continue with
gym eval resubmit --recover once the scheduler accepts the job; a reply that is missing or says the
request was lost stays accounting unknown. When a later segment completes the run, it removes an earlier
stop marker, logs it, and journals run_complete_stop_superseded in chain-end-journal.jsonl.
A driver that stops on a typed condition exits at once and the next guard writes its kind and the way
out to .gym_chain_incomplete. The commands are in the decision table (section 4). Do not resubmit while a
job of the run is live.
While the chain runs, read its progress with the read-only inspection of section 3 (gym eval resubmit "$GYM_JOB_ID" <benchmark> --recover --inspect, which reports RUNNING while a job is live) or with
gym eval status "$GYM_JOB_ID", which reads artifacts/rollouts_batch_status.json (expected, completed and
remaining rollouts per agent, from the current attempts) without a scheduler. Counting the lines of
artifacts/rollouts.jsonl is only a fallback: it reads the whole store, which can be large and holds every
attempt.
3. Inspect first, always
gym eval resubmit "$GYM_JOB_ID" <benchmark> --recover --inspect \
--score-agent <agent name in the aggregate> \
--score-key '["agent_metrics", "mean/reward"]'
The agent name is agent_ref.name of the rows, the agent entry in
artifacts/rollouts_aggregate_metrics.json; without the score flags the score gate reports "score
unavailable". --inspect reads the saved evidence on the run's host and evaluates the gates; it
dispatches and writes nothing. The first read of a Gym pin installs it on that host (minutes; later
reads reuse it). The decision is the same without --inspect. A file that changes under the read stops
it ("unstable sources"), so never edit a run while you read it. Keep the JSON line: it is your record.