Skip to content

Qwen3 Dense

Model guide index

Overview and status

Registry type: qwen3. The dense decoder adds bias-free attention, Q/K normalization, and explicit head dimensions to the shared GQA/RoPE stack. Native text loading, cache, completion, chat, sampling, and streaming are implemented. Qwen/Qwen3-0.6B is a supported primary checkpoint with real generation and applicable interface records. See the current support inventory. Measured quality and throughput retain their own workload scope. Qwen3 MoE checkpoints are outside this dense implementation.

Model Architecture

The diagram follows the native implementation. Layer counts, widths, head counts, and input sizes come from the checkpoint configuration; this is an architecture map, not an additional support or qualification claim.

Token IDs → token embeddings
    ↓
┌──────────────────── Decoder block × L ──────────────────────┐
│ RMSNorm → bias-free Q/K/V → Q/K norm → GQA + RoPE   → add   │
│ RMSNorm → gated feed-forward (SwiGLU)               → add   │
└─────────────────────────────────────────────────────────────┘
    ↓
Final RMSNorm → LM head → next-token logits

Papers and upstream references

Paper: Qwen3 Technical Report.

Only the dense decoder is shown. Thinking/non-thinking behavior comes from the checkpoint and chat template, not a second decoder branch.

Installation and assets

Use Python 3.10+ and python -m pip install -e . from the repository root. Model execution needs Apple Silicon/Metal. Supply the matching config.json, complete safetensors weights/index, tokenizer.json, tokenizer metadata, and chat template. Keep explicit head_dim from the checkpoint; it need not equal hidden_size / num_attention_heads.

Completion and chat

mlx-one inspect Qwen/Qwen3-0.6B
mlx-one generate Qwen/Qwen3-0.6B "The advantages of unified memory are" \
  --max-tokens 64 --temperature 0 --stream

The CLI uses a raw completion prompt. For instruct chat, let the checkpoint template format the messages. This candidate example may download the model; add an immutable revision to load_text_model for a reproducible run.

from mlx_one import TextGenerationOptions, load_text_model, stream_chat

bundle = load_text_model("Qwen/Qwen3-0.6B")
for chunk in stream_chat(
    bundle,
    [{"role": "user", "content": "What is unified memory?"}],
    options=TextGenerationOptions(max_tokens=64),
    template_options={"enable_thinking": False},
):
    print(chunk.text, end="", flush=True)

enable_thinking is passed to the loaded template. It only affects templates that implement it; the ChatML fallback has no thinking switch. Enabling thinking needs a larger generation budget and does not constitute reasoning qualification.

Cache and troubleshooting

Use dense KV. The current experimental block backend is restricted to dense Qwen2/Qwen2.5, so Qwen3 does not inherit its support. Neither prefix reuse nor long-context performance is qualified by these examples. Reduce context/output size when memory admission fails; the config's maximum is not a safe-memory promise. Unexpected tensor shapes often indicate a MoE checkpoint or a lost explicit head dimension. Use the separate embedding and reranker guides for retrieval tasks.

Implementation and validation

See configuration, model, and weights. Backend-free tests and Metal tests cover the native families.

pytest -q tests/test_native_qwen_architectures.py
MLX_ONE_RUN_MLX_TESTS=1 pytest -q tests/test_native_qwen_mlx.py

Qualification definitions and candidates are in the root README and model catalog.


Edit this page