jingyaogong/minimind

🧠 两小时从 0 训出你的 64M 大模型。Train your own 64M LLM from scratch in 2 hours.

Edition record

  • 2026-11-29 · growth · 7d · x-large — rank 7 / 248
  1. 2026-11-29 · growth · x-large — rank 7 / 248
  2. 2026-11-28 · growth · x-large — rank 7 / 251
  3. 2026-11-27 · growth · x-large — rank 7 / 248
  4. 2026-11-25 · growth · x-large — rank 8 / 247
  5. 2026-11-24 · growth · x-large — rank 10 / 243

Editions on the board: 5

What it solves

Large language models are typically huge and expensive to train, which makes it hard for individuals to understand how they work internally or to experiment with them. Existing frameworks like transformers and trl hide the underlying mechanics behind high-level abstractions, so you can run a full training pipeline in a few lines of code without learning what actually happens. MiniMind tackles this by providing a complete, from-scratch implementation of a very small language model (about 64M parameters) that you can train on a single consumer GPU in roughly 2 hours for the supervised fine-tuning stage, at a GPU rental cost of about 3 dollars. It opens the "black box" of LLMs so you can see and modify every step.

How it works

MiniMind provides a minimal Transformer decoder-only architecture (with Dense and MoE variants) aligned with the Qwen3 ecosystem. It includes a custom tokenizer (vocabulary of 6,400 tokens) and training code for it, plus open datasets for pretraining, supervised fine-tuning, and reinforcement learning. The project covers the full training pipeline: pretraining, SFT, LoRA, RLHF (DPO), RLAIF (PPO/GRPO/CISPO), tool use, agentic RL, adaptive thinking, and model distillation. All core algorithms are implemented natively in PyTorch, without relying on high-level abstractions from third-party libraries. It also supports multi-GPU training (DDP, DeepSpeed), training visualization via wandb/SwanLab, evaluation on standard benchmarks, long-context extension via YaRN, and compatibility with popular inference and training frameworks like llama.cpp, vllm, ollama, and Llama-Factory.

Who it’s for

MiniMind is for learners and practitioners who want to understand how large language models work by building one from scratch, rather than just fine-tuning existing models. It is also useful for researchers who need a lightweight, reproducible baseline for experiments. Because it runs on a single consumer GPU (e.g., an RTX 3090) and costs only a few dollars in compute, it is accessible to hobbyists, students, and small teams who want hands-on experience with the entire LLM training process.

Highlights

  • Train a 64M-parameter language model from scratch in about 2 hours on a single RTX 3090, costing roughly $3 in GPU rental.
  • Full training pipeline: pretraining, SFT, LoRA, DPO, PPO/GRPO/CISPO, tool use, agentic RL, adaptive thinking, and distillation.
  • All core algorithms implemented from scratch in PyTorch, with no reliance on high-level abstractions.
  • Open datasets and tokenizer training code provided.
  • Compatible with popular third-party frameworks (transformers, trl, peft, llama.cpp, vllm, ollama, Llama-Factory).
  • Supports multi-GPU training (DDP, DeepSpeed) and training visualization (wandb/SwanLab).
  • Includes evaluation on standard benchmarks and long-context extension via YaRN.
  • Provides a simple OpenAI-compatible API server and a Streamlit chat WebUI.

Related

  • Project
  • Project
  • Project
  • Project
  • Project