Skip to content

feat(trtllm): support agentic training for SWE rollout - #3130

Merged
terrykong merged 27 commits into
NVIDIA-NeMo:mainfrom
hchings:trtllm-agentic-swe
Jul 26, 2026
Merged

feat(trtllm): support agentic training for SWE rollout#3130
terrykong merged 27 commits into
NVIDIA-NeMo:mainfrom
hchings:trtllm-agentic-swe

Conversation

@hchings

@hchings hchings commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

Add support of agentic training for SWE with TRTLLM rollout.
This MR builds on top of #2420 (merged).

[‼️ Notes for reviewers ‼️]

  • This MR only ensure convergence of trtllm aligns w/ vllm's. Perf optimizations will be in subsequent MRs.

Scope of testing:

1. Qwen3.5-35B-A3B 4 nodes X GB200/GB300

Retested w/ latest commits as of 7/25.

2. Qwen3-30B-Thinking, 16 nodes X H100s

  • TRTLLM wandb, using the recipe provided by Rayen. Please see pinned run w/ suffix eos-fix-0630-r3.
  • Convergence aligned with BIn Hu's run with vllm. vllm wandb, verified by Jia in early July.

Last tested til commit 0591b0e.
Tentatively remove Thinking scripts in 07dbfd4 and will add them back in a follow-up MR.

Issues

TRTLLM-13972

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

  • ...

@copy-pr-bot

copy-pr-bot Bot commented Jul 8, 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.

@hchings
hchings force-pushed the trtllm-agentic-swe branch from bc92d0a to c6b1fd9 Compare July 10, 2026 07:25
@hchings
hchings force-pushed the trtllm-agentic-swe branch from c6b1fd9 to 231a945 Compare July 12, 2026 05:30
@hchings
hchings force-pushed the trtllm-agentic-swe branch 2 times, most recently from 292c5e2 to c2f4d83 Compare July 13, 2026 21:18
@hchings hchings changed the title [WIP] SWE agentic training for trtllm rollout [WIP] Support agentic training for SWE with TRTLLM rollout Jul 13, 2026

@yuki-97 yuki-97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @hchings , left some comments.

this PR support gym path, it's worth to add a functional test and nightly test for this, you can take 3eedbc6 as an example for nightly test.

Reviewed via hchings#4 (delta against shuyix/trtllm), scoped to the agentic-SWE + TRT-LLM HTTP server changes. Scripts and recipe YAMLs skipped per the PR note. Comments target the shared code paths.

Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py Outdated
Comment thread tests/unit/models/generation/test_vllm_generation.py
Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py
Comment thread ray.sub Outdated
Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py Outdated
Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py Outdated
Comment thread examples/swe_bench/grpo_qwen3_30b_async_swe.yaml Outdated
Comment thread examples/swe_bench/grpo_qwen3_30b_async_swe.yaml Outdated
@hchings
hchings force-pushed the trtllm-agentic-swe branch from c2f4d83 to 6947764 Compare July 21, 2026 01:42
@github-actions github-actions Bot added Documentation Improvements or additions to documentation CI Relating to CI labels Jul 21, 2026
@hchings
hchings marked this pull request as ready for review July 21, 2026 01:47
@hchings
hchings requested review from a team as code owners July 21, 2026 01:47

@terrykong terrykong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hchings — the TRT-LLM agentic path is a valuable addition, and the convergence-parity scoping (with perf deferred) is a reasonable split. This pass was reviewed via hchings#4 (the true delta against shuyix/trtllm, since #3130 is stacked on the not-yet-merged #2420), scoped to the 14 files that PR adds. Same head SHA, so comments anchor here.

