ai newsFr., 4. Dez.
EilmeldungAlibaba Releases Qwen4-35B-A3B: Open-Weight MoE Model With 1M Context

Can You Train a 64M LLM in 2 Hours for ¥3? Inside 75.4K-Star MiniMind's 4,753 Lines of Pure PyTorch

jingyaogong/minimind just surged past 75,382 stars ( 9,985 forks, Apache-2.0) on GitHub Trending. Its headline hook— "Train your own 64M LLM from scratch in 2 hours for ¥3" —travels fast, and often gets misread as a shortcut to building a cheap production assistant on a laptop. I inspected all 22 P

dev.toFreitag 06:33 · 04.12.2 Min. Lesezeit
Bild: dev.to

jingyaogong/minimind just surged past 75,382 stars ( 9,985 forks, Apache-2.0) on GitHub Trending. Its headline hook— "Train your own 64M LLM from scratch in 2 hours for ¥3" —travels fast, and often gets misread as a shortcut to building a cheap production assistant on a laptop.

I inspected all 22 Python files ( 4,753 total lines) and read through README.md down to its benchmark tables at line 1,628. Here is what makes the codebase genuinely special—and the four fine-print realities hidden behind the tagline.

High-level libraries ( transformers, trl, peft ) let you fine-tune in twenty lines, but they hide how RoPE scaling, GQA, MoE routing loss, or GRPO advantages actually execute tensor by tensor.

MiniMind strips away training-framework abstractions and aligns its 2026 minimind-3 mainline with Qwen3 / Qwen3-MoE across clean, standalone PyTorch scripts:

Reading model_minimind.py ( 293 lines) alongside train_pretrain.py ( 166 lines) and train_grpo.py ( 322 lines) over a weekend teaches more real mechanics than most paid courses.

Credit to the author: none of these caveats are hidden—they are documented right inside README.md, just skipped by viral reposts.

Line 42 of README.md explicitly clarifies:

"2 hours" refers to 1 epoch of SFT on a single NVIDIA RTX 3090 (24 GB), and "¥3" is the corresponding cloud GPU rental cost.

Line 252 shows the author's actual workstation: 8 × RTX 3090 (24 GB) + 128 GB RAM. Quick demos use pretrain_t2t_mini.jsonl ( 1.2 GB ) + sft_t2t_mini.jsonl ( 1.6 GB ), whereas the full minimind-3 mainline corpus requires 10 GB pretrain + 14 GB SFT JSONL plus rlaif.jsonl ( 24 MB ) and agent_rl.jsonl ( 86 MB ).

Because MiniMind avoids custom fused Triton or DeepSpeed-MoE kernels to stay readable, routing tokens into per-expert buckets multiplies kernel-launch overhead. Line 599 openly notes that 4 experts / top-1 MoE trains roughly 50% slower than the matching dense model.

Keeping vocab_size = 6400 stops the embedding and LM-head layers from dominating a 64M parameter budget, but splits Chinese and English text into significantly more tokens per sentence than modern 100K+ tokenizers.

Line 1,628 publishes transparent zero-shot benchmarks (where random 4-choice guessing sits at 25% ):

Similarly, the bundled tool-calling data comes from ~100k qwen3-4b traces across ~10 mock tools (weather, math, time)—great for learning multi-turn <tool_call> formatting, not generalizable agent production.

When reading LLM training repos from scratch, which piece tripped you up first—GQA/RoPE tensor shapes or writing DPO/GRPO losses cleanly?

Quelle: dev.to (dev.to). Original öffnen