Skip to content

Commit 7a557f3

Browse files
committed
[None][feat] trtllm_modeling_v2: stated disaggregated deployments and members wider than one node
The flow could gate neither a member wider than one node nor a disaggregated deployment it had not been given a pytest for: boot, accuracy, serve and acceptance start one engine with mpirun inside one node's job, and accuracy.disagg names a test. A member wider than environment.gpus_per_node is now one engine across the nodes of one job, and accuracy.disagg can name the tree's own three files of a deployment (the config of trtllm-serve disaggregated, a context and a generation config), which the flow serves and scores through the proxy against the floor the accuracy gate holds that unit to. The benchmark is the tree's own trtllm-eval command of it, given a stand-in for its LLM that sends each prompt to the proxy, as the tree's disaggregated accuracy test does; the gate reads the score from the job's output with the accuracy gate's own judgement. The test form of accuracy.disagg is unchanged. A job that spans nodes states nodes=N lead=1 and is run once by the session's lead: one more scheduler with no devices on the allocation's batch host, outside the container. Each of its worlds is a step of the allocation (srun --overlap --mpi=pmix, the counts and the hosts), entering the session's container with the words the spec states in environment.step_args. A deployment that fits one node needs neither: its job starts each server there as main starts an engine on one node. session render writes the lead's entry and the session's environment beside the entry. Preflight says before any GPU job whether a gates session holds the nodes; across nodes each rank's Triton cache and import record are on its own node. Signed-off-by: Wanli Jiang <35160485+Wanli-Jiang@users.noreply.github.com>
1 parent a879e61 commit 7a557f3

24 files changed

Lines changed: 2117 additions & 174 deletions

File tree

