Repository navigation
Conversation
The key terminology page called rollout and trajectory aliases and defined a "task attempt" as one rollout. The code uses the terms differently: EpisodeId identifies one execution of a rollout, a retry adds an attempt to the same rollout, and TrajectoryRecord is the data recorded for one episode. Rewrite the glossary to match the code. A rollout is one sample of a task and gets one reward. An episode is one execution of a rollout, and only the final episode's result counts. A trajectory is the record of an episode, made of agent invocations, turns, and steps. Attempt now means only the retry number, and trace now means an OpenTelemetry trace. Each entry names the matching term in other tools where one exists. Update the architecture and environments pages, which used "task attempt" for an episode and called the trajectory a rollout. Signed-off-by: Ananth Subramaniam <[email protected]>
|
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. |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
HOLD — three RISK documentation-contract mismatches remain, plus one NOTE about ATIF step counting.
The separation between sampling and retries is useful, but the new definitions still misdescribe recorded turns, unscored failures, and checkpoint-restored episodes. These are documentation findings; no runtime regression is asserted.
Reviewed all three changed pages and traced the relevant execution, persistence, checkpoint, and export contracts. Validation was static only: tests and the Fern build were not executed. Suggested wording should be verified before adoption.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| | **Agent** | Model + agent harness. | | ||
| | **Rollout driver** | Coordinates an episode and records its trajectory. | | ||
| | **Agent invocation** | One conversation held by the root agent or by a subagent within an episode. | | ||
| | **Turn** | One exchange within an agent invocation: a request to the agent and the agent's answer. A turn contains one or more steps. | |
There was a problem hiding this comment.
RISK — Distinguish agent exchanges from recorded trajectory turns
Failure / blast radius: One request to Simple Agent can make a tool-calling model request followed by a final-answer model request. The glossary predicts one turn containing two steps, but _create_episode() emits one TrajectoryTurn per model response (producer). The existing regression explicitly expects two turns, numbered 1 and 2, with step_count values 1 and 1 (assertions). Readers using this hierarchy to interpret ng_trajectory will therefore misidentify its boundaries and counts.
Correction: Qualify the Turn row and the diagram's turn label rather than changing the producer to fit the glossary. A replacement row could be:
| **Turn** | A harness-reported exchange or decision within an agent invocation. Simple Agent records each model response as a `TrajectoryTurn`, including tool-calling responses, so one request to the agent can produce several recorded turns. A user-facing dialogue exchange or agent activation is a separate boundary. |Change the diagram label to “harness-reported exchange or decision.” The invariant is that interaction-level terminology must not imply a different persisted TrajectoryTurn boundary.
Preservation / acceptance (not executed): Retain the existing two-turn assertion above, including step_count == [1, 1]; do not merge those records. A final answer without tools should still produce one recorded turn. Multiple tool calls requested in one model response should remain one recorded turn, not one turn per tool. Keep the existing user-facing meaning of multi-turn dialogue, but distinguish it from the saved-record boundary.
| | **Task attempt** | One rollout for a specific task. Multiple attempts per task capture different approaches and support pass@k. | | ||
| | **Trace** | Debug-oriented log of a rollout (timing, tool I/O, metadata) beyond the scored trajectory. | | ||
| | **Run** | One collection or evaluation job over one or more tasksets. Not the agent server's `/run` endpoint; call that "the agent's `/run` episode". | | ||
| | **Rollout** | One sample of a task. Each rollout gets one reward. `num_repeats` sets how many rollouts each task gets, and metrics such as pass@k count rollouts. A rollout is identified by its task and its repeat index. Other tools call this a *sample* (pass@k papers, Inspect) or a *trial* (Harbor). | |
There was a problem hiding this comment.
RISK — Do not promise a reward for infrastructure-failed rollouts
Failure / blast radius: A rollout whose last episode returns a terminal failure, or exhausts its retry budget, does not necessarily receive a reward. _episode_record() creates a failure record without a reward, and collection writes it to the failures sidecar rather than the scored output (conversion, persistence). Thus “each rollout gets one reward” incorrectly suggests that missing verification is a scored result, which matters when readers interpret metric denominators.
Correction: Replace the unconditional reward claims here and in the overview/tree, Episode, and Reward entries with the conditional contract. Suggested wording:
Each successfully scored rollout has one reward, supplied by its completing episode. An infrastructure-failed rollout can remain unscored; failed episodes are excluded from scores by default. Explicit failure/missing-rollout counting options can add metric-input zeros without inventing verifier rewards in the saved artifacts.
Keep the task/repeat identity and num_repeats definitions. The invariant is one selected score for a scored rollout—not a guaranteed verifier reward for every scheduled sample.
Preservation / acceptance (not executed): Retain the existing failure-counting regression: one HTTP-500 failure plus one reward-1 success yields one scored input and mean 1.0 by default; explicitly counting that failure yields two metric inputs and mean 0.5, while the failure sidecar still has no reward. Also check the documented retry example: an infrastructure failure followed by successful verification contributes only the successful reward, whereas num_repeats=2 creates two independent rollout identities.
| ### State | ||
|
|
||
| Per-task state that changes as the agent takes actions. Each task attempt starts from a clean state, this ensures attempts are independent and rewards are attributable to the agent's actions on that task. | ||
| Per-task state that changes as the agent takes actions. Each episode starts from a clean state, so episodes are independent and rewards are attributable to the agent's actions on that task. |
There was a problem hiding this comment.
RISK — Exempt checkpoint continuations from the clean-state guarantee
Failure / blast radius: A checkpoint restore increments the episode attempt while retaining session state. ResourcesParticipant.install() restores the saved state and binds the same session ID to next_attempt(...) (implementation). The existing counter regression performs two increments in attempt 1, restores into attempt 2, and expects the next increment to return 3—not 1 (regression). Under this PR's episode definition, those are different episodes, so they neither start clean nor constitute independent samples. This misstates the contract for readers implementing checkpoint-aware state/session handling.
Correction: Replace this paragraph with:
Per-task mutable state changes as the agent takes actions. A fresh rollout, or a retry restarted from its input, starts with clean, isolated state. A checkpoint-restored episode instead continues saved state from the same rollout; such episodes are not independent samples.
Make the corresponding qualification in the glossary's State, Episode, and Session entries and the “Each episode follows” introduction: setup-to-verify is the normal fresh-execution flow, not a requirement that restored episodes reseed. For Session, explicitly allow saved state/session identity to be restored for the rollout's next episode. A restored Simple Agent execution already has a regression asserting that it skips resource seeding (assertion).
Preservation / acceptance (not executed): Keep clean isolation for new samples and restart-from-input retries; do not change runtime behavior to reset restored state. Retain the counter regression's results 3 then 4 and its unchanged session ID, and the restored-agent regression's absence of /seed_session. Static acceptance: the edited definitions must distinguish fresh/restarted execution from checkpoint continuation while retaining the same logical rollout ID and incremented attempt.
| | **Rollout driver** | Coordinates an episode and records its trajectory. | | ||
| | **Agent invocation** | One conversation held by the root agent or by a subagent within an episode. | | ||
| | **Turn** | One exchange within an agent invocation: a request to the agent and the agent's answer. A turn contains one or more steps. | | ||
| | **Step** | One model call and the tool calls it requests. ATIF and agent RL papers use "step" in the same sense. | |
There was a problem hiding this comment.
NOTE — Limit the ATIF equivalence to agent steps
Failure / blast radius: ATIF's step is not universally one model call: Gym also exports initial system and user messages as steps (exporter). The existing two-model-call fixture exports four steps—system, user, agent, agent—and total_steps == 4 (step assertions, total). The unqualified equivalence can make readers interpret ATIF totals as model-call counts.
Correction: Replace this row with:
| **Step** | Here, one model call and the tool calls it requests. This corresponds to an ATIF agent step; ATIF also represents system and user messages as steps, so its total step count is not a model-call count. |This preserves the intended model/tool-cycle definition without redefining the external format.
Preservation / acceptance (not executed): Retain the existing export assertions for [system, user, agent, agent] and total_steps == 4. The first agent step must still contain both parallel tool calls, while the final no-tool answer remains another agent step. Static acceptance: the glossary explicitly says ATIF agent step, not ATIF step generally.
ffrujeri
left a comment
There was a problem hiding this comment.
The rollout / episode / trajectory split matches EpisodeId and TrajectoryRecord and is a clear improvement over the alias wording. Happy to approve after a rebase. When rebasing: main's #5083 added a Sessions section, so the new Session row could fold into it; please also keep #5131's task-folder wording and #5179's harness-conformance link. One mismatch worth a look: Simple Agent records one TrajectoryTurn per model call (turn_no=step), so "a turn contains one or more steps" doesn't match recorded trajectories. Could the Turn definition be loosened, or the difference noted?
yaoyu-33
left a comment
There was a problem hiding this comment.
HOLD: the branch conflicts with main, and earlier asks are still open.
The split itself is right. I checked it against main: EpisodeId is "one physical attempt of a logical rollout" (rollout_id plus attempt, starting at 0); retries keep the logical rollout ID; num_repeats adds rollout indexes; and TrajectoryRecord is built from agent invocations, then turns, then model calls. That matches the proposed Rollout, Episode, Attempt and Trajectory rows.
What blocks merging:
- The PR conflicts with
maininabout/architecture.mdxandabout/concepts/key-terminology.mdx(inline onkey-terminology.mdx:12). - The earlier asks are still open: the bot threads on turn vs recorded
TrajectoryTurn, the reward promise for unscored failed rollouts, checkpoint-restored episodes, and ATIF steps, plus ffrujeri's rebase notes. The turn and checkpoint points still hold onmain:simple_agentrecordsturn_no=step, and a checkpoint restore bindsnext_attempt(...).
Inline comments add the following: the Environment Server's /run, how the attempt cap works with --extend-attempts, a link to a page main removed, the duplicate Session row, and one leftover use of attempt in architecture.mdx.
Checked at 592b0c3c: pre-commit run --files on the three pages passes, and fern check reports 0 errors. Docs-only, so no rollouts are needed. CI has already run on this head.
| ## Overview | ||
|
|
||
| A **dataset** is a JSONL file of **tasks** (one row = one problem). Running the agent on a task produces a **rollout** (also called a **trajectory**) — one attempt and its record. | ||
| A **dataset** is a JSONL file of **tasks** (one row = one problem). A **run** samples each task one or more times; each sample is a **rollout**, and each rollout gets one **reward**. Gym executes a rollout as an **episode**, and records what happened in the episode as a **trajectory**. |
There was a problem hiding this comment.
Blocker: merge main first. This branch conflicts with main in key-terminology.mdx and architecture.mdx. Since this PR was opened, #5131 added task folders and #5179 removed the trajectory-capabilities page. While you resolve the conflicts:
- Keep the task-folder wording in the overview, in the Task row, and in the tree. For example:
task one dataset row or task folder. - Keep main's
/main/datalink targets. - The PR body cites
nemo_gym/episode_types.pyandnemo_gym/rollout_observability.py. Those files are nownemo_gym/core/episode_types.pyandnemo_gym/trajectory/trajectory_record.py, so please update the paths in the body too.
| | **Rollout / trajectory** | **Rollout** (verb): execute an agent in an environment — take actions and record what happens. **Rollout** (noun) / **trajectory**: the ordered record of one attempt (states, actions, rewards). In Gym these names are aliases; architecture calls the resulting trajectory a *rollout*. Multiple rollouts per task support metrics like pass@k. See [trajectory capabilities](/reference/trajectory-capabilities). | | ||
| | **Task attempt** | One rollout for a specific task. Multiple attempts per task capture different approaches and support pass@k. | | ||
| | **Trace** | Debug-oriented log of a rollout (timing, tool I/O, metadata) beyond the scored trajectory. | | ||
| | **Run** | One collection or evaluation job over one or more tasksets. Not the agent server's `/run` endpoint; call that "the agent's `/run` episode". | |
There was a problem hiding this comment.
Environment Servers take /run too: rollout collection submits each episode to the Environment Server's /run (architecture.mdx on main). Agent servers are not the only owners of that endpoint, so the disambiguation should name both:
| | **Run** | One collection or evaluation job over one or more tasksets. Not the agent server's `/run` endpoint; call that "the agent's `/run` episode". | | |
| | **Run** | One collection or evaluation job over one or more tasksets. Not the `/run` endpoint of an Environment Server or agent server, which takes one episode. | |
| | **Run** | One collection or evaluation job over one or more tasksets. Not the agent server's `/run` endpoint; call that "the agent's `/run` episode". | | ||
| | **Rollout** | One sample of a task. Each rollout gets one reward. `num_repeats` sets how many rollouts each task gets, and metrics such as pass@k count rollouts. A rollout is identified by its task and its repeat index. Other tools call this a *sample* (pass@k papers, Inspect) or a *trial* (Harbor). | | ||
| | **Episode** | One execution of a rollout, from `seed_session()` through `verify()`, identified by the rollout ID and an attempt number. As in Gymnasium, an episode runs from reset to done. Gym may retry a rollout after an infrastructure failure; each retry is a new episode of the same rollout, and only the final episode's result counts. | | ||
| | **Attempt** | The retry number of an episode within its rollout, starting at 0. Use "attempt" only in this sense: a repeat of a task is a new rollout, not a new attempt. The cap is `NEMO_GYM_MAX_ROLLOUT_ATTEMPTS`. | |
There was a problem hiding this comment.
The cap is not simply the env var. A run saves NEMO_GYM_MAX_ROLLOUT_ATTEMPTS (default 3) in its manifest when it starts, and gym eval resubmit --recover --extend-attempts N raises it later (attempt_cap, _get_max_rollout_attempts). If you change the env var before a resume, a saved run keeps its old cap. Suggest:
The cap is
NEMO_GYM_MAX_ROLLOUT_ATTEMPTS(default 3), saved with the run; a recovery with--extend-attemptsraises it.
| | **Rollout** | One sample of a task. Each rollout gets one reward. `num_repeats` sets how many rollouts each task gets, and metrics such as pass@k count rollouts. A rollout is identified by its task and its repeat index. Other tools call this a *sample* (pass@k papers, Inspect) or a *trial* (Harbor). | | ||
| | **Episode** | One execution of a rollout, from `seed_session()` through `verify()`, identified by the rollout ID and an attempt number. As in Gymnasium, an episode runs from reset to done. Gym may retry a rollout after an infrastructure failure; each retry is a new episode of the same rollout, and only the final episode's result counts. | | ||
| | **Attempt** | The retry number of an episode within its rollout, starting at 0. Use "attempt" only in this sense: a repeat of a task is a new rollout, not a new attempt. The cap is `NEMO_GYM_MAX_ROLLOUT_ATTEMPTS`. | | ||
| | **Trajectory** | The record of what happened in one episode: agent invocations, turns, model calls, and tool calls, plus gaps where data is missing. A rollout's trajectory is the trajectory of its final episode. A trajectory is data; a rollout is the sample it describes. See [trajectory capabilities](/reference/trajectory-capabilities). | |
There was a problem hiding this comment.
/reference/trajectory-capabilities no longer exists on main: #5179 removed it and added a redirect to harness conformance. Please link /main/observability/harness-conformance#results, the same target main's Rollout row uses.
| | **Episode** | One execution of a rollout, from `seed_session()` through `verify()`, identified by the rollout ID and an attempt number. As in Gymnasium, an episode runs from reset to done. Gym may retry a rollout after an infrastructure failure; each retry is a new episode of the same rollout, and only the final episode's result counts. | | ||
| | **Attempt** | The retry number of an episode within its rollout, starting at 0. Use "attempt" only in this sense: a repeat of a task is a new rollout, not a new attempt. The cap is `NEMO_GYM_MAX_ROLLOUT_ATTEMPTS`. | | ||
| | **Trajectory** | The record of what happened in one episode: agent invocations, turns, model calls, and tool calls, plus gaps where data is missing. A rollout's trajectory is the trajectory of its final episode. A trajectory is data; a rollout is the sample it describes. See [trajectory capabilities](/reference/trajectory-capabilities). | | ||
| | **Trace** | An OpenTelemetry trace: timed spans across Gym's servers, emitted when [distributed tracing](/observability/distributed-tracing) is on. LLM observability tools use the word the same way. A trace shows timing; the trajectory is the scored record. | |
There was a problem hiding this comment.
Nit: the closing sentence, the trajectory is the scored record, contradicts the Trajectory row above, which says a trajectory is data and the rollout is what gets scored. Suggest: A trace shows timing; the trajectory is the saved record of the episode.
| | **State** | Per-episode mutable world (files, DB, tool results, and so on). `seed_session()` starts a clean session; tools update that session; it is not a snapshot of the whole environment config. | | ||
| | **Verifier** | Scores an episode into a **reward** (typically 0–1) via `verify()` on the resources server. Also called scorer or grader. See [Build Verifiers](/build-verifiers). | | ||
| | **Reward** | Numerical score (typically 0.0–1.0) for how well the episode did; the final episode's reward is the rollout's reward — used as eval metrics and as the RL learning signal. | | ||
| | **Session** | The state one server keeps for one episode: the *resources session* (started by `seed_session()`) and the *agent session*. A session ends with its episode. | |
There was a problem hiding this comment.
main now has a Sessions section (#5083, key-terminology.mdx on main). It already defines resources session / agent session as per-episode state, defines episode session, and asks readers not to add synonyms. Keeping this row would define session twice. Please drop it when you merge main, and point the tree's session node at that section instead.
| ## How an Agent Runs a Task in NeMo Gym Environments | ||
|
|
||
| Each task attempt is an *episode*. Rollout collection sends every episode to an Environment Server. An Environment Server that drives agent sessions, such as `single_agent_turn`, runs it in this order, and the resulting trajectory is called a *rollout*: | ||
| Each sample of a task is a *rollout*, and Gym executes each rollout as an *episode*. Rollout collection sends every episode to an Environment Server. An Environment Server that drives agent sessions, such as `single_agent_turn`, runs it in this order and records what happened as a *trajectory*: |
There was a problem hiding this comment.
This page has one more spot that uses the old sense: the State Isolation bullet (line 91) says each rollout gets its own session, so attempts never interfere. Under the new definitions that should read each episode gets its own session, so episodes never interfere with each other, with the checkpoint-restore caveat from the open bot thread on environments.mdx.
What does this PR do?
The key terminology page says rollout and trajectory are aliases, and it defines a "task attempt" as one rollout. The code uses these words differently.
EpisodeIdinnemo_gym/episode_types.pyidentifies "one physical attempt of a logical rollout": a retry underNEMO_GYM_MAX_ROLLOUT_ATTEMPTSkeeps the rollout ID and incrementsattempt, whilenum_repeatscreates new rollouts.TrajectoryRecordinnemo_gym/rollout_observability.pyis the data recorded for an episode. A reader who learns the vocabulary from the docs therefore misreads the code, and the architecture page contradicts the glossary on the same site.This PR rewrites the glossary to match the code:
num_repeatsand pass@k count rollouts.seed_session()throughverify(). A rollout usually has one episode; after an infrastructure failure Gym can run it again as a new episode, and only the final episode's result becomes the reward./runendpoint.The overview opens with the run → task → rollout → episode → trajectory hierarchy. Entries name the matching term in other tools where one exists: a rollout is a sample in pass@k papers and Inspect and a trial in Harbor, an episode runs from reset to done as in Gymnasium, and a step matches ATIF's step.
about/architecture.mdxcalled each task attempt an episode and the resulting trajectory a rollout; it now uses the same definitions.about/concepts/environments.mdxreplaces "task attempt" with "episode" where it describes per-episode state and scoring.No issue tracks this. The change is docs-only and sets the vocabulary that later reviewer-team and code-organization changes refer to.
Validation
npm run checkfromfern/(fern check)pre-commit run --fileson the changed pagesRollouts
N/A: docs-only change with no runtime behavior.
Compatibility and benchmark impact
None. No page moves, so no redirects are needed.
Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).