Repository navigation
Description
Use cases, pain points, and background
Token capture can only be turned on per agent, from config. A model call is captured when its URL carries the /training-token-capture segment, and Gym adds that segment when token_id_capture.enabled is set and the agent has token_id_capture: true, or when all_agents: true is set. The decision is made in three places:
- Agent servers:
_token_id_capture_enabled()innemo_gym/base_responses_api_agent.py. single_agent_turn:_agent_responses_path()inenvironment_servers/single_agent_turn/app.py.nemo_user_sim: per participant, for the assistant only.
Nothing in a rollout request can change it. So every rollout that runs through a capturing agent is captured, including validation and other eval-only rollouts that are never trained on.
For each captured call, the training framework writes the generated token ids and logprobs into its training data store. When the request sets top_logprobs, it also writes the k alternatives per token. For rollouts that are never trained on, all of this is wasted storage and transfer, and with top_logprobs the waste is large.
NeMo RL does not hit this yet, because token capture only runs in its single-controller runner, which has no validation loop. It will as soon as validation runs with capture enabled.
Description
Let the caller turn token capture off or on for each rollout, without changing agent config. A training framework could then run validation rollouts through the same agents and environments without capturing them.
Design
Open for discussion. One sketch:
- Add a rollout-level setting to the rollout request: the run body for agent
/run, and the episode request for Environment Servers. - When an agent or Environment Server builds the
/ng-rollout/...URL prefix, use that setting to decide whether to add/training-token-capture.
Related work:
- feat(core): let callers name an agent instance on model calls #5252 makes the training tag per agent instance (
training_agent_instances). That selection is still static config. - Per-rollout sampling for training (Coding-agent servers reject generation controls sent by NeMo-RL #4656) needs the same kind of rollout-level setting carried into model-call URLs. Both could share one mechanism.
Out of scope
- Selecting which agents or agent instances are captured. That is covered by feat(core): let callers name an agent instance on model calls #5252.
- Changing which fields a captured call records.
Activity
feat(capture): let a rollout skip token capture
feat(gym): do not capture tokens for validation rollouts
feat(capture): let a rollout skip token capture
feat(capture): let a rollout skip token capture
feat(capture): let a rollout skip token capture
feat(capture): let a rollout skip token capture (NVIDIA-NeMo#5711)
feat(gym): do not capture tokens for validation rollouts
feat(gym): do not capture tokens for validation rollouts
feat(gym): do not capture tokens for validation rollouts