★ Reading this for free? Get 20 structured AI courses + per-chapter AI tutor — the first chapter of every course free, no card.Start free in 30 seconds
AI Models

Qwen 3 Local Setup Guide: Run Alibaba's AI Model with Ollama

February 4, 2026
18 min read
Local AI Master Research Team

Want to go deeper than this article?

Free account unlocks the first chapter of all 20 courses — RAG, agents, MCP, voice AI, MLOps, real GitHub repos.

📚AI Learning Path

Ollama’s running. Here’s what to build with it. Go from “ollama run” to RAG apps, agents, and fine-tuned models — structured and hands-on. First chapter free.

Start free
Or own it for life — Lifetime $149, pay once

To run Qwen3 locally, install Ollama, then run ollama pull qwen3:8b and ollama run qwen3:8b — that's the 8B dense model in about 6GB of VRAM, the recommended starting point for most people. Pick by hardware: qwen3:8b for an 8GB GPU, qwen3:14b for 16GB, and qwen3:32b or the qwen3:30b-a3b MoE for 24GB. All open-weight Qwen 3 models are Apache 2.0 (free commercial use), span 0.6B to 235B parameters across 119 languages, and support a toggleable thinking mode. The newer flagship Qwen3.7-Max (May 2026) is API-only with no open weights, so it cannot run locally.

Qwen 3 Quick Start

Choose Your Model:

qwen3:8b
6GB VRAM
Best starter model
qwen3:14b
10GB VRAM
Strong reasoning
qwen3:32b
20GB VRAM
Best quality
qwen3:30b-a3b
19-24GB VRAM
MoE efficiency

Quick Install (3 commands):
curl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen3:8b
ollama run qwen3:8b

What is Qwen 3?

Qwen 3 is Alibaba Cloud's flagship large language model series, released April 28-29, 2025. It represents a massive leap forward with 36 trillion training tokens across 119 languages—nearly double the 18 trillion tokens used for Qwen 2.5.

The release includes 8 models: 6 dense architectures ranging from 0.6B to 32B parameters, plus 2 Mixture-of-Experts (MoE) models with 30B and 235B total parameters. All models are released under the Apache 2.0 license, making them fully open source and commercially usable without restrictions.

What makes Qwen 3 exceptional:

  1. Performance scaling: Qwen3-32B matches Qwen2.5-72B capability—72B-class performance from a single RTX 4090
  2. 119 languages: The most multilingual open-source model available
  3. Dual-mode thinking: Switch between deep reasoning and fast responses
  4. MoE efficiency: 30B quality with 3B inference cost (30B-A3B variant)
  5. State-of-the-art benchmarks: Outperforms DeepSeek-R1 on 17/23 benchmarks

Reading articles is good. Building is better.

Free account = 20+ free chapters across 20 courses, with a per-chapter AI tutor. No card. Cancel anytime if you ever upgrade.

Qwen 3 Model Family: Complete Overview

Dense Models (All Parameters Active)

Dense models activate all parameters during inference. They're simpler to deploy and have predictable resource requirements.

ModelParametersLayersAttention HeadsKV HeadsContextVRAM (Q4)
Qwen3-0.6B0.6B2816432K~1GB
Qwen3-1.7B1.7B2816432K~2GB
Qwen3-4B4B3624832K~3GB
Qwen3-8B8B36328128K~5-6GB
Qwen3-14B14B48408128K~10GB
Qwen3-32B32.8B64648128K~20GB

Mixture-of-Experts (MoE) Models

MoE models contain many "expert" sub-networks but only activate a subset for each token. This gives better quality per compute dollar.

ModelTotal ParamsActive ParamsExpertsActiveContextVRAM (Q4)
Qwen3-30B-A3B30B3B1288128K~19-24GB
Qwen3-235B-A22B235B22B12881M*140GB+
Qwen3-Next-80B-A3B80B3B512+110-~30GB
Qwen3-Coder-480B-A35B480B35B--256K-1M250GB+

*Extended to 1M tokens with the Qwen3-2507 update.

Understanding MoE Efficiency

The Qwen3-30B-A3B model is particularly notable:

  • 30B total parameters stored in memory
  • Only 3B activated per token (8 of 128 experts)
  • 30B-class quality with 8B-class speed
  • Fits on RTX 4090 with INT4 quantization

This is why MoE is revolutionary for local AI: you get significantly better quality without proportionally more compute or memory.


Qwen 3 Release Timeline

DateReleaseKey Features
April 28-29, 2025Qwen3 Initial8 models (6 dense + 2 MoE), Apache 2.0
July-August 2025Qwen3-25071M token context, improved thinking
August 4, 2025Qwen-ImageImage generation model
September 5, 2025Qwen3-MaxFlagship API model
September 10, 2025Qwen3-NextHybrid MoE, multi-token prediction
October 4, 2025Qwen3-VL-30B-A3BVision-language MoE
January 23, 2026qwen3-max-2026-01-23Integrated thinking + tool use
May 20, 2026Qwen3.7-Max1M context, native extended-thinking, agentic — API-only, no open weights (not runnable locally)

The Qwen team maintains rapid development with monthly updates and new model variants. Note that the latest flagship, Qwen3.7-Max (May 20, 2026), is a proprietary API-only model on Alibaba Cloud Model Studio with no open weights released, so it is not part of the local/Ollama lineup covered in this guide. For local use, the Apache 2.0 open-weight dense and MoE models below remain the relevant choices.


Should I run the original Qwen3 or the Qwen3-2507 update?

This is the single most common point of confusion when you go to pull a model in mid-2026, so it's worth getting right before you download 20GB. The original April 2025 Qwen3 release used a hybrid design: one set of weights that you toggled between reasoning and direct answers with /set think and /set nothink. In the July-August 2025 "2507" refresh, Alibaba split that into two dedicated, separately-trained checkpoints — and the newer 2507 weights generally score higher on reasoning and instruction-following than the original hybrids.

VariantReasoning behaviorBest forOllama tag example
Original Qwen3 (Apr 2025)Hybrid — toggle /set think / /set nothinkMixed workloads, one model to manageqwen3:8b, qwen3:32b
Qwen3-Instruct-2507Always direct (no visible chain-of-thought)Fast chat, RAG, high-throughput, structured outputqwen3:30b-a3b-instruct-2507
Qwen3-Thinking-2507Always reasons before answeringHard math, multi-step coding, agentsqwen3:30b-a3b-thinking-2507

The 2507 split exists in 4B, 30B-A3B, and 235B-A22B sizes, with native context extended to 256K tokens. Recommended sampling settings differ between the two: for Instruct-2507 use temperature 0.7, top_p 0.8, top_k 20; for Thinking-2507 use temperature 0.6, top_p 0.95, top_k 20. Practical rule of thumb: if you want one model that does everything, pull the original hybrid qwen3:8b or qwen3:32b; if you have a clear job (a fast assistant or a deep reasoner), the matching 2507 checkpoint will usually beat the toggled hybrid at that one job.

# Direct, fast assistant (no chain-of-thought) — great for RAG and chat
ollama pull qwen3:30b-a3b-instruct-2507

# Deep reasoner — math, multi-step coding, agent loops
ollama pull qwen3:30b-a3b-thinking-2507

# Small but capable 2507 pair (fits ~4GB VRAM)
ollama pull qwen3:4b-instruct-2507
ollama pull qwen3:4b-thinking-2507

If you are choosing a local model purely for everyday assistant use, it's worth weighing Qwen3 against the rest of the field — our roundup of the best Ollama models for local use compares Qwen3, Llama, Gemma, and DeepSeek side by side so you can see where each one wins.


Reading articles is good. Building is better.

Free account = 20+ free chapters across 20 courses, with a per-chapter AI tutor. No card. Cancel anytime if you ever upgrade.

Benchmark Performance

Qwen3-235B-A22B vs Competitors

BenchmarkQwen3-235BDeepSeek-R1GPT-4oClaude 3.5
MMLU Pro80.6%79.0%78.4%77.2%
LiveCodeBench70.7%65.9%33.4%38.9%
CodeForces ELO2,0562,0291,8911,886
ArenaHard95.692.390.289.5
MATH-50090.2%97.3%74.6%78.3%
GSM8K95.4%95.8%92.0%91.6%

Key insight: Qwen3-235B-A22B outperforms DeepSeek-R1 on 17 of 23 benchmarks while using only:

  • 35% of total parameters (235B vs 671B)
  • 60% of active parameters (22B vs 37B)

Performance Scaling: Qwen 3 vs Qwen 2.5

Each Qwen 3 model matches a larger Qwen 2.5:

Qwen 3MatchesImprovement
Qwen3-1.7BQwen2.5-3B1.8x smaller
Qwen3-4BQwen2.5-7B1.75x smaller
Qwen3-8BQwen2.5-14B1.75x smaller
Qwen3-14BQwen2.5-32B2.3x smaller
Qwen3-32BQwen2.5-72B2.2x smaller

This means Qwen3-32B on a single RTX 4090 delivers performance that previously required multi-GPU setups with Qwen 2.5.

Qwen 3 vs Llama Comparison

StrengthQwen 3Llama
STEM ReasoningStrongerGood
MathematicsStronger (95.4% GSM8K)Good
CodingStronger (2,056 ELO)Strong
MultilingualStronger (119 langs)Limited
Structured OutputGoodStronger
Creative WritingGoodStronger
Multi-step RefactoringStrongerGood

Recommendation: Use Qwen 3 for STEM, math, coding, and multilingual tasks. Use Llama for creative writing and when you need clean structured outputs.


Step-by-Step Local Setup with Ollama

Step 1: Install Ollama

macOS/Linux:

curl -fsSL https://ollama.com/install.sh | sh

Windows: Download from ollama.com/download and run the installer.

Verify installation:

ollama --version
# Should show: ollama version 0.5.x or higher

Step 2: Choose and Pull Your Model

Select based on your VRAM:

# 4GB VRAM - Basic, fast
ollama pull qwen3:0.6b

# 6GB VRAM - Good starter (default)
ollama pull qwen3:8b

# 10-12GB VRAM - Strong reasoning
ollama pull qwen3:14b

# 20-24GB VRAM - Best quality
ollama pull qwen3:32b

# 19-24GB VRAM - MoE efficiency (recommended for 24GB)
ollama pull qwen3:30b-a3b

Step 3: Run the Model

# Run default (8B)
ollama run qwen3

# Or specify size
ollama run qwen3:32b

Step 4: Configure Thinking Mode

Within the interactive session:

# Enable thinking mode (chain-of-thought reasoning)
/set think

# Disable thinking mode (fast direct responses)
/set nothink

# Adjust context length
/set parameter num_ctx 40960

# Adjust response length
/set parameter num_predict 32768

# Exit
/bye

Step 5: Create an Optimized Configuration

For best results, create a custom Modelfile:

cat > Modelfile << 'EOF'
FROM qwen3:32b

# Optimal for reasoning
PARAMETER temperature 0.7
PARAMETER top_p 0.8
PARAMETER num_ctx 32768

# System prompt for technical tasks
SYSTEM """You are Qwen 3, a highly capable AI assistant created by Alibaba Cloud.
For complex problems:
1. Analyze the problem systematically
2. Consider multiple approaches
3. Show your reasoning clearly
4. Verify your solution before finalizing
Be precise, thorough, and helpful."""
EOF

# Create custom model
ollama create qwen3-optimized -f Modelfile

# Run optimized version
ollama run qwen3-optimized

Why does Qwen3 forget the start of long prompts? (the num_ctx gotcha)

This is the bug that quietly ruins more local Qwen3 setups than any hardware issue. By default, Ollama caps the context window at a small value (historically 2,048, more recently 4,096 tokens) regardless of the 128K–256K the model itself supports. When your conversation, document, or agent loop exceeds that cap, Ollama silently truncates from the beginning — no error, no warning. The symptom is a model that "forgets" your instructions or the top of a pasted file, and people wrongly blame Qwen3's quality when the real culprit is the runtime default.

The fix is to set num_ctx explicitly. A one-off override inside a session or via the API gets reset when the model unloads, so the durable fix is to bake it into a Modelfile:

# Durable fix — bake a larger context into a custom model
cat > Modelfile << 'EOF'
FROM qwen3:8b
PARAMETER num_ctx 32768
EOF
ollama create qwen3-32k -f Modelfile
ollama run qwen3-32k

A few things worth knowing so you don't trip over the override order:

  • Modelfile PARAMETER num_ctx wins over the OLLAMA_CONTEXT_LENGTH environment variable, which in turn wins over the built-in default.
  • Bigger context costs VRAM. Going from 4K to 32K context on the 8B model adds roughly 1–2GB of KV-cache memory, so leave headroom or you'll spill into system RAM and crawl.
  • You rarely need the full 128K/256K locally. For most chat, coding, and RAG work, 16K–32K is the sweet spot between recall and speed. Reserve the very long contexts for whole-repo or whole-document tasks.

If you're on a tight 8GB card, this trade-off between context size and quantization is exactly the balancing act covered in our guide to the best local AI models for 8GB RAM, which walks through how far you can push num_ctx before performance falls off a cliff.


Thinking Mode Deep Dive

Qwen 3 features a dual-mode architecture that lets you switch between deep reasoning and fast responses.

How Thinking Mode Works

When enabled, Qwen 3 generates internal reasoning before the final answer:

  1. Problem Analysis: Breaks down the question into components
  2. Approach Exploration: Considers multiple solution paths
  3. Reasoning Chain: Works through the logic step by step
  4. Verification: Checks the answer before responding
  5. Final Response: Delivers the clean answer

This is similar to DeepSeek R1's chain-of-thought but optimized for Qwen's architecture.

When to Use Each Mode

Use Thinking Mode (/set think) for:

  • Complex mathematics
  • Multi-step coding problems
  • Logical reasoning puzzles
  • Analysis that requires verification
  • Educational explanations

Use Non-Thinking Mode (/set nothink) for:

  • Simple factual questions
  • Quick translations
  • General conversation
  • Time-sensitive responses
  • High-throughput applications

Thinking Budget Control

Advanced users can allocate computational resources:

# Python API example with thinking budget
import ollama

response = ollama.chat(
    model='qwen3:32b',
    messages=[{
        'role': 'user',
        'content': 'Solve this step by step with careful reasoning...'
    }],
    options={
        'temperature': 0.7,
        'num_ctx': 32768,
        'num_predict': 8192  # Allow space for thinking
    }
)

VRAM Requirements: Complete Guide

Dense Models by Quantization

ModelFP16Q8_0Q5_K_MQ4_K_MMinimum GPU
Qwen3-0.6B1.2GB0.8GB0.6GB0.5GBAny 4GB
Qwen3-1.7B3.4GB2GB1.5GB1.2GBGTX 1060
Qwen3-4B8GB5GB3.5GB3GBRTX 3060 6GB
Qwen3-8B16GB9GB7GB5-6GBRTX 3060 12GB
Qwen3-14B28GB15GB11GB10GBRTX 4070 16GB
Qwen3-32B64GB34GB24GB20GBRTX 4090 24GB

MoE Models

ModelTotal ParamsQ4_K_M VRAMHardware Required
Qwen3-30B-A3B30B19-24GBRTX 4090 or Mac 64GB
Qwen3-235B-A22B235B140GB+2x H100 or 4x A100
BudgetHardwareBest ModelPerformance
$300RTX 3060 12GBqwen3:8b Q430 tok/s
$500RTX 4060 Ti 16GBqwen3:14b Q428 tok/s
$800RTX 4070 Ti Super 16GBqwen3:14b Q532 tok/s
$1,600RTX 4090 24GBqwen3:32b Q422 tok/s
$1,600RTX 4090 24GBqwen3:30b-a3b25 tok/s

Apple Silicon Performance

MacMemoryBest ModelPerformance
M1/M2 8GB8GBqwen3:4b Q425 tok/s
M1/M2 16GB16GBqwen3:8b Q418 tok/s
M2/M3 Pro 32GB32GBqwen3:14b Q520 tok/s
M3 Max 64GB64GBqwen3:32b Q418 tok/s
M3 Max 128GB128GBqwen3:30b-a3b15 tok/s

MoE Architecture Deep Dive

Understanding Mixture-of-Experts helps you choose between dense and MoE models.

How MoE Works

  1. Expert Network: Model contains 128 "expert" sub-networks
  2. Router: Each token goes through a routing mechanism
  3. Expert Selection: Router selects 8 of 128 experts for that token
  4. Computation: Only selected experts process the token
  5. Aggregation: Expert outputs are combined for final result

Qwen 3 MoE Specifications

ComponentQwen3-30B-A3BQwen3-235B-A22B
Total Parameters30B235B
Active Parameters3B22B
Expert Count128128
Active Experts88
RoutingToken-levelToken-level
Memory (Q4)19-24GB140GB+

Qwen3-Next Architecture (Preview)

The Qwen3-Next variant previews future architecture:

  • 512 routed experts + 1 shared expert (vs 128 in standard)
  • 10 active experts per token (vs 8)
  • Multi-token prediction for faster inference
  • Hybrid attention mechanism

This is where Qwen 3.5 is heading—more experts, better routing, faster generation.

When to Use MoE vs Dense

Choose MoE (30B-A3B) when:

  • You have exactly 24GB VRAM
  • You need 30B-class quality
  • Throughput matters more than latency
  • Running multiple concurrent requests

Choose Dense (32B) when:

  • You want simpler deployment
  • You need consistent latency
  • You're fine-tuning the model
  • Debugging model behavior

Integration Options

Python with Ollama API

import ollama

# Basic chat
response = ollama.chat(
    model='qwen3:32b',
    messages=[{
        'role': 'user',
        'content': 'Explain quantum computing in simple terms'
    }]
)
print(response['message']['content'])

# Streaming
for chunk in ollama.chat(
    model='qwen3:32b',
    messages=[{'role': 'user', 'content': 'Write a Python quicksort'}],
    stream=True
):
    print(chunk['message']['content'], end='', flush=True)

OpenAI-Compatible API

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:11434/v1",
    api_key="ollama"
)

response = client.chat.completions.create(
    model="qwen3:32b",
    messages=[{"role": "user", "content": "Hello!"}],
    temperature=0.7
)
print(response.choices[0].message.content)

Open WebUI (ChatGPT-like Interface)

docker run -d -p 3000:8080 \
  --add-host=host.docker.internal:host-gateway \
  -v open-webui:/app/backend/data \
  --name open-webui \
  ghcr.io/open-webui/open-webui:main

Access at http://localhost:3000 and select qwen3:32b from the dropdown.

VS Code with Continue Extension

  1. Install Continue extension
  2. Configure Ollama provider:
{
  "models": [
    {
      "title": "Qwen 3 32B",
      "provider": "ollama",
      "model": "qwen3:32b",
      "contextLength": 32768
    }
  ]
}

vLLM for Production

pip install vllm
python -m vllm.entrypoints.openai.api_server \
    --model Qwen/Qwen3-32B-Instruct \
    --max-model-len 32768

SGLang for High Throughput

pip install "sglang[all]"
python -m sglang.launch_server \
    --model-path Qwen/Qwen3-32B-Instruct \
    --port 30000

Best Use Cases for Qwen 3

1. Multilingual Applications

With 119 languages, Qwen 3 excels at:

  • Translation services
  • Multilingual chatbots
  • Global content creation
  • Cross-language analysis

2. STEM and Technical Work

Top benchmark scores make it ideal for:

  • Mathematical problem solving
  • Scientific analysis
  • Technical documentation
  • Research assistance

3. Code Generation

CodeForces ELO 2,056 and LiveCodeBench 70.7% mean excellent:

  • Algorithm implementation
  • Code review and debugging
  • Refactoring suggestions
  • Multi-file code generation

For serious coding work there's a dedicated model worth knowing about. The flagship Qwen3-Coder-480B-A35B needs 250GB+ of memory and is out of reach for a single workstation, but Alibaba also released Qwen3-Coder-30B-A3B-Instruct (sometimes called "Qwen3-Coder Flash") — a Mixture-of-Experts model with 30B total but only ~3.3B active parameters. That makes it genuinely runnable on a 24GB GPU (or a 32GB+ Mac) at Q4, while still delivering strong agentic-coding performance, native 256K context (extendable toward 1M with YaRN), and a tool-calling format built for assistants like Cline and Qwen Code:

# Locally-runnable coder MoE (~3.3B active) — fits a 24GB GPU at Q4
ollama pull qwen3-coder:30b
ollama run qwen3-coder:30b

If your machine tops out at 16GB, a dense 14B-class model is often the better coding pick than a heavier MoE — our breakdown of the best 14B coding models compares Qwen3-14B against the alternatives at that VRAM tier. For the full feature set, benchmarks, and agent-integration notes on the dedicated coder line, see our Qwen3-Coder model page.

