创建

登录 ReadmeX

或

了解我们如何处理你的信息: 隐私政策

ReadmeX

陪你读懂 AI 动态

今天,想先了解什么?

选一份动态总结,或直接聊聊你的问题。

社区和关注动态总结只属于你自己。

资讯

开发者发布190行纯JAX版DeepSeek-V3

AI 总结

开发者以190行纯JAX代码实现了DeepSeek-V3架构的多个关键组件,并同时提供测试、检查点、训练日志、图解和复现说明。作者称其在一台MacBook Air M5上使用公版侦探小说从头预训练了一个3620万参数模型,但明确表示这只是架构演示,并非能力强大的语言模型。该项目未实现稀疏专家调度、MLA权重吸收、FP8训练、DualPipe、节点限制路由、YaRN及后训练。

深度见解

该项目为理解MLA、DeepSeekMoE路由、负载均衡和多词元预测提供了紧凑且易读的参考,但训练结果均来自作者自述,实现也与完整的DeepSeek-V3并不等价。

The architecture from the DeepSeek-V3 technical report in 190 lines of pure JAX, pretrained from scratch on a MacBook Air on public-domain detective fiction.

No Flax, no Equinox, no PyTorch. Params are plain dicts of arrays and every part of the model is a function you can read top to bottom in deepseek_v3.py.

Read the write-up:DeepSeek V3 in 190 lines of pure JAX, with diagrams, the code explained piece by piece, and the results.

What's in the 190 lines

Idea from the paperWhat it doesWhere
Multi-head Latent Attention (MLA)Caches one small latent per token instead of full keys and values: 480 → 144 numbers per token per layer heremla, init_cache
Decoupled RoPEOne rotary key shared by all heads, kept outside the compressed latentrope, apply_rope, mla
DeepSeekMoE1 shared expert that always runs + 16 routed experts, top-4 per tokenroute, moe
Auxiliary-loss-free balancingA per-expert bias nudges routing toward idle experts; it changes which experts are picked, not their weightsupdate_bias, route
Sequence-wise balance lossThe small complementary loss from the paper (α = 1e-4)seq_balance_loss
Multi-token prediction (MTP)An extra module also predicts the token after next, weighted λ = 0.3 in the lossforward, loss_fn
Training and generationbf16 compute on f32 master weights; prefill + decode with the MLA cachemake_train_step, generate

#DeepSeek-V3#deepseek-v3-jax#JAX#DeepSeekMoE#Multi-head Latent Attention#DeepSeek-AI

原文约 6 分钟读完阅读原文
群聊

还没有评论,来说说你的看法。