How one taskset now trains on several harnesses: each prompt group picks one

NVIDIA-NeMo/RL #5158 ยท all links pinned to head 824c116

Before
A taskset maps to exactly one Gym server in environment_server_routes. Every prompt group of that taskset runs on the same agent harness.
This PR
Adds env.nemo_gym.multi_harness: a taskset lists several servers, and each prompt group picks one of them by hashing its group ID onto the weights.
Status
New feature, under review. The design works for harnesses of different agent types. Harnesses that share one agent type are refused at startup; see the second page.

Three pages on this PR, one question each. This one: what the new route does next to the old one.

Background. A taskset is a group of tasks. A Gym Environment Server runs one agent harness (OpenCode, Pi, โ€ฆ) on a task. GRPO scores each answer against its prompt group's mean reward, so all answers in one group must come from the same harness, or the model learns the gap between harnesses. Dotted words have a short explanation: hover or tap them.

Both paths end the same way: RL writes the chosen server name into the row as row["_ng_environment_server"], and Gym sends the row to that server. The only new step is how the name is chosen. get_nemo_gym_route_name now checks multi_harness first. For a listed taskset it calls select(taskset, group_id). That hashes the group ID to a number in [0, 1) and finds which harness's slice of the weights it lands in. The hash needs no saved state, so the driver, every Gym actor and every retry pick the same server.

Before: one server per taskset After: multi_harness, weights opencode_agent 3 ยท pi_agent 1 rows of groups g8, g9, g10 {task_id:{taskset:"swe"}, _ng_group_id:"g8"} โ€ฆ same rows of groups g8, g9, g10 {task_id:{taskset:"swe"}, _ng_group_id:"g8"} โ€ฆ get_nemo_gym_route_name environment_server_routes["swe"] โ†’ "swe_opencode" for every group get_nemo_gym_route_name โ†’ covers("swe") select("swe", group_id): sha256 โ†’ [0, 1) opencode_agent 3/4 pi 1/4 00.751 g9 .426 g8 .519 g10 .791 g8 โ†’ "swe_opencode" g9 โ†’ "swe_opencode" g10 โ†’ "swe_pi" Same group ID โ†’ same pick in driver, every actor, every retry. _prepare_materialized_nemo_gym_rows row["_ng_environment_server"] = server โ†’ Gym runs the row there. Same code from here on. metrics swe/reward/mean result["_ng_harness"] โ†’ harness_metric_namespace swe/opencode_agent/reward/mean, swe/pi_agent/โ€ฆ

Green border = new in this PR. Blue dashed = where the two paths become one. The hash values are real outputs of select()'s formula for these group IDs. The bar shows each harness's share of the weights; a group goes to the slice its hash lands in.

The route, as pseudocode

Pick a server for one row โ€” after (the before is the last two lines alone)

# driver, and again on each Gym actor before the row is sent
def route(row):
    taskset = row.task_id.taskset
    if multi_harness.covers(taskset):
        u = sha256("v1" + row.group_id)[:8] / 2**64      # same group โ†’ same u everywhere
        return slice_of(u, weights_of(taskset)).server  # weights keyed by agent TYPE
    return environment_server_routes[taskset]          # the old path, unchanged

Real code: get_nemo_gym_route_name, MultiHarnessRoutes.select.

Startup โ€” new

# driver, once, after the Gym actors are up
infos  = actor.describe_environment_servers(listed)   # each actor reads its own Gym config
routes = resolve_multi_harness(cfg, infos)      # one agent type per server; types must differ
for a in actors: a.set_multi_harness_routes(routes)  # driver and actors share one table

Real code: _install_multi_harness_routes.

What still differs, and why keep both

environment_server_routesmulti_harness.routes
Servers per tasksetoneseveral, one per harness
Who picksthe confighash of the group ID, weighted by agent type
Metric namesswe/reward/meanswe/<agent>/reward/mean; no swe/reward/โ€ฆ key
Startup checksroute existseach server runs one agent; servers of a taskset run different agent types, one server type, one verifier
Resumenothing newwith token capture, a restored group must land on the same agent type, or the run stops

Both stay: a taskset with one harness keeps the simple route, and a taskset goes in exactly one of the two (setup refuses both).

So what. Groups never mix harnesses, and the split follows the weights without any saved state. That is the right shape for GRPO. The catch is the agent type rule in the startup checks: Gym often runs several harnesses under one agent type, and those configs are refused. Page 2 shows why, and the fix.