> This page is for version Main (default).
> For other versions, use one of these documentation indexes:
> - Main (default): https://docs.nvidia.com/nemo/gym/main/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo/gym/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo/gym/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo/gym/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo/gym/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo/gym/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo/gym/v0.3.0/llms.txt
> - 0.2.1: https://docs.nvidia.com/nemo/gym/v0.2.1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/gym/_mcp/server.

# nemo_gym.rollout_compare.command

The gym dev compare command surface.

RolloutCompareConfig is the pydantic config whose fields and docstring are the command's
options, and run_compare loads both sides, compares them, resolves the per-side log roots,
writes the JSON summary first and then the report or the JSON to stdout, returning the exit
code.

## Module Contents

### Classes

| Name                                                                             | Description                                                                                                    |
| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| [`RolloutCompareConfig`](#nemo_gym-rollout_compare-command-RolloutCompareConfig) | Compare two rollout JSONL files task by task: count identical, flipped, masked and missing tasks and print the |

### Functions

| Name                                                           | Description                                                                                             |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| [`run_compare`](#nemo_gym-rollout_compare-command-run_compare) | Load both sides, print the report (or the JSON summary with `json_stdout`) and write the JSON file when |

### API

```python
class nemo_gym.rollout_compare.RolloutCompareConfig()
```

**Bases:** [BaseNeMoGymCLIConfig](/nemo/gym/nemo-gym/nemo_gym/config_types#nemo_gym-config_types-BaseNeMoGymCLIConfig)

Compare two rollout JSONL files task by task: count identical, flipped, masked and missing tasks and print the
losing side's verifier output for every flip. A report, not a gate: the exit code is 0 for a report and 1 when
an input cannot be read or the `--json` summary cannot be written.

Examples:

```python
# Old server vs Harbor path on the same tasks
gym dev compare old/rollouts.jsonl new/rollouts.jsonl

# Resolve relative `verifier_logs_dir` paths against the Harbor server directory, keep 30 log lines per flip,
# and also write a machine-readable summary
gym dev compare old.jsonl new.jsonl --logs-root environment_servers/harbor --tail 30 --json compare.json

# Join on an explicit field when auto-detection picks the wrong one
gym dev compare old.jsonl new.jsonl --key verifier_metadata.instance_id
```

**`json_output`** `Optional[str]`

---

**`json_stdout`** `bool`

---

**`key`** `Optional[str]`

---

**`logs_root`** `Optional[str]`

---

**`new_rollouts`** `str`

---

**`old_rollouts`** `str`

---

**`tail`** `int`

---

```python
nemo_gym.rollout_compare.run_compare(
    config: nemo_gym.rollout_compare.command.RolloutCompareConfig,
    out = None
) -> int
```

Load both sides, print the report (or the JSON summary with `json_stdout`) and write the JSON file when
asked. Exit code: 0 for a report, 1 for unreadable input or unwritable output.