Conversation
Correct interleaved q_proj/gate layout, updated GDN key names for recent Transformers checkpoints, tied-embedding handling, and run FLA tests on CUDA. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TransformerConfig.qwen3_5_like()factory and size-specific builders with a 3:1 Gated DeltaNet + full-attention block patternpartial_rotary_factoronRoPEConfig(25% of head dim, matching Qwen3.5)qwen3_5_texthybrid models, including multimodal checkpoint key normalizationout_proj/normkey names, interleaved fusedq_proj+gate layout, and tied word embeddingsArchitecture Details
Qwen3.5 dense models use a hybrid architecture with key differences from Qwen3:
allow_neg_eigval=Falsehead_dim=256, GQA, per-head QK norm, elementwise output gating, partial RoPE (θ=10M)hidden_states * weightwith HF zero-init → OLMo ones-init transform)HF conversion fixes
linear_attn.out_proj/linear_attn.norm(Transformers 5.9+) with legacyo_proj/o_normfallbacks[q, gate]weights; OLMo stores[all q, all gate]— conversion now unshuffles correctlyembed_tokenstolm_head.w_outwhentie_word_embeddings=TrueTest plan
pytest -v src/test/nn/transformer/model_test.py -k qwen3_5— builder configs, param counts, GPU forward (9 tests)pytest -v -m gpu src/test/nn/hf/qwen3_5_test.py— HF logits parity vsQwen/Qwen3.5-0.8B(requiresHF_TOKEN, GPU,fla)test_qwen3_5_matches_huggingface— logits match withinrtol=1e-3, atol=5e-3(mean diff ~3e-4, max ~3e-3; relaxed tolerance accounts for HF torch fallback vs OLMo FLA kernels for GDN)src/test/nn/rope_test.py— partial RoPE coverageNote on GPU-only tests: Qwen3.5 is a GDN + attention hybrid, unlike Qwen3 (attention-only). The end-to-end forward and HF parity tests require a GPU because GDN layers depend on
flash-linear-attention(fla), which has no CPU implementation. Config/param-count tests remain CPU-safe.Made with Cursor