Skip to content

Bound text-only continuation nudges - #3198

Merged
sgharghabi merged 1 commit into
mainfrom
fix/finance-agent-bounded-continuations
Sep 10, 2026
Merged

sgharghabi merged 1 commit into
mainfrom
fix/finance-agent-bounded-continuations

Conversation

@sgharghabi

@sgharghabi sgharghabi commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Disable synthetic user nudges for GRPO finance training to preserve NeMo-RL monotonic trajectories. Keep Gym eval on the default (nudge and continue), and record text_only as the stop reason.

What does this PR do?

Stops the finance agent from injecting a synthetic user message (Continue. / the v2 nudge) on a text-only turn when GRPO training turns the flag off.

That injection is a new user turn. On reasoning models, the chat template then treats earlier assistant turns as “before the last user message” and strips their <think> blocks. The re-templated prompt is no longer a prefix of the tokens NeMo-RL already recorded, which trips non-monotonically increasing trajectory and then the fatal Non-contiguous messages found. A 50-turn tool loop is fine; a single nudge is not.

This PR:

  • Adds continue_if_not_tool_call (bool, default true):
    • Eval (shipped finance_agent.yaml / finance_agent_v2.yaml): omit the field; inherit true. A text-only turn injects the nudge and the loop continues until max_steps / time.
    • Training (NVFlow GRPO overlay): false. The first text-only reply ends the episode. No nudge.
  • Records stop_reason: text_only when that path ends the loop, so a zero from “never submitted” is distinguishable from “judged wrong” or max_turns.
  • Leaves max_steps: 50 as the overall turn budget for real tool-calling episodes.

max_steps still caps all model turns. continue_if_not_tool_call only applies when a turn is prose with no tool call, so training does not burn 50 steps on an all-text loop.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format/copyright pass).
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@copy-pr-bot

copy-pr-bot Bot commented Sep 9, 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.

@sgharghabi
sgharghabi marked this pull request as draft September 9, 2026 23:06
@sgharghabi
sgharghabi force-pushed the fix/finance-agent-bounded-continuations branch 2 times, most recently from d98bee6 to e1724cc Compare September 10, 2026 16:53
@sgharghabi
sgharghabi marked this pull request as ready for review September 10, 2026 18:10
@sgharghabi
sgharghabi removed the request for review from psgundecha-nv September 10, 2026 18:11
@bxyu-nvidia

Copy link
Copy Markdown
Contributor

/ok to test db9060f

Add continue_if_not_tool_call (default true) so Gym eval still injects
the no-tool-call nudge until max_steps or time. GRPO overlays set false
to end the episode on the first text-only turn and keep NeMo-RL
trajectories monotonic. Record stop_reason text_only when that path
ends the loop.

Signed-off-by: Shaya Gharghabi <sgharghabi@nvidia.com>
@sgharghabi
sgharghabi force-pushed the fix/finance-agent-bounded-continuations branch from db9060f to 5e2aece Compare September 10, 2026 18:20
@sgharghabi
sgharghabi enabled auto-merge (squash) September 10, 2026 18:24
@sgharghabi

Copy link
Copy Markdown
Contributor Author

/ok to test 5e2aece

@sgharghabi
sgharghabi merged commit 9506eb8 into main Sep 10, 2026
31 checks passed
@sgharghabi
sgharghabi deleted the fix/finance-agent-bounded-continuations branch September 10, 2026 18:40
jkyi-nvidia pushed a commit that referenced this pull request Sep 11, 2026
Disable synthetic user nudges for GRPO finance training to preserve
NeMo-RL monotonic trajectories. Keep Gym eval on the default (nudge and
continue), and record `text_only` as the stop reason.

## What does this PR do?

Stops the finance agent from injecting a synthetic user message
(`Continue.` / the v2 nudge) on a text-only turn when GRPO training
turns the flag off.

That injection is a new user turn. On reasoning models, the chat
template then treats earlier assistant turns as “before the last user
message” and strips their `<think>` blocks. The re-templated prompt is
no longer a prefix of the tokens NeMo-RL already recorded, which trips
`non-monotonically increasing trajectory` and then the fatal
`Non-contiguous messages found`. A 50-turn **tool** loop is fine; a
single nudge is not.

This PR:

- Adds `continue_if_not_tool_call` (bool, **default `true`**):
- **Eval** (shipped `finance_agent.yaml` / `finance_agent_v2.yaml`):
omit the field; inherit `true`. A text-only turn injects the nudge and
the loop continues until `max_steps` / time.
- **Training** (NVFlow GRPO overlay): `false`. The first text-only reply
ends the episode. No nudge.
- Records `stop_reason: text_only` when that path ends the loop, so a
zero from “never submitted” is distinguishable from “judged wrong” or
`max_turns`.
- Leaves `max_steps: 50` as the overall turn budget for real
tool-calling episodes.

`max_steps` still caps all model turns. `continue_if_not_tool_call` only
applies when a turn is prose with no tool call, so training does not
burn 50 steps on an all-text loop.

## Checklist

- [x] I have read the [contributing
guidelines](https://docs.nvidia.com/nemo/gym/latest/contribute/development-setup).
- [x] The change is focused; unrelated "drive-by" edits are tracked as
separate issues/PRs.
- [x] Tests added or updated and pass locally, or N/A for docs-only /
non-code changes (so CI unit/server checks pass when applicable).
- [x] Pre-commit checks pass locally (`pre-commit run --all-files`) (so
CI lint/format/copyright pass).
- [x] All commits have DCO sign-off (`git commit -s`) (so the DCO check
passes).

Signed-off-by: Shaya Gharghabi <sgharghabi@nvidia.com>
Signed-off-by: Junkeun Yi <jkyi@nvidia.com>

This branch was previously deployed

1 inactive deployment
public — 5e2aeceb Deployed Sep 10, 2026 by copy-pr-bot[bot] via release / finalize / notify #2771
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants