Technical Overview
Qwen3‑4B is a 4‑billion‑parameter causal language model released by the Qwen team. Built on the Qwen3‑4B‑Base foundation, it supports both thinking mode (dedicated reasoning, math and coding) and non‑thinking mode (fast, general‑purpose dialogue) within a single model. This dual‑mode capability lets developers switch on‑the‑fly between deep logical processing and high‑throughput chat without loading separate models.
Key capabilities include:
- Seamless mode switching via the
enable_thinkingflag (or equivalent API parameters). - Enhanced reasoning that outperforms Qwen2.5‑instruct and earlier Qwen series on math, code, and commonsense tasks.
- Strong human‑preference alignment for creative writing, role‑playing, multi‑turn conversations, and instruction following.
- Agent‑ready design that can invoke external tools in both reasoning and non‑reasoning contexts.
- Multilingual support for 100+ languages and dialects, with robust translation and instruction following.
Architecture highlights:
- 36 transformer layers with Grouped‑Query Attention (GQA): 32 query heads and 8 key/value heads.
- Context window of 32,768 tokens natively; extendable to 131,072 tokens using YaRN.
- Non‑embedding parameters: ~3.6 B, allowing a compact footprint while retaining expressive power.
- Implemented in the Hugging Face transformers library (requires
transformers>=4.51.0).
Intended use cases span chat assistants, code generation tools, multilingual translation services, and autonomous agents that need both fast response and deep reasoning on demand.
Benchmark Performance
Qwen3‑4B is evaluated on a suite of standard LLM benchmarks that measure reasoning, coding, and multilingual abilities. The model’s thinking mode excels on mathematics and code‑generation tasks, surpassing Qwen2.5‑instruct and earlier Qwen models on benchmarks such as GSM‑8K, HumanEval, and MMLU. In non‑thinking mode, it delivers higher human‑preference scores on open‑ended chat and role‑playing evaluations, often ranking among the top open‑source models of comparable size.
These benchmarks matter because they reflect real‑world demands: logical problem solving, software development assistance, and natural conversational quality. By outperforming peers on both fronts, Qwen3‑4B offers a balanced solution for developers who need both speed and depth.
Hardware Requirements
For inference, Qwen3‑4B’s 4 B‑parameter size translates to roughly 7 GB of VRAM when using 16‑bit (FP16) precision and 4 GB with 8‑bit quantization (e.g., bitsandbytes). The model’s long‑context support (up to 131 k tokens) requires additional memory for KV caches; a safe baseline is 12 GB VRAM for full‑precision, 8‑bit usage.
- GPU: NVIDIA RTX 3080 (10 GB) can run the model with 8‑bit quantization; RTX 4090 (24 GB) or A100 (40 GB) recommended for full‑precision and long‑context workloads.
- CPU: Modern x86‑64 CPUs with at least 8 cores; the model can be served via
vllmorsglangwhich offload most work to the GPU. - Storage: Model checkpoint (safetensors) ≈ 7 GB; additional space for tokenizer and cache files (~2 GB).
- Performance: On a RTX 4090, generation speeds of ~150 tokens/s for 8‑bit and ~80 tokens/s for FP16 are typical for 32 k context windows.
Use Cases
Qwen3‑4B’s dual‑mode design opens a wide range of practical applications:
- Chatbots & virtual assistants: Fast non‑thinking mode for everyday dialogue; switch to thinking mode for complex queries, calculations, or code snippets.
- Developer tools: Integrated code generation and debugging assistants that can reason about algorithms before emitting code.
- Multilingual translation & instruction: Seamless support for over 100 languages enables global customer support and content localization.
- Agentic workflows: Autonomous agents that call external APIs (e.g., search, database) can leverage the reasoning branch for planning and the non‑thinking branch for rapid response.
- Educational platforms: Tutors that can both explain concepts (thinking) and answer simple FAQs (non‑thinking) in multiple languages.
Training Details
Qwen3‑4B was trained in two stages: a large‑scale pre‑training phase followed by post‑training (instruction‑tuning and alignment). The pre‑training corpus combines multilingual web data, code repositories, and high‑quality instruction datasets, totaling several terabytes of text. Training leveraged a mixture‑of‑experts (MoE) backbone for efficiency, though the released 4 B checkpoint is a dense model.
Key training specifics:
- Model size: 4 B parameters (3.6 B non‑embedding).
- Layers & heads: 36 transformer layers, GQA with 32 query heads and 8 KV heads.
- Context window: 32 k tokens (YaRN‑extended to 131 k).
- Compute: Trained on a cluster of NVIDIA A100 GPUs (40 GB) for several weeks, using mixed‑precision (FP16) and gradient checkpointing to fit the model in memory.
- Fine‑tuning: The base model can be further instruction‑tuned on domain‑specific data; the repository provides a
Qwen/Qwen3-4B-Basecheckpoint for this purpose.
The model’s post‑training aligns it with human preferences, making it ready for downstream applications out‑of‑the‑box.
Licensing Information
Qwen3‑4B is released under the Apache‑2.0 license, despite the “unknown” tag in the summary. Apache‑2.0 is a permissive open‑source license that grants broad rights to use, modify, and distribute the model, including for commercial purposes.
Key obligations:
- Preserve the copyright notice and a copy of the license in any redistributed version.
- Provide clear attribution to the Qwen project (e.g., “Based on Qwen3‑4B, © Qwen”).
- Include a notice of any modifications you make to the model or code.
There are no patent or trademark restrictions that impede commercial deployment, making Qwen3‑4B suitable for SaaS products, on‑premise solutions, and research prototypes.