‎agent-flow/agent_flow/workflows/trtllm_modeling_v2/README.md‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,36 @@ a container runtime, a shell). The run needs:
8080
- a session with a `time_limit` to be followed before its end: from `handover_lead` before then it
8181
starts only jobs that fit, and the next session started on the same spool takes the rest;
8282
- one orchestrator per workspace (a new one resumes from it), on a host that sees the run
83-
directory, checkout and checkpoints at the same paths as every session.
83+
directory, checkout and checkpoints at the same paths as every session;
84+
- for anything wider than one node (`environment.gpus_per_node`), a gates session of that many
85+
nodes (`nodes: N`, a watcher on each) **and its lead**. A member wider than a node (`dep16` on
86+
4-GPU nodes) and a disaggregated deployment across nodes are jobs of whole nodes. A watcher
87+
runs inside the container on one node and nothing it starts reaches another, so the lead runs
88+
such a job once: the same scheduler with no devices, on the allocation's batch host, outside
89+
the container. `session render` writes its entry beside the session's (`session_lead.sh`):
90+
run it once there, beside the step that runs the entry on each node. The run's paths are the
91+
same inside and outside the container: the lead enters a job's tree by its path.
92+
Each world of such a job is a **step** of the allocation: `srun --overlap` (it shares its
93+
nodes with the watchers' step) `--mpi=pmix`, with the counts and the hosts, which are the
94+
flow's. `environment.step_args` states the site's words, whatever a step needs to see what
95+
the watchers' step sees: `--container-image=...`, `--container-name=...`, and where the site
96+
needs them the mounts (a step without them dies at once: `cd: <the job's tree>: No such file
97+
or directory`) and an account. A step's shell is a fresh one, so `session render` also
98+
writes `session_env.sh`, the entry's exports and setup lines, which every step reads first:
99+
render again after changing either. Every step keeps its Triton cache under its node's
100+
`TMPDIR` when the run declares one, so that is a directory of each node. This is Slurm with
101+
a named container; the flow starts a world across nodes no other way.
102+
103+
**Disaggregation.** `accuracy.disagg` states one of two things. A deployment, as the tree
104+
states one, with three files: `config` for `trtllm-serve disaggregated -c` and the LLM-API
105+
options of the `context` and of the `generation` servers (`trtllm-serve --config`), as in
106+
`examples/kimi_k3/disagg/`. The flow serves it itself, one `trtllm-serve` per instance behind
107+
`trtllm-serve disaggregated`, and scores the unit's benchmark through the proxy, held to the
108+
floor the accuracy gate holds that unit to. It reads from the files only how many servers a
109+
side has and how many ranks one has; each server gets its side's file as it is. On one node
110+
its job starts the servers there; across nodes it is one step per instance. Or a `test`: the node id of
111+
a disaggregated-serving accuracy test the run writes beside the tree's own, which the gate runs
112+
as CI does. State the deployment unless the request needs a test of its own.
84113

85114
`trtllm-modeling-v2 monitor status` shows each session, and raises `SESSION_ENDING` while one is in
86115
hand-over with no newer session on its spool. A gate or test job the run has

‎agent-flow/agent_flow/workflows/trtllm_modeling_v2/agents/skills/trtllm-modeling-v2-features/SKILL.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ Climb only as far as the claim needs. Each rung says what it cannot see.
7878
*Blind to* accuracy: boot checks only that a few short continuations are
7979
not empty.
8080
4. **Accuracy, disagg, acceptance.** `gate accuracy` runs the benchmark
81-
with CUDA graphs; `gate disagg --unit disagg` runs the target's
82-
disaggregated-serving test as CI does; `gate acceptance` judges
81+
with CUDA graphs; `gate disagg --unit disagg` serves the
82+
deployment `accuracy.disagg` states and scores it through its proxy, or
83+
runs the target's disaggregated-serving test as CI does when it states a
84+
`test`; `gate acceptance` judges
8385
speculators. *Blind spots* are per feature in the reference; they are why
8486
each feature carries a proof of its own.
8587

@@ -90,7 +92,7 @@ Climb only as far as the claim needs. Each rung says what it cannot see.
9092
| KV-cache dtype | a variant setting `llm_api_options.kv_cache_config.dtype` | the loader's KV-quantization log line, which no gate reads | variant accuracy |
9193
| CUDA graphs | `runtime.cuda_graph` (default on) | the options sent; no gate reads the captures | accuracy |
9294
| overlap scheduler | `runtime.overlap_scheduler` (default on, core) | the argument only | nothing of its own |
93-
| disaggregation | feature `disagg` + `accuracy.disagg.test` | a benchmark scored through `trtllm-serve disaggregated` | the tree's disaggregated-serving test |
95+
| disaggregation | feature `disagg` + `accuracy.disagg` (`config`/`context`/`generation`, or `test`) | a benchmark scored through `trtllm-serve disaggregated` | the flow's own serving of the stated deployment, or the tree's disaggregated-serving test |
9496
| multimodal | feature `multimodal` | an image prompt answered | boot image, image benchmark |
9597
| speculative | features `mtp`, `eagle3`, `dflash`, `dspark` | accepted tokens per iteration | acceptance gate |
9698

@@ -112,7 +114,11 @@ Climb only as far as the claim needs. Each rung says what it cannot see.
112114
and chunked prefill are off there. Prove every other feature once, as one
113115
variant on core at the member the request validates fully (`spec/INTAKE.md`),
114116
never two at once.
115-
- **Write the disaggregated test the way the tree's own are written,** in
117+
- **Write a disaggregated test only when `accuracy.disagg` states a `test`.**
118+
With `config`, `context` and `generation` there the flow serves the deployment itself:
119+
a failing `gate disagg` is then about the target or its options, never about
120+
a launcher to write. When it does state a test, write it the way the tree's
121+
own are written, in
116122
`tests/integration/defs/accuracy/test_disaggregated_serving.py`: a
117123
`LlmapiAccuracyTestHarness` class with context and generation server configs,
118124
`launch_disaggregated_llm`, the benchmark task of `accuracy_core.py` (GSM8K

‎agent-flow/agent_flow/workflows/trtllm_modeling_v2/agents/skills/trtllm-modeling-v2-features/references/features.md‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,23 @@ launcher also passes `--server_role`). Then `trtllm-serve disaggregated -c
254254
disagg_config.yaml`, which lists the `context_servers` and
255255
`generation_servers` URLs.
256256

257-
**Flow proof.** The `disagg` unit owes only its disaggregated-serving test
258-
(`checks/disagg.py`; `gate disagg --unit disagg --member <m>`): a test the run
257+
**Flow proof.** The `disagg` unit owes only its `disagg` check
258+
(`checks/disagg.py`; `gate disagg --unit disagg --member <m>`), and the run's
259+
`task.yaml` says which of two it is. Read `accuracy.disagg` before writing
260+
anything.
261+
262+
*It states `config`, `context` and `generation`:* the tree's own three files
263+
(`examples/kimi_k3/disagg/`), and the flow serves that deployment itself. You
264+
write no test, launcher or server. Each side is one `trtllm-serve` per instance
265+
with `--server_role` and its side's file as `--config`, as it is but for the
266+
gate's `modeling_v2: require` (`gates/disagg/disagg.<unit>.<member>/options.<ctx|gen>.yaml`
267+
is what it ran; nothing of the unit's options is in it), behind
268+
`trtllm-serve disaggregated -c` with the stated `config`. The gate passes when
269+
every server and the proxy came up and the unit's benchmark through the proxy is at or
270+
above the unit's floor. Its verdict names the server that did not come up and
271+
its log, in the same directory. `gate disagg` submits the job, across nodes too.
272+
273+
*It states `test`:* the proof is a test the run
259274
writes beside the tree's own in `accuracy/test_disaggregated_serving.py`
260275
(`launch_disaggregated_llm` starts both workers and `trtllm-serve
261276
disaggregated`), named by `accuracy.disagg.test`. The gate runs it from its
@@ -266,7 +281,7 @@ node: write the test for two engines of two; `accuracy.disagg.devices`
266281
overrides, never past a node), and passes only when every test the node id
267282
selects passed: a skip (too few devices, no `LLM_MODELS_ROOT`) fails it.
268283

