Repository navigation
Description
Use cases, pain points, and background
Many reasoning models have a feature in the chat template (or system prompt) to enable or disable thinking. RL runs often want to target both modes at the same time to ensure performance increases on both. It would be great to have this implemented and tested natively in Gym so that it's easy to just add a metadata flag to datapoints that the datapoint should be treated as either reasoning on or reasoning off.
Right now there's a workaround where you can make two "versions" of the policy model and two "versions" of the agent that point at different policy models, but (a) this is awkward, and would be a pain to duplicate across every resource server and (b) this needs more testing, I found that environments like xLAM appeared to break in reasoning off mode, since the tool parsing appears to break, at least with our model (Nemotron Nano v3 chat template).
Current workaround:
policy_model_reasoning_on:
responses_api_models:
vllm_model:
[...]
chat_template_kwargs:
enable_thinking: true
policy_model_reasoning_off:
responses_api_models:
vllm_model:
[...]
chat_template_kwargs:
enable_thinking: false
instruction_following_simple_agent_reasoning_on:
responses_api_agents:
simple_agent:
[...]
model_server:
type: responses_api_models
name: policy_model_reasoning_on
instruction_following_simple_agent_reasoning_off:
responses_api_agents:
simple_agent:
[...]
model_server:
type: responses_api_models
name: policy_model_reasoning_off
Description:
- Add chat kwargs support to
responses_api_models/vllm_model/app.py - Determine whether the above duplication (which would need to be for every single resource server!) is the best/only way to handle mixed reasoning on/off training
- Implement the best solution and add example to documentation
Design:
responses_api_models/vllm_model/app.py- TBD - either all resource servers, as in the workaround, or better perhaps the base specification for resource servers in general
Out of scope:
What are some items that this issue could be mistaken to cover that this issue should explicitly NOT cover?
Acceptance Criteria:
- Implementation
- Proof that rollouts work and chat template is successfully applied and that reasoning/tools are correctly parsed back into the expected format (in particular, tool parsing needs to be confirmed that it works if the model does not output
</think>itself) - Documentation
Activity
cmunley1 commentedon Feb 5, 2026
do you have example of how it break?
cmunley1 commentedon Feb 5, 2026
isnt chat template kwargs supported now? e.g.
https://github.com/NVIDIA-NeMo/Gym/blob/main/responses_api_models/vllm_model/app.py#L155-L156
cmunley1 commentedon Feb 5, 2026
I think this is not too unreasonable, what else do you suggest, something like an array of kwargs options?
hrossnv commentedon Feb 11, 2026
Good catch, the WIP pull request that I based this issue on was based on an earlier version of Gym that didn't have that change yet.
I don't have another suggestion right now as I'm not familiar enough with Gym's internal implementation, but at least to me, having to duplicate every single resource server YAML config in Gym and duplicate all the values in it except
responses_api_agents.model_server.nameseems like a lot of duplicated code that might get hard to maintain in the future. Think how long that code block would be if I hadn't just given the example for instruction following only. I don't mind the policy model duplication so much, since it's a much shorter config, and that doesn't actually result in spinning up two copies of the model (as far as I understand).So, it's possible that I might have hit the bug where
chat_template_kwargswasn't passed to/tokenizeendpoint (can't find an issue for that mentioned here on GitHub, but I saw it discussed on Slack), but at any rate, I got rollouts like this:Specifically what happens is that the model appears to be generating reasonable tool calls, but you can see that it doesn't output
</think>(which makes sense because that should be in the assistant prompt with enable thinking false, even though for some reason I don't see it in this rollout). This seems to break the verifier's tool parsing because we see that even though the model outputs a reasonable-looking tool call, it's not parsed intopredicted_calls. For what it's worth, our tool parser for this model (Qwen3 or the Nemotron Nano v3 tool parser both work) does support reasoning off not generating</think>, so this shouldn't be a problem.Thanks for your help!
cmunley1 commentedon Feb 11, 2026
@bxyu-nvidia @hrossnv some ideas I have ...
what if we allow per-task chat template kwargs - so you can create a dataset with a blend of reasoning on / off - this way you can test different blends?
Or, we could add a config for mulitple chat template configs, e.g.
feat: per task chat template and extra body args (#672)
cmunley1 commentedon Mar 4, 2026
@hrossnv should be resolved by #672
can we close this?
hrossnv commentedon Mar 4, 2026
Looks good to me!
feat: per task chat template and extra body args (#672)
feat: per task chat template and extra body args (NVIDIA-NeMo#672)