← Sat, Nov 14 digest

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

read article ↗ hn thread ↗

A developer implemented the core DeepSeek-V3 architecture, including Multi-head Latent Attention and auxiliary-loss-free MoE, in roughly 190 lines of pure JAX and trained it locally on a MacBook Air.

read it Offers a remarkably compact, readable implementation of complex modern LLM architectures like MLA and MoE that technical readers can study in an afternoon.

summary

Vaibhaav Tiwari built a 36.2M parameter miniature version of DeepSeek-V3 using about 190 lines of pure JAX, completely avoiding heavy frameworks like PyTorch or Flax. The implementation includes advanced architectural features like Multi-head Latent Attention, auxiliary-loss-free load balancing, and multi-token prediction. Trained from scratch on a MacBook Air using public-domain detective fiction, the project demonstrates that state-of-the-art ideas can be cleanly isolated and studied locally. The accompanying write-up provides deep-dive diagrams, performance metrics, and complete reproducibility steps.

key points

  1. Implements core DeepSeek-V3 mechanisms—including MLA, DeepSeekMoE, auxiliary-loss-free balancing, and MTP—in just 190 lines of pure JAX.
  2. Trained a 36.2M parameter model on 21.7 million tokens of public-domain detective fiction in 2.6 hours on a MacBook Air M5.
  3. Demonstrates that bias-based load balancing successfully evens out expert load without impacting validation loss.

who should read it

Machine learning engineers and developers looking to understand modern LLM architectures like MLA and MoE from first principles.

discussion warm

consensus

Commenters are overwhelmingly enthusiastic, praising the project as an exceptional educational resource for learning modern LLM mechanics from scratch.

best comment by joebarbere ↗

Thanks for this! I've been trying to get local training working on Fedora with ROCm for a while now, and this is the first project that ran end-to-end on my RX 7600 XT 16GB.

The whole reason for me buying the card was to play around with deep learning and models, so it's awesome to have a stepping off point now!

No CUDA meant ROCm surprisingly just worked with JAX.

Gotchas for anyone with a 7600 XT: it needed two env vars, HSA_OVERRIDE_GFX_VERSION=11.0.0 because JAX's plugin rejects gfx1102, and XLA_FLAGS=--xla_gpu_enable_triton_gemm=false to stop a GPU hang.

I'm on Fedora 45 with the …

A commenter shares practical instructions and environment variables for running the JAX code smoothly on AMD ROCm hardware.

Generated by an LLM from the article and thread. Check the sources before relying on it.