Train a 64M-parameter language model from scratch in about two hours
open sourceApache-2.0free
MiniMind is an end-to-end pipeline, written in plain PyTorch, for training an ultra-small language model of about 64M parameters from scratch, which its README puts at about two hours and RMB 3 of GPU rental for one SFT epoch on a single RTX 3090. It covers data cleaning, pretraining, supervised fine-tuning, LoRA, DPO, PPO and GRPO reinforcement learning, tool use, agentic RL, MoE and distillation, and its trained models are on Hugging Face. Its author presents it both as a reproduction of the LLM training pipeline and as a hands-on way to learn how LLMs are built.
Problems it solves
- train a small language model from scratch on one consumer GPU
- a readable end-to-end LLM training pipeline I can modify, from pretraining to RLHF
- try GRPO or DPO on a tiny model without renting a cluster
- reproduce the whole chatbot training pipeline cheaply
Features
- pretraining, SFT, LoRA and distillation for a 64M-parameter model
- DPO, PPO, GRPO and CISPO reinforcement learning stages
- MoE, tool use, agentic RL and adaptive thinking
- core algorithms in native PyTorch without high-level training libraries
- trained models published on Hugging Face
- sibling projects for vision, omni, diffusion and linear-attention models
Alternatives
The same job
These do what MiniMind does.
- nanochat The best ChatGPT that $100 can buy
- Colossal-AI PyTorch library for distributed training, fine-tuning and inference of large AI models
- torchtitan A PyTorch-native platform for training generative AI models at scale
- OpenRLHF Scalable RLHF and agentic RL framework on Ray and vLLM
