Skip to content

docs: update external harness token capture guide - #2349

Merged
ananthsub merged 1 commit into
mainfrom
ananthsub/tokidcap/docs-extras
Sep 1, 2026
Merged

docs: update external harness token capture guide#2349
ananthsub merged 1 commit into
mainfrom
ananthsub/tokidcap/docs-extras

Conversation

@ananthsub

@ananthsub ananthsub commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Explains how to collect trainable rollouts from an external agent harness that drives its own model calls and returns text without token ids.

How it works

flowchart LR
    H[External agent harness] -->|model calls| M[Gym model server]
    M -->|exact token ids and log probabilities| S[(Capture storage)]
    H -->|finished rollout| C[Rollout collector]
    S --> C
    C -->|rebuild verified call chain| R[Token-bearing response]
    R --> T[Trainer]
Loading

Gym records token ids while they are still available in the model server. It links each call to its rollout, rebuilds the verified chain that produced the scored response, and masks incomplete or ambiguous rollouts instead of guessing.

Summary

  • Shows when external-harness token capture is needed and when native response token ids should be used instead.
  • Walks through model-server, capture-store, agent opt-in, sampling, tokenizer, and tool-parser configuration.
  • Explains the rebuilt response, first-run health metrics, terminal attribution, masking, and capture cleanup.
  • Documents optional verified prefix supply and its backend requirements, including the stock vLLM limitation.
  • Covers both Gym's node-local file store and framework-owned capture transports without exposing internal storage or matching implementation details.
  • Provides the consumer lifecycle and rollout-id requirements needed by custom training loops.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@copy-pr-bot

copy-pr-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ananthsub
ananthsub force-pushed the ananthsub/tokidcap/docs-extras branch from 1540697 to 75409c4 Compare August 6, 2026 21:11
@ananthsub
ananthsub force-pushed the ananthsub/tokidcap/docs-extras branch from 75409c4 to 4c1d234 Compare August 6, 2026 21:37
@ananthsub
ananthsub force-pushed the ananthsub/tokidcap/docs-extras branch from 4c1d234 to 57cae21 Compare August 6, 2026 23:12
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Aug 6, 2026
@ananthsub
ananthsub force-pushed the ananthsub/tokidcap/docs-extras branch from 57cae21 to 3d18357 Compare August 6, 2026 23:53
@ananthsub

Copy link
Copy Markdown
Contributor Author

/claude review

@claude

claude Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

SHIP — LGTM, no reliability concerns.

Docs-and-tests-only change to the token-id-capture external-harness guide plus two new tests. No runtime library code touched; no verifier, scorer, async, or public-API surface affected.

Verified against the implementation:

  • Doc protocol signatures (TokenSink.put/mark_incomplete/close, TokenSource.seal/drop/close, LineageStore.resolve/record/close) match nemo_gym/token_id_capture/protocols.py exactly, including the async mark_incomplete and the seal_id/version conditional-drop contract.
  • The documented finalize_rollout_token_capture(result, source) / retire_rollout_token_capture(rollout_id, source, built) call shape matches delivery.py.
  • The referenced overlay responses_api_models/vllm_model/configs/vllm_model_supply_prefix.yaml exists.
  • New tests assert real behavior: test_file_lineage_concurrent_idempotent_publication_stays_unique exercises 4 concurrent FileLineageStore writers and asserts a unique resolve; test_an_external_endpoint_round_trips_the_sink_and_source_protocols drives a real request through the server and checks seal → entries → conditional drop → empty re-seal. Test API usage (build_source, FileLineageStore.record/resolve, TokenCaptureSnapshot) matches current signatures.

No BLOCKER/RISK/NOTE findings.

@ananthsub
ananthsub force-pushed the ananthsub/tokidcap/docs-extras branch from 5d2e81a to 058f873 Compare August 18, 2026 07:49
@ananthsub ananthsub changed the title docs: parent resolution and prefix supply docs: parent resolution and verified prefix supply Aug 18, 2026
@ananthsub

Copy link
Copy Markdown
Contributor Author

/claude review

@claude

claude Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

SHIP — LGTM, no reliability concerns.

Docs-plus-test change to token_id_capture. Reviewed both changed files against the diff and the trusted base implementation.

  • Docs (external-agent-harnesses.mdx): the new protocol descriptions match source — TokenSink.mark_incomplete/close are async in protocols.py, TokenSource.freeze/drop(*, snapshot_id, version) -> bool and LineageStore.resolve/record signatures are accurate, and the rebuild_response/paired-source startup requirement matches config.py validation. No factual drift.
  • Tests: both new tests assert real behavior, not pass-throughs.
    • test_file_lineage_concurrent_idempotent_publication_stays_unique exercises FileLineageStore's lock + idempotent record (byte-identical payload is a no-op) under concurrent writers, then confirms resolve returns the single unique parent — matches _record/_resolve.
    • test_an_external_endpoint_round_trips_the_sink_and_source_protocols drives a configured sink/source through the server, freezes via build_source(), and verifies conditional drop retires the exact snapshot — matches TokenCaptureSnapshot and build_source.
    • Remaining changes are comment rewrites only.

No async, API-compat, or config-convention concerns. (pytest execution was gated by sandbox permissions; verification was static against the base implementation.)

@ananthsub

Copy link
Copy Markdown
Contributor Author

/claude review

@ananthsub

Copy link
Copy Markdown
Contributor Author

/claude review

@claude

claude Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

SHIP — LGTM, no reliability concerns.

Docs-only rewrite of external-agent-harnesses.mdx. No runtime, verifier, scorer, or async code touched — zero blast radius on training/eval correctness.

Verified every technical claim against the trusted base:

  • Config keys (delta_records, max_mask_fraction, mask_fraction_min_samples, all_agents, rebuild_response, return_token_id_information, sampling_overrides) all exist in nemo_gym/token_id_capture/config.py and responses_api_models/vllm_model/app.py.
  • File paths (vllm_model_for_training.yaml, vllm_model_supply_prefix.yaml) exist.
  • API symbols (finalize_rollout_token_capture, retire_rollout_token_capture, run_conformance) exist in delivery.py/conformance.py.
  • Metric field names (n_calls, chains, delivered_fraction, quarantined_calls, empty_generation_calls, unresolved_parent_calls, mask_sample, terminal_attribution.chain = delivered) match consumer.py/builder.py.
  • Prefix-supply incompatibility with use_completions_api and is_responses_native matches the guards in app.py:228-231.
  • YAML nesting for the per-agent opt-in and run-wide capture block matches the schema.

No factual drift found.

Replace the implementation-oriented integration reference with a task-focused guide for configuring, validating, and consuming captured external-harness rollouts. Align prefix supply, terminal attribution, masking, and framework-owned storage guidance with the behavior now available on main.

Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
@ananthsub

Copy link
Copy Markdown
Contributor Author

/ok to test 654b421

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements to documentation r0.6.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge. sla:triage-overdue Review assignment is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant