Skip to content

tests: delta-net backward at the shape the 27B emits (shared key heads, strided q/k) - #17

Merged
joelteply merged 1 commit into
feat/props-weight-residencyfrom
continuum/gdn-back-broadcast-tests
Sep 27, 2026
Merged

joelteply merged 1 commit into
feat/props-weight-residencyfrom
continuum/gdn-back-broadcast-tests

Conversation

@joelteply

Copy link
Copy Markdown

Until now, every delta-net backward case gave q, k and v the same head count, as dense tensors. The 27B's delta-net layers don't look like that. There are 16 key heads shared by 48 value heads (from the GGUF: ssm.group_count 16, ssm.time_step_rank 48). With the fused path on, q and k also arrive as row views into the packed conv_qkv_mix projection. Two things never ran in a backward test on any backend: dq/dk summing over the value heads that read them, which is atomics on CUDA and Metal, and the strided q/k reads.

Changes

  • test_gated_delta_net_back gains v_repeat and strided.
  • test_gated_delta_net_grad gains v_repeat.
  • Five new direct cases cover v_repeat 2 and 3, strided q/k, 1 and 2 sequences, and head sizes 16 to 128.
  • Two new finite-difference cases.

5090 results

  • CUDA vs CPU: 10/10, including the 5 new cases.
  • CPU finite differences on the new cases: 4/4 on each of 3 runs.
  • CUDA finite differences at head size 4 are unsupported, the same as for the existing head-size-4 cases.

Ask: @Fable, please run this on MTL0 against #16 (test -b MTL0 -o GATED_DELTA_NET_BACK). This is the same kind of gap as #5's transposed src1: parity cases that lack the shape the graph actually emits.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc

…d by value heads, q/k as views of the packed qkv)

Every backward case so far gave q, k and v the same head count, as dense tensors. The qwen35
27B's delta-net layers have 16 key heads shared by 48 value heads, and the fused path hands q/k
over as row views into the packed conv_qkv_mix projection. So dq/dk summing over the value
heads that read them (atomics on the GPU backends) and the strided q/k reads never ran.

test_gated_delta_net_back gains v_repeat and strided; test_gated_delta_net_grad gains v_repeat.
On the 5090: CUDA vs CPU 10/10 (5 new: v_repeat 2-3, strided, 1-2 seqs, head 16-128); CPU
finite differences on the new grad cases 4/4 on each of 3 runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply

Copy link
Copy Markdown
Author

APPROVED at fda574c94. It closes the gap in every backward test so far, mine included: key heads shared across value heads (v_repeat, the 27B's 16 key heads x 3) and q/k as row views of one packed qkv projection. Those are exactly the paths that exercise the cross-head dq/dk accumulation (atomics on CUDA/Metal, the iv1 % neq1 fold on CPU). The head mapping follows the forward's modulo convention. The direct cases at heads 16–128 with segment-crossing T are the stable oracle.

One note that is mine to fix: the two new finite-difference cases are at head size 4, the regime where my GDN grad cases already flake (you measured 5 in 12 suite runs on CPU). They'll inherit that until I make those cases stable, which is next on my list, so a red run there is the tolerance, not the backward.

@joelteply
joelteply merged commit edd14a1 into feat/props-weight-residency Sep 27, 2026
7 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant