Skip to content

[rl] Verifiers: each rollout worker runs its Verifiers envs; the env server is gone - #5899

Closed
felipemello1 wants to merge 1 commit into
felipemello1/verifiers-v2/1-taskset-package-idsfrom
felipemello1/verifiers-v2/2-verifiers-0.4.1
Closed

felipemello1 wants to merge 1 commit into
felipemello1/verifiers-v2/1-taskset-package-idsfrom
felipemello1/verifiers-v2/2-verifiers-0.4.1

Conversation

@felipemello1

@felipemello1 felipemello1 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary (human-written)

Agent details

TLDR: Each rollout worker now runs its Verifiers envs itself, on Verifiers 0.4.0. The env server process and its pool are gone, and the env is configured once, in the dataset config. One picture of the whole path is in torchtitan/rl/examples/verifiers/README.md.

before:  controller -> rollout worker -> env server (ZMQ) -> env server pool -> Verifiers env
after:   controller -> rollout worker (Verifiers env inside, serving until close)

Stack (15 PRs, bottom first; merging a PR also merges every PR below it; this PR in bold)

# PR What
1 Run Verifiers groups in rollout workers Verifiers groups run in rollout workers; the env server stays
2 Rollouts that fail outside the policy are recorded, not trained a failed rollout no longer drops its group
3 Rollouter: least-loaded placement; the controller sizes the pool from rollouts_per_worker least-loaded placement; the pool size follows the rollouts in flight
4 Rollout workers get generate_fn and release_session_fn once, at setup; the rollouter closes each worker before it stops them generator functions at setup; workers close before they stop
5 Verifiers: each example is an installed package; its name is the taskset id taskset ids are package names
6 Verifiers: each rollout worker runs its Verifiers envs; the env server is gone the env runs in the worker (Verifiers 0.4.0)
7 Verifiers: the generation server keeps one session per trace sessions; 1 GiB requests; the renderer refuses overlong prompts
8 Verifiers 0.4.1 and renderers 0.2.0 both pins move
9 Verifiers: only a rollout that Verifiers finished cleanly trains the failure rule
10 Verifiers README: terms, concurrency and sandboxes README only: terms, concurrency, sandboxes
11 Verifiers: time each rollout's sandbox start, setup, agent, model, finalize and scoring per-phase time metrics
12 Terminal-Bench: terminal_bench_env_config takes the package that exports the taskset a package argument for launchers outside the repo
13 Spread rollout workers over the job's hosts opt-in: rollout workers on the other hosts
14 Terminal-Bench: run each task in its image's WORKDIR and grade with task.toml timeouts Terminal-Bench task fixes
15 Rollout workers, the router and the controller report their CPU and memory each step per-role CPU and memory metrics

Alone on main, not in this stack: "Validation reads each prompt at most once; ValidationConfig.steps defaults to -1" and "Terminal-Bench 35B-A3B recipe: Dist-MoE in both roles, FULL CUDA graph generators, DAPO loss".

Problem

  1. Main runs Verifiers' env server as a second process pool under the rollout workers: each rollout goes from a worker to the env server (ZMQ), then to a pool worker.
  2. Verifiers 0.4.1 removes that server (serve_env), so the integration has to move before the pin can.
  3. The env config is set twice: VerifiersRollouter copies the training taskset into the env server's config.
  4. Verifiers 0.4.0 already runs an env in-process: Env.serving, Env.slots and Env.run_slot(..., on_trace=).

Solution

  1. The rollout worker loads one Verifiers env per env config, keeps it serving until close, and runs each rollout in its own task with env.slots(task) and env.run_slot.
  2. The env is configured once, in VerifiersTaskDataset.Config(env, select). Each sample carries it as JSON. The dataset parses it as the worker will, so an env a worker can't load fails when the dataset is built.
  3. Every routing session that Verifiers' traces open is released, retried attempts included (on_trace).
  4. close cancels the running rollouts (each run_slot stops its own sandbox), then stops serving the envs, then the generation server.
  5. Gone: the env server, VerifiersRollouter and the worker_kwargs path in 4 core files. Rollouter.Config.num_threads_per_worker takes None (Python's default thread pool), which the two Verifiers recipes use. Also gone: VerifiersRolloutWorker.Config.renderer_multiplex (no recipe set it; Verifiers' default of 256 stays) and connection_timeout_sec (the wait for the env server).
  6. Configurable.to_dict writes pydantic fields (the dataset's env config) with model_dump(mode="json"), so RenderersConfigAdapter.to_dict goes.
  7. The README keeps what the deletion forces: how one group runs, shutdown, taskset ids and "Add an experiment". Its terms, "Concurrency" and "Sandboxes" come in PR 10, "Verifiers README: terms, concurrency and sandboxes".
  8. Unchanged here: the generation server, the trace converter, the statuses and the rewards. The next three PRs change them.

You may ask:

  • Why not move the pin first? Verifiers 0.4.1 has no env server, so a bump alone can't run.
  • Why the dataset change in this PR? The worker builds the env from each sample; main's env server takes its env config apart from the samples.
  • Why does main's code stay for the overlong-prompt string match, the group-id sampling param and trace: Any? PR 7 (sessions), PR 8 (the converter's vf.Trace) and PR 9 (the failure rule) replace them. This PR only moves the env.

NOTE: not run on GPUs, on Verifiers 0.4.0. Merge this PR together with PRs 7-9, after one short Terminal-Bench run at PR 9's head: the GPU runs so far used the 0.4.1 shape.

TODOs in this PR: wait for a session's model calls in flight before its release (PR 7 does it); lazily deserialized task data; skip tasks whose first prompt never fits; mix two envs in one stream; several agents per episode; the vision processor; the proxy bypass (upstream Verifiers); Verifiers' renderer lock (upstream Verifiers).

Test plan

pip install -e torchtitan/rl/examples/verifiers/dapo_math -e torchtitan/rl/examples/verifiers/terminal_bench
pytest tests/rl/unit_tests/cpu tests/unit_tests/cpu/components/test_renderer.py tests/unit_tests/cpu/config
# Verifiers 0.4.0: 973 passed, 1 skipped

