Module qwen3_ssm

Module qwen3_ssm 

Source
Expand description

Qwen3-Next SSM (Gated Delta Net) layer implementing TransformerLayer.

Corrected pipeline matching the HuggingFace reference implementation:

  1. QKVZ projection (interleaved output)
  2. Deinterleave QKVZ → sequential [Q | K | V | Z]
  3. BA projection (interleaved output)
  4. Compute GDN gates: gate = exp(-A * softplus(alpha + dt_bias)), beta = sigmoid(b)
  5. Conv1d update on [Q | K | V] concatenated (d_inner=8192)
  6. Split conv output → Q’, K’, V’
  7. GDN decode (Q’, K’, V’, gate, beta) — kernel handles GQA internally
  8. Gated RMS norm (GDN output, Z gate)
  9. Output projection [value_dim → hidden_size]
  10. MoE FFN

Re-exports§

pub use gdn_flags::GdnFlags;
pub use gdn_flags::MAX_F16_TWIN_DFLASH_GAMMA;
pub use gdn_flags::MAX_F16_TWIN_K;
pub use gdn_flags::default_dflash_gamma;
pub use gdn_flags::gdn_fused_norm_enabled;
pub use gdn_flags::ssm_batched_recurrent_enabled;
pub use gdn_flags::ssm_h_dtype_bits;
pub use gdn_flags::ssm_h_f16_pool_enabled;
pub use gdn_flags::ssm_h_fp16_enabled;
pub use gdn_flags::verify_exact_enabled;

Modules§

gdn_flags
GDN / SSM decode-path flags, resolved ONCE from the serve command line.

Structs§

Qwen3SsmLayer
Qwen3-Next SSM/GDN layer (36 of 48 layers).