4. Educational Content

Thinking mode enables:

  • Step-by-step tutorials
  • Concept explanations
  • Practice problem generation
  • Adaptive learning assistance

5. Business Analysis

Strong reasoning for:

  • Market analysis
  • Financial modeling
  • Strategic planning
  • Report generation

Troubleshooting Common Issues

Model Runs Out of Memory

# Use smaller quantization
ollama pull qwen3:32b-q4_0

# Reduce context
ollama run qwen3:32b --num-ctx 8192

# Try MoE variant (more efficient)
ollama run qwen3:30b-a3b

Slow Generation Speed

# Check GPU is being used
ollama ps

# Force GPU layers
OLLAMA_NUM_GPU=999 ollama run qwen3:32b

# Verify CUDA
nvidia-smi

Thinking Mode Not Working

# Make sure you're in interactive mode
ollama run qwen3:32b

# Then enable thinking
/set think

Poor Multilingual Output

# Increase context for better language handling
/set parameter num_ctx 16384

# Use system prompt to specify language

Key Takeaways

  1. Qwen 3-32B delivers 72B-class performance on a single RTX 4090
  2. 119 languages make it the best multilingual open model
  3. MoE 30B-A3B gives 30B quality with 3B inference cost
  4. Thinking mode enables deep reasoning like DeepSeek R1
  5. Apache 2.0 license means free commercial use
  6. Performance scaling means smaller models punch above their weight
  7. Easy setup with Ollama gets you running in under 5 minutes

Next Steps

  1. Compare with DeepSeek R1 for reasoning tasks
  2. Compare with Llama 4 for creative writing
  3. Learn about MoE architecture in depth
  4. Check VRAM requirements for your hardware
  5. Build AI agents with Qwen 3
  6. Set up RAG for document chat

Qwen 3 represents the cutting edge of open-source AI from Alibaba. Whether you need the efficiency of the 30B-A3B MoE model, the raw capability of the 32B dense model, or the lightweight speed of the 8B variant, Qwen 3 delivers state-of-the-art performance that runs entirely on your own hardware. The combination of 119 languages, thinking mode, and Apache 2.0 licensing makes it an exceptional choice for both personal and commercial applications.

🎯
AI Learning Path

Ollama’s running. Here’s what to build with it.

Go from “ollama run” to RAG apps, agents, and fine-tuned models — structured and hands-on. First chapter free.

Or own it for life — Lifetime $149 $599, pay once

Liked this? 20 full AI courses are waiting.

From fundamentals to RAG, agents, MCP servers, voice AI, and production deployment with real GitHub repos. First chapter free, every course.

Reading now
Join the discussion

Local AI Master Research Team

Creator of Local AI Master. I've built datasets with over 77,000 examples and trained AI models from scratch. Now I help people achieve AI independence through local AI mastery.

Build Real AI on Your Machine

RAG, agents, NLP, vision, and MLOps - chapters across 20 courses that take you from reading about AI to building AI.

Want structured AI education?

20 courses, 495+ chapters, from $9. Understand AI, don't just use it.

AI Learning Path

Comments (0)

No comments yet. Be the first to share your thoughts!

📅 Published: February 4, 2026🔄 Last Updated: June 20, 2026✓ Manually Reviewed

Build Real AI on Your Machine

RAG, agents, NLP, vision, and MLOps - chapters across 20 courses that take you from reading about AI to building AI.

Was this helpful?

LM

Written by the Local AI Master Team

The team behind Local AI Master

We build Local AI Master around practical, testable local AI workflows: model selection, hardware planning, RAG systems, agents, and MLOps. The goal is to turn scattered tutorials into a structured learning path you can follow on your own hardware.

✓ Local AI Curriculum✓ Hands-On Projects✓ Open Source Contributor
📚
Free · no account required

Grab the AI Starter Kit — career roadmap, cheat sheet, setup guide

No spam. Unsubscribe with one click.

🎯
AI Learning Path

Go from reading about AI to building with AI

20 structured courses. Hands-on projects. Runs on your machine. Start free.

Or own it for life — Lifetime $149 $599, pay once
Free Tools & Calculators