Skip to main content
Back

Alibaba's Qwen3-4B Hits 4.8M Downloads Matching Models 18x Its Size

Alibaba's compact dense model packs hybrid reasoning, 128K context via YaRN, and 119-language support into 4B parameters under Apache 2.0.

Pro

  • Qwen3-4B is a 4B dense model with hybrid thinking and non-thinking modes in one checkpoint, available on Hugging Face.
  • Apache 2.0 license, 32K native context extendable to 131K via YaRN scaling.
  • Trained on ~36 trillion tokens across 119 languages using a four-stage post-training pipeline.
  • Benchmarks: 83.7 MMLU-Redux, 97.0 MATH-500, 85.2 RULER; rivals Qwen2.5-72B-Instruct.
  • Runs on vLLM, SGLang, Ollama, llama.cpp, LM Studio, and MLX out of the box.
  • Weaknesses: long-context retrieval in thinking mode and repetition loops under greedy decoding.

Alibaba's Qwen team has quietly turned Qwen3-4B into one of the most downloaded small models on Hugging Face, racking up nearly 4.8 million downloads. The dense 4-billion parameter model ships with a feature most models this size lack: a switch that toggles between deliberate chain-of-thought reasoning and fast, direct replies inside the same weights.

The pitch is that you no longer need a separate reasoning model and a separate chat model. One 4B checkpoint, released under Apache 2.0, tries to cover both.

A 4B model that trades punches with 72B

Qwen3-4B belongs to a six-model dense lineup alongside Qwen3-32B, 14B, 8B, 1.7B, and 0.6B, all released under Apache 2.0. The architecture details from the model card are worth knowing before you pull weights:

  • 4.0B total parameters, 3.6B non-embedding
  • 36 transformer layers
  • Grouped-query attention with 32 query heads and 8 key/value heads
  • 32,768 token native context, extendable to 131,072 tokens with YaRN scaling
  • Tied input/output embeddings (unlike the 8B and larger dense siblings)

Alibaba's launch post claims Qwen3-4B rivals Qwen2.5-72B-Instruct on many tasks. Reported scores include 83.7 on MMLU-Redux, 77.5 on C-Eval, 97.0 on MATH-500, and 65.9 on MLogiQA, with strong results in both thinking and non-thinking modes. On long-context retrieval, Qwen3-4B averages 85.2 on the RULER benchmark in non-thinking mode, with performance tapering as sequence lengths approach 128,000 tokens.

The thinking switch

In the chat template, an enable_thinking flag controls whether the model emits a <think>...</think> block before its final answer. You can also flip it per turn by dropping /think or /no_think into a user message, which comes in handy inside longer agent loops.

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=True  # False for fast, direct replies
)

The behavior goes deeper than formatting. Alibaba describes a four-stage post-training pipeline built to fuse the two modes: long chain-of-thought cold start, reasoning-based RL, thinking mode fusion, then general RL across more than 20 domains including instruction following and tool use. A single set of weights can then be steered toward step-by-step math or toward snappy chat without swapping checkpoints.

How it was built

The pretraining budget is aggressive for something this small. Qwen3 was trained on roughly 36 trillion tokens spanning 119 languages and dialects, roughly double the Qwen2.5 corpus, with synthetic math and code data generated by earlier Qwen2.5-Math and Qwen2.5-Coder models. Pretraining ran in three stages: broad general knowledge at 4K context, a knowledge-intensive stage weighted toward STEM and code, and a final long-context stage that extends the window to 32K.

On the base-model side, the Qwen3 8B, 4B, 1.7B, and 0.6B base checkpoints hold up across nearly all benchmarks reported in the technical report.

Where it struggles

Small dense models still have small-dense-model failure modes, and Qwen3-4B is no exception. Performance on lengthy retrieval tasks drops slightly in thinking mode, which can introduce extraneous generation that hurts information extraction. The model card is also blunt that greedy decoding causes repetition loops, so the recommended sampling is Temperature=0.6, TopP=0.95, TopK=20 in thinking mode, with a slightly hotter setup in non-thinking mode.

Community reception has been broadly positive but not uncritical. Developers report the model is weak on factual recall but pleasant for chat and code generation, and that the 4B and 30B Qwen3 releases are especially strong for their memory footprint.

Getting it running

The deployment story is where a 4B model earns its keep. It slots into essentially every serving stack developers already use:

  • vLLM: vllm serve Qwen/Qwen3-4B --enable-reasoning --reasoning-parser deepseek_r1
  • SGLang: python -m sglang.launch_server --model-path Qwen/Qwen3-4B --reasoning-parser qwen3
  • Local: Ollama, LM Studio, MLX-LM, llama.cpp, KTransformers
  • Agents: Qwen-Agent with built-in MCP tool wiring

For the 128K context path, YaRN scaling is a config edit rather than a retrain. You add a rope_scaling block to config.json with factor: 4.0 and original_max_position_embeddings: 32768, or pass equivalent flags on the vLLM or llama.cpp command line. The team explicitly warns against enabling YaRN for short prompts, since the static scaling factor can hurt performance on inputs that fit natively in 32K.

Why this release matters

Benchmarks aside, the more interesting shift is that a 4B open-weight model now credibly does two jobs that used to require two different systems: a reasoning model with visible chain-of-thought for hard problems, and a fast instruction model for everything else, controllable per request. Combined with 128K context, Apache 2.0, and native tool-calling support documented in the Qwen3 technical report, it becomes a plausible default for on-device assistants, coding copilots that run without a network, and agent frameworks that want a cheap, fast worker model that can occasionally think hard when a task demands it.