Skip to content

feat: Qwen3.5 GatedDeltaNet fixes - #37

Merged
ekryski merged 1 commit into
ekryski:alphafrom
TheTom:pr/alpha-7-qwen35-gdn
Apr 16, 2026
Merged

ekryski merged 1 commit into
ekryski:alphafrom
TheTom:pr/alpha-7-qwen35-gdn

Conversation

@TheTom

@TheTom TheTom commented Apr 16, 2026

Copy link
Copy Markdown

Clean port from ek/tom-eric-moe-tuning. Part of alpha cleanup.

@ekryski ekryski left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but should rebase after Should be rebased off of one of #35 is in because there is some overlap.

Adds Qwen3.5 model family with GatedDeltaNet layers:
- Gated linear attention with delta rule
- Hybrid SSM + sliding window attention
- Short convolution state management
- MoE support via SwitchLayers

Key improvements from tom-eric branch:
- Fix bf16 dtype promotion in computeGatedDeltaG (no fp32 roundtrip)
- Add eval barriers in gatedDeltaOps to bound prefill memory
- Use ops fallback for gatedDeltaUpdate (Metal kernel has T>1 bug)
- Add .contiguous() on conv cache to prevent 9GB memory leak
- Force dtype per-layer to prevent bf16->fp32 promotion in lazy graph
- Per-layer eval during prefill to cap activation memory
- RotatingKVCache support for attention layers

Deferred: fused Metal kernels, FusedGateUpSwitchGLU, quadratic attention

Co-Authored-By: tturney1@gmail.com
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@TheTom
TheTom force-pushed the pr/alpha-7-qwen35-gdn branch from f76f3d5 to f77cb9c Compare April 16, 2026 04:24
@ekryski
ekryski merged commit cdb5fcc into ekryski:alpha Apr 16, 2026
div0-space pushed a commit to LibraxisAI/mlx-swift-lm that referenced this pull request Nov 29, 2026
mlx-swift 4c6ca4c53169d0ec52a31707e5ec9cc4fb8aab13 (local wip/cluster-next): cluster ekryski#56 + single-Mac ekryski#58,
pinning core a1d75679 (cluster ekryski#35 + single-Mac ekryski#37, the 4d913204 revert)
and mlx-c 1d0ce055. The merge before this needs GPU.withCommandBufferLimits,
which only this stack has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants