Skip to content

feat: Add Tau bench environment - #2479

Open
ashors1 wants to merge 47 commits into
mainfrom
ashors/multiturn-env
Open

ashors1 wants to merge 47 commits into
mainfrom
ashors/multiturn-env

Conversation

@ashors1

@ashors1 ashors1 commented May 12, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

This PR adds a Tau bench environment to serve as an example of a multi-turn environment with an option for LLM-as-a-judge. This can be used to analyze the performance of more complicated multi-turn environments natively in NeMo-RL.

Note that we provide the option to mock user and judge models using user_strategy='mock' and judge_model='mock'.

Issues

List issues that this PR closes (syntax):

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 May 12, 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.

@ashors1
ashors1 requested review from guyueh1 and terrykong May 12, 2026 22:54
Comment thread nemo_rl/experience/rollouts.py Resolved
Comment thread pyproject.toml Resolved

@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.

Review Summary

Nice work adding the tau-bench multi-turn environment — the architecture is clean and the mock mode is a thoughtful addition for testing without LLM credentials. Two critical issues need attention before merge:

  1. _tokenize_env_observation silently breaks all existing multi-turn environments — the new function passes role="environment" to apply_chat_template, which silently drops the message on Qwen/Llama templates. Math, code, sliding_puzzle, vlm, and reward_model environments would lose all observation feedback in rollouts.

  2. TestCallJudge is entirely broken — fixture missing _mock_mode attribute, and all tests mock requests.post instead of litellm.completion.

Additional notes (not tied to specific diff lines)

  • Documentation: This is a new feature (feat:) but there is no user-facing documentation. docs/guides/environments.md does not mention tau-bench, and there is no guide analogous to docs/guides/grpo-sliding-puzzle.md. Consider adding a section.

  • Design note: The pre-step mechanism wastes one generation turn per episode (~2% overhead with max_steps=50). The tradeoff is documented in the code and reasonable, but worth noting.

  • Global litellm monkey-patch: Mock mode at tau_bench_environment.py:149 patches litellm.completion globally at the module level. Any other code in the same worker process that uses litellm.completion would also get the mock. Consider a more targeted patch.

  • Env var clobbering: os.environ["OPENAI_API_KEY"] = user_api_key at tau_bench_environment.py:188 unconditionally overwrites any existing key (defaults to "dummy" from config fallback). Guard with if user_api_key:.

Generated by Claude Code

Comment thread nemo_rl/experience/rollouts.py Resolved
Comment thread nemo_rl/experience/rollouts.py Resolved
judge_api_key="dummy",
max_steps=30,
):
"""Return a bare TauBenchWorker instance without spawning a Ray actor."""

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.

test_tau_bench_environment.py:74-92 — Broken test fixture

_make_worker() never sets _mock_mode or _mock_latency_s. When _call_judge runs if self._mock_mode: (line 266), it raises AttributeError.

Additionally, all TestCallJudge tests mock requests.post but the implementation uses litellm.completion. The mocks are never hit — tests either fail or pass for the wrong reason (the broad except Exception returns 0.0).

Suggested fix: add worker._mock_mode = False and worker._mock_latency_s = 0.0 to _make_worker(), then replace mock.patch("requests.post", ...) with mock.patch("litellm.completion", ...) and build mocks matching litellm's return type (resp.choices[0].message.content).

Comment thread examples/configs/grpo_tau_bench.yaml Resolved
Comment thread pyproject.toml Resolved
Comment thread nemo_rl/data/processors.py Resolved
@ashors1
ashors1 force-pushed the ashors/multiturn-env branch from 6229f3f to f32be23 Compare June 4, 2026 17:33
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Jun 4, 2026
@ashors1
ashors1 marked this pull request as ready for review June 5, 2026 02:34
@ashors1
ashors1 requested review from a team as code owners June 5, 2026 02:34
@ashors1

ashors1 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 5499b99

@ashors1

ashors1 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a370039

Signed-off-by: ashors1 <[email protected]>
@ashors1

ashors1 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test ff60101

@ashors1

ashors1 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 09413fe

@ashors1

ashors1 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 991e22f

Signed-off-by: ashors1 <[email protected]>
@ashors1

ashors1 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 5a71574

Signed-off-by: ashors1 <[email protected]>
@ashors1

ashors1 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 224baa0

Signed-off-by: ashors1 <[email protected]>
@ashors1

ashors1 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 9956bf7

@ashors1

ashors1 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test ac5713b

Signed-off-by: ashors1 <[email protected]>
@ashors1

ashors1 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7a01135

@ashors1 ashors1 added CI:L1 Run doctests, unit tests, and functional tests and removed CI:L1 Run doctests, unit tests, and functional tests labels Aug 6, 2026
@ashors1

ashors1 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 7a01135

@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026

This branch was previously deployed

2 inactive (outdated) deployments
public — 2547af84 Deployed Jun 25, 2026 by copy-pr-bot[bot] via release / finalize / publish-docs #1483
test — 363a63f7 Deployed Jun 12, 2026 by copy-pr-bot[bot] via Wait in test approval queue #12280
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Environments currently return role as part of content

2 participants