Alibaba's Qwen4-35B-A3B Brings 1M-Token Multimodal AI to Local Devices
Alibaba's Qwen4-35B-A3B lands with a hybrid sparse-attention MoE architecture, 1M-token context, native multimodality, and day-0 support across every major runtime.
Takeaways
- Alibaba released Qwen4-35B-A3B, a multimodal MoE with 35B params, 3.8B active, Apache-2.0.
- Hybrid Gated DeltaNet plus Qwen Sparse Attention delivers a native 1M-token context window.
- 20.5B Per-Layer N-gram Embedding table acts as a learned cache, only 16 rows read per token.
- Day-0 support in transformers, llama.cpp, vLLM, SGLang, MLX, with BF16/FP8/GGUF/oMLX quants.
- MTP speculative decoding yields 22% speedup on Apple M5 with Q4 quant in llama.cpp.
- Adjustable
reasoning_effortlevels (xhigh/high/low/off) replace separate reasoning checkpoints.
Alibaba's Qwen team has released Qwen4-35B-A3B, a native multimodal mixture-of-experts model built for local and self-hosted inference. Hugging Face coordinated day-zero support across Transformers, llama.cpp, MLX, vLLM, SGLang, and TRL, giving developers supported paths for inference, serving, quantization, and fine-tuning at launch.
A mixture-of-experts model routes each token through a subset of its weights, reducing computation while retaining a larger overall parameter capacity. Qwen4 combines that design with sparse attention, a learned n-gram lookup system, and native text, image, and video inputs.
One model, three parameter budgets
Qwen4's parameter counts describe different deployment costs. Its main network contains about 35 billion parameters, while roughly 3.8 billion are active for each token. A separate Per-Layer N-gram Embedding system contributes about 20.5 billion parameters, bringing total storage to approximately 56 billion parameters.
| Specification | Qwen4-35B-A3B |
|---|---|
| Main parameters | About 35B |
| Active main parameters per token | About 3.8B |
| PLE parameters | About 20.5B |
| Total parameters | About 56B |
| Context window | Up to 1 million tokens |
| Inputs | Text, images, and video |
| License | Apache 2.0 |
The low active count reduces per-token computation, but storage and memory requirements still reflect the larger model. Quantization and PLE offloading therefore remain central to local deployment. The Apache 2.0 license permits commercial use, subject to its notice and attribution requirements.
Sparse retrieval stretches attention to 1M tokens
The text decoder repeats a four-layer pattern ten times. Three layers use Gated DeltaNet, which updates a fixed-size state as tokens arrive. The fourth layer uses Qwen Sparse Attention, or QSA, to retrieve individual tokens from distant parts of the context.
QSA first groups token keys into blocks of four and averages the keys within each block. For every query, a lightweight indexer selects as many as 512 relevant blocks. The attention layer then reads the individual tokens from those blocks, covering up to 2,048 selected tokens, plus as many as three tokens from the final incomplete block.
This retrieval step caps the expensive token-level attention work while preserving access to material anywhere in the context. Gated DeltaNet handles the running sequence state, and every fourth layer can recover specific distant tokens. The design avoids global all-to-all attention across the full million-token window, whose cost would grow quadratically with sequence length.
Qwen4 also carries four residual streams, each initialized from a copy of the token's 2,048-dimensional embedding. Learned gates combine those streams before each attention or MoE block, allowing the network to maintain parallel feature pathways and choose their contribution at every stage.
A 20.5B-parameter n-gram memory
The Per-Layer N-gram Embedding tables collectively contain about 20.5 billion parameters, yet each token reads only 16 rows. Eight lookups represent a recent two-token sequence, while eight represent a three-token sequence containing the current token and its two immediate predecessors.
These learned lookups store short-range token patterns outside the main network weights. Their sparse access pattern adds substantial storage capacity with limited per-token computation, helping explain how the model reaches roughly 56 billion total parameters while activating about 3.8 billion main parameters for each token.
oMLX can offload the PLE tables to SSD and fetch the required entries during inference. That reduces unified-memory pressure on Apple Silicon, although SSD speed, caching behavior, quantization, context length, and runtime overhead still affect latency and whether a given configuration fits.
Reported gains need workload-level checks
Across the Frontier List suite, the Qwen team reports performance comparable to the larger Qwen 3.8 Flash Next. The suite includes Terminal Bench, FrontierCode, AutomationBench, DeepSWE, APEX Agents, and HealthBench Professional, covering terminal use, coding, automation, software engineering, agent tasks, and health-related evaluation.
The published results come from the model's release materials, so production evaluations should reproduce the relevant tasks with the intended prompt format, quantization, reasoning setting, and context length. Aggregate benchmark results cannot determine latency, tool-use reliability, or accuracy on a specific application.
For video input, the processor samples two frames per second and pairs consecutive sampled frames. The vision transformer applies full patch-level attention within each frame pair, containing the visual token budget while preserving short-range motion and scene information.
Local runtimes arrive on day zero
| Runtime | Launch support |
|---|---|
| Transformers | Multimodal inference and configurable reasoning effort |
| llama.cpp | GGUF quantization and multi-token prediction |
| MLX and oMLX | Apple Silicon kernels, image input, quantization, and PLE offloading |
| vLLM and SGLang | Server-oriented inference |
| TRL | Reference reinforcement-learning fine-tuning |
The ggml-org collection publishes Q4_K_M 4-bit, Q6_K 6-bit, and Q8_0 8-bit GGUF versions for llama.cpp. The following command starts a server with the 4-bit model and uses multi-token prediction to draft as many as three tokens per step:
llama serve -hf ggml-org/Qwen4-35B-A3B-GGUF:Q4_K_M \
--spec-type draft-mtp \
--spec-draft-n-max 3
Multi-token prediction proposes several future tokens before the main decoding step verifies them. Hugging Face reports that three draft tokens increased generation speed by 22% on an Apple Silicon M5 using the Q4 quantization. That result reflects one hardware and runtime configuration, so throughput should be measured with the target prompt lengths, output lengths, and acceptance rates.
Transformers exposes a reasoning_effort option with four values: xhigh, high, low, and off. The default is high. Applications can vary inference compute by request while keeping one checkpoint loaded, which is useful when interactive queries and deeper analysis share the same service.
oMLX provides custom Metal kernels for QSA and the gated residual path, along with image input, multi-token prediction, and SSD offloading for PLE. Its oQ quantizations work with oMLX and mlx-lm. Offloading the large lookup tables makes deployment on Macs with 32GB to 64GB of unified memory more practical, with final memory use determined by quantization, cache size, context length, and runtime overhead.
GRPO reward diverges from held-out results
Hugging Face also released a reference cyber-defense fine-tuning pipeline using TRL's asynchronous Group Relative Policy Optimization trainer and a LoRA adapter. GRPO samples groups of candidate outputs and updates the model from their relative rewards, while LoRA limits training to a small set of adapter weights.
Evaluation on the same 12 held-out CyberDefense Bench tasks produced the following results:
| Checkpoint | Tasks passed | Pass rate |
|---|---|---|
| Base model | 4 of 12 | 33% |
| Update 50 | 6 of 12 | 50% |
| Update 100 | 3 of 12 | 25% |
The update-50 adapter performed best on this small held-out sample, even though training reward continued to rise through update 100. The result supports checkpoint retention and repeated external evaluation during GRPO training. Reward trends provide one signal; held-out task performance determines whether an update improves the intended behavior.
Where Qwen4 fits
- Local inference: Sparse expert activation and quantization reduce compute requirements, while PLE offloading addresses the model's larger storage footprint.
- Long documents: Hybrid fixed-state and sparse attention provides a path to million-token contexts without global quadratic attention over the entire sequence.
- Multimodal applications: One checkpoint accepts text, images, and video, simplifying systems that previously required separate model variants.
- Commercial products: Apache 2.0 permits commercial deployment under clear, established terms.
- Agent and coding systems: The reported benchmark profile makes the model a candidate for terminal, software-engineering, automation, and document-analysis workloads.
Teams currently serving dense models with 70 billion or more parameters can benchmark Qwen4-35B-A3B on their own prompts, tools, and quality thresholds. llama.cpp provides GGUF inference with multi-token drafting, while the published MLX quants cover Apple Silicon deployments. The deciding measurements are task accuracy, peak memory, time to first token, sustained throughput, and behavior at the context lengths the application actually uses.