Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0b159e3
chore: move all cli functions into a single location
marta-sd Jun 12, 2026
7cdcb8e
feat: add basic 'gym' command router
marta-sd Jun 12, 2026
cba678a
feat: add --config and --storage flags to the gym router
marta-sd Jun 15, 2026
82e3505
fix: don't pass unknown --flag or -f args to hydra
marta-sd Jun 16, 2026
b075b92
chore: add basic tests for testing new cli
marta-sd Jun 16, 2026
95ddd2f
feat: run all tests if no resource server was passed
marta-sd Jun 16, 2026
0519f87
feat: add flags to eval run
marta-sd Jun 16, 2026
e013525
feat: add flags to dataset commands
marta-sd Jun 16, 2026
6a79259
feat: add flags for other eval commands
marta-sd Jun 16, 2026
bed6576
feat: add flags for env commands
marta-sd Jun 16, 2026
4a05371
chore: print deprecation notice for all legacy commands
marta-sd Jun 17, 2026
17b79ae
chore: add tests for checking that all ng_ and nemo_gym_ commands pri…
marta-sd Jun 17, 2026
6288170
feat: add --verbose flag
marta-sd Jun 17, 2026
6a2cd5c
feat: allow to select relevant config through passing server name
marta-sd Jun 17, 2026
16431a6
feat: add --json flag for machine-readable output (+ move diagnostics…
marta-sd Jun 17, 2026
02967e0
feat: add 'did you mean?' hints for typos
marta-sd Jun 17, 2026
81fca19
feat: add --search-dir for loading user configs from custom location
marta-sd Jun 22, 2026
ba6dc10
feat: add gym search command
marta-sd Jun 22, 2026
c53e912
feat: add generic deployment config and --model-checkpoint flag
marta-sd Jun 22, 2026
4b97e8a
fix: unify rendundant --model-name and --model-checkpoint flags into …
marta-sd Jun 22, 2026
c0747bd
feat: add --benchmark flag to gym env run command
marta-sd Jun 22, 2026
efed901
chore: migrate docs, skills and READMEs to use new cli
marta-sd Jun 22, 2026
8d72078
fix: handle ng_ commands with no registered gym command
marta-sd Jun 23, 2026
26be13d
fix: add QUERY_KEY_NAME constant and make it a reserved key
marta-sd Jun 23, 2026
f83f70a
fix: more descriptive error message when no benchmark configs found f…
marta-sd Jun 23, 2026
a4c13b0
fix: add backward compatibility for import used in RL
marta-sd Jun 23, 2026
628086e
Merge branch 'main' into martas/1434
marta-sd Jun 23, 2026
89c2009
Merge branch 'main' into martas/1434
marta-sd Jun 24, 2026
355907e
feat(registry): environment registry — discover + resolve environment…
wprazuch Jun 17, 2026
fe103a2
feat(cli): wire 'gym list environments' onto the registry
wprazuch Jun 24, 2026
ef2ada2
feat: environment suite manager (M4 core)
wprazuch Jun 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 34 additions & 26 deletions .claude/skills/add-benchmark/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ Before starting, determine which type of benchmark you're adding:

### Step 1: Scaffold the server

Run `ng_init_resources_server` to generate the directory structure:
Run `gym env init` to generate the directory structure:

```bash
ng_init_resources_server +entrypoint=resources_servers/my_benchmark
gym env init --resource-server my_benchmark
```

This creates:
Expand Down Expand Up @@ -77,10 +77,10 @@ Convert your source dataset to Gym JSONL format. Each line must have `responses_
**`train`/`validation` datasets**: Upload to the GitLab dataset registry — these must NOT be committed to git.

```bash
ng_upload_dataset_to_gitlab \
+dataset_name=my_benchmark \
+version=0.0.1 \
+input_jsonl_fpath=resources_servers/my_benchmark/data/my_dataset.jsonl
gym dataset upload --storage gitlab \
--name my_benchmark \
--revision 0.0.1 \
--input resources_servers/my_benchmark/data/my_dataset.jsonl
```

Requires MLflow credentials in `env.yaml` (or passed via CLI):
Expand All @@ -94,12 +94,16 @@ mlflow_tracking_token: <your-gitlab-api-token>
**Validate** your data:
```bash
# Validate example data (for PR submission)
ng_prepare_data "+config_paths=[resources_servers/my_benchmark/configs/my_benchmark.yaml]" \
+output_dirpath=/tmp/prepare +mode=example_validation
gym dataset collate --config resources_servers/my_benchmark/configs/my_benchmark.yaml \
--output-dir /tmp/prepare \
--mode example_validation

# Download and prepare train/validation from GitLab
ng_prepare_data "+config_paths=[resources_servers/my_benchmark/configs/my_benchmark.yaml]" \
+output_dirpath=data/my_benchmark +mode=train_preparation +should_download=true +data_source=gitlab
gym dataset collate --config resources_servers/my_benchmark/configs/my_benchmark.yaml \
--output-dir data/my_benchmark \
--mode train_preparation \
--download \
+data_source=gitlab
```

### Step 3: Implement verify()
Expand Down Expand Up @@ -162,7 +166,7 @@ Both fields must coexist: `jsonl_fpath` is the local download destination, `gitl

```bash
# Run server tests (creates isolated .venv, slow on first run)
ng_test +entrypoint=resources_servers/my_benchmark
gym env test --resource-server my_benchmark

# Run core library tests to check nothing broke
pytest tests/unit_tests/ -x
Expand All @@ -174,14 +178,18 @@ Test coverage must be >= 95%. Write tests for: verify pass, verify fail (wrong o

```bash
# Start servers
ng_run "+config_paths=[resources_servers/my_benchmark/configs/my_benchmark.yaml,responses_api_models/openai_model/configs/openai_model.yaml]"
gym env run \
--config resources_servers/my_benchmark/configs/my_benchmark.yaml \
--model-type openai_model

# Quick test with example data
ng_collect_rollouts +agent_name=my_benchmark_simple_agent \
+input_jsonl_fpath=resources_servers/my_benchmark/data/example.jsonl \
+output_jsonl_fpath=results/example_rollouts.jsonl \
+num_repeats=1 \
"+responses_create_params={max_output_tokens: 16384, temperature: 1.0}"
gym eval run --no-serve \
--agent my_benchmark_simple_agent \
--input resources_servers/my_benchmark/data/example.jsonl \
--output results/example_rollouts.jsonl \
--num-repeats 1 \
--max-output-tokens 16384 \
--temperature 1.0

# Inspect results
```
Expand All @@ -196,17 +204,17 @@ Run against multiple models to validate correctness. Recommended suite:

```bash
# Collect rollouts
ng_collect_rollouts +agent_name=my_benchmark_simple_agent \
+input_jsonl_fpath=resources_servers/my_benchmark/data/my_dataset.jsonl \
+output_jsonl_fpath=results/rollouts.jsonl \
+num_repeats=5 \
"+responses_create_params={max_output_tokens: 16384, temperature: 1.0}"
gym eval run --no-serve \
--agent my_benchmark_simple_agent \
--input resources_servers/my_benchmark/data/my_dataset.jsonl \
--output results/rollouts.jsonl \
--num-repeats 5 \
--max-output-tokens 16384 \
--temperature 1.0

# Compute per-task pass rates
ng_reward_profile +input_jsonl_fpath=resources_servers/my_benchmark/data/my_dataset.jsonl \
+rollouts_jsonl_fpath=results/rollouts.jsonl \
+output_jsonl_fpath=results/profiled.jsonl \
+pass_threshold=1.0
gym eval profile --inputs resources_servers/my_benchmark/data/my_dataset.jsonl \
--rollouts results/rollouts.jsonl

# Aggregate metrics (pass@1 = avg_reward, pass@k from max_reward)
python scripts/print_aggregate_results.py +jsonl_fpath=results/profiled.jsonl
Expand Down
24 changes: 14 additions & 10 deletions .claude/skills/add-benchmark/references/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ Externalize system prompts to text files, pass via `--system-prompt` argument. M

### `data/.gitignore` default patterns

Generated by `ng_init_resources_server`:
Generated by `gym env init`:
```
*train.jsonl
*validation.jsonl
Expand All @@ -562,10 +562,10 @@ If your filename doesn't match (e.g. `my_eval.jsonl`), add a custom pattern (e.g
1. **Generate** the JSONL file using your conversion script (in the source repo)
2. **Upload** to GitLab dataset registry:
```bash
ng_upload_dataset_to_gitlab \
+dataset_name=my_benchmark \
+version=0.0.1 \
+input_jsonl_fpath=resources_servers/my_benchmark/data/my_dataset.jsonl
gym dataset upload --storage gitlab \
--name my_benchmark \
--revision 0.0.1 \
--input resources_servers/my_benchmark/data/my_dataset.jsonl
```
3. **Add `gitlab_identifier`** to the dataset entry in YAML config:
```yaml
Expand All @@ -591,18 +591,22 @@ mlflow_tracking_token: <your-gitlab-api-token>

The tracking URI format is `https://<gitlab-host>/api/v4/projects/<PROJECT_ID>/ml/mlflow`.

### Verification with `ng_prepare_data`
### Verification with `gym dataset collate`

Validate example data (for PR submission):
```bash
ng_prepare_data "+config_paths=[resources_servers/my_benchmark/configs/my_benchmark.yaml]" \
+output_dirpath=/tmp/prepare +mode=example_validation
gym dataset collate --config resources_servers/my_benchmark/configs/my_benchmark.yaml \
--output-dir /tmp/prepare \
--mode example_validation
```

Download and prepare train/validation from GitLab:
```bash
ng_prepare_data "+config_paths=[resources_servers/my_benchmark/configs/my_benchmark.yaml]" \
+output_dirpath=data/my_benchmark +mode=train_preparation +should_download=true +data_source=gitlab
gym dataset collate --config resources_servers/my_benchmark/configs/my_benchmark.yaml \
--output-dir data/my_benchmark \
--mode train_preparation \
--download \
+data_source=gitlab
```

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Next actions:

Symptoms:

- `ng_run` or `ng_collect_rollouts` fails before launching servers
- `gym env run` or `gym eval run --no-serve` fails before launching servers
- errors mention missing config keys, unknown overrides, or interpolation failures
- wrong agent/resource server starts despite expected data

Expand All @@ -134,7 +134,7 @@ Evidence to collect:

Next actions:

- reduce to a minimal `ng_run "+config_paths=[...]"` command
- reduce to a minimal `gym env run --config ...` command
- add overrides back one at a time
- trust target checkout code over copied command templates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is an escalation ladder. Do not patch agents, resource servers, model adapt
1. Enable Gym's existing request debug flag:

```bash
ng_run '+config_paths=[...]' ++global_aiohttp_client_request_debug=True
gym env run --config ... ++global_aiohttp_client_request_debug=True
```

2. Re-run the smallest failing case and capture stdout/stderr.
Expand Down
12 changes: 6 additions & 6 deletions .claude/skills/nemo-gym-reward-profiling/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: nemo-gym-reward-profiling
description: >-
Use to help users get started with Nemo Gym reward profiling. Covers the basic
ng_run, ng_collect_rollouts, and ng_reward_profile workflow, repeated rollouts,
gym env run, gym eval run, and gym eval profile workflow, repeated rollouts,
materialized inputs, rollout JSONL artifacts, task and rollout identity, output
inspection, partial profiling, and rollout_infos. For failed jobs, prefer
nemo-gym-debugging.
Expand All @@ -14,16 +14,16 @@ description: >-

Use this skill when the user wants to run, understand, or lightly modify Nemo Gym reward profiling. Keep the answer oriented around the normal workflow:

`ng_run` starts model/resource servers, `ng_collect_rollouts` writes rollout artifacts, and `ng_reward_profile` generates profiling output from those artifacts.
`gym env run` starts model/resource servers, `gym eval run --no-serve` writes rollout artifacts, and `gym eval profile` generates profiling output from those artifacts.

If the user is primarily debugging a failed job or stack trace, use the `nemo-gym-debugging` skill first.

## Basic Workflow

1. Identify the environment config paths and input JSONL.
2. Start Gym servers with `ng_run`.
3. Collect rollouts with `ng_collect_rollouts`; this writes `rollouts.jsonl` and `*_materialized_inputs.jsonl`.
4. Run `ng_reward_profile` on the materialized inputs and rollout JSONL to generate `*_reward_profiling.jsonl`.
2. Start Gym servers with `gym env run`.
3. Collect rollouts with `gym eval run --no-serve`; this writes `rollouts.jsonl` and `*_materialized_inputs.jsonl`.
4. Run `gym eval profile` on the materialized inputs and rollout JSONL to generate `*_reward_profiling.jsonl`.
5. Inspect line counts and profile rows.

Repeated rollouts are the main profiling lever. `num_repeats=1` is valid, but per-task averages and variance are only meaningful with multiple rollouts per task.
Expand All @@ -48,6 +48,6 @@ Load references only when the user needs that detail:

## Practical Defaults

- Treat `ng_reward_profile` as the reward profiling step; rollout collection does not write reward profile files.
- Treat `gym eval profile` as the reward profiling step; rollout collection does not write reward profile files.
- Run strict profiling by default. If rollout collection stopped early, use `++allow_partial_rollouts=True` to profile completed rollouts and drop original input rows with no completed rollout.
- Trust the target checkout's CLI help and `nemo_gym/reward_profile.py` over memory if flags differ.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Reward profiling is built around joining materialized inputs with rollout result

- `*_materialized_inputs.jsonl`: expanded inputs after repeat expansion. Each row should have `_ng_task_index` and `_ng_rollout_index`.
- `rollouts.jsonl`: completed rollout results. Each row should have matching `_ng_task_index` and `_ng_rollout_index`.
- `*_reward_profiling.jsonl`: task-level summaries produced by `ng_reward_profile`.
- `*_reward_profiling.jsonl`: task-level summaries produced by `gym eval profile`.
- `*_agent_metrics.json`: agent/global aggregate metrics.

## Task Profile Rows
Expand Down Expand Up @@ -36,7 +36,7 @@ Full model responses stay in `rollouts.jsonl`. Join back to full rows with `(_ng

## Partial Profiles

Strict profiling is the default. If materialized inputs and rollout results do not have the same rollout keys, `ng_reward_profile` fails and suggests:
Strict profiling is the default. If materialized inputs and rollout results do not have the same rollout keys, `gym eval profile` fails and suggests:

```bash
++allow_partial_rollouts=True
Expand Down
40 changes: 20 additions & 20 deletions .claude/skills/nemo-gym-reward-profiling/references/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Substitute environment-specific config paths, input data, model endpoint, and ou
## Minimal Flow

```bash
CONFIG_PATHS="your_model_config_paths,your_env_config_paths"

POLICY_MODEL_NAME="your_policy_model_name"
POLICY_BASE_URL="your_policy_base_url"
POLICY_ENDPOINT_KEY="your_policy_endpoint_key"
Expand All @@ -19,41 +17,43 @@ AGENT_NAME="your_agent_name"
NUM_REPEATS=2
NUM_SAMPLES_IN_PARALLEL=8

ng_run "+config_paths=[$CONFIG_PATHS]" \
+policy_model_name="$POLICY_MODEL_NAME" \
+policy_base_url="$POLICY_BASE_URL" \
+policy_api_key="$POLICY_ENDPOINT_KEY" &
gym env run \
--config your_model_config_paths \
--config your_env_config_paths \
--model "$POLICY_MODEL_NAME" \
--model-url "$POLICY_BASE_URL" \
--model-api-key "$POLICY_ENDPOINT_KEY" &
NG_RUN_PID=$!
trap 'kill "$NG_RUN_PID" 2>/dev/null || true' EXIT
./scripts/wait_for_servers.sh "$NG_RUN_PID"

agent_args=()
if [[ -n "$AGENT_NAME" ]]; then
agent_args=(+agent_name="$AGENT_NAME")
agent_args=(--agent "$AGENT_NAME")
fi

ng_collect_rollouts \
gym eval run --no-serve \
"${agent_args[@]}" \
+input_jsonl_fpath="$DATA_JSONL" \
+output_jsonl_fpath="$ROLLOUTS_JSONL" \
+num_repeats="$NUM_REPEATS" \
+num_samples_in_parallel="$NUM_SAMPLES_IN_PARALLEL"

ng_reward_profile \
++materialized_inputs_jsonl_fpath="$MATERIALIZED_JSONL" \
++rollouts_jsonl_fpath="$ROLLOUTS_JSONL"
--input "$DATA_JSONL" \
--output "$ROLLOUTS_JSONL" \
--num-repeats "$NUM_REPEATS" \
--concurrency "$NUM_SAMPLES_IN_PARALLEL"

gym eval profile \
--inputs "$MATERIALIZED_JSONL" \
--rollouts "$ROLLOUTS_JSONL"
```

If rows already contain `agent_ref`, leave `AGENT_NAME` empty. Passing `+agent_name` supplies a default for rows without one.

## Partial Rollouts

By default, `ng_reward_profile` expects every materialized input row to have a matching rollout row. If collection stopped early, profile the completed rollouts with:
By default, `gym eval profile` expects every materialized input row to have a matching rollout row. If collection stopped early, profile the completed rollouts with:

```bash
ng_reward_profile \
++materialized_inputs_jsonl_fpath="$MATERIALIZED_JSONL" \
++rollouts_jsonl_fpath="$ROLLOUTS_JSONL" \
gym eval profile \
--inputs "$MATERIALIZED_JSONL" \
--rollouts "$ROLLOUTS_JSONL" \
++allow_partial_rollouts=True
```

Expand Down
4 changes: 2 additions & 2 deletions .codex/skills/nemo-gym-debugging/references/error-profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Next actions:

Symptoms:

- `ng_run` or `ng_collect_rollouts` fails before launching servers
- `gym env run` or `gym eval run --no-serve` fails before launching servers
- errors mention missing config keys, unknown overrides, or interpolation failures
- wrong agent/resource server starts despite expected data

Expand All @@ -134,7 +134,7 @@ Evidence to collect:

Next actions:

- reduce to a minimal `ng_run "+config_paths=[...]"` command
- reduce to a minimal `gym env run --config ...` command
- add overrides back one at a time
- trust target checkout code over copied command templates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is an escalation ladder. Do not patch agents, resource servers, model adapt
1. Enable Gym's existing request debug flag:

```bash
ng_run '+config_paths=[...]' ++global_aiohttp_client_request_debug=True
gym env run --config ... ++global_aiohttp_client_request_debug=True
```

2. Re-run the smallest failing case and capture stdout/stderr.
Expand Down
14 changes: 7 additions & 7 deletions .codex/skills/nemo-gym-reward-profiling/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: nemo-gym-reward-profiling
description: >-
Use to help users get started with Nemo Gym reward profiling. Covers the basic
ng_run, ng_collect_rollouts, and ng_reward_profile workflow, repeated rollouts,
gym env run, gym eval run, and gym eval profile workflow, repeated rollouts,
materialized inputs, rollout JSONL artifacts, task and rollout identity, output
inspection, partial profiling, and rollout_infos. For failed jobs, prefer
nemo-gym-debugging.
Expand All @@ -14,16 +14,16 @@ description: >-

Use this skill when the user wants to run, understand, or lightly modify Nemo Gym reward profiling. Keep the answer oriented around the normal workflow:

`ng_run` starts model/resource servers, `ng_collect_rollouts` writes rollout artifacts, and `ng_reward_profile` generates profiling output from those artifacts.
`gym env run` starts model/resource servers, `gym eval run --no-serve` writes rollout artifacts, and `gym eval profile` generates profiling output from those artifacts.

If the user is primarily debugging a failed job or stack trace, use `$nemo-gym-debugging` first.
If the user is primarily debugging a failed job or stack trace, use the `nemo-gym-debugging` skill first.

## Basic Workflow

1. Identify the environment config paths and input JSONL.
2. Start Gym servers with `ng_run`.
3. Collect rollouts with `ng_collect_rollouts`; this writes `rollouts.jsonl` and `*_materialized_inputs.jsonl`.
4. Run `ng_reward_profile` on the materialized inputs and rollout JSONL to generate `*_reward_profiling.jsonl`.
2. Start Gym servers with `gym env run`.
3. Collect rollouts with `gym eval run --no-serve`; this writes `rollouts.jsonl` and `*_materialized_inputs.jsonl`.
4. Run `gym eval profile` on the materialized inputs and rollout JSONL to generate `*_reward_profiling.jsonl`.
5. Inspect line counts and profile rows.

Repeated rollouts are the main profiling lever. `num_repeats=1` is valid, but per-task averages and variance are only meaningful with multiple rollouts per task.
Expand All @@ -48,6 +48,6 @@ Load references only when the user needs that detail:

## Practical Defaults

- Treat `ng_reward_profile` as the reward profiling step; rollout collection does not write reward profile files.
- Treat `gym eval profile` as the reward profiling step; rollout collection does not write reward profile files.
- Run strict profiling by default. If rollout collection stopped early, use `++allow_partial_rollouts=True` to profile completed rollouts and drop original input rows with no completed rollout.
- Trust the target checkout's CLI help and `nemo_gym/reward_profile.py` over memory if flags differ.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Reward profiling is built around joining materialized inputs with rollout result

- `*_materialized_inputs.jsonl`: expanded inputs after repeat expansion. Each row should have `_ng_task_index` and `_ng_rollout_index`.
- `rollouts.jsonl`: completed rollout results. Each row should have matching `_ng_task_index` and `_ng_rollout_index`.
- `*_reward_profiling.jsonl`: task-level summaries produced by `ng_reward_profile`.
- `*_reward_profiling.jsonl`: task-level summaries produced by `gym eval profile`.
- `*_agent_metrics.json`: agent/global aggregate metrics.

## Task Profile Rows
Expand Down Expand Up @@ -36,7 +36,7 @@ Full model responses stay in `rollouts.jsonl`. Join back to full rows with `(_ng

## Partial Profiles

Strict profiling is the default. If materialized inputs and rollout results do not have the same rollout keys, `ng_reward_profile` fails and suggests:
Strict profiling is the default. If materialized inputs and rollout results do not have the same rollout keys, `gym eval profile` fails and suggests:

```bash
++allow_partial_rollouts=True
Expand Down
Loading
Loading