Welcome Qwen 4: Cutting-edge intelligence on-device
Qwen4-35B-A3B by the Alibaba Qwen Team is out on Hugging Face!
Following the architectural preview in Qwen3.8-Flash-Next, Qwen4-35B-A3B brings Qwen's full next-generation hybrid design into production.It is a natively multimodal Mixture-of-Experts (MoE) model with ~35B main parameters and ~3.8B active parameters per token and ~20.5B Per-Layer N-gram Embedding (PLE) parameters (~56B total).
It supports native text, image, and video inputs, a 1M token context window, and is licensed under Apache-2.0.
We collaborated with the Qwen Team to ship day-0 support across transformers, llama.cpp, Llama App, vLLM, SGLang, MLX, Inference Providers, and Inference Endpoints. This post walks through the salient features of the architecture, how to run it, and how to fine-tune it for your own tasks.
Qwen4-35B-A3B is a multimodal mixture-of-experts model with 1M-token context window.The text decoder repeats the same four-layer pattern ten times.The first three layers use Gated DeltaNet, which updates a fixed-size memory as it reads each token.
The fourth uses Qwen Sparse Attention (QSA), which lets the current token look back at individual tokens from anywhere in the context.To decide where to look, a small indexer groups tokens in groups of four tokens and averages their keys.
For each query, it picks up to 512 groups.The attention layer then reads the individual tokens in those groups, plus any tokens in the last unfinished group.That gives it up to 2,048 selected tokens and at most three more at the end.
Qwen4-35B-A3B also changes how information moves between layers.Each token starts with four copies of its 2,048-dimensional embedding.These become four residual streams.Before each attention or MoE block, learned gates mix the streams into a single input.
The eight selected experts and the shared expert process that input and produce one combined output.Each stream then adds a scaled copy of that same output to its own state.A learned gate sets the scale separately for each stream.One of the biggest pieces of the model sits in the second decoder layer.
This layer has a per-layer embedding table (PLE), which consists of 20.5B parameters.Each token reads just 16 rows of the PLE table.Eight lookups encode the last two tokens and the other eight lookups encode the last three tokens (the current token and two tokens immediately before that).
The layer joins those 16 embeddings into one, gates their contribution to each residual stream, and uses a short convolution to mix in nearby patterns.
The model employs a vision transformer to encode images and video.The ViT reads images into 16 × 16 patches and merges each 2 × 2 group of spatial patches into one visual token, which is passed to the text decoder.
For video, the processor samples 2 frames per second and groups consecutive sampled frames into pairs.The vision transformer then lets every patch attend to every other patch within that frame pair.
Qwen team has published the model benchmarks in the model card, we have picked community favorites across different tasks below.Qwen4-35B-A3B punches way above its size and class across various benchmarks.
For example, it is comparable to the much larger Qwen 3.8 Flash Next, or even better in some tasks.For example, it is comparable to the much larger Qwen 3.8 Flash Next, or even better in some tasks.
Qwen4-35B-A3B ships with day-0 support in transformers, llama.cpp, vLLM, SGLang, Inference Providers, and Inference Endpoints.
The quickest way to run the model is the any-to-any pipeline:
Going one level lower, you can load the model and processor with the auto classes, AutoModelForMultimodalLM and AutoProcessor. You can control reasoning effort directly, it takes four values ("xhigh", "high", "low", or "off”) and defaults to high if no value is provided.
In the following sections we will showcase how to run inference on different modalities. A common setup for all the sections will be to load the model and the processor.
To run inference with image and text you can simply add images to the messages and pass them to apply_chat_template.
Similarly, you can also add videos to the messages and pass them to apply_chat_template. Note that you need to have torchcodec and ffmpeg installed.
We can also provide tools that the model can use to solve the request. This is how you would do it.
Qwen4-35B-A3B comes with day-0 llama.cpp and Llama App support. We ship 3 quantized versions to the Hub, specifically Q4_K_M 4-bit, Q6_K 6-bit and Q8_0 8-bit. You can find them in this GGUF repository.
MTP speculative decoding is supported out of the box. You simply need to enable it using the --spec-type and --spec-draft-n-max options. We got great results using 3 draft tokens: generation speed increased 22% on an Apple Silicon M5 with the Q4 quant.
Qwen4-35B-A3B runs on Apple Silicon with oMLX and mlx-lm.