Understanding and Implementing Qwen3 From Scratch
- Source
- magazine.sebastianraschka.com
- Author
- Sebastian Raschka, PhD
- Date

Context
Sebastian Raschka's Qwen3 tutorial moves from architecture diagrams to rebuilding model components in PyTorch. Its stated scope includes dense models and variants, with the aim of giving learners components they can inspect and adapt.
That comparison exposes a concrete design choice. Qwen's expert models select a subset of neural subnetworks for each token, rather than using every expert. The technical report documents this routing. The tutorial is a hands-on continuation of Raschka's conceptual gpt-oss architecture analysis, aimed at understanding how those design choices become code.
- Qwen3's 235B instruct model ranked 8th on LMArena, tied with the proprietary Claude Opus 4. The only models above it, DeepSeek 3.1 and Kimi K2, are about 3x and 4x larger, so Qwen3 wins on performance per parameter.
- Qwen released a 1T-parameter 'max' variant that beat Kimi K2, DeepSeek 3.1 and Claude Opus 4 on every major , and kept it closed. The open Qwen3 weights are deliberately not the lab's strongest model.
- The case for reading code over diagrams: an architecture figure shows you the boxes, but only a working PyTorch implementation pins down tensor shapes and the order operations actually run in, which is what you need to modify it.
- mixture-of-experts — A model built from many specialist sub-networks where only a few activate per token, giving big-model capability at small-model running cost.
- LLM — A large language model — the neural network behind tools like Claude and ChatGPT, trained on huge amounts of text to predict what comes next.
- open weights — A model whose trained parameters are published for anyone to download and run — unlike API-only models you can access but never possess.
- benchmark — A standard public test set for comparing AI models — the shared scoreboards behind every "model X beats model Y" claim.
“While the code sections may look verbose, I hope that they help explain the building blocks better than conceptual figures alone!”
Checking sign-in…
Loading comments…






