Repository navigation
[rl][models] GDN: one input projection grouped by key head, shared by trainer and generator (5/7) - #5689
Conversation
|
@claude please review |
|
Claude finished @felipemello1's task in 4m 43s —— View job Verdict: looks good, with minor changes. I found no correctness bugs. Four inline comments: the allocator cap lift needs a Review detailsWhat I checked and found sound
Inline comments
Not verified hereI couldn't import |
b4ffc72 to
75bcb61
Compare
|
Reply from claude: Addressed the review at d78b6fd. The cap lift now runs only for GDN models: on Qwen3-0.6B it helped with expandable segments but cost 114 KV blocks on the default allocator. Added the S(0) comment. |
|
Reply from claude: @claude please review |
|
Claude finished @felipemello1's task in 2m 9s —— View job Verdict: LGTM. The two follow-up commits fix what they set out to fix, I agree with your reasons for declining the other three comments, and I found nothing new to flag. Review details (d78b6fd)Follow-ups from the first review
Re-checked and sound
Optional, not blocking
Not verified hereI couldn't run torch, the tests, or pre-commit in this sandbox. The numerics and memory conclusions above come from reading the code plus the measurements in the PR body. |
d78b6fd to
7b80af3
Compare
|
Reply from claude: @claude please review |
|
Claude finished @felipemello1's task in 1m 52s —— View job Approve -- please add the one TODO before merging. See the review. |
There was a problem hiding this comment.
Verdict: Approve -- please address the item below before merging. The re-pushed stack (HEAD 7b80af3) has the same content I reviewed at d78b6fd, and the earlier follow-ups still hold. The one thing left is a missing TODO on a private-API workaround.
What this PR does. In the vLLM generator, VLLMGDN keeps a rank-local fused copy of the six GDN input-projection weights [q|k|v|z|a|b] and of the three conv weights. Each step then runs one GEMM and splits the result into column views, where it used to run six GEMMs and a cat. After each FSDP group unshards, its fused weights are refreshed in place, so CUDA-graph addresses stay stable, and the six projection storages are freed. The init loop also lifts vLLM's 20 MiB split cap, in GDN models only.
Example.
base: x -> in_proj_q, _k, _v, _z, _a, _b (6 GEMMs) -> cat(q,k,v) -> conv -> recurrence
this PR: x -> F.linear(x, input_weight_CD).split([qkv, z, a, b]) -> conv reads qkv in place -> recurrence
load N: FSDP unshard group -> refresh_fused_weights(): copy_ into fused weights -> free in_proj_* storage
Must fix
torchtitan/rl/generator/vllm/model_wrapper.py:490-- the cap lift calls privatetorch._C._accelerator_*AllocatorSettingsto work around vLLM's load-time cap, but there's noTODOwith an upstream link (CLAUDE.md principle 3). A one-line comment fixes it (see the inline comment).
Details
- Earlier findings, re-checked at HEAD. The cap lift is gated on
has_gdn(model_wrapper.py:489-501). TheS(0)comment is atgdn.py:460-461. The three items you declined (try/finally,isinstance(VLLMGDN), config-swap test) I still consider settled, for the reasons given in the earlier replies. - Forward equivalence.
VLLMGDN.forward(gdn.py:544-555) does everythingGDN.forward(common/attention/gdn.py:518-559) does, apart from remat regions. The generator doesn't use those, andgate_TC.unflattenstands in forlocal_head_splitwith no CP in the generator. - Compile/graph safety.
input_weight_CD/conv_weight_CWare plain tensor attributes. They are assigned once, during the init unshard loop, which runs before vLLM compiles and captures. After that they are only updated in place withcopy_, so Dynamo guards and captured addresses stay valid.
Not verified: GPU-side numerics and memory. I relied on the measurements in the PR body.
|
Claude finished @felipemello1's task in 4m 39s —— View job Request changes: I found no correctness bug in the |
There was a problem hiding this comment.
Verdict: Request changes -- the redesign resolves @tianyu-l's comment and I found no correctness bug, but it now changes the trainer's main-path computation in shared code, and the PR has no trainer loss or memory comparison yet.
What this PR does. GDN's six input projections become one in_proj parameter. Its rows are grouped per key head as [q|k|v|z|a|b], so a TP Shard(0) holds whole heads, as QKVLinear does. A compiled gdn_split_in_proj region splits the GEMM output and copies q/k/v into one contiguous block. InnerGDN, both CP variants and VLLMInnerGDN now take that block. The base state dict adapter packs and unpacks the logical projections through Shard(1), and the generator's fused copy, refresh hook and allocator override are gone.
Example.
27B, TP4, rank r holds key heads 4r..4r+3:
base: x -> in_proj_q/_k/_v/_z/_a/_b (6 GEMMs) -> [generator: cat(q,k,v)] -> conv -> recurrence
this PR: x -> in_proj [T, 4*1030] -> split: mixed_qkv [T, 2560], a/b [T, 12], gate [T, 12, 128] -> conv -> recurrence
HF load: in_proj_qkv/_z/_a/_b -> (qwen3_5) in_proj_q.._b -> (base) regroup per key head -> in_proj
Must fix
-
The PR description has no human-written summary. That section is empty. The author has to write it (see
CONTRIBUTING.md, "AI-assisted contributions"). -
The trainer has no numerics or memory evidence. This now changes the training path for every Qwen3.5/3.6/3.8 run, not just the generator. Two things move numerics:
- Init: one
_LINEAR_INITdraw over 16480 rows replaces six separate draws, so seed-42 losses differ from base. - Reduction order: the GEMM output can differ from the six separate GEMMs (the body itself says cuBLAS split-K's the narrow
a/bGEMMs).
The bitwise GPU test runs at toy shapes, so it doesn't cover this. CLAUDE.md asks for a loss comparison on computation changes. Initializing both arms from the same HF checkpoint (for example Qwen3.5-0.8B on C4 for a few hundred steps) removes the init confound. Please also add trainer peak memory at 27B. The split briefly holds
projected_TCand its copies together, and the trainer table only reports kernel time. - Init: one
Should consider
gdn.py:559-- move the head-divisibility check intoGDN.Config.__post_init__, and checkin_proj.out_featuresthere too (inline).gdn.py:207--_split_in_proj'slocal_mapdeclares noin_types. Pass scalar ints so they can be declared, or add a TODO saying why they can't (inline).tests/unit_tests/cpu/models/qwen3_6/test_qwen3_6.py:83-- these two tests testmodels/common/attention/gdn.pyandQwen35StateDictAdapter..claude/rules/tests.mdplaces tests mirroring the source tree, so move them totests/unit_tests/cpu/models/common/and.../qwen3_5/. Both guard real invariants (the strided-head bug fixed in 5647926, and the adapter layout), so keep them.
Questions
- The 35B-A3B trainer GDN layer gets 1.3-1.6% slower. Is that the four copy kernels outweighing a smaller GEMM (dim 2048)? A short note in the body would tell a maintainer whether that's expected.
Details
- Earlier findings at HEAD. @tianyu-l's change request is addressed by the redesign. The earlier automated must-fix (a TODO on the private allocator API) and the review-1 items no longer apply, because
VLLMGDN, the refresh hook and the allocator override are deleted. - TP and FSDP.
qwen3_5/model.py:395already requirestp | n_key_heads, soShard(0)ofin_projgives each rank whole 1030-row groups. The local split sizes andconv_*shapes match. FSDP dim-0 shards can cut through a group, which is why the adapter goes throughShard(1). - Adapter. In
_split_gdn_in_projand_merge_gdn_in_proj, the reshapes only split or merge dims that aren't sharded, so DTensorShard(1)->Shard(2)->Shard(1)propagates cleanly. The order is right: the qwen3_5from_hfproduces logicalin_proj_q/k/v/z/a/b, then the base packs them (qwen3_5/state_dict_adapter.py:371).to_hfdoes the reverse at line 136. One difference from_merge_qkv_linear(which asserts): if the placement wasn't recorded, the result silently staysShard(1). That's harmless on the HF-load path, which always callsto_hffirst. - Callsites. Every
in_proj_q/_v.out_featuresreader moved ton_key_heads/n_heads: validation, flops, the TP check, the vLLM registry and wrapper, and the adapter. There are no otherGDN.Configbuilders, no FQN-based LoRA, quantization or remat targets onin_proj_*, and no golden loss files to regenerate. - Generator.
VLLMInnerGDNgets a contiguousmixed_qkv_TC(the output ofcat), which is what the paged conv needs. Weight sync uses native names, soin_proj.weightflows like any linear. - Saved activations match base:
mixed_qkv_TCstands in for q/k/v, andgate_THVforgate_TC. Only the transient peak can grow, hence must-fix 2.
Not verified: DTensor Shard(1) round-trip on a real multi-axis mesh (only the plain-tensor CPU test runs), trainer memory, GPU numerics. A maintainer still needs to review, since this touches models/base and models/common.
|
Reply from claude: @claude please re-review (head 0ac3fff). Must fix:
The body also has a NOTE that from-scratch init now draws one Should consider: all three are done in 0ac3fff. The checks moved to Question (35B-A3B layer +1.3-1.6%): likely the split's copies. At D 2048 the six GEMMs are already cheap, so one GEMM saves less than the copies cost. I haven't profiled it per kernel. There is a line in "You may ask". |
|
Claude finished @felipemello1's task in 1m 25s —— View job Approve -- @felipemello1 still needs to write the human-written summary before merging. See the review. |
There was a problem hiding this comment.
Verdict: Approve -- please address the item below before merging. At 0ac3fff the trainer evidence is in the body, all three should-consider items are fixed, and the new commit introduces no problems.
What this PR does. GDN's six input projections become one in_proj parameter whose rows are grouped by key head, so a TP Shard(0) holds whole heads, the same way QKVLinear does. A compiled gdn_split_in_proj region splits the GEMM output into contiguous mixed_qkv, a, b and gate tensors. The state dict adapter packs HF's projections into in_proj and unpacks them back out.
Example.
27B, TP4, rank r holds key heads 4r..4r+3:
base: x -> in_proj_q/_k/_v/_z/_a/_b (6 GEMMs) -> [generator: cat(q,k,v)] -> conv -> recurrence
this PR: x -> in_proj [T, 4*1030] -> split: mixed_qkv [T, 2560], a/b [T, 12], gate [T, 12, 128] -> conv -> recurrence
Must fix
- The "Summary (human-written)" section is still empty. The reply is right that an agent must not fill it in. @felipemello1 has to write it before merge (
CONTRIBUTING.md, "AI-assisted contributions").
Earlier findings, checked at HEAD
- Trainer numerics and memory: resolved. The SFT run starts both arms from the same HF checkpoint. Step-1 loss matches, and the gap (max 4.0e-3, mean 9e-4) is within the gap you get from changing
num_chunksalone (5.5e-3 / 1.0e-3). Peak memory goes down, and the per-layer GDN peak is unchanged at 27B and 35B-A3B. The body has a NOTE that from-scratch init draws one tensor where it used to draw six. - Checks in
GDN.Config.__post_init__: resolved (gdn.py:557-570). It followsKDA.Config. The duplicate assertion intest_build_model_config.pyis gone, and every in-repoGDN.Configbuilder (qwen3_5/flavors.py:411,test_qwen3_5_deltanet.py:396) setsin_proj.out_featuresconsistently. in_typeson_split_in_proj: resolved (gdn.py:208-209). The[None] * 6leaf matches the list argument. Keeping a singlein_proj_split_sizessource, which the adapter shares, is a reasonable reason not to switch to scalar ints.- Test placement: resolved. The split test is now at
tests/unit_tests/cpu/models/common/test_gdn.py, and the adapter layout test is attests/unit_tests/cpu/models/qwen3_5/test_qwen3_5_state_dict_adapter.py. Both moved verbatim.test_qwen3_6.pyhas no leftover imports. - 35B-A3B question: answered. It's in "You may ask" and marked as not profiled. That's enough for a maintainer to judge it.
A maintainer still needs to review, since this PR touches models/base and models/common.
Not verified: GPU numerics and memory. I relied on the measurements in the PR body.
|
Reply from claude: CI fix in the latest commit. On the A10G runner, |
|
Reply from claude: @tianyu-l, ready for another look. Your question on the generator's fused weight ("why don't we do this for training?") turned into a redesign: GDN now has one Gone with it: the generator's second weight copy, its refresh after every weight load, and the allocator override. Tests and numerics (full table in the description): BC: TorchTitan DCP checkpoints saved before this PR don't load (six keys become one); HF checkpoints load as before (NOTE in the description). |
VLLMGDN (the generator's GDN) keeps fused copies of the local [q|k|v|z|a|b] projection and [q|k|v] conv weights, and VLLMInnerGDN runs one GEMM and reads q|k|v as a column view of its output. Each FSDP group's unshard (initial load and every load_state_dict) refreshes the fused copies of the GDN layers it holds and frees their six projections' unsharded storages; the next unshard re-allocates them. So the generator keeps one copy of the weights, and a load holds one layer's projections twice at most. Parameters, state dict and the trainer are unchanged.
…g at init vLLM's load_model caps max_split_size at 20 MiB. A free block of 20 MiB or more then only serves requests of about its size, so later GDN layers could not reuse the 80 MiB of projections each layer frees, and with expandable segments ~20 MiB of each stayed mapped after empty_cache (0.96 GiB at Qwen3.5-27B TP2, -58 KV blocks).
On Qwen3-0.6B (TP1) the lift adds 297 KV blocks with expandable segments but costs 114 (0.28 GiB more reserved after empty_cache) with the default allocator.
… trainer and generator GDN's six input projections (in_proj_q/k/v/z/a/b) become one in_proj whose rows are grouped by key head, [q | k | v | z | a | b] per key head, like QKVLinear's wqkv per KV group, so a TP shard holds whole heads at any TP that divides the key heads. One GEMM in the trainer and the generator. - GDN.Config: in_proj and n_key_heads replace the six projection configs. - _split_in_proj (local_compile region gdn_split_in_proj, batch-invariant) copies q|k|v into one contiguous mixed_qkv_TC and returns a, b and the gate as [T, H, V]. - The inner ops (InnerGDN, UlyssesInnerGDN, ContextParallelInnerGDN, VLLMInnerGDN) take mixed_qkv_TC; VLLMInnerGDN reads it in place for the paged conv. - The base HF adapter splits and packs in_proj as the six logical projections, so the Qwen3.5 HF mapping is unchanged. Native checkpoints with six keys no longer load. - Removes the generator-only VLLMGDN, its fused-copy refresh, the FSDP storage freeing and the allocator-cap lift.
…, full adapter layout test
…ee check under spmd typechecking)
…s, tests mirror the source tree
…s six is not bitwise on A10G)
8e2cddb to
5447dd0
Compare
…skill fixes (#5759) ## Summary (human-written) <!-- Write this yourself, not with an AI tool. 2-5 sentences: the problem, why this approach, and what you checked yourself. --> This PR adapts learnings from recent code review experience from me. ## Why Three problems with the review automation on `main`: 1. **Area routing.** Several areas lack the right PoCs, `cuda_graph` is named after files that were renamed to `accelerator_graph`, and the RL vLLM attention code has no area of its own because it is spread across `torchtitan/rl/generator/vllm/`. 2. **The bot approves one-sided designs.** On #5689 the bot approved a generator-only fused GDN projection. That design needed `free_storage` on FSDP-owned params, a refresh hook, a private `torch._C._accelerator_setAllocatorSettings` call, and an ordering invariant. A native fused parameter shared with the trainer would delete all of that, and the bot only said so after being asked to review the maintainer's review. The first two runs on #5689 didn't load the `pr-review` skill at all. 3. **A stale REQUEST_CHANGES.** On #5313 the bot wrote "Approve" in a "review my review" run but submitted `COMMENT`, as the skill instructed for that mode. Its earlier `REQUEST_CHANGES` stayed and kept blocking the PR. **Example (area matching).** A PR touching `rl/generator/vllm/attention/gdn.py`, `rl/generator/vllm/worker.py` and `tests/rl/x.py`: | | Areas matched | Requested | | --- | --- | --- | | Before (any prefix match) | `rl` (3) | `felipemello1, pzhan9, wwwjn` (cap of 3 used up) | | After (longest prefix) | `rl` (2), `rl_attention` (1) | `felipemello1, pzhan9, wwwjn, liangel-02, drisspg`, minus the author and already-requested code owners, capped at 3 | ## What changed - **`.github/area_reviewers.yml`** - `attention` += `fegin`, `liangel-02` - `quantization` += `vkuzo` - `context_parallel` += `liangel-02`, `drisspg` - `cuda_graph` -> `accelerator_graph`, += `sanketpurandare` - new `rl_attention` (`torchtitan/rl/generator/vllm/attention/`): `liangel-02`, `drisspg` - **`.github/workflows/area_reviewers.yml`:** each changed file counts toward the area with its longest matching prefix, so a subarea wins over its parent. - **Mechanical, skim:** `attention.py`, `mla.py`, `gdn.py`, `kda.py`, `linear_attention.py` move from `torchtitan/rl/generator/vllm/` to `torchtitan/rl/generator/vllm/attention/` (mirrors `models/common/attention/`). The only other changes are import updates in `model_wrapper.py`, `registry.py`, `worker.py`, the moved files, and the RL tests. - **`.claude/skills/pr-review/`** - New gate question 7, "one-sided design": an optimization added to only one side (generator vs. trainer, inference vs. training, one model or backend) must be compared against the shared version and what it would delete. Workaround machinery counts as evidence for the shared version: private APIs, storage tricks on FSDP-owned tensors, refresh hooks, copies kept in sync, ordering invariants. - If the shared version would delete that machinery, the finding is the lead must-fix with Request changes or Needs discussion, never a TODO. Same item added to `review-checklist.md`. - The review event always matches the verdict line in every mode. `COMMENT` is used only for answers with no verdict. - The fallback body file is written in the working directory; writes to `/tmp` are denied. - **`.github/workflows/claude-code.yml`** - Allow `mcp__github__create_and_submit_pull_request_review`; its absence made the #5689 "review my review" run fail to post. - The prompt says invoking the `pr-review` skill is the first action. ## Numerics No computation change. The RL change only moves files and updates imports. ## Testing - `pytest tests/rl/unit_tests/cpu/test_vllm_wrapper.py tests/rl/unit_tests/cpu/test_vllm_registry.py`: 25 passed. - All moved modules plus `model_wrapper`, `registry` and `worker` import. The GDN GPU tests collect (23 tests) but were not run on GPU. - I checked the area-matching logic with a local node script on the example above. - The skill and workflow changes take effect only after merge (the workflows run from `main`).
…er override; agent self-review; rl/transport (#6407) ## Summary (human-written) <!-- Write this yourself, not with an AI tool. 2-5 sentences: the problem, why this approach, and what you checked yourself. --> ## Why Since #5667, `@claude review` has reviewed 459 PRs. Of the 380 PRs it approved, 30 then got a formal "request changes" from a maintainer, and about 20 more got substantive inline asks. In nearly all of them the bot either saw the problem and approved anyway, or never asked the questions maintainers ask most ("does the repo already do this?", "who should own this?"). The opposite failure, the bot blocking something a maintainer was fine with, is rare: in the PRs we sampled, 2 of its 81 must-fix items were wrong and about a third were minor (the empty human-written summary was the biggest source). **Example** (#6112, controller sizes the rollout worker pool): ``` before: bot approved 10 times; tianyu-l then blocked: "the controller reads rollouter.rollouts_per_worker to compute a count it hands back to the Rollouter -- violates encapsulation" after: same commit, new skill -> Request changes, must-fix #1: "controller.py:589 -- wrong owner for the worker count ..." ``` There was also no way for a code owner to overrule the bot except dismissing its review in the GitHub UI, and a later `@claude review again` would block again. ## What changed **Review skill** (`.claude/skills/pr-review/`, `review-checklist.md`): - Verdict rules: Approve only when every remaining item is an edit the bot could write itself. Anything the author still owes (a design change, an unexplained golden change, evidence the PR rests on) is Request changes; anything only a maintainer can decide is Needs discussion. A hedge like "a maintainer should decide" can't come with Approve. - Always must-fix: a violated written rule, a silent wrong result, a second definition of an existing concept, a gate finding. - Design gate: new questions for the existing counterpart, in-repo ownership, and the design behind a bug; "ban only what doesn't work on main"; read the numbers behind a claim. The overlapping-PR search is mandatory and reported. - Re-review covers every commit since the last full review, including code taken from the bot's own suggestions. A scoped question gets a `COMMENT`, not a whole-PR verdict. - The bot fact-checks its own proposed fixes, and cites a source for claims about external tools or marks them unverified (never must-fix). - An empty "Summary (human-written)" is a one-line "Before merge" note that never affects the verdict. - Checklist: config ownership direction, general shared wrappers, dead code the PR creates, model variants as flavors, a mechanical pass over every new or changed function. **Code owner override** (`SKILL.md`, `claude-code.yml`, `CONTRIBUTING.md`): a code owner comments `@claude override` (optionally `@claude override 2,3: <reason>`); the bot approves if nothing else is open and doesn't re-raise the overridden items. A code owner's GitHub approval or "LGTM" is not an override, so a teammate can approve without the bot dropping its findings. Dismissing the bot's review still unblocks the PR, but isn't an override: the bot can't tell who dismissed it. **Agent self-review** (`CLAUDE.md`, `pr-description`): an agent preparing a PR runs `pr-review` in branch mode first and records unaddressed items in an optional "Self-review" section. PRs written without an agent are unaffected; a missing section is never a finding. Where each new rule comes from (maintainer asks the bot missed): | Change | PRs | | --- | --- | | No Approve with open design/evidence items or a "maintainer should decide" hedge | #6007, #5837, #5997, #5712, #5511, #5996 | | Author waiver can't clear a must-fix | #6201, #6202, #6203 | | Existing counterpart; one source of truth | #5228, #6169, #5881, #5823, #5824, #6059, #5812 | | Responsibility owner; config ownership direction | #6112, #6332, #5802, #5803, #6325 | | Fix the design behind the bug; a TODO doesn't justify a workaround | #5572, #5689, #5657 | | Fact-check the bot's own suggested fixes | #5740, #5802, #5511, #4819, #5543 | | Re-review covers all new commits; scoped asks don't approve | #5824, #5842 | | Mandatory overlap search | #5885, #6248 | | Ban only what doesn't work on main | #5543 | | Summary placeholder no longer a must-fix | #6119, #6174, #6112, #5868 | **Rules**: `design.md` gets the one-general-wrapper rule (moved from `models.md`, whose glob skipped `torchtitan/rl`), thin adapters, and the consumer owning its values; `config.md` gets ownership direction and "a Config doesn't read runtime state"; `direction.md` calls all-to-all the MoE reference implementation, so a new vendor-specific dispatch path (e.g. #6242) needs a reason the existing backends can't serve. **Area reviewers**: `.ci/` -> huydhn, wwwjn; `torchtitan/rl/transport/` -> d4l3k. **Mechanical, skim**: `torchtitan/rl/transport/` holds data movement between RL actors. - `rl/model_state_dict_transport.py` -> `rl/transport/model_state_dict.py` - `rl/MODEL_STATE_DICT_TRANSPORT.md` -> `rl/transport/MODEL_STATE_DICT_TRANSPORT.md` - `rl/trainer/rdma_microbatch.py` -> `rl/transport/rdma_microbatch.py` - tests: `tests/rl/unit_tests/cpu/test_{model_state_dict_transport,rdma_microbatch}.py` -> `tests/rl/unit_tests/cpu/transport/test_{model_state_dict,rdma_microbatch}.py` - imports, READMEs and `scripts/install_rl_env.sh` updated; no code changes. ## User-facing changes | Before | After | | --- | --- | | Overrule the bot: dismiss its review in the UI, and it blocks again on the next run | `@claude override [items]: <reason>`; the bot approves and doesn't re-raise them | | Empty human-written summary: bot must-fix | One "Before merge" line, no effect on the verdict | | `from torchtitan.rl.model_state_dict_transport import ...` | `from torchtitan.rl.transport.model_state_dict import ...` | | `from torchtitan.rl.trainer.rdma_microbatch import ...` | `from torchtitan.rl.transport.rdma_microbatch import ...` | ## Testing Backtest: the new skill run locally (nothing posted) on each PR at the commit and thread state the bot originally saw. | PR | Bot then | New skill | What the maintainer asked | | --- | --- | --- | --- | | #6112 | Approve | Request changes | worker-count ownership (caught) | | #5837 | Approve | Request changes | apply to `dp_shard` too (caught) | | #5572 | Approve | Request changes | delete the injection design (caught) | | #6201 | Approve after author waived pins | Request changes, waiver ignored | pins broke GPU tests after merge (caught) | | #6007 | Approve | Request changes | fold K3.1 into K3 (caught) | | #5543 | Request changes: "ban it" | Request changes: keep main's path | don't break gpt-oss + DeepEP (fixed) | | #6144, #5905 (controls) | Approve | Approve | -- | | #6137 (control) | Approve | Needs discussion | -- (merge gate on an upstream API) | Code owner override, simulated on #6201: override by a code owner lifts the named item; `@claude override` from the author changes nothing; a code owner's "LGTM" approval followed by "review again" keeps Request changes. Transport move: 83 RL CPU unit tests pass locally (`transport/test_model_state_dict.py`, `test_trainer.py`, `test_engine_loop.py`). `transport/test_rdma_microbatch.py`, `test_generator.py` and `test_batcher_actor.py` fail to collect in my env on `origin/main` too (stale attention-gym / Monarch), so CI is the check for those. ## Known issues / follow-ups - Open PRs that edit the moved files rebase cleanly (git follows the renames), but new imports of the old module paths will break: #6309 (adds a delta transport that should live in `rl/transport/`), #6237, #6176, #6177, #5862, and drafts #6127, #6393, #6163, #5764. - The Actions bot can't read dependency source (e.g. SGLang); follow-up for the workflow. ## Self-review pr-review (branch mode) at ad905a5: Needs discussion. Fixed: branch mode diffs against `origin/main` and skips description findings before a description exists; the "Config doesn't read runtime state" rule no longer contradicts hardware validation; dismissal dropped as an override form (the bot can't tell who dismissed); `test_rdma_microbatch.py` added to the transport area. Not addressed: - One concern per PR -- the five changes ship together at the maintainer's request. - Open PRs touching the moved files -- listed above; the maintainer will coordinate.
Summary (human-written)
Agent details
TLDR: GDN's six input projections become one
in_projparameter, in the trainer and the generator. Its rows are grouped by key head, so a TP shard holds whole heads, asQKVLineardoes for GQA. Qwen3.5-27B generator at TP4: decode -14% at 64 requests, mixed -2 to -3%. Trainer: same loss and grads within rounding for every GDN head layout in the repo.Problem
xsix times (in_proj_q,_k,_v,_z,_a,_b). The generator then concatenates q, k and v for its paged convolution.aandbhave 48 rows each at 27B, and cuBLAS splits the narrow GEMMs over K: 4 extra reduce kernels per layer, every step.[q | k | v | z | a | b]weight can't be TP-sharded: aShard(0)would split blocks of different sizes across ranks.Solution
GDN.in_projreplaces the six, with rows grouped by key head (layout above), soShard(0)keeps whole heads.gdn_split_in_proj, splits the output and copies q, k and v into one contiguous tensor for the convolution. The inner ops (InnerGDN, both CP variants,VLLMInnerGDN) take that tensor.in_proj_qkv,_z,_a,_b) intoin_projand back, next to its QKV packing.in_projlike any linear), the convolution weights, the other attention layers.Results
Trainer: 200-step SFT run and layer timing
You may ask:
Shard(0); HF's Qwen3-Next stores itsin_proj_qkvzthe same way.[q | k | v]block. The copy is the split region's 4 Triton kernels: 4.7-6.6 us per layer at 1-256 tokens (27B TP4).[q | k | v]conv weight would need the same key-head grouping and adapter packing asin_proj. The generator concatenates the three per call: 1.3 us per layer, about 0.8% of a 27B TP4 decode-64 step (48 layers, 7.76 ms). The trainer convolves three column views and pays nothing. Not worth the extra layout.NOTE: TorchTitan DCP checkpoints saved before this PR have six keys per GDN layer and don't load into
in_proj. HF checkpoints load as before, so the way out is to save withcheckpointer.last_save_in_hf=Trueon the old commit and load withcheckpointer.initial_load_in_hf=True.NOTE: a model built from scratch draws one random
in_projinstead of six, so its seed-42 losses differ from the base. Models loaded from HF are not affected.NOTE: Ulysses CP splits
in_proj's output and re-concatenates q, k and v: one more copy on that path, not measured.NOTE: MXFP8
in_projat TP1 passes the% 32row check, but its blocks span section boundaries (1030 rows per key head). No recipe quantizes GDN projections.Test plan
5/7 of the GDN generator stack, on top of the decode-routing PR (4/7).