Skip to content
AI Primer
release

Alibaba releases Qwen4-35B-A3B under Apache 2.0 with 1M-token context

Alibaba's first open-weight Qwen4 model ships with native million-token context and day-zero runtime support. Quantized downloads support local deployment, including an 18GB RAM configuration from Unsloth.

8 min read
Alibaba releases Qwen4-35B-A3B under Apache 2.0 with 1M-token context
Alibaba releases Qwen4-35B-A3B under Apache 2.0 with 1M-token context

TL;DR

  • Alibaba released an Apache 2.0 multimodal MoE with native million-token context: the launch announcement specifies 35B main parameters and 3B active per token.
  • Independent agent evaluations improved: Artificial Analysis scored Qwen4 at 25 versus Qwen3.8-27B's 20, +5 points, in its evaluation.
  • Local deployment starts at 18GB RAM with SSD offload, according to Unsloth's release. That configuration uses a 3-bit quant and a short context.
  • Results against Qwen3.8-Flash-Next vary by task: Qwen4 wins on DeepSWE and HealthBench but trails on Terminal Bench and FrontierCode, as one early comparison noted.

A 20B-parameter n-gram table sits outside the advertised 35B and can live in host RAM or on SSD. Qwen's tokenizer compatibility notes disclose another gotcha: identical formatted chat text can produce different token IDs depending on the implementation.

Weights, API and day-zero support

Alibaba's first open-weight Qwen4 accepts text, images and video, produces text, and supports 1,048,576 tokens natively, according to the launch announcement and Qwen's model card.

  • Downloads: Apache 2.0 weights on Hugging Face and ModelScope, with BF16, FP8 and quantized formats described in the integration announcement.
  • Managed API: Qwen Cloud serves the model as qwen4-35b-a3b.
  • Local runtimes: Transformers, llama.cpp, Llama App and oMLX shipped support through the Hugging Face partnership.
  • Serving engines: vLLM shipped dedicated images; Qwen also acknowledged SGLang's launch support.
  • Hosted inference: Prime Inference added the model in its launch announcement.
  • Live evaluation: Agent Arena made it available for tasks involving search, files and terminal tools, with leaderboard scores still pending.

Agent benchmarks

Qwen published comparisons against Qwen3.8-27B, Qwen3.8-Flash-Next and Inkling2 Mini.

Selected gains from that chart:

  • DeepSWE v1.1: Qwen3.8-27B's 42.2 → Qwen4's 61.8, +19.6 points.
  • NL2Repo: Flash-Next's 48.1 → 51.7, +3.6 points.
  • AutomationBench-AA: Flash-Next's 55.9 → 57.9, +2.0 points.
  • HealthBench Professional: Flash-Next's 34.8 → 47.4, +12.6 points.

Qwen mixes its own tests with externally sourced results in this chart. Its evaluation notes credit Artificial Analysis and Mercor for several scores and identify Work360 as an internal benchmark.

Independent evaluator Artificial Analysis put Qwen4 at 25 on its Intelligence Index at xhigh effort, versus 20 for both Qwen3.8-27B and Inkling 2 Mini, in its evaluation. Flash-Next scored 28; Artificial Analysis called Qwen4 the highest-scoring model below 150B parameters, counting its additional embedding and MTP components.

Artificial Analysis measured $0.55 per task versus $3.53 for Qwen3.8-27B, about 84% lower. It attributed the reduction to Alibaba Cloud's pricing despite greater output-token use: $0.06 per million input tokens, $0.36 per million output tokens and $0.003 per million cache-hit tokens.

FrontierCode and GPQA regressions

Qwen4's wins over Flash-Next are task-specific, a qualification highlighted in one early comparison. Qwen's chart also reports:

  • Terminal Bench 4.1: Flash-Next's 24.2 → Qwen4's 21.2, −3.0 points.
  • FrontierCode-AA 2.0: 27.1 → 16.1, −11.0 points.
  • GPQA: 91.7 → 86.9, −4.8 points. Qwen4 also trails Qwen3.8-27B's 89.2 by 2.3 points.

Against Qwen3.8-27B, Artificial Analysis identified HLE-Diamond as the only material regression in its evaluation suite, down 4 points, while reporting gains of roughly 16 points on Terminal Bench and 10 on CritPt v2 in its breakdown.

Gated DeltaNet and sparse attention

Qwen specifies three changes to the decoder's information flow in its architecture description:

  1. Hybrid attention: Forty layers repeat a three-to-one pattern: 30 Gated DeltaNet layers maintain fixed-size recurrent states; 10 Qwen Sparse Attention layers retain KV caches.
  2. Sparse experts: Each MoE layer has 256 routed experts, with eight routed experts plus one shared expert activated per token.
  3. Gated residuals: Four residual streams carry each token's state. Rank-256 gates mix them into each sublayer's input and distribute its output back across the streams.

The sparse-attention indexer selects up to 512 four-token blocks. Each query attends to those 2,048 tokens plus up to three tokens in the unfinished final block, according to Hugging Face's technical walkthrough.

On NVIDIA, vLLM combines those sparse KV caches with native NVFP4 storage. It reports roughly 8 GiB of KV cache for a million-token context, versus 80 GiB for its hypothetical BF16 full-attention comparison across all 40 layers, in its serving analysis.

The NVFP4 K/V tensors alone are about 3.6 times smaller than BF16, excluding the separate FP8 indexer cache, as vLLM's launch thread specifies.