test_a_group_runs_end_to_end_in_a_rollout_worker runs a real Verifiers env through the renderer client and the generation server, with a fake generator. Also new: test_close_cancels_the_running_rollouts_before_it_stops_the_envs, test_a_second_close_returns_while_the_first_still_stops_an_env, test_worker_serves_one_env_per_env_config_until_close, test_rollout_releases_every_session_verifiers_minted (a retried attempt's trace too), test_verifiers_task_dataset_rejects_an_env_the_worker_cannot_load.

@pytorch-bot pytorch-bot Bot added the ciflow/rl label Nov 6, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 6, 2026
@felipemello1 felipemello1 changed the title [rl] Verifiers 0.4.1 and renderers 0.2.0: each rollout worker runs the Verifiers env [rl] Verifiers 0.4.1 and renderers 0.2.0: each rollout worker runs the Verifiers env (2/2) Nov 6, 2026
@felipemello1
felipemello1 added this pull request to stack #5878 November 6, 2026 04:06
@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review

@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 5m 41s —— View job


Needs discussion: the code reads correctly, but the Docker Terminal-Bench run that is meant to gate this draft hasn't happened, and a maintainer should decide on the RAM and group-placement trade-offs. Review

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

Verdict: Needs discussion -- the code is a net deletion and reads correctly, but it replaces how the Terminal-Bench recipe runs, and the run that would validate that hasn't happened yet: a Docker Terminal-Bench run, which the description names as the condition for leaving draft. The +4.7 GB host RAM and the move to placing whole groups on one worker are trade-offs a maintainer should accept.

What this PR does. Verifiers 0.4.1 removed the ZMQ env server (serve_env, EnvClient, the worker pool). Each VerifiersRolloutWorker now loads the Verifiers env in setup_async and holds env.serving() until a new RolloutWorker.close(), which the Monarch actor's __cleanup__ calls. It runs each rollout as env.run_slot(slot, ModelContext(...)). The PR deletes env_server.py and Rollouter.setup_async(worker_config=...). It also bumps renderers to 0.2.0, makes the generation server accept the switched-off top_k=-1/min_p=0.0, and reads trace token ids as int32 arrays. Net -213 LoC.

Example.

Terminal-Bench, Qwen3.5-9B recipe: (3+1) x 12 = 48 active groups x 32 = 1,536 episodes in flight
before: 4 rollout workers --ZMQ--> env server: 16 pool procs, max_concurrent=96 each, spread per rollout
after:  16 rollout workers, each runs whole groups; run_group.choose() puts ~3 groups (~96 episodes:
        agent loop + render + interception server + Docker) on one event loop
host RAM (from the description): 21.5 GB -> 26.2 GB

Must fix

  1. PR description -- "Summary (human-written)" is empty. The description itself names a gate that hasn't run yet: one short Terminal-Bench run with Docker, reporting in-flight rollouts per worker, render wait, host RAM, and whether any containers are left after a cancelled group. The deleted env server was the only path this recipe has ever run on. Please add those results before taking the PR out of draft.

Should consider

  • torchtitan_recipes/rl/verifiers_terminal_bench.py:149 -- render threads stay at 4 per worker for ~96 in-flight episodes (inline).
  • tests/rl/unit_tests/cpu/test_verifiers_example.py:177 -- no test enters and exits env.serving() from different tasks, as Monarch does; a one-line change to the end-to-end test would cover it (inline).

Questions

  • Rollouter.run_group_rollouts sends each group with run_group.choose(...). Does Monarch's choose balance by load? If it picks uniformly, then at ~3 groups per worker on average, some workers will run 5-6 Terminal-Bench groups (160+ containers) while others sit idle. The env-server pool, which spread single rollouts, didn't have that problem. Per-worker in-flight counts from the Docker run would answer this.
  • RolloutWorker.close() (torchtitan/rl/rollout/rollouter.py:359) adds a lifecycle hook to shared RL code with one implementer. I think it earns its place: it pairs with setup_async, it closes the generation server (which before was never closed), and it lets setup_async(worker_config=...) go. A maintainer should still confirm.
Details
  • Gate: the problem is real. 0.4.1 deletes the server, and renderers 0.2.0 breaks 0.4.0, so the two pins must move together. Copying the 1.3k-line server into the repo would be the bigger change. The rollout worker is the right layer.
  • No references remain anywhere in the repo to the env server, HarborEnv, run_program, connection_timeout_sec, or the 0.4.0/0.1.12 pins.
  • The new raise in run_group for a bad sample or bad task data is caught by Controller._rollout_loop (logged, rollout/group_failures) and by validation's gather(return_exceptions=True), as the description says.
  • _build_sampling_params builds vLLM SamplingParams directly, without generation_config defaults. So accepting top_k=-1, min_p=0.0 matches what the generator actually samples.
  • GenerationServer.close() is a no-op if start() never ran, so close() after a failed setup_async is safe.
  • Shutdown order: before, VerifiersRollouter.close stopped the env server before Rollouter.close waited for generate calls. Now episodes stay alive until stop_rollout_workers(). Controller.run cancels groups before close, so this only affects a group whose cancel_group failed, and that group waits out the drain timeout in both versions.
  • Validation tasks are rebuilt with the training taskset's task_type() and config.task, as the env server did before. No change.

Not verified: Verifiers 0.4.1 internals (that env.serving() isn't bound to a task, whether load_environment loads the Harbor dataset in each of the 16 workers, that vf.TaskData always has name), and all Docker/GPU behavior.

connection_timeout_sec=1800.0,
),
# Each worker runs the agent loops of its groups; 16 processes share that CPU work.
worker_pool_size=16,

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.

With this PR the rollout worker's default executor does the rendering, and num_threads_per_worker (default 4) sets its size (RolloutWorkerActor.__init__). In the Qwen3.5-9B recipe, (3+1) x 12 = 48 active groups x 32 = 1,536 episodes run across 16 workers. That puts ~96 multi-turn, up-to-32K-token rollouts on 4 render threads per process. The env-server pool workers rendered on Python's default executor, which has min(32, os.cpu_count() + 4) threads. If the Docker run shows render wait, set num_threads_per_worker here next to worker_pool_size, with a comment on how you picked it, so users don't have to find it themselves. (Unverified: I'm relying on the description's statement that Verifiers renders on the default executor.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines +177 to +201
async def run():
await worker.setup_async(
tokenizer_config=None,
renderer_config=from_renderers(Qwen3RendererConfig(enable_thinking=False)),
hf_assets_path="tests/assets/tokenizer",
)
try:
return await worker.run_group(
generate_fn=generate_fn,
release_session_fn=AsyncMock(),
sample=VerifiersTaskSample(
verifiers_task_data={
"idx": 0,
"prompt": "What is 1 + 1?",
"ground_truth": "2",
}
),
group_id=5,
group_size=2,
sampling=SamplingConfig(
temperature=1.0, top_p=1.0, max_tokens=64, seed=100
),
)
finally:
await worker.close()

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.

This test runs setup_async and close in the same task. In production, Monarch runs them in different tasks: the setup_async endpoint, then __cleanup__. The comment at rollouter.py:149-151 says that only works while Verifiers' serving resources aren't bound to a task. No test checks that. If a Verifiers upgrade makes serving() hold an anyio cancel scope or an asyncio.timeout, exiting it from another task raises RuntimeError, and that would surface only at shutdown of a real run.

Run each step in its own task and this test catches it at no extra cost:

    async def run():
        await asyncio.create_task(worker.setup_async(...))
        try:
            return await worker.run_group(...)
        finally:
            # Monarch closes the worker from `__cleanup__`, not the setup task.
            await asyncio.create_task(worker.close())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

@felipemello1
felipemello1 force-pushed the felipemello1/http/6-verifiers-groups-in-workers branch from 94acdb9 to c7f5077 Compare November 6, 2026 05:19
@felipemello1
felipemello1 force-pushed the felipemello1/verifiers-v2/2-verifiers-0.4.1 branch from 46c3079 to e6a4157 Compare November 6, 2026 05:19
@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review

@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 3m 49s —— View job


Needs discussion: the code reads correctly, but this draft still waits on its own real-model Terminal-Bench run, the human-written summary is empty, and the container watchdog needs a TODO linking an upstream Verifiers issue. Review

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

Verdict: Needs discussion -- the code reads correctly and is a net deletion, but the PR is still a draft. Its own gate, a Terminal-Bench run with a real model (in-flight rollouts per worker, render wait, host RAM against 26 GB), hasn't run. And the +4.7 GB host RAM and whole-group-per-worker placement are trade-offs a maintainer has to accept.

What this PR does. Verifiers 0.4.1 deleted the ZMQ env server. Each VerifiersRolloutWorker now loads the env in setup_async and holds env.serving() until a new RolloutWorker.close(), which the actor's __cleanup__ calls. It runs each rollout as env.run_slot(slot, ModelContext(...)). Since the last review, each worker also starts a sh watchdog in its own session. When the worker's pipe closes, the watchdog runs docker rm -f on the worker's verifiers.run=$VF_RUN_ID containers. The Terminal-Bench recipe now sets num_threads_per_worker=32.

Example.

TB Qwen3.5-9B: 48 active groups x 32 rollouts over 16 workers (~96 episodes per worker on average)
before: rollout worker --ZMQ--> env server (16 pool procs, rollouts spread one at a time)
after:  rollout worker: env.run_slot x32 per group, render on 32 threads, watchdog per worker
worker SIGKILLed mid-episode -> its watchdog removes its containers (description: 12 s)

Must fix

  1. PR description: "Summary (human-written)" is still empty, and the description lists a real-model Terminal-Bench run as "still open before ready". Please add the summary, and add that run's numbers before moving out of draft.
  2. torchtitan/rl/examples/verifiers/rollouter.py:198-206: the container watchdog works around a Verifiers gap but has no TODO linking an upstream issue (inline).

Still open from the last review

  • tests/rl/unit_tests/cpu/test_verifiers_example.py: the end-to-end test still calls setup_async and close in the same task, so nothing guards the "serving resources aren't bound to a task" assumption at rollouter.py:150-152 across a Verifiers upgrade. To fix it, wrap both calls in asyncio.create_task(...).
  • Resolved: render threads (the recipe now sets 32 and says why).

Questions

  • Does load_environment call taskset.load() eagerly? If it does, each of the 16 workers reads the whole Harbor/TMax dataset. Then the verifiers README line "so workers never load the dataset" is wrong, and the dataset is part of the 1,635 MB per worker.
  • Does Monarch's choose balance by load, or pick at random? With whole 32-rollout groups per worker, random placement makes some workers run 2x the average number of containers. The real-model run's per-worker in-flight counts would answer this.
Details
  • Gate: unchanged since the last review. The two pins must move together, and the rollout worker is the right layer. Copying the 1.3k-line server would be the bigger change.
  • Watchdog fd handling: Python pipes are non-inheritable (PEP 446), and subprocess / asyncio children use close_fds=True, so docker CLI or harness subprocesses don't keep the write end open and delay the sweep. A multiprocessing fork would keep it open. Nothing in this path forks.
  • close() after a failed or skipped setup_async is safe: the exit stack is empty, GenerationServer.close() is a no-op, and the watchdog is None or gets swept.
  • test_rollouter_pool.py now checks that mesh.stop() reaches close(), which guards the __cleanup__ wiring.
  • The watchdog also starts for the DAPO (Subprocess runtime) recipe. That's harmless: it exits when docker is absent, or else runs one empty docker ps.

Not verified: Verifiers 0.4.1 internals (when VF_RUN_ID is read, whether vf.TaskData always has name for the overflow warning at rollouter.py:363, eager taskset loading), and all Docker/GPU behavior.

Comment on lines +198 to +206
# Verifiers labels each container it starts `verifiers.run=$VF_RUN_ID`. One id per
# worker lets this worker's watchdog remove exactly its containers if the worker is
# killed: a killed worker runs no cleanup (`__cleanup__` runs only on a graceful stop,
# and actor code runs off the main thread, where Python can't handle SIGTERM).
# TODO: a kill of the whole process tree at once (e.g. its cgroup) takes the watchdog too.
# TODO: Compose projects (`vf-<uuid>`) carry no run label, so the watchdog misses them;
# no Terminal-Bench 2.1 or TMax task uses Compose.
os.environ["VF_RUN_ID"] = f"torchtitan-{uuid.uuid4().hex}"
self._container_watchdog = _start_container_watchdog(os.environ["VF_RUN_ID"])

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.

The watchdog works around a Verifiers gap: any process that runs env.serving() and dies without cleanup (Verifiers' own runner included) leaves its labelled containers running. Verifiers already owns the verifiers.run label and the container lifecycle, so the reaper belongs there: for example, serving() could start this watchdog itself, or the Docker runtime could start a per-run reaper. Today torchtitan keeps a shell script that has to match Verifiers' label scheme, and it breaks silently if Verifiers renames the label or the env var. Nothing tests the real label: the unit test uses a fake docker and checks the string this code builds.

The two TODOs here describe the watchdog's own limits, not the upstream gap. Per CLAUDE.md principle 3, please add a TODO with a link to a Verifiers issue (container cleanup when the serving process dies), so the script gets deleted once Verifiers handles it, e.g.:

# TODO(verifiers): remove the watchdog once Verifiers reaps its own containers when the
# serving process dies: <issue link>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

@felipemello1
felipemello1 force-pushed the felipemello1/http/6-verifiers-groups-in-workers branch from c7f5077 to 2a4af25 Compare November 6, 2026 06:16
@felipemello1
felipemello1 force-pushed the felipemello1/verifiers-v2/2-verifiers-0.4.1 branch from e6a4157 to 7d72cb7 Compare November 6, 2026 06:16
@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review

@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 2m 3s —— View job


Needs discussion: the code reads correctly, but the draft still waits on its real-model Terminal-Bench run, and the human-written summary is empty. Both upstream workarounds (the watchdog and no_proxy) need Verifiers issue links, and the no_proxy merge drops an uppercase NO_PROXY. Review

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

Verdict: Needs discussion -- the code still reads correctly, but the PR is a draft waiting on its own real-model Terminal-Bench run. The +4.7 GB host RAM and the whole-group-per-worker placement are trade-offs a maintainer has to accept.

What changed since the last review. VF_RUN_ID now keeps a launcher's id as its prefix. The watchdog has a TODO saying when to drop it. The loopback no_proxy setup moved here from the deleted env_server.py. The end-to-end test now skips when uv's package index is unreachable.

Example.

host env before setup_async: HTTPS_PROXY=http://proxy:3128  NO_PROXY=.corp.internal
after (this PR):             no_proxy=NO_PROXY=127.0.0.1,localhost   <- .corp.internal is lost

Must fix

  1. PR description: "Summary (human-written)" is still empty. The description still lists one real-model Terminal-Bench run as "still open before ready" (in-flight rollouts per worker, render wait, host RAM against 26 GB). Please add both before taking the PR out of draft.
  2. torchtitan/rl/examples/verifiers/rollouter.py:1899: partly resolved. The watchdog now has a TODO, but it points at 0.4.0's _arm_teardown, not at an upstream Verifiers issue. The new no_proxy TODO at rollouter.py:178 has no link either. Please file one Verifiers issue per gap and link it, so both workarounds get deleted when upstream fixes them.

Should consider

  • torchtitan/rl/examples/verifiers/rollouter.py:179-182: drops an uppercase-only NO_PROXY (inline).
  • tests/rl/unit_tests/cpu/test_verifiers_example.py:686: the end-to-end test leaks VF_RUN_ID, no_proxy and NO_PROXY into later tests (inline).

Still open from the last review

  • tests/rl/unit_tests/cpu/test_verifiers_example.py: setup_async and close still run in the same task. Nothing guards the comment at rollouter.py:1574-1576 (serving resources are not bound to a task) across a Verifiers upgrade. Wrap both calls in asyncio.create_task(...).

Questions

  • torchtitan/rl/examples/verifiers/README.md says "workers never load the dataset". Does load_environment call taskset.load() eagerly? If it does, each of the 16 Terminal-Bench workers reads the Harbor/TMax dataset, and that line is wrong.
  • Does Monarch's choose balance by load? With whole 32-rollout groups on one worker, random placement leaves some workers with twice the average number of containers. The real-model run's per-worker in-flight counts would answer this.
Details
  • Gate: unchanged. Verifiers 0.4.1 and renderers 0.2.0 must move together, and the rollout worker is the right layer for the env.
  • close(): closing the watchdog's stdin ends cat. Then sh sweeps once, backgrounds the second sweep and exits, so wait(60) returns after the first sweep. stdout is not piped, so the background subshell can't block it.
  • to_dict calls replace(self, environment=None), which re-runs __post_init__. That check never reads environment, so it is safe.
  • slot.task.data.name or slot.task.data.idx logs 0 for a nameless task with index 0. That is correct.

Not verified: Verifiers 0.4.1 internals (eager taskset loading, and whether TaskData always has a name attribute). No Docker or GPU behavior was checked.

Comment on lines +179 to +182
no_proxy = os.environ.get("no_proxy", "")
no_proxy = ",".join(filter(None, (no_proxy, "127.0.0.1", "localhost")))
os.environ["no_proxy"] = no_proxy
os.environ["NO_PROXY"] = no_proxy

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.

This reads only the lowercase no_proxy, then overwrites both spellings. Say a host sets only NO_PROXY=.corp.internal along with HTTPS_PROXY. After setup_async, both variables are 127.0.0.1,localhost, so the worker and every subprocess it starts (harness installs through uv, the docker CLI) now send internal hosts through the proxy. The code came from env_server.py, so the bug isn't new, but this PR is the one moving it. Merge both spellings:

Suggested change
no_proxy = os.environ.get("no_proxy", "")
no_proxy = ",".join(filter(None, (no_proxy, "127.0.0.1", "localhost")))
os.environ["no_proxy"] = no_proxy
os.environ["NO_PROXY"] = no_proxy
no_proxy = ",".join(
filter(
None,
(
os.environ.get("no_proxy"),
os.environ.get("NO_PROXY"),
"127.0.0.1",
"localhost",
),
)
)
os.environ["no_proxy"] = no_proxy
os.environ["NO_PROXY"] = no_proxy

The TODO above also works around a Verifiers gap. Like the watchdog's TODO, it needs an upstream issue link (CLAUDE.md principle 3).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

@felipemello1
felipemello1 force-pushed the felipemello1/verifiers-v2/2-verifiers-0.4.1 branch from 7d72cb7 to 764c31e Compare November 6, 2026 06:32
@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review

@claude

claude Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 1m 19s —— View job


Needs discussion: the new push changes none of the open items. The human-written summary is still empty, the real-model Terminal-Bench run hasn't been done, and the no_proxy and watchdog workarounds still have no Verifiers issue links. Review

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

Verdict: Needs discussion -- every item from the 06:19 review is still open at 764c31e. The PR is still a draft waiting on its own real-model Terminal-Bench run, and a maintainer still has to accept the +4.7 GB host RAM and the whole-group-per-worker placement.

What this PR does. Verifiers 0.4.1 deleted the ZMQ env server. Each VerifiersRolloutWorker now loads the env in setup_async, holds env.serving() until close() (called from the actor's __cleanup__), and runs each rollout as env.run_slot(...). A per-worker sh watchdog removes the worker's verifiers.run=$VF_RUN_ID containers if the worker is killed. Verifiers moves to 0.4.1 and renderers to 0.2.0 together.

Example.

before: rollout worker --ZMQ--> env server (16 pool procs) --> agent loop --HTTP--> GenerationServer
after:  rollout worker: env.run_slot x group_size --HTTP--> the same worker's GenerationServer
host with only NO_PROXY=.corp.internal -> after setup_async: no_proxy=NO_PROXY=127.0.0.1,localhost

Must fix (still open)

  1. PR description: "Summary (human-written)" is still empty, and the description still lists the real-model Terminal-Bench run as "still open before ready" (in-flight rollouts per worker, render wait, host RAM against 26 GB). Both are needed before this PR leaves draft.
  2. torchtitan/rl/examples/verifiers/rollouter.py:578 and :179 -- both upstream workarounds (the container watchdog and the loopback no_proxy edit) still have no Verifiers issue link. The watchdog TODO points at 0.4.0's _arm_teardown, and the no_proxy TODO links nothing. Please file one Verifiers issue for each gap and link it in its TODO (CLAUDE.md principle 3), so both get deleted once upstream fixes them.

Should consider (still open)

  • torchtitan/rl/examples/verifiers/rollouter.py:180-183 -- reads only lowercase no_proxy and overwrites both spellings, so a host that sets only NO_PROXY loses its entries. The fix is in the earlier inline suggestion.
  • tests/rl/unit_tests/cpu/test_verifiers_example.py (end-to-end test) -- setup_async and close still run in the same task. Nothing guards the assumption at rollouter.py:155-157 that serving resources aren't bound to a task. To fix it, wrap each call in asyncio.create_task(...). The test also leaves VF_RUN_ID, no_proxy and NO_PROXY set for later tests; use monkeypatch.setenv/delenv up front so they get restored.

Questions (still open)

  • Does load_environment call taskset.load() eagerly? If it does, each of the 16 Terminal-Bench workers reads the Harbor/TMax dataset, and the README line "workers never load the dataset" is wrong.
  • Does Monarch's choose balance by load? With whole 32-rollout groups on one worker, random placement leaves some workers with twice the average number of containers.
Details
  • At HEAD, the hunks for the items above (rollouter.py setup_async/close/watchdog, the end-to-end test, the recipe) match what the 06:19 review saw. The new push changed none of them.
  • Re-checked: close() after a failed or skipped setup_async is safe (the exit stack is empty, GenerationServer.close() is a no-op, and the watchdog is None). The watchdog blocks on read before it checks for docker, so close()'s write to its stdin never hits a closed pipe in the normal path.
  • Gate: unchanged. The two pins must move together, and the rollout worker is the right layer.

Not verified: Verifiers 0.4.1 internals (eager taskset loading, TaskData.name) and all Docker/GPU behavior.

@felipemello1
felipemello1 removed this pull request from stack #5878 November 8, 2026 19:07
@felipemello1
felipemello1 changed the base branch from felipemello1/http/6-verifiers-groups-in-workers to main November 8, 2026 19:07
@felipemello1
felipemello1 force-pushed the felipemello1/verifiers-v2/2-verifiers-0.4.1 branch from 764c31e to 8848afc Compare November 8, 2026 19:08
@felipemello1
felipemello1 changed the base branch from main to felipemello1/http/6-verifiers-groups-in-workers November 8, 2026 19:09
@felipemello1
felipemello1 added this pull request to stack #5950 November 8, 2026 19:09
@claude

claude Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 47s —— View job


Needs discussion: picking up the MessageEnvRolloutWorker rename adds no new problems at d0de8ae, and no bare RolloutWorker is left in the repo. Still open: the human-written summary, the real-model Terminal-Bench run, and Verifiers issue links for the three upstream TODOs. Review

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

Verdict: Needs discussion -- at d0de8ae, this PR picks up the MessageEnvRolloutWorker rename from below cleanly and adds no new problems. The same three items still keep it in draft.

What changed since the last review. The PR below renamed the stock RolloutWorker to MessageEnvRolloutWorker with no alias. This PR now uses the new name in torchtitan/rl/README.md, next to BaseRolloutWorker and VerifiersRolloutWorker. There is no bare RolloutWorker left anywhere in the repo at HEAD. VerifiersRolloutWorker still subclasses BaseRolloutWorker, so the rename leaves its code path alone.

Example.

torchtitan/rl/README.md
  before:  Subclass `RolloutWorker` or `Rollouter` ...
  after:   Subclass `MessageEnvRolloutWorker` or `Rollouter` ...; a worker whose env isn't a
           `MessageEnv` subclasses `BaseRolloutWorker` (e.g. `VerifiersRolloutWorker`)

Must fix (still open)

  1. PR description: "Summary (human-written)" is still empty. The real-model Terminal-Bench run (rollouts in flight per worker, render wait, host RAM against 26 GB) also hasn't been done; the recipe's worker_pool_size TODO tracks it. The PR can't merge while row 0 is under it either, as the description says.
  2. torchtitan/rl/examples/verifiers/rollouter.py: none of the three TODOs that work around Verifiers gaps (no_proxy in setup_async, the VF_RUN_ID limiter scope, the container watchdog) links a Verifiers issue yet (CLAUDE.md principle 3). The author says the issues are drafted and waiting for their OK to file.
Details
  • I searched the repo at HEAD for \bRolloutWorker\b and got no matches. Every worker-name reference in the diff is BaseRolloutWorker, MessageEnvRolloutWorker or VerifiersRolloutWorker.
  • The core hunks match the last review: BaseRolloutWorker.close(), the actor's __cleanup__, and the removed Rollouter.setup_async(worker_config=...).
  • Gate: unchanged. The two pins have to move together, and the rollout worker is the right layer for the env.

Not verified: Verifiers 0.4.1 internals. I didn't run any tests here, and no Docker or GPU behavior was checked.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review. The stack is reordered: Verifiers groups in workers, then Verifiers 0.4.1, then worker placement come first (the stack table shows the new rows). It is also rebuilt with three reviewed passes: a code-style pass over every changed file, the rewritten placement docs (the VerifiersRollouter docstring and the two Verifiers READMEs; the old SVG is deleted), and the 3 newest main commits. No behavior change from the passes.

@claude

claude Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 2m 2s —— View job


Needs discussion: the reorder and the three passes add no new problems at be1e7c3. Still open: the human-written summary, the real-model Terminal-Bench run, and Verifiers issue links for the three upstream TODOs. Review

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

Verdict: Needs discussion -- at be1e7c3, the reorder and the three passes add no new problems. The same three items still keep this PR in draft.

What changed since the last review. This PR now sits directly on "taskset package ids" (row 4). "One handle per rollout worker" (row 6) and "Spread rollout workers" (row 7) are now above it. So at this head, Rollouter.run_group_rollouts sends each group with Monarch's run_group.choose(...) (torchtitan/rl/rollout/rollouter.py:256), and the description's NOTE now says exactly that. The __cleanup__ check is again its own test, test_stopping_the_rollout_workers_closes_each_worker in test_shutdown.py. The test it was folded into last time belongs to row 6, so at this base test_shutdown.py has no real-process rollout-worker test to extend. A standalone test is the right call here. The VerifiersRollouter docstring now draws where each process runs, the Verifiers README has a call-order table, and the Terminal-Bench README notes that containers run on Docker's bridge network.

Example.

VerifiersRollouter docstring, rl_grpo_qwen35_9b_terminal_bench under SlurmLauncher:
  Layout: trainer (8 GPUs) -> mesh "trainer" (1 node); 8 x 1-GPU generators -> "node_0"
  host 0: trainer, controller, router, batcher, 16 rollout workers (spawn_cpu_procs), 16 watchdogs
  host 1: 8 generators

Must fix (still open)

  1. PR description: "Summary (human-written)" is still empty. The real-model Terminal-Bench run (rollouts in flight per worker, render wait, host RAM against 26 GB) also hasn't been done; the recipe's worker_pool_size TODO tracks it. The PR can't merge while row 0 is under it either, as the description says.
  2. torchtitan/rl/examples/verifiers/rollouter.py: none of the three TODOs that work around Verifiers gaps (no_proxy in setup_async, the VF_RUN_ID limiter scope, the container watchdog in _start_container_watchdog) links a Verifiers issue yet (CLAUDE.md principle 3). The author says the issues are drafted and waiting for their OK to file.
Details
  • I checked the new docstring diagram against the code. Layout packing (launcher/base.py:179-205) gives the trainer its own node and puts the eight 1-GPU generators on a shared one. The router, batcher and rollout workers come from spawn_cpu_procs on the controller host (actors/monarch/system.py:100,169-182). SlurmLauncher's bind_to is a listen address, not CPU pinning, so "No TorchTitan process is pinned to cores" holds.
  • The core hunks match the last review: BaseRolloutWorker.close(), the actor's __cleanup__, the removed Rollouter.setup_async(worker_config=...), and the num_threads_per_worker docstring. close() still sends "clean" only after aclose() returns.
  • Outside deleted lines, nothing in the repo still mentions env_server, EnvClient, serve_env, ServeConfig, HarborEnv, connection_timeout_sec, or the 0.4.0/0.1.x pins.
  • Gate: unchanged. The two pins have to move together, and the rollout worker is the right layer for the env.

Not verified: Verifiers 0.4.1 internals, including the new Terminal-Bench README claim that Docker containers use the bridge network rather than host networking. I didn't run any tests, and no Docker or GPU behavior was checked.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review. The stack is rebased onto main (the look-aside router PR merged), and the PRs below this one are updated. Below this PR, env_server_address became a constructor arg passed through Rollouter.setup_async(worker_kwargs=...); this PR now deletes that path, and its diagram is redrawn as lanes.

@claude

claude Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 1m 38s —— View job


Needs discussion: removing the worker_kwargs path and redrawing the diagram as lanes add no new problems at bd22d90. One small new doc item: the lane diagram leaves out release_groups. Still open: the human-written summary, the real-model Terminal-Bench run, and Verifiers issue links for the three upstream TODOs. Review

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

Verdict: Needs discussion -- at bd22d90, the rebase onto main and the removal of worker_kwargs add no new problems. The same three items still keep this PR in draft.

What changed since the last review. In the PR below, env_server_address is now a constructor argument of VerifiersRolloutWorker, passed through Rollouter.setup_async(worker_kwargs=...) -> spawn_rollout_workers(**kwargs) -> RolloutWorkerActor(worker_kwargs=...). This PR deletes that whole path in both ActorSystem signatures, the Monarch actor, and Rollouter.setup_async, along with the TODO that asked for exactly this. worker_config.build() now takes no arguments. The README's "Integration flow" is now a lane diagram: one column per process, with rows for run_group, start, chat, reserve, generate, release_reservation, grade, release_session, and RolloutGroup.

Example.

below this PR:  VerifiersRollouter.setup_async -> env_server.start() -> super().setup_async(
                    worker_kwargs={"env_server_address": addr}) -> RolloutWorkerActor(worker_kwargs=...)
                    -> VerifiersRolloutWorker(config, env_server_address=addr)
this PR:        Rollouter.setup_async -> spawn_rollout_workers(config, num_workers, num_threads)
                    -> RolloutWorkerActor -> worker_config.build() -> VerifiersRolloutWorker(config)

Must fix (still open)

  1. PR description: "Summary (human-written)" is still empty. The real-model Terminal-Bench run (rollouts in flight per worker, render wait, host RAM against 26 GB) also hasn't been done; the recipe's worker_pool_size TODO tracks it.
  2. torchtitan/rl/examples/verifiers/rollouter.py: three TODOs work around Verifiers gaps (no_proxy in setup_async, the VF_RUN_ID limiter scope, the container watchdog in _start_container_watchdog), and none of them links a Verifiers issue yet (CLAUDE.md principle 3). The author says the issues are drafted and waiting for their OK to file.

Should consider (new)

  • torchtitan/rl/examples/verifiers/README.md:45-47 -- the lane diagram leaves out the controller's release_groups call at group end, which is the call that frees the group's KV (inline).
Details
  • After the PR, the repo has no references to worker_kwargs, env_server_address, env_server, EnvClient, serve_env, ServeConfig or HarborEnv outside the deleted lines.
  • The release_reservation row's "no reply" matches the controller's generate_fn (controller.py:685, .broadcast).
  • Core hunks match the last review: BaseRolloutWorker.close(), the actor's __cleanup__, and test_stopping_the_rollout_workers_closes_each_worker in test_shutdown.py. close() still writes "clean" only after aclose() returns.
  • Gate: unchanged. The two pins have to move together, and the rollout worker is the right layer for the env. With look-aside routing merged, the "Must not merge while row 0 is under it" caveat from the last two reviews no longer applies.

Not verified: Verifiers 0.4.1 internals. I didn't run any tests, and no Docker or GPU behavior was checked.

Comment on lines +45 to +47
11 | |--release_session--------->| | one per trace, after
| | | | | run_slot returns
12 |<-RolloutGroup---| | | | scored

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.

The lanes stop at row 12, so they leave out one of the release calls: after the group returns, the controller calls router.release_groups([group_id]) (controller.py:1202), and that call frees the group's held KV. The VerifiersRollouter docstring points here for "Call order, with the release calls", and the new comment at rollouter.py:372 depends on release_groups running. As drawn, a reader would take row 11 (release_session) as the only cleanup. One more row fixes it:

Suggested change
11 | |--release_session--------->| | one per trace, after
| | | | | run_slot returns
12 |<-RolloutGroup---| | | | scored
11 | |--release_session--------->| | one per trace, after
| | | | | run_slot returns
12 |<-RolloutGroup---| | | | scored
13 |--release_groups---------------------------->| | frees the group's KV

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: Fixed in e933617: row 13 is release_groups, from the controller to the router, with the note "drops its cache salts". It frees held KV only when the engine holds session KV, and no recipe sets session_kv_holder, so "frees the group's KV" would overstate it. Step 4 now says the controller releases the group before TitanRL trains on it (controller.py:1202, then finalize_work).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review. This push adds the release_groups row to the Verifiers README diagram (your inline suggestion, with the note narrowed to what it does by default) and fixes the order in step 4.

@claude

claude Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 1m 16s —— View job


Needs discussion: the new release_groups row and the step 4 order fix resolve the last review's item at e933617, with no new problems. Still open: the empty human-written summary, the real-model Terminal-Bench run, and Verifiers issue links for the three upstream TODOs. Review

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

Verdict: Needs discussion -- at e933617, the README fix resolves the last review's item and adds no new problems. The same three items still keep this PR in draft.

What changed since the last review. The Verifiers README's lane diagram now has a row 13: the controller calls release_groups on the router after the group returns. Step 4 now gives the order the controller uses: it releases the group, then TitanRL trains on it.

Example.

controller.py:1202  await generator_router.release_groups.call_one([work.group_id])   <- row 13
controller.py:1203  await group_buffer.finalize_work(group)                             <- "trains on it"
router.release_groups -> fan-out to each generator -> engine_loop.release_groups:
  "drop the pinned cache salts" (held KV too, only with session_kv_holder)

Resolved since the last review

  • torchtitan/rl/examples/verifiers/README.md:48: the release_groups row is there, and its note ("drops its cache salts") matches what the call does by default. Generator.release_groups (generator/generator.py:432) drops the pinned salts. It frees held KV only when VLLMEngine.Config.session_kv_holder is set, and no recipe sets it, so narrowing the note from my suggestion was the right call. The arrow ends at the router column, which matches InterGeneratorRouter.release_groups (routing/inter_generator.py:246) fanning the call out to each generator.

Must fix (still open)

  1. PR description: the "Summary (human-written)" section is still empty. The real-model Terminal-Bench run (rollouts in flight per worker, render wait, host RAM against 26 GB) also hasn't been done; the recipe's worker_pool_size TODO tracks it.
  2. torchtitan/rl/examples/verifiers/rollouter.py: three TODOs work around Verifiers gaps (no_proxy in setup_async, the VF_RUN_ID limiter scope, and the container watchdog in _start_container_watchdog). None of them links a Verifiers issue yet (CLAUDE.md principle 3). The author says the issues are drafted and waiting for their OK to file.
Details
  • The new row's columns line up with rows 11 and 12: the arrowhead lands on the router column, and the note starts in the same column as the others.
  • Gate: unchanged. The two pins have to move together, and the rollout worker is the right layer for the env.

Not verified: Verifiers 0.4.1 internals. I didn't run any tests, and no Docker or GPU behavior was checked.

ThreadPoolExecutor(max_workers=num_threads)
)
self._worker = worker_config.build(**worker_kwargs)
self._worker = worker_config.build()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this makes sense to me, but why was this in the first place. do you know?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.


def load(self) -> list[VerifiersMathTask]:
"""Build the tasks consumed by both the dataset and environment server."""
"""Build the tasks the controller samples; rollout workers rebuild each from its data."""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

lets not put "controller" her, as this may change in the future. It build tasks for training/eval. Thats it, no?

I dont get the part of "rebuild"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

async def sync_log_step(self, step: int) -> None:
sl.set_step(step)

async def __cleanup__(self, exc: Exception | None) -> None:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

noob question: should this is cleanup or close? i dont think that we have cleanup in other workers, do we? Its fine to keep as it is, i just want to understand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

# Verifiers' train client always sends these switched off, so vLLM ignores the model's
# generation_config. TorchTitan's generator samples the full vocabulary, which is the
# same; it can't honor any other value.
disabled_values = {"top_k": -1, "min_p": 0.0}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

why a dict and not a set? Attributing values is confusing. Also, comment can be 2 lines instead of 3, and written better, something like: "TODO: Titan doesn't current support different top_k. Raise early.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

6 |<-scored group----|<-trace, reward-| | | |
7 |--batch, packed by the batcher process-------------------------------------------->|
| | | | |<-new weights|
controller rollout worker container generators trainer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

as i mentioned before, in another PR, this should be in verifiers readme.md. In this PR, it is added there, so we can delete it from here, as its the same thing, and we can have one source of truth and point to that doc instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines +126 to +127
- Workers busy on CPU: raise the rollouter's `worker_pool_size` (default 4; the Terminal-Bench
recipe uses 16).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

dont mention specific examples, specially config values that differ from example to example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

--config <recipe function name>
```

## Scaling

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i dont like this section too much. I think we can delete it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

# TODO: 16 is untuned. Set it from a Terminal-Bench run with Docker: rollouts in flight
# per worker, render wait and host RAM. The `VerifiersRollouter` docstring and the
# Verifiers README's "Scaling" section copy 16: update them with it.
worker_pool_size=16,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i asked about it in a different PR. Can we have a better heuristic, defined in the controller, that the user can override, based on buffer size, number of cpus available, etc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also, too many comments//todos. Lets see what we can do about them and be less verbose.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

"""Start this worker's generation server, then load and serve the Verifiers env.
Verifiers renders with its own renderer, so no tokenizer here."""
del tokenizer_config
if vision_processor_config is not None:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

didnt we merge in titan some PRs for vision models? wouldnt this break them?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

@@ -75,25 +84,33 @@ async def __call__(self, rollout: Rollout, env_input: object) -> float:


class VerifiersRollouter(Rollouter):

@felipemello1 felipemello1 Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this docstring is poorly written. It should be something like:

"""Class responsible for the logic to create rollouts. It is the TitanRL integration with verifiers. More details can be found in

In this integration,

Titan provides:
- Generator endpoint
- Sandbox
- bla bla bla

Verifiers:

  • Outputs a completed rollout, later scored in make_scored_group and casts it to TitanRL expected format."""

We could also add some info that this runs multiple workers, one per agent, bla bla bla. Not sure. Wdyt? Like the TLDR of the data flow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines +125 to +126
"""How a rollout worker runs a Verifiers group; `__post_init__` fills in
`worker.environment.taskset`."""

@felipemello1 felipemello1 Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

why does this need to happen in post init? it isnt very elegant. Is this also how other libraries integrate with verifiers?

Why not create some method, like worker: update task?

Also, not for this PR, but in the future we may have multiple tasks in the same training job, e.g. both dapo-math and terminal bench.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines +155 to +157
environment: VerifiersEnvConfig
"""Verifiers env and agent config, e.g. `vf.SingleAgentEnvConfig(agent=...)`. Leave
`environment.taskset` unset: `VerifiersRollouter` copies the training taskset in."""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this doesnt sound right. If we will copy it in, it should be a proper method. Its also unclear how we would deal with different environments, like math and terminal bench at the same time. Maybe these are a different Env type and the "env" definition is loaded here? i would need to understand better the data flow

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines +173 to +178
def to_dict(self) -> dict[str, Any]:
# The generic dump can't serialize the pydantic env config.
return {
**BaseRolloutWorker.Config.to_dict(replace(self, environment=None)),
"environment": self.environment.model_dump(mode="json"),
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

why would we need to_dict?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

del tokenizer_config, vision_processor_config
"""Start this worker's generation server, then load and serve the Verifiers env.
Verifiers renders with its own renderer, so no tokenizer here."""
del tokenizer_config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

whats the idea behing deleting the tokenizer config? where do we tokenize them? and it tokenization distributed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is it because the renderes has it? If so, then i dont see wy we need tokenizer_config in the signature in the first place. This should also be true for the MessageEnv worker, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: answers to the comments on this PR that have no inline thread.

the review bot (comment): A maintainer still has to accept the +4.7 GB host RAM and putting each whole group on one worker.

In "Rollouter: least-loaded placement; the controller sizes the pool from rollouts_per_worker", whole groups stay on one worker, placed on the least-loaded one, at most rollouts_per_worker rollouts per worker (64 by default). Its count frees a whole group at once, so the busiest worker carries more than the mean: about 55 running at 64 per worker, simulated. "Rollouter: place single rollouts; the controller centers each group" (a planned follow-up PR, not opened yet) places single rollouts, counts each as it returns, and centers groups in the controller, which costs a mean per group. For memory, "Rollout workers, the router and the controller report their CPU and memory each step" reports each worker's memory every step.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: @claude please review

@claude

claude Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @felipemello1's task in 5m 14s —— View job


Verdict: Needs discussion -- see the review on this PR.

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

Verdict: Needs discussion -- the design is right: 0.4.1 removes serve_env, so each rollout worker runs its own envs, and the PR is -530 LoC net. But a GPU run is still pending, the README partly ignores @felipemello1's earlier comments, and two edits loosen explicit contracts.

What this PR does. It bumps Verifiers to 0.4.1 and renderers to 0.2.0. It deletes the separate env server and the Docker watchdog. Each VerifiersRolloutWorker now loads its envs, one per env config, and runs env.run_slot once per rollout. Model calls go through a loopback GenerationServer in that worker. Failed rollouts get reward None in score_group, which replaces error_reward=0.0 in the recipes. Core changes: Configurable._convert dumps pydantic models, so RenderersConfigAdapter.to_dict is deleted.

Example.

before: controller -> env server actor (serve_env) -> rollout worker -> generator
after:  controller -> rollout worker [vf env -> interception -> train client -> GenerationServer] -> generator
        group of 8, rollout 3 hits a SandboxError -> status error_infra, reward None,
        and the other 7 train

Must fix

  1. The PR description: "Summary (human-written)" is empty. Its NOTE also says nothing has run on GPUs yet and that one short Terminal-Bench run gates the merge. Add that run's loss/reward and status rates before this merges.
  2. generation_server.py:207 -- the allowlist of sampling params is gone, so unknown params are ignored without a word (inline).
  3. rollouter.py:264 -- score_group grades rollouts and then throws the grades away. It may raise TypeError on a None trace.reward (unverified). Filter before scoring (inline).
  4. README.md:105-172 -- @felipemello1's request to drop example-specific values and the scaling section is only partly addressed (inline).
  5. TODOs that work around Verifiers gaps have no upstream issue link (principle 3): rollouter.py:593 (no_proxy on loopback) and verifiers_terminal_bench.py:127 (renderer lock on the event loop).

Should consider

  • rollouter.py:237 -- the multi-agent list split can't run; return a single Rollout (inline).
  • rollout_worker.py:73 -- the RDMA TODO is unrelated to this bump (inline).
  • rollouter.py run_id default_factory reads VF_RUN_ID at config build time, and a random uuid ends up in the dumped job config. That's fine if intended, but two configs built in one process get different ids.
  • With the watchdog gone, a killed worker now leaves Docker containers behind until someone runs docker rm by label (README). A maintainer should accept this tradeoff explicitly.

Questions

  • @felipemello1's earlier questions, answered from the code:

    • worker_kwargs carried env_server_address to each worker. It disappears along with the env server.
    • Vision: the renderer Verifiers builds gets no processor, so setup_async raises for image models. MessageEnv vision recipes are unaffected.
    • The tokenizer is gone because the train client renders in each worker with its own renderers copy.

    Do these match your intent?

Details

Gate: the problem is real. 0.4.1 removes serve_env, and the pins must move together. The layer is right: Verifiers runs inside the rollout worker, and core only gets the generic pydantic dump in configurable.py. The rewrite resolves these earlier comments:

  • the watchdog
  • the VF_RUN_ID scope
  • the to_dict override and its test
  • num_threads_per_worker (now None, with a reason)
  • the __post_init__ taskset copy
  • one env per env config
  • the top_k/min_p dict
  • the dapo_math/data.py "controller"/"rebuild" docstring

Tests: the generation server, status and lifecycle tests guard real invariants (sessions released, close order, calls in flight drained). The scoring test doesn't cover a None grade.

Not verified: what sampling keys the Verifiers 0.4.1 client sends, whether trace.reward is None on failed traces, and anything on GPU.

Comment on lines +207 to +212
# TODO: TitanRL's generator doesn't support other top_k or min_p yet. Raise early.
for name, full_vocabulary in (("top_k", -1), ("min_p", 0.0)):
if sampling_params.get(name, full_vocabulary) != full_vocabulary:
raise ValueError(
f"sampling_params.{name}={sampling_params[name]!r} is unsupported"
)

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.

This drops the old allowlist (unsupported sampling parameters: ...). Now only top_k and min_p get checked, and every other key is ignored without a word. Say a Verifiers env sets repetition_penalty=1.1, presence_penalty, min_tokens, or stop strings: the generator samples without them, and the trace logprobs no longer match what the env asked for. Nothing reports it. That breaks principle 8.

Smallest fix: bring the allowlist back next to the no-op checks. This is about 4 lines:

Suggested change
# TODO: TitanRL's generator doesn't support other top_k or min_p yet. Raise early.
for name, full_vocabulary in (("top_k", -1), ("min_p", 0.0)):
if sampling_params.get(name, full_vocabulary) != full_vocabulary:
raise ValueError(
f"sampling_params.{name}={sampling_params[name]!r} is unsupported"
)
# TODO: TitanRL's generator doesn't support other top_k or min_p yet. Raise early.
for name, full_vocabulary in (("top_k", -1), ("min_p", 0.0)):
if sampling_params.get(name, full_vocabulary) != full_vocabulary:
raise ValueError(
f"sampling_params.{name}={sampling_params[name]!r} is unsupported"
)
honored = {"temperature", "top_p", "max_tokens", "seed", "stop_token_ids", "top_k", "min_p"}
protocol = {"logprobs", "skip_special_tokens", "routed_experts_prompt_start"}
if unsupported := sorted(set(sampling_params) - honored - protocol):
raise ValueError(f"unsupported sampling parameters: {unsupported}")

Unverified: I haven't checked which other keys the 0.4.1 renderer client always sends. If it sends some with no-op defaults (e.g. repetition_penalty=1.0), add them to the (name, no-op value) loop instead of the allowlist. test_sampling_config_takes_only_what_the_generator_honors could take one more parametrize row for this case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines +264 to +273
rubric_outputs = await super().score_group(rollouts, env_input)
scored = []
for rollout, rubric_output in zip(rollouts, rubric_outputs, strict=True):
# Validation groups have negative ids (`Controller`'s `_validation_group_ids`).
is_validation_timeout = (
rollout.group_id < 0 and rollout.status is RolloutStatus.ERROR_TIMEOUT
)
keeps_grade = rollout.status in _TRAINED_STATUSES or is_validation_timeout
scored.append(rubric_output if keeps_grade else RubricOutput(reward=None))
return scored

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.

This calls the rubric on every rollout, then throws away the grades of ERROR, ERROR_TIMEOUT (training) and TRUNCATED_PROMPT_TOO_LONG rollouts. That has two costs:

  • Reward fns run for nothing. That matters with a custom rubric, e.g. an LLM judge.
  • Unverified: a failed trace may carry trace.reward = None. Then RewardFromVerifiers returns None, and Rubric._score_single_rollout evaluates w * None (rubric.py:154). That raises a TypeError, and the whole group fails, which contradicts "a failure stays inside its episode". On the base branch, error_reward=0.0 in the recipes short-circuited errored rollouts, but this PR removes it.

Decide keeps_grade first and score only those rollouts. This is simpler and doesn't depend on how the rubric treats failures:

keeps_grade = [
    rollout.status in _TRAINED_STATUSES
    # Validation groups have negative ids (`Controller`'s `_validation_group_ids`).
    or (rollout.group_id < 0 and rollout.status is RolloutStatus.ERROR_TIMEOUT)
    for rollout in rollouts
]
graded = iter(await super().score_group(
    [r for r, keep in zip(rollouts, keeps_grade) if keep], env_input
))
return [next(graded) if keep else RubricOutput(reward=None) for keep in keeps_grade]

The existing scoring test uses rollouts with no turns, so RewardFromVerifiers always returns 0.0 there, and the None-reward path is never exercised.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines 237 to 251
# `make_scored_group` numbers a raised entry by its position, so each episode's first
# rollout, or its error, sits at the episode's index. Rollouts of other trainable agents
# in one episode follow.
first_rollouts: list[Rollout | BaseException] = []
other_agent_rollouts: list[Rollout] = []
for episode_output_or_error in episode_outputs_or_errors:
if isinstance(episode_output_or_error, BaseException):
first_rollouts.append(episode_output_or_error)
continue
rollouts = episode_output_or_error
first_rollouts.append(rollouts[0])
other_agent_rollouts.extend(rollouts[1:])
return await self.make_scored_group(
first_rollouts + other_agent_rollouts, sample, group_id=group_id
)

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.

This code can never run. _run_episode raises unless there is exactly one trainable trace (line 342), so rollouts[1:] is always empty, other_agent_rollouts never gets an element, and the list return at 347-356 always holds one item. The TODO at line 340 already records the multi-agent case.

Have _run_episode return a single Rollout (-> Rollout, (trace,) = trainable_traces after the check). Then this block becomes:

return await self.make_scored_group(
    list(episode_outputs_or_errors), sample, group_id=group_id
)

That removes about 12 lines plus the "A list:" docstring and comment. Bring the list back along with the per-agent advantages that need it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines +105 to +172
## What crosses each hop

One model call at 128K tokens of context (turn 133 of an agent's rollout), measured on CPU:

```text
hop what crosses bytes
agent (container) -> egress proxy (worker) the whole chat history, JSON 573 KB
egress proxy -> interception server the same bytes, relayed 573 KB
train client -> GenerationServer (loopback) the whole prompt's token ids 586 KB
generate_fn -> generator (Monarch) the whole prompt's token ids 374 KB
generate_fn -> router the request and session ids < 1 KB
each reply, back to the agent the new completion only a few KB
```

- Each call carries the whole history: the agent speaks OpenAI chat, and the generator gets the
full prompt. So the bytes a rollout moves grow with turns x context: about 140 MB of encode and
decode for a 128K rollout of 133 turns, at most about 0.6 MB per call.
- The cost is worker CPU to encode and decode: about 50 ms per call at 128K, about 4 s per
rollout. At most 0.6 MB per call is little for the network.
- Memory grows only with the rollout's own length. The trace keeps each message once, with
only the tokens it adds; the GenerationServer keeps counters per session; a `Rollout` keeps each
turn's new prompt tokens and its completion, about 1.4 MB at 128K.
- Size limits. The GenerationServer reads request bodies up to 1 GiB; replies have no limit.
The largest Monarch message here is a worker's scored group, G x one `Rollout`: about 44 MB for
32 rollouts at 128K. With router replay or top-k logprobs on, the batcher's packed step becomes
the largest message. A recipe that turns either on also sets
`async_loop.batcher.rdma_min_tensor_bytes`, so those tensors go by RDMA: Monarch caps a message
at 10 GiB and fails the whole actor mesh above it.

## Concurrency

One cap: the controller keeps at most K groups of G rollouts in flight, with
K = `(target_offpolicy_steps + 1) x num_prompts_per_train_step` and G = `num_samples_per_prompt`.
A group is in flight from when a worker starts it until it returns to the controller. The rest
follows from K x G. Example column: K = 48 groups of G = 32 (1,536 rollouts in flight), V = 89
validation tasks.

| what | how many | example | set by |
|---|---|---|---|
| rollout workers, processes on the controller host | ceil(K x G / rollouts_per_worker) | 24 | `Rollouter.Config.rollouts_per_worker` (64) |
| rollouts per worker | a sizing target: whole groups are placed, so a worker can hold up to one group more (groups of 24 at 64: 72); a group larger than it raises | 64 | the same |
| sandboxes | one per running rollout: at most K x G + V | 1,625 | the agent's runtime |
| interception servers per worker | one per 32 rollouts in flight; never shrink | 2 | Verifiers: the env's `interception.multiplex` |
| renderers per worker, about 175 MB each | one per 256 model calls in flight; never shrink | 1 | Verifiers: `vf.TrainClientConfig.multiplex` |
| threads per worker | Python's default, min(32, CPUs + 4) | 32 | `Rollouter.Config.num_threads_per_worker` (the Verifiers recipes set None; default 4) |
| controller host CPUs | one per worker, plus local sandboxes | 24 + sandboxes | the host |

- Placement: the Rollouter counts rollouts in flight per worker and sends each group to the
worker with the lowest count. It is a list of numbers in the controller, so it works wherever
the workers run. A group's count drops when the whole group returns.
- A whole group runs on one worker, so a group larger than `rollouts_per_worker` raises when the
config is built. Example: groups of 128 at the default 64 raise; set `rollouts_per_worker=128`
and 16 groups run on 16 workers, one group each.
- Each rollout starts its own sandbox and removes it when it ends. Validation
sends its V tasks at once, beside training (`ValidationConfig.steps`), hence the + V. Usually far
fewer run: a group stays in flight until its slowest rollout ends.
- Verifiers' pools, measured in one worker: 1, 1, 2, 4 and 10 interception servers at 1, 32, 33,
100 and 300 rollouts. A second renderer loads only above 256 model calls in flight, and loading
it stops the worker's event loop for 0.4-1.2 s. At 64 rollouts per worker and groups of at most
64, a worker holds under 128 rollouts, so it keeps one renderer. A local runtime (Docker too)
opens no tunnel; a remote provider without its own tunnel opens one per interception server.
TitanRL adds no knob for these pools: set them in the Verifiers config.
- Threads run renders and blocking runtime calls. With 4, renders waiting for the renderer lock
held every thread, and other thread work (e.g. sandbox cleanup) waited up to 346 ms in a
100-rollout test, vs 12 ms with 32. More threads are not faster: renders hold Python's GIL.
- CPUs: a local Docker sandbox shares the controller host's CPUs with the workers. `--cpus`
limits a container but reserves nothing, so 24 workers and 200 running 1-CPU sandboxes want
about 224 CPUs. A remote provider runs sandboxes on its own machines.

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.

@felipemello1 asked earlier not to mention specific example config values ("dont mention specific examples, specially config values that differ from example to example"), and to delete the scaling section. "Scaling" is gone, but "What crosses each hop" and "Concurrency" bring the same kind of content back:

  • an example column (K=48, G=32, 24 workers, 1,625 sandboxes)
  • measured byte counts at 128K
  • pool counts at 1/32/33/100/300 rollouts
  • 346 ms vs 12 ms thread waits

These numbers go stale with every Verifiers or recipe change. They also make the README about 2.4k words, up from about 700.

Suggestion: keep the one-cap rule (K x G in flight, rollouts_per_worker, a group larger than it raises). Keep the size limits (1 GiB request body, the 10 GiB Monarch cap and rdma_min_tensor_bytes). Keep the CPU note for local Docker. Drop the example column and the measurements, or move them into the PR description, where they describe this PR's testing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines +73 to +75
# TODO: once a group's per-token arrays (router replay rows, top-k logprobs) pass about
# 3 GiB, send RDMA handles in this reply, registered once per rollout and released after
# the batcher reads them: Monarch caps a message at 10 GiB.

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.

This is a core TitanRL TODO, and it isn't related to the Verifiers 0.4.1 / renderers 0.2.0 bump: any rollout worker with router replay or top-k logprobs hits the same limit. Following one concern per PR, move it to its own PR, or to the PR that adds router replay.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: answers to the points in the review that have no inline thread.

the review bot (review): Its NOTE also says nothing has run on GPUs yet and that one short Terminal-Bench run gates the merge. Add that run's loss/reward and status rates before this merges.

Agreed, the run gates the merge of this PR and the next three in the stack. A 50-step Terminal-Bench run of this stack waits for free hosts; it hasn't started. When it ends, its loss, reward and status rates go into the description.

the review bot (review): TODOs that work around Verifiers gaps have no upstream issue link (principle 3): rollouter.py:593 (no_proxy on loopback) and verifiers_terminal_bench.py:127 (renderer lock on the event loop).

The two Verifiers issues aren't filed yet, so these TODOs have no link. Each names its gap: skip the proxy for a loopback base_url, and wait for the renderer lock on the event loop.

the review bot (review): rollouter.py run_id default_factory reads VF_RUN_ID at config build time, and a random uuid ends up in the dumped job config. That's fine if intended, but two configs built in one process get different ids.

Intended. The config is built once per run and pickled to every worker, so all the workers share one id. Having it in the saved job config helps: the cleanup command that "Verifiers README: terms, concurrency and sandboxes" adds to the README filters containers by it. A launcher that wants a fixed id sets VF_RUN_ID.

the review bot (review): With the watchdog gone, a killed worker now leaves Docker containers behind until someone runs docker rm by label (README). A maintainer should accept this tradeoff explicitly.

The author accepted it in the design review, after the earlier review round. A maintainer's sign-off is still open. The watchdog covered only Docker, and only a killed worker. A graceful stop cancels each rollout, and its run_slot stops its own sandbox. A remote provider's leases reclaim its sandboxes. After a killed Docker run, the README's "Sandboxes" section, added in "Verifiers README: terms, concurrency and sandboxes", gives the one-line cleanup by the run's label.

the review bot (review): @felipemello1's earlier questions, answered from the code ... Do these match your intent?

They match the plan this PR follows, and each has its own thread: worker_kwargs goes with the env server, the image-prompt raise applies only to Verifiers rollouts, and the MessageEnv worker still builds its tokenizer from tokenizer_config.

Comment on lines +218 to +222
# Verifiers' client in this worker calls its generation server on loopback. With
# http_proxy set, httpx sends even loopback requests to the proxy unless no_proxy
# names the host.
# TODO: drop once Verifiers' train client ignores env proxies for a loopback base_url.
# Keep the host's own entries from either spelling, e.g. NO_PROXY=.corp.internal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this docstring is not helpful as it is. I am also skeptical of the TODO. Perhaps we are not using it correctly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

del tokenizer_config, vision_processor_config
"""Start this worker's generation server, then load and serve the Verifiers env.
Verifiers renders with its own renderer, so no tokenizer here."""
del tokenizer_config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is it because the renderes has it? If so, then i dont see wy we need tokenizer_config in the signature in the first place. This should also be true for the MessageEnv worker, no?

Comment on lines +242 to +250
# One VF_RUN_ID per worker: "torchtitan-<uuid>", or "<launcher's VF_RUN_ID>-<uuid>".
# 1. Verifiers labels each container it starts `verifiers.run=$VF_RUN_ID`.
# 2. So the watchdog removes exactly this worker's containers when the worker dies.
# 3. Side effect: Verifiers' run-wide creation-rate limits (e.g. `PrimeConfig.creates_per_min`)
# apply per worker.
# TODO: drop the side effect once Verifiers keeps the container label and the limiter scope apart.
run_id_prefix = os.environ.get("VF_RUN_ID", "torchtitan")
os.environ["VF_RUN_ID"] = f"{run_id_prefix}-{uuid.uuid4().hex}"
self._container_watchdog = _start_container_watchdog(os.environ["VF_RUN_ID"])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i think i am missing here some diagram showing exactly all components and their connections betwen envserver, generation server, rollout worker, shutdown process, etc. Like, some documentation i can read once, non verbose, diagram, enumerated, how did locally on discussion 190.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment on lines 299 to 301
# Each group replaces this one slot. That is safe because every group's generate_fn routes the
# same way; keep per-group state out of it.
self._generation_server.set_generate_fn(generate_fn)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is this worker serving only one group at a time? My intuition is that each worker serves multiple groups, otherwise if we wanted to have 500 concurrent groups, we would need 500 cpus, for most of the part idle, waiting for tool call/generation.

In other words: is this state preserved for this one group?

But if this is serving multiple groups, then the generate_fn could be different across groups? I dont know if this is a real pattern though, i.e. we would have multiple generate_fn. Please check in other libraries. If it isnt, we could try to simplify this and NOT set it per group call, but something we set at the start?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

# same way; keep per-group state out of it.
self._generation_server.set_generate_fn(generate_fn)
# Rebuild the controller's task from its data, as the taskset's `load` builds it.
task_type = self._verifiers_env.taskset.task_type()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i dont really get this. The sample should define the task type, no? sounds like bad design on our end.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

return turns


def _start_container_watchdog(run_id: str) -> subprocess.Popen:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Too verbose and too many todos. It doesn't sound elegant. Please double check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Comment thread torchtitan/rl/README.md Outdated
Comment on lines +138 to +139
because Verifiers runs the env and its agent loop, and a
`VerifiersRollouter` that copies the training taskset into the worker's env config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
because Verifiers runs the env and its agent loop, and a
`VerifiersRollouter` that copies the training taskset into the worker's env config.
because Verifiers runs the env and its agent loop.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

verifiers_env_server=VerifiersEnvServer.Config(
environment=HarborEnvConfig(
worker=VerifiersRolloutWorker.Config(
environment=vf.SingleAgentEnvConfig(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i dont understand this: are we not using harbor anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

# TODO: 16 is untuned. Set it from a Terminal-Bench run with Docker: rollouts in flight
# per worker, render wait and host RAM. The `VerifiersRollouter` docstring and the
# Verifiers README's "Scaling" section copy 16: update them with it.
worker_pool_size=16,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also, too many comments//todos. Lets see what we can do about them and be less verbose.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this was in an earlier pr. It seems that this wasnt properly rebased?

@felipemello1 felipemello1 Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: Right. "Run Verifiers groups in rollout workers" merged with two edits made in the web editor. GitHub's stack then rebased the next four PRs and stopped at this one, which rewrites the same lines. Fixed at 15:40 PST: this PR and the nine above it are rebuilt on the new base, with both edits carried up. This PR is one commit again (+843/-983).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

@felipemello1

Copy link
Copy Markdown
Contributor Author

Reply from claude: This PR is replaced by the fresh draft "[rl] Verifiers: each rollout worker runs its Verifiers env; the env server is gone". It keeps the dataset config and taskset ids from main; the dataset redesign and the installed-package ids from this PR are on hold. The comments here were read when planning it. Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/docker ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant