← All projects
Project record1 mention
Originally shared on Hacker News

DeepSeek V3 in ~200 lines of pure Jax

A ~190-line from-scratch reimplementation of DeepSeek V3's core ideas in pure JAX — multi-head latent attention, mixture-of-experts with bias-based load balancing instead of an auxiliary loss, and multi-token prediction. A 36.2M-parameter version was trained on a MacBook Air M5 (24 GB) with jax-metal on 207 old detective novels (12,000 steps in ~2.6 hours), and the trained checkpoint and exact data are available in the v1.0 release so text can be generated without training.

Last shared
01 / The problem

What it addresses

Understanding what actually makes DeepSeek V3 different, by rebuilding its main ideas from scratch.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. DeepSeek V3 in ~200 lines of pure Jax

    A ~190-line from-scratch reimplementation of DeepSeek V3's core ideas in pure JAX — multi-head latent attention, mixture-of-experts with bias-based load balancing instead of an auxiliary loss, and multi-token prediction. A 36.2M-parameter version was trained on a MacBook Air M5 (24 GB) with jax-metal on 207 old detective novels (12,000 steps in ~2.6 hours), and the trained checkpoint and exact data are available in the v1.0 release so text can be generated without training.

    Problem: Understanding what actually makes DeepSeek V3 different, by rebuilding its main ideas from scratch.

    Posted by @VaibhaavTiwari · Original source ↗

    Story title · @VaibhaavTiwari · · Source ↗

    Show HN: DeepSeek V3 in ~200 lines of pure Jax

    Submitted URL · @VaibhaavTiwari · · Source ↗

    https://github.com/Vaibhaav-Tiwari/deepseek-v3-jax

    Source text · @VaibhaavTiwari · · Source ↗

    so I rebuilt its three main ideas from scratch in pure JAX: Multi-head Latent Attention, mixture-of-experts with bias-based load balancing instead of an auxiliary loss, and multi-token prediction. The model is about 190 lines.

    Source text · @VaibhaavTiwari · · Source ↗

    It’s a 36.2M-parameter version trained on a MacBook Air M5 (24 GB) with jax-metal, on 207 old detective novels. 12,000 steps took about 2.6 hours.

    Source text · @VaibhaavTiwari · · Source ↗

    The trained checkpoint and exact data are in the v1.0 release, so you can generate text without training.

    Source text · @VaibhaavTiwari · · Source ↗

    I wanted to understand what actually makes DeepSeek V3 different

    Source text · @VaibhaavTiwari · · Source ↗

    Full write-up with diagrams and results: https://vaibhaav.in/writing/deepseek-v3-jax/

    Source text · @VaibhaavTiwari · · Source ↗

    I wanted to understand what actually makes DeepSeek V3 different, so I rebuilt its three main ideas from scratch in pure JAX