Rebase needed: the PR currently has merge conflicts against main (mergeable: CONFLICTING) — please rebase on main (or the refreshed #2420 base) and resolve before merge.

A few non-blocking notes (details in the inline comments where actionable):

  • Verified positive: the new test_replace_prefix_tokens_qwen3_think_shift_picks_assistant_eos_not_user_eos is a genuine regression test — we executed both the old positional and new EOS-count algorithms on its inputs; the old one drops the intervening user turn, the new one preserves it.
  • We also verified the open logprob question on the earlier review thread is not a bug on this code path (evidence permalinks in the thread reply) — no change needed there.
  • The pure helpers in trtllm_http_server.py (_parse_tool_calls, _to_int_ids, _compute_splice_inputs, ...) currently have no unit coverage; they are CPU-testable with a stub tokenizer. We have a verified-passing 8-test suite for them — happy to share it on this PR if useful.
  • Nightly/functional coverage for the gym+trtllm path is still on your TODO — +1 to landing at least one entry with (or right after) this PR.
  • For the perf follow-up PRs: asyncio.to_thread(llm.generate, ...) uses asyncio's default executor (max ~32 threads), which caps concurrent HTTP generations well below max_batch_size: 256 — worth revisiting when you optimize throughput (e.g. a dedicated executor or llm.generate_async).

Generated by Claude Code

Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py
Comment thread tests/unit/models/generation/test_openai_server_utils.py
Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py
Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py Outdated
Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py Outdated
Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py
Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py Outdated
Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py Outdated
Comment thread nemo_rl/data/llm_message_utils.py Outdated
Comment thread nemo_rl/models/generation/openai_server_utils.py
@cmunley1

cmunley1 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

did you measure logp error with stripped thinking blocks (Qwen3)? wouldn't it be high without something like an attn mask in this case if you are recomputing?

@hchings hchings changed the title [WIP] Support agentic training for SWE with TRTLLM rollout [feat] Support agentic training for SWE with TRTLLM rollout Jul 21, 2026
@hchings
hchings force-pushed the trtllm-agentic-swe branch 2 times, most recently from bdaadcb to ec1a8dd Compare July 21, 2026 23:09
bxyu-nvidia
bxyu-nvidia previously approved these changes Jul 23, 2026
Comment thread nemo_rl/models/generation/openai_server_utils.py
@hchings
hchings force-pushed the trtllm-agentic-swe branch from 15a5c98 to c679c58 Compare July 23, 2026 20:53
@github-actions github-actions Bot removed the CI Relating to CI label Jul 23, 2026
Signed-off-by: Erin Ho <14718778+hchings@users.noreply.github.com>
@hchings

hchings commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 74769c6

@terrykong terrykong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing 5bd494e4 "fix validation, aligned w/ vllm's behavior" with one goal: match how vLLM does this today, and keep this PR to the status quo.

The short version: this change actually diverges from vLLM rather than mirroring it, and as written it's inert. Detail + receipts in the inline comment. Suggested path is to revert to the unconditional assert for this PR (which is the vLLM behavior) and unblock validation config-side, deferring real per-split sampling to a follow-up.

Generated by Claude Code

Comment thread nemo_rl/models/generation/trtllm/trtllm_http_server.py Outdated
Signed-off-by: Erin Ho <14718778+hchings@users.noreply.github.com>
@hchings
hchings force-pushed the trtllm-agentic-swe branch from 74769c6 to 7c33404 Compare July 25, 2026 04:39

@terrykong terrykong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm modulo proof that examples/swe_bench/grpo_qwen3_30b_async_swe_trtllm.yaml can run (was concern about validation sampling params causing error so need to make sure it's also passing the same sampling params)

@hchings

hchings commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7c33404

@terrykong terrykong added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:L1 Run doctests, unit tests, and functional tests labels Jul 25, 2026
@terrykong

Copy link
Copy Markdown
Collaborator

/ok to test 7c33404

Signed-off-by: Erin Ho <14718778+hchings@users.noreply.github.com>
@hchings

hchings commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test e62fb40

terrykong
terrykong previously approved these changes Jul 25, 2026
joyang-nv added a commit that referenced this pull request Jul 25, 2026
Apply the final behavior from michal2409/RL branch mfutrega/mlperf-training-qwen35-main-gb300-fixes at 41352f7, adapted to the newer PR #3130 APIs.

Signed-off-by: Jonas Yang <joyang@nvidia.com>
@joyang-nv

Copy link
Copy Markdown
Member

/ok to test bffcfbe

Signed-off-by: Erin Ho <erinh@nvidia.com>
Signed-off-by: Erin Ho <14718778+hchings@users.noreply.github.com>
@hchings

hchings commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 07dbfd4

@terrykong
terrykong enabled auto-merge (squash) July 25, 2026 23:36
@terrykong
terrykong disabled auto-merge July 25, 2026 23:41
@terrykong
terrykong enabled auto-merge (squash) July 25, 2026 23:41
@terrykong
terrykong merged commit a4e21a8 into NVIDIA-NeMo:main Jul 26, 2026
82 checks passed
@hchings hchings self-assigned this Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants