Repository navigation
Conversation
973a307 to
bbb44a5
Compare
835adfc to
5418fe8
Compare
5418fe8 to
d4bac44
Compare
|
/ok to test d4bac44 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
I found two RISK issues: collation can discard the new sampling field, and redirects can drop the sampling segment before generation. Both can make trained calls fail or use the wrong sampling values.
I reviewed the supplied changeset and directly affected contracts, callers, and tests. This was a static review; I didn't execute tests or independently verify the reported smoke runs.
Inline comments (escaped v1):
-
nemo_gym/data/dataset_preparation.pyline 1314: RISK — Preserve sampling when collation materializes a flat rowA flat source row containing
responses_create_paramsand_ng_model_sampling={"temperature":0.6}, declared withtaskset: tasks, loses its sampling during collation.materialize_taskremoves_ng_fields from task data, but this whitelist restores only identity fields. The new_episode_request_bodybranch consequently sends nomodel_sampling. A required Model Server refuses the trained call; an optional one generates without the requested values.Could you import
MODEL_SAMPLING_KEY_NAMEhere and add it to this tuple, immediately afterATTEMPT_INDEX_KEY_NAME?ATTEMPT_INDEX_KEY_NAME, MODEL_SAMPLING_KEY_NAME,Also add the literal
"_ng_model_sampling"toRESERVED_ROW_KEYS. Validation runs before conversion and currently treats this framework field as unknown task data, so strict collation rejects the same valid row. Keep the existing whitelist rather than copying every_ng_field. The invariant is that sampling survives beside the task, never inside it.Proposed checks, not executed: extend
test_collation_preserves_shard_and_retry_identitywith_ng_model_sampling={"temperature":0.6,"top_p":0.95,"max_output_tokens":64}. Assert that the prepared row retains it,task_inputexcludes it, and the parsed episode request contains exactly those values. Retain both explicit-rollout-ID cases and their attempt assertions. Add a strict-validation case that accepts this field while still rejecting an unrelated unknown task field. Rows without sampling must retain their existing shape. Please verify the suggested change before adopting it. -
nemo_gym/server_runtime/request_handling/model_sampling.pyline 129: RISK — Keep the sampling segment on redirectsStripping the segment without restoring it on redirect responses loses the caller's sampling. For example, send
POST /ng-sampling/<encoded temperature=0.6>/v1/responses/with body{"input":"task","temperature":1.0}to a Model Server and follow its trailing-slash redirect. The first request is routed as/v1/responses/; it isn't rewritten because_TOKEN_LIMIT_FIELDSmatches only the slashless path. The redirect therefore targets/v1/responseswithout sampling. A required server answers 422, while an optional server generates at1.0instead of0.6. The agent middleware has the same omission at its forwarding branch.Redirect preservation is already part of the URL-prefix contract: the trace middleware restores its segment, and its existing regression test explicitly covers followed trailing-slash redirects.
Could you wrap
sendin both sampling middleware classes and restore the original sampling segment on root-relative and same-origin redirect targets? Preserve the mount path, rollout ID, capture tag, trace context, and query; insert sampling after those prefixes, without duplicating an existing segment. Leave cross-origin redirects untouched. The exact helper needs to account for the different model and agent prefix stacks; a blanket prepend would put sampling before the rollout prefix and be rejected.Proposed checks, not executed: parameterize followed trailing-slash requests across Responses, Chat Completions, and Messages, with required sampling on and off. Encoded values must reach the provider and capture unchanged, including the output cap. A
nullrequest must retain the caller's sampling and the vLLMx-ng-sampling: nullheader. Add an agent activation case proving its downstream model call retains the segment. Repeat with rollout/capture/trace prefixes and a relay mount; retain slashless behavior, query strings, unsampled evaluation behavior, malformed-segment rejection, and unchanged cross-origin redirect targets.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
d4bac44 to
5f9ed17
Compare
|
/ok to test 5f9ed17 |
5f9ed17 to
c97de79
Compare
|
/ok to test c97de79 |
ananthsub
left a comment
There was a problem hiding this comment.
This PR needs a refreshed description and swe_together rollout evidence before it merges.
The description predates the rebase onto main:
- It says the PR is stacked on #5463 and that its last five commits are this PR's. #5463 has merged, and this PR is three commits.
- Several parts describe #5463, not this PR: the second problem bullet, the tau2, pinchbench and
conversational_tool_use_policy_tool_generationrows, theapplies_model_samplingparagraph, and the compatibility notes on the agent URL helper. - Compatibility should list the new
model_samplingkeyword onrun_judgeandAuxiliaryModel. It should also say thatnemo_user_simandswe_togethernow admit episodes with values instead of refusing them at admission. - Validation lists unit tests this PR does not touch, and the end-to-end run is at bbb44a5, before the rebase.
- "A trained participant whose values get lost is refused rather than sampled as untrained" holds only when the segment is missing. A participant given
nullpassesrequired_model_servers.
No run shows swe_together with values. Please add a short smoke run where the candidate on policy_model gets the values and the judge, user simulator and interaction scorer carry null. Or say why it is N/A.
Two follow-ups for whichever change lands second:
- #5711 conflicts with this PR in
responses_path. Itsnemo_user_simtest still callsresponses_path(capture_training_tokens=...), which needstrained=. - NVIDIA-NeMo/RL#5030's doc names only
single_agent_turn,single_agent_turn_legacyandharboras environment servers that apply the values.
… values nemo_user_sim accepted an episode's model_sampling and ran every participant without it. The assistant, the participant a training framework trains, now carries the episode's values in its activation path, beside the training tag it already had. The user simulator carries null, and so do the environment's own judge, summary and tool-simulation calls to support_model, which defaults to the policy endpoint: they keep their own sampling, or support_model's sampling_overrides. Those calls set the segment through the request context, so the server client places it after any rollout prefix it adds. nemo_user_sim now declares applies_model_sampling. Gym-only evaluation sends no values, and its URLs are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zeyu Zhou <[email protected]>
…values swe_together accepted an episode's model_sampling and ran its agents without it. The candidate, the agent a training framework trains, now carries the episode's values in its activation path. The judge agent's activation and the environment's own simulator and interaction-scorer calls carry null, so they keep their own sampling, or their Model Servers' sampling_overrides. swe_together now declares applies_model_sampling. Gym-only evaluation sends no values, and its URLs are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zeyu Zhou <[email protected]>
The training guide said nemo_user_sim and swe_together do not apply a training framework's values yet. It now lists the participants those environments do not train among the calls that keep their own sampling, and describes how an environment server applies the values to its participants or refuses them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zeyu Zhou <[email protected]>
c97de79 to
d0e4280
Compare
|
/ok to test d0e4280 |
|
Before this merges, I think it should be folded into the agent-instance stack (#5252, #5253). Otherwise Gym ends up with two conventions for which agent instances are trained: one for token capture and one for sampling. Where the two diverge. This PR fixes the trained agent instance in code ( Proposed split: three settings at three levels.
What this removes.
Concretely for this PR: rebase onto #5253, and replace @pthombre, does this split work for the stack? |
|
currently waiting for #5253 to be merged |
What does this PR do?
Gym side of PR 2 in the design doc "RL sampling through Gym": multi-agent environments. It needs no NeMo RL code change; NeMo RL picks it up with a Gym submodule bump. Two of its parts moved into #5463 during review and are on
main: environment servers that do not apply the values refuse them (applies_model_sampling), and roles an agent runs besides the trained one getnull(trained=False).Problem
main,nemo_user_simandswe_togetherrefuse an episode that carries a training framework's sampling values (model_sampling): they do not apply them, so they do not declareapplies_model_sampling. A NeMo RL run cannot use them.What each participant's URL carries, in a run with values
nemo_user_simnemo_user_simsupport_model)nullswe_togetherswe_togethernullEach environment server sets its participants' segments with
BaseEnvironmentServer.model_sampling_segment(request, trained=...), and both now declareapplies_model_sampling. Every untrained participant that calls a Gym Model Server is markednullexplicitly, so a trained participant whose segment goes missing is refused rather than sampled as untrained. A participant wrongly givennullis not refused; the tests check who gets which.Not changed
sampling_overrides,model_call_sampling.required_model_servers([policy_model]) andnemo_user_sim's shipped config.Compatibility
UserSimEnvironmentServer.responses_path: keywordcapture_training_tokensis nowtrained.nemo_user_simandswe_togethernow admit episodes that carry values; onmainthey refuse them at admission.swe_together'srun_judgeandAuxiliaryModeltake a new keyword-onlymodel_sampling(defaultNone).Validation
nemo_user_sim's andswe_together's suites, including which participants get the values with token capture on.swe_together;nemo_user_simran with a stand-in forusersim.pre-commit run --fileson the changed files: passed.max_new_tokens2048. Each untrained role is pinned to values of its own.swe_togetherran later, Gym only, at d0e4280 (this head): one task with the training values, sandboxes on OpenSandbox. Its untrained roles keep the benchmark's own settings. The judge reached its turn limit before giving a verdict, so the episode is unscored; that doesn't affect the sampling check.examples/run_grpo_single_controller.pynemo_user_simrollouts (no NeMo RL recipe yet)swe_togetherrollout, one tasksimple_agent+ LLM judgesingle_agent_turnlegacy_agentconversational_tool_use_policy_tool_generationlegacy_agentsimple_agentnemo_user_simopencode_agentswe_togetherclaude_code_agent), simulated user, interaction scorerEvery trained call carried its phase's values within the cap. Every untrained role's calls carried
nulland kept its own values. No refusals; in the RL run, no vLLM sampling assertion fired and the training step completed.🤖 Generated with Claude Code