57B parameters and SSD offload

Qwen's 35B name leaves another 22B parameters off the label. Its accounting is 35B main model + 20B n-gram embeddings + 2B Multi-Token Prediction, approximately 57B altogether.

At decoder layer 2, each token reads 16 rows from the n-gram table: eight bigram lookups and eight trigram lookups. A gated projection and short convolution fold those embeddings into the residual streams, according to Hugging Face's explanation.

vLLM keeps the table in pinned host memory and overlaps its row gathering with preceding GPU work. Its deployment recipe lists these weight footprints, before KV-cache allocation:

| Checkpoint | GPU-side model | Host-side n-gram table |
| --- | ---: | ---: |
| FP8 | 39.7 GB | 20.5 GB |
| BF16 | 72.7 GB | 41 GB |

Unsloth's smaller configuration uses 18GB RAM plus an approximately 20GB SSD-resident engram, with a 3-bit UD-IQ3_XXS quant and short context. Its local-running guide separately describes 4-bit UD-IQ4_XS deployment on 24GB devices.

Unsloth Desktop automatically places the table in RAM when capacity permits and leaves it on SSD otherwise. The 18GB configuration and the native million-token maximum describe different memory budgets.

MTP speculative decoding

llama.cpp exposes the model's built-in drafter through --spec-type draft-mtp.

Hugging Face measured a 22% generation-speed increase on Apple Silicon M5 with a Q4 quant and three draft tokens in its launch tests.

Unsloth includes an MTP head in every GGUF, without a separate draft-model file. Its benchmarks show workload-dependent gains on an RTX 5090 with UD-Q4_K_XL, greedy decoding and thinking disabled:

  • Code, one draft token: 174.9 → 224.0 tokens/s, +28%.
  • Prose, one draft token: 168.6 → 205.3 tokens/s, +22%.
  • Prose, three draft tokens: 168.6 → 174.9 tokens/s, +4%.

Quantization accuracy and missing components

Unsloth tested UD-Q4_K_XL on 300 questions across GSM8K, MATH-500, CRUXEval-O and MMLU-Pro, using four samples per question with thinking enabled. Accuracy moved from BF16's 95.3% to 95.0%, −0.3 percentage points, according to the quantization results.

Two independently adjustable pieces complicate the usual “4-bit model” description:

  • Engram precision: With the same UD-Q4_K_XL main weights, replacing the 11.52GB IQ4_NL table with a 21.76GB Q8_0 table reduced mean KLD by about 6%, according to the engram tests.
  • MLX components: Unsloth's 34GB dynamic 4-bit MLX conversion is text-only, without a vision encoder or MTP head. Its documentation reports 87% lower mean KLD than a standard 31.3GB MLX 4-bit conversion.

The same guide reports occasional looping in the smallest GGUF quants and applies different sampling settings to those variants.

Local agents and throughput

Ollama shipped these entry points in its announcement, which also linked a pre-release build:

Teknium also acknowledged the local release.

Magnitude reported the following rates in its launch announcement:

| Hardware | Reported tokens/s |
| --- | ---: |
| Mac mini M2 Pro, 32GB | 36 |
| RTX 3060, 12GB VRAM | 46 |
| RTX 3090, 24GB VRAM | 88 |

Magnitude distributes model components across GPU memory, system RAM and SSD, as its implementation overview explains. The 12GB figure describes GPU VRAM, not the complete machine's memory requirement.

A subsequent Magnitude reply reported 73 tokens/s on DGX Spark. Separately, vLLM reported 514 tokens/s for one request on a B300 with FP8 weights, MTP and SPEED-Bench prompts in its serving tests.

Tokenizer and thinking controls

Qwen ships a reference tokenizer/processor that depends on tiktoken and requires trust_remote_code=True. Its model card distinguishes that implementation from the compatibility Jinja template:

  • Token identity: The template can produce identical formatted text but different token IDs because the reference implementation distinguishes control tokens from ordinary text at the ID level.
  • Reasoning effort: xhigh, high, low and off are supported; high is the default.
  • Thinking history: preserve_thinking is enabled by default, retaining reasoning across turns.
  • End-to-end latency: Qwen warns that lower effort can increase failures and retries, raising total task latency and token consumption despite faster individual turns.

RL consistency and held-out results

vLLM demonstrated bitwise-identical rollout and trainer logprobs with SkyRL and Megatron-LM's mLite path. With VLLM_BATCH_INVARIANT=1, it recorded 0 mismatches across 682,536 comparisons during 10 DAPO steps on eight GB200s, while retaining its accelerated serving features.

The determinism setting carried a throughput cost. On one GB200 at concurrency 32, rollout throughput moved from 6,821 to 6,322 tokens/s, −7.3%, in vLLM's paired measurement.

Hugging Face also published a separate TRL recipe for training a security-alert triage adapter. On its 12 held-out CyberDefense Bench tasks, passes moved from 4/12 for the base model to 6/12 at update 50, then 3/12 at update 100, even as training reward trended upward, according to its training walkthrough.

Further reading

Discussion across the web

Where this story is being discussed, in original context.

On X· 9 threads
TL;DR2 posts
Weights, API and day-zero support3 posts
Agent benchmarks1 post
FrontierCode and GPQA regressions2 posts
Gated DeltaNet and sparse attention1 post
57B parameters and SSD offload2 posts
Quantization accuracy and missing components2 posts
Local agents and throughput4 posts
RL consistency and held-out results2 posts
Share on X