269-
**Blind spots.** Boot and accuracy never cross the hop; only the test does, and
284+
**Blind spots.** Boot and accuracy never cross the hop; only the `disagg` check does, and
270285
it judges a benchmark score, not token identity with an aggregated engine. A
271286
hop that loses part of the state can still score within the floor on short
272287
answers. The transceiver backend and runtime the workers actually ran are not

‎agent-flow/agent_flow/workflows/trtllm_modeling_v2/checks/accuracy.py‎

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -326,36 +326,51 @@ def floor_fields(floor: accuracy_policy.Floor | None) -> dict[str, Any]:
326326
if failure:
327327
return _verdict(passed=False, detail=failure, **ran, **floor_fields(planned))
328328

329+
judged = judge_score(
330+
accuracy, unit, benchmark, reference, combined, relative=relative,
331+
note="; score validation only; eval cache reuse was not probed (zero hits are not a failure)",
332+
) # fmt: skip
333+
return _verdict(**({} if "measured" in judged else floor_fields(planned)), **judged, **ran)
334+
335+
336+
def judge_score(
337+
accuracy: Mapping[str, Any],
338+
unit: str | None,
339+
benchmark: str,
340+
reference: float,
341+
output: str,
342+
*,
343+
relative: bool = False,
344+
said: str = "measured",
345+
note: str = "",
346+
) -> dict[str, Any]:
347+
"""A verdict's fields for a benchmark's ``output``: its score against the unit's floor.
348+
349+
The accuracy gate's judgement, and the disagg gate's of a deployment it served, which
350+
opens the sentence with ``said``; ``note`` ends a verdict that has a floor.
351+
"""
329352
pattern = resolve_per_unit(accuracy, "score_pattern", unit)
330-
measured = parse_eval_score(combined, pattern)
353+
measured = parse_eval_score(output, pattern)
331354
if measured is None:
332-
return _verdict(
333-
passed=False,
334-
detail=unparsed_score_detail(combined, pattern),
335-
**ran,
336-
**floor_fields(planned),
337-
)
338-
339-
floor, source = resolve_floor(accuracy, unit, benchmark, reference, combined, relative)
355+
return dict(passed=False, detail=unparsed_score_detail(output, pattern))
356+
floor, source = resolve_floor(accuracy, unit, benchmark, reference, output, relative)
340357
if floor is None:
341-
return _verdict(
358+
return dict(
342359
passed=False,
343-
detail=f"measured {measured:.4f}, but the statistical floor needs the sample "
360+
detail=f"{said} {measured:.4f}, but the statistical floor needs the sample "
344361
f"count and there is {source}. A floor that cannot be computed is not a pass",
345362
measured=measured,
346-
**ran,
347363
)
348364
passed = measured >= floor.value
349-
return _verdict(
365+
return dict(
350366
passed=passed,
351-
detail=(
352-
f"measured {measured:.4f} {'>=' if passed else '<'} {floor.value:.4f} "
353-
f"({floor.describe()}; count from {source}); score validation only; "
354-
"eval cache reuse was not probed (zero hits are not a failure)"
355-
),
367+
detail=f"{said} {measured:.4f} {'>=' if passed else '<'} {floor.value:.4f} "
368+
f"({floor.describe()}; count from {source}){note}",
356369
measured=measured,
357-
**ran,
358-
**floor_fields(floor),
370+
floor=floor.value,
371+
se=floor.se,
372+
samples=floor.samples,
373+
floor_rule=floor.describe(),
359374
)
360375

361376

@@ -401,6 +416,7 @@ def resolve_model_key(task_data: Mapping[str, Any], unit: str | None = None) ->
401416
"ACCURACY_TIMEOUT_S",
402417
"eval_command",
403418
"eval_harness_command",
419+
"judge_score",
404420
"load_reference_score",
405421
"parse_eval_score",
406422
"resolve_discriminators",

0 commit comments

Comments
 (0)