Alibaba's Qwen4-35B-A3B Runs a Million Tokens on 3B Active Parameters
Alibaba's new open-weight MoE packs a 1M-token context, 3B active parameters, and agentic coding scores that beat models several times its size.
Takeaways
- Alibaba released Qwen4-35B-A3B-FP8, a 35B MoE with 3B active parameters under Apache 2.0.
- Hybrid Gated DeltaNet + sparse attention enables a native 1,048,576-token context window.
- 256 experts with 8 routed + 1 shared active per token; adds 20B n-gram embeddings and 2B MTP head.
- Scores 61.8 on DeepSWE v1.1 agentic coding, beating the 3x larger Qwen3.8-Flash-Next.
- Ranked #1 open-weight model in the 40B to 150B class on Artificial Analysis Intelligence Index.
- Deployable on vLLM, SGLang, llama.cpp, Ollama; four reasoning-effort levels (xhigh/high/low/off).
Alibaba’s Qwen team has released the first open-weight model in its Qwen4 series. Qwen4-35B-A3B uses a mixture-of-experts architecture with 35 billion core parameters and about 3 billion activated for each token. The Apache 2.0 release supports text and images, offers a native 1,048,576-token context window, and targets local or self-hosted agents that need long context without dense-model compute costs.
The checkpoint’s storage requirements exceed its 3B active size. Alongside the core model, Qwen includes a 20B-parameter n-gram embedding table and a 2B-parameter Multi-Token Prediction head. A full FP8 load can therefore require roughly 57GB for weights before runtime overhead, depending on how the backend stores auxiliary components. Typical 24GB consumer GPUs will need a lower-bit quantization, CPU or system-memory offloading, or a multi-GPU setup.
Hybrid attention stretches the context window
Qwen4 replaces an all-softmax attention stack with a hybrid design intended to reduce inference work and the memory consumed by the key-value cache. Most layers use Gated DeltaNet, a linear-attention variant that carries a compact state forward. Every fourth layer uses Qwen Sparse Attention, which selects 512 blocks representing up to 2,048 tokens instead of comparing every token with the full context.
The 40-layer network repeats a four-block pattern 10 times: three Gated DeltaNet blocks followed by one sparse-attention block. Each block also contains a mixture-of-experts module. The router selects 8 of 256 routed experts for each token, while one shared expert remains active; every expert has an intermediate dimension of 512.
The auxiliary weights serve separate purposes. The n-gram table injects learned bigram and trigram features at layer 2, while the Multi-Token Prediction head learns to predict several future tokens. These components increase checkpoint size without raising per-token expert activation to the same level as a dense 57B model.
Coding scores lead the launch results
Alibaba reports that Qwen4-35B-A3B beats the dense Qwen3.8-27B on 10 of 12 launch benchmarks and the larger Qwen3.8-Flash-Next on 6. Its largest gains appear in agentic coding and repository-generation tasks. Flash-Next retains a substantial lead on FrontierCode-AA 2.0 and also scores higher on GPQA.
| Benchmark | Qwen4-35B-A3B | Qwen3.8-Flash-Next | Qwen3.8-27B |
|---|---|---|---|
| DeepSWE v1.1, agentic coding | 61.8 | 58.7 | 42.2 |
| NL2Repo, repository generation | 51.7 | 48.1 | 42.3 |
| Terminal-Bench 4.1 | 21.2 | 24.2 | 5.6 |
| FrontierCode-AA 2.0 | 16.1 | 27.1 | 14.9 |
| AutomationBench-AA | 57.9 | 55.9 | 48.2 |
| APEX Agents v1.1 | 59.0 | 61.0 | 47.5 |
Independent results from Artificial Analysis show a similar strength profile. At the xhigh reasoning setting, the model ranked first among six open-weight models in its 40B-to-150B comparison group, with an Intelligence Index of 25 against a median of 9. Benchmark scores remain sensitive to prompts, reasoning settings, tool scaffolding, and harness versions, so production evaluations should reproduce the intended workload.
Artificial Analysis also measured unusually high output volume: 175 million tokens across its suite, compared with a 95.9 million median. Tasks took 14.3 minutes at the median despite a decoding rate of 238 tokens per second. Fast token generation can still produce long end-to-end latency when the model emits extended reasoning traces or repeatedly calls tools.
Sparse activation lowers serving costs
Reported PlotlyDataAnalyticsBench results illustrate the cost advantage of activating about 3B parameters per token. Qwen4-35B-A3B scored 34 of 43 for $0.15, with a median response time of 15 seconds. That result was one point below Qwen4 Max at roughly one-fifteenth of the cost.
Qwen3.8-27B scored 38 on the same benchmark, four points higher than Qwen4-35B-A3B. The sparse Qwen4 model completed the work about 3.5 times faster and at approximately one-tenth of the cost. Hosted pricing will also depend on reasoning length, generated-token limits, batching, and provider-specific quantization.
Early local tests indicate that suitable hardware can sustain high throughput. One user reported decode speeds approaching 300 tokens per second and prefill above 10,000 tokens per second on two AMD Radeon Pro R9700 GPUs. Another reported 45 tokens per second with a Q6 quantization and the full context window on a Strix Halo mini-PC. Prefill measures how quickly the system ingests the prompt; decode measures generation after that prompt has been processed.
The checkpoint and deployment paths
The base model card describes an image-text-to-text model, meaning it can accept images and text while producing text. Its main configuration is:
- 35B core parameters with about 3B activated per token
- 20B-parameter n-gram embeddings and a 2B Multi-Token Prediction head
- 40 layers using 30 Gated DeltaNet blocks and 10 sparse-attention blocks
- 256 routed experts, with 8 routed and 1 shared expert active per token
- A native context limit of 1,048,576 tokens
- FP8 E4M3 weights under the Apache 2.0 license
Qwen documents support for vLLM, SGLang, Transformers, llama.cpp, Ollama, Unsloth, and MLX, subject to the backend’s current model support. A vLLM server can be started with:
vllm serve Qwen/Qwen4-35B-A3B-FP8
Transformers can load the checkpoint, although Qwen recommends its reference tokenizer with trust_remote_code=True. The compatibility Jinja template can produce different token IDs from the reference implementation. Because remote code executes Python from the model repository, production deployments should inspect the implementation and pin a reviewed revision.
Memory planning should include weights, activations, expert-routing buffers, the vision encoder, and context state. The hybrid attention stack reduces long-context overhead, although a million-token request still requires substantially more memory and prefill time than a routine coding prompt.
Reasoning controls require deliberate tuning
Qwen4 exposes four reasoning-effort levels: xhigh, high, low, and off. The default is high. OpenAI-compatible servers can receive the setting through chat_template_kwargs, provided the serving backend implements the model’s template:
completion = client.chat.completions.create(
model="Qwen/Qwen4-35B-A3B-FP8",
messages=messages,
extra_body={
"chat_template_kwargs": {
"preserve_thinking": True,
"reasoning_effort": "high",
},
},
)
Qwen cautions that lower reasoning effort can increase total agent latency when shallow analysis causes failed tool calls or repeated attempts. Teams should measure complete task duration, success rate, and token consumption rather than relying on decoding speed alone.
The recommended sampling settings also change with reasoning mode:
- Thinking enabled:
temperature=1.0andtop_p=0.95 - Thinking disabled:
temperature=0.7,top_p=0.80, andpresence_penalty=1.5
Best suited to long-context local agents
Qwen4-35B-A3B fits workloads that combine large inputs, tool use, and constrained inference budgets. Likely applications include repository-wide code changes, document pipelines, long-video question answering, and local agent loops. Apache 2.0 licensing also permits commercial use and modification under the license’s terms.
Deployment decisions should account for its weaker FrontierCode-AA 2.0 and GPQA results, large stored-weight footprint, and high output-token consumption. Teams using hosted endpoints should cap generation and track retries, while local deployments should test quantization quality, tokenizer behavior, full-context memory use, and task-level latency on their own hardware.