You can now train your own LLM from scratch in about 2 hours.
It's called MiniMind, a 64M-parameter language model, about 1/2700 the size of GPT-3, built so anyone can see how an LLM is actually made.
The full training pipeline is included:
1. Data cleaning and pretraining 2. Supervised fine-tuning (SFT) 3. LoRA 4. Preference training with DPO 5. Reinforcement learning with PPO and GRPO 6. Tool use and agentic RL 7. Model distillation
Everything is written in plain PyTorch, with no high-level libraries hiding the parts that matter.
It runs on a single consumer GPU like an RTX 3090.
There are also vision, multimodal and diffusion versions if you want to go further.
Link: github.com/jingyaogong/minimind
If you've only ever called an LLM through an API, this is the best way to learn what happens underneath.
