
Qwen4-35B-A3B Brings Hybrid Sparse Attention and 1M Context to Local MoE

The Alibaba Qwen Team has released Qwen4-35B-A3B on Hugging Face under the Apache-2.0 license, bringing the hybrid architecture previewed in Qwen3.8-Flash-Next into a production open-weights release. Built as a natively multimodal Mixture-of-Experts (MoE) model for local and server deployments, it accepts text, image, and video inputs across a 1M-token native context window and produces text outputs. The model combines ~35B main parameters (~3.8B active per token across 256 routed experts) with ~20.5B Per-Layer N-gram Embedding (PLE) parameters, totaling roughly 56B parameters.
Hybrid Decoder, Sparse Attention, and Multimodal Design
Qwen4-35B-A3B‘s text decoder repeats a four-layer pattern ten times. The first three layers in each group use Gated DeltaNet, which updates a fixed-size memory as it reads each token. The fourth layer uses Qwen Sparse Attention (QSA) so each query can selectively attend across the full context: a small indexer groups tokens into chunks of four, averages their keys, and selects up to 512 groups per query, letting attention read up to 2,048 selected tokens plus at most three tokens from a trailing unfinished group.
Between blocks, the model replaces a single residual path with four parallel residual streams initialized from copies of each token’s 2,048-dimensional embedding. Learned gates mix the streams into one input before each attention or MoE block; eight selected experts and one shared expert produce a combined output, which is added back to each stream through stream-specific learned scaling gates. Separately, the second decoder layer houses the 20.5B-parameter PLE table. Each token performs 16 lookups—eight encoding the last two tokens and eight encoding the current and two prior tokens—joins the embeddings, gates their contribution to each residual stream, and applies a short convolution to mix nearby patterns.
For visual inputs, a vision transformer slices images into 16×16 patches and merges 2×2 spatial patch groups into single visual tokens. For video, the processor samples 2 frames per second and groups consecutive frames into pairs so every patch can attend across the frame pair. The post states that Qwen4-35B-A3B matches or outperforms the larger Qwen 3.8 Flash Next on some tasks, with full benchmark details published in the model card.
Day-0 Inference, Speculative Decoding, and Local Offloading
The release ships with day-0 support across transformers, llama.cpp, Llama App, vLLM, SGLang, MLX (oMLX), TRL, Inference Providers, and Inference Endpoints, with checkpoints in BF16, FP8, OMLX, and GGUF (Q4_K_M, Q6_K, and Q8_0). In transformers, inference runs through the image-text-to-text pipeline or AutoModelForMultimodalLM with AutoProcessor. Chat templates support tool calling and an adjustable reasoning_effort level ("xhigh", "high", "low", or "off", defaulting to "high"), while video inputs require torchcodec and ffmpeg.
For local execution, Multi-Token Prediction (MTP) speculative decoding is built into llama.cpp and oMLX. Enabling three draft tokens via --spec-type draft-mtp --spec-draft-n-max 3 on the Q4_K_M GGUF checkpoint increased generation speed by 22% on an Apple Silicon M5. On Apple Silicon, oMLX also adds custom Metal kernels for QSA and the gated residuals, image support, and SSD offloading for the PLE table using oQ quants, while official mlx-lm language-model support is in progress.
Cyber Defense RL Tuning and Agentic Demos
To demonstrate post-training, the post walks through a reinforcement learning workflow using AsyncGRPOTrainer in TRL and vLLM on a two-GPU H200 Hugging Face Job. The recipe trains a LoRA adapter to triage security alerts and cite codebase evidence, awarding a binary reward (plus a small bonus for fewer tool calls). On 12 held-out CyberDefense Bench tasks, the base model passed 4/12, the update-50 checkpoint passed 6/12, and the update-100 checkpoint dropped to 3/12, showing that earlier checkpoints can generalize better on held-out tasks even as training reward climbs.
Hugging Face also evaluated Qwen4-35B-A3B zero-shot inside the Pi coding agent across three interactive tasks: generating an introductory animation video for a speculative decoding benchmarking tool, asking clarifying questions before building a developer slide deck on Llama App and llama.cpp, and generating a real-time mountain-and-cloud flight scene without external skills.


