feat(thunderagent): include HiCache retention capacity - #11185
Conversation
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
WalkthroughThis PR introduces HiCache host token capacity metadata published by the SGLang engine and consumed by ThunderAgent's retention-budget calculation, updates documentation to reflect this budget model, reworks the MiniMax launch script into a policy-parameterized script, and replaces MiniMax-M2 reproduction docs with a Harbor/Pi A/B walkthrough. ChangesHiCache Retention Budget
Estimated code review effort: 3 (Moderate) | ~25 minutes Harbor/Pi Reproduction and Launch Script
Estimated code review effort: 3 (Moderate) | ~25 minutes Related Issues: None referenced in the provided changes. Related PRs: None referenced in the provided changes. Suggested labels: documentation, enhancement, sglang, thunderagent-router Suggested reviewers: None specified. Poem: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
Signed-off-by: Ishan Dhanani <ishandhanani@gmail.com>
## Summary Add recipe-side [ThunderAgent](https://arxiv.org/abs/2602.13692) integration on top of the Dynamo rollout backend introduced in #110(#110). This change adds program-aware routing for multi-turn agent trajectories while preserving the existing verl agent-loop and colocated training architecture. All integration remains inside the recipe; it does not modify core verl or Dynamo source code. ## Changes - Enable ThunderAgent through dynamo_trainer.yaml while retaining: - thunderagent.enabled=true for the Dynamo with ThunderAgent. - thunderagent.enabled=false for the native Dynamo KV-router baseline. - VARIANT=global for the native verl vLLM baseline. - Add concise launch examples: - dynamo/run_uniagent_variant.sh - dynamo/smoke_dynamo_v1.sh - dynamo/train_30b_rl_dynamo_kv_metrics.sh - Add focused unit tests for program lifecycle, routing headers, finalization, process ordering, configuration, registration, and verl compatibility. - Document KV-aware routing and end-to-end ThunderAgent benchmark results, including the corresponding plots. ## Required versions - Dynamo: 59d614641837e593f0567b79d75394aae5f864e0 - Includes the ThunderAgent lifecycle support merged through ai-dynamo/dynamo#11185 (ai-dynamo/dynamo#11185). ## Benchmark evidence For the matched Uni-Agent × verl synchronous GRPO experiment: - Concurrency 384: 1.94× rollout throughput and 1.39× observed full-step throughput. - Concurrency 512 <img width="416" height="224" alt="thunder agent rollout" src="https://github.com/user-attachments/assets/21f3abbd-b868-42d2-8065-6fe055fffbfb" /> <img width="416" height="226" alt="thunder_agent_globalstep" src="https://github.com/user-attachments/assets/2b95f045-e95a-4c7c-a435-7b3108f5e3b6" /> These benchmark results come from the matched runs documented in dynamo/README.md; no additional GPU training job was launched while preparing this PR. --------- Co-authored-by: Jinyan Chen <jinyanc@nvidia.com> Co-authored-by: Sophia Yang <sopyang@cw-dfw-cs-001-vscode-01.cm.cluster> Co-authored-by: OpenAI Codex <codex@openai.com>
ThunderAgent now derives its retention budget from SGLang worker metadata as GPU KV plus native HiCache host capacity, rather than device KV alone. This keeps program-level pause/resume aligned with the memory SGLang can actually retain while preserving SGLang as the authority for cache admission and movement.
CLOSES: DYN-3366
How This Was Implemented
DynamoPiadapter so every trial sends one stable session ID and the ThunderAgent arm sends an explicit terminal lifecycle request.ta|kvlauncher, a scored Verified walkthrough, and a dedicated 32-waynopimage-preparation command.Walkthrough
Mental model
SGLang knows the realized device and host cache sizes after startup, so it publishes both through the existing model deployment card. ThunderAgent consumes that card when it computes utilization; the session ID remains an identity hint that groups turns into a program, not a cache command.
Capacity and lifecycle
The capacity observer sums GPU KV tokens and native HiCache host tokens for each worker. The scheduler applies its existing thresholds to that sum, so a
0.95pause threshold means 95% of the memory that can retain the program locally; the existing GPU-only behavior remains when host capacity is absent.Harbor runs Pi inside the SWE-bench task container and maps the trial ID to
DYN_AGENT_SESSION_ID. Pi sends the same header on every model turn, and the ThunderAgent arm sends onex-dynamo-session-finalrequest at trial completion so program state can be released; the stock KV arm omits only that terminal request while retaining the same identity headers.Reproduction
run_minimax_8xh100.sh ta|kvowns the repeated two-worker TP4 MiniMax stack and loadsMiniMaxAI/MiniMax-M2.7from Hugging Face behind theMiniMaxAI/MiniMax-M2API alias. The README shows one scored Verified smoke and the complete 500-task run.Image preparation is a separate upstream Harbor
nopinstall-only job: authenticate to Docker Hub, run 32 trials concurrently with host networking, retain stopped containers to avoid per-trial Compose teardown, then prune once after all 500 task images exist. The measured run usesDynamoPiand the same host-network overlay, avoiding one Docker bridge network per trial.Boundaries and limitations
Mooncake capacity is deliberately excluded because matching content can be absent or evicted. The change does not make session identity sticky in the stock router, does not change SGLang cache correctness, and does not claim pause/resume activity from an unsaturated one-task smoke.
Validation
pytest -q components/src/dynamo/thunderagent_router/tests/test_capacity.py components/src/dynamo/sglang/tests/test_runtime_metadata.py— 24 passed.npm run checkandnpm test -- --runinagent-plugins/pi-plugin— TypeScript clean, 6 passed.0.16.0, and agent-plugins revisions.taandkvlaunch commands each registered two TP4 workers fromMiniMaxAI/MiniMax-M2.7; the public model endpoint became ready.astropy__astropy-12907in both arms with reward1.0and zero exceptions. ThunderAgent logged terminal release with zero programs remaining; stock KV omitted the lifecycle request.bash -n components/src/dynamo/thunderagent_router/run_minimax_8xh100.sh,fern docs broken-links, applicable pre-commit hooks, andgit diff --checkpassed.Summary by CodeRabbit
New Features
Bug Fixes
Documentation