Qwen/Qwen3-4B-MLX-8bit

Run locally on Apple devices with Mirai

Type
local
From
Alibaba
Quantization
MLX 8-bit
Parameters
4B
Size
3.9 GB
Source
Hugging Face

An 8-bit quantized version of Qwen3-4B, optimized for efficient inference on Apple Silicon using the MLX framework. Part of the Qwen3 generation of large language models from Alibaba's Qwen team, this variant brings powerful reasoning and conversational capabilities to local Mac hardware.

Key Features

  • Dual-mode reasoning: Seamlessly switch between a thinking mode — where the model engages in step-by-step reasoning for math, coding, and logic tasks — and a non-thinking mode for fast, general-purpose dialogue. Both modes are available within a single model via the `enable_thinking` toggle or in-prompt `/think` and `/no_think` commands.
  • 4 billion parameters (3.6B non-embedding) across 36 layers, using Grouped Query Attention (32 Q heads, 8 KV heads).
  • 32,768 token native context, extendable to 131,072 tokens using YaRN rotary position embedding scaling.
  • 100+ language support, with strong multilingual instruction following and translation capabilities.
  • Agent and tool-calling proficiency, with reliable integration into external tools and frameworks like Qwen-Agent and MCP-compatible servers.

Architecture & Quantization

The base Qwen3-4B model is a causal language model that went through both pretraining and post-training stages. This MLX release applies 8-bit quantization, reducing memory footprint while retaining high output quality — ideal for on-device inference via `mlx_lm` (≥ 0.25.2).

Ideal Use Cases

  • Local AI assistants on macOS with Apple Silicon
  • Complex reasoning, code generation, and math problem-solving (thinking mode)
  • Lightweight, responsive chat and creative writing (non-thinking mode)
  • Multilingual applications and agentic workflows with tool integration

Provenance

Released by the Qwen team under the Apache 2.0 license. Compatible with `transformers` (≥ 4.52.4) and `mlx_lm` for straightforward integration.

Explore all local models
1
Choose framework
2
Run the following command to install Mirai SDK
spm https://github.com/trymirai/uzu.git
3
Apply code
1import Uzu23public func runChat() async throws {4    let engineConfig = EngineConfig.create()5    let engine = try await Engine.create(config: engineConfig)67    guard let model = try await engine.model(identifier: "Qwen/Qwen3-4B-MLX-8bit") else {8        return9    }10    for try await update in try await engine.download(model: model).iterator() {11        print("Download progress: \(update.progress())")12    }1314    let messages = [15        ChatMessage.system().withText(text: "You are a helpful assistant"),16        ChatMessage.user().withText(text: "Tell me a short, funny story about a robot")17    ]18    let session = try await engine.chat(model: model, config: .create())19    let stream = await session.replyWithStream(input: messages, config: .create())20    var message: ChatMessage? = nil21    for try await update in stream.iterator() {22        switch update {23        case .replies(let replies):24            message = replies.last?.message25        case .error(let error):26            print("Error: \(error)")27        }28    }29    print("Text: \(message?.text() ?? "empty")")30}

Other local models from Alibaba