MiniMind: Train a 64M-Parameter LLM From Scratch in Just 2 Hours
MiniMind is an open-source project that trains a 64-million-parameter language model from scratch in about two hours on a single GPU, for roughly the cost of a cup of coffee. It publishes the model, the data, and every line of the training pipeline, so anyone can reproduce the whole journey from random weights to a chatting model.

Key facts
- Project: jingyaogong/minimind on GitHub — train a 64M-parameter LLM from scratch in just 2 hours
- GitHub stars: 66,346, with 8,700 forks (checked 18 November 2026)
- Licence: Apache License 2.0
- Created: 27 July 2024
- Commits: 426, across 2 releases
- Model size: 64 million parameters (minimind-3), about 1/2700th the size of GPT-3
- Training claim: about 2 hours for one SFT epoch on a single NVIDIA 3090, at a rental cost of roughly 3 yuan
- Latest models: minimind-3 (64M) and minimind-3-moe (198M total, 64M active), released 1 April 2026
What Is MiniMind and Why Does It Matter?
Large language models feel like magic boxes. ChatGPT, DeepSeek and Qwen answer brilliantly, but their training runs need clusters of GPUs, datasets measured in trillions of tokens, and budgets no individual can match. Opening the black box and understanding how a model actually works should be exciting, but most learning stops at fine-tuning: take an existing model, add a little LoRA, teach it a few instructions, and call it a day. The project puts it bluntly: that is like teaching Newton to use a 21st-century smartphone, interesting but far from understanding physics.
MiniMind takes the other road. It trains a language model from zero, not from a checkpoint, starting with random weights and a small dataset, and it documents every step. The mainline model has about 64 million parameters, roughly 1/2700th the size of GPT-3, and the README’s headline claim is that one epoch of supervised fine-tuning takes about two hours on a single NVIDIA 3090, with a rental cost of about 3 yuan. That number is specific and honest: the project notes that “2 hours” means the SFT stage running one epoch on one 3090, and “3 yuan” is the GPU rental cost for that window. The point is not that a 64M model competes with frontier models; it is that the full pipeline fits on hardware a student can rent, and every line of it is readable.
The numbers back up the interest. Created in July 2024, MiniMind passed 66,000 stars and 8,700 forks by November 2026, making it one of the most-starred LLM training projects on GitHub. It is also a tutorial in disguise: the project describes itself as a starting point that is reproducible, understandable and extensible, aimed at anyone who wants to learn LLM training by reading code rather than by watching paid courses. New AI learning projects like this one appear regularly on the KongoTech homepage, where each week’s trending developer projects get the same close treatment.
What Does the Full MiniMind Pipeline Cover?
MiniMind is unusual because it covers the entire training chain, not just one stage. It starts with a custom tokenizer trained with byte-pair encoding, including template markers for tool calls, tool responses and thinking, so the model learns the same special tokens it will use at inference time. Then comes pretraining on a cleaned text dataset, followed by supervised fine-tuning that teaches the model to follow instructions and chat. After that, the pipeline keeps going: LoRA fine-tuning implemented from scratch without a wrapper library, knowledge distillation, and reinforcement learning from human feedback with DPO, plus reinforcement learning from AI feedback with PPO, GRPO and CISPO, all implemented natively in PyTorch.
The project also covers the newer ideas. Tool calling lets the model invoke tools during a conversation — AG-UI is the protocol that carries those agent actions into a frontend — and adaptive thinking lets a reasoning model decide whether to show its chain of thought. Agentic RL trains the model across multi-turn tool-use scenarios. There are experimental extensions, too: a diffusion language model, a linear-attention model, a vision model called MiniMind-V, and a multimodal model called MiniMind-O. The mainline architecture aligns with the Qwen3 and Qwen3-MoE ecosystem, so the dense model is about 64M parameters and the mixture-of-experts version is about 198M total with 64M active. What Is Univer shows an agent working inside a live office document, and MiniMind is the same instinct applied to learning: build the thing yourself, from the smallest working piece, instead of only using someone else’s finished product.
How Do You Train MiniMind From Scratch?
The quickest path has two steps after cloning the repository and installing the dependencies. First, download the data: the default reproduction needs only two small files, pretrain_t2t_mini.jsonl and sft_t2t_mini.jsonl, placed in the dataset directory. Second, run the training scripts from the trainer directory. Pretraining is one command:
cd trainer && python train_pretrain.py
That produces a pretraining checkpoint in the output directory. Supervised fine-tuning is the second command:
cd trainer && python train_full_sft.py
That produces the chat model weights. Both scripts support checkpoint saving, so adding --from_resume 1 resumes automatically from the last checkpoint, including the optimiser state and training progress, and it even works when you resume on a different number of GPUs. Multi-GPU training uses torchrun for distributed data parallel, and DeepSpeed is supported for larger runs. Training can be logged to Weights and Biases or to SwanLab, which the project switched to as its default visualiser because it is easier to reach from some networks.
If you would rather skip training and talk to the model first, the released weights are available. Download minimind-3 from Hugging Face or ModelScope, then run the command-line chat with python eval_llm.py --load_from ./minimind-3. There is also a Streamlit web demo for a browser chat window, and the model works with third-party inference engines including Ollama, vLLM, llama.cpp, SGLang and MNN, plus an OpenAI-compatible API server so it plugs into chat interfaces such as FastGPT and Open WebUI.

What Makes MiniMind Different From Other LLM Tutorials?
Most LLM tutorials hide the hard parts behind frameworks. A few lines of code load a model, load a dataset, and start training, because libraries such as transformers, trl and peft expose high-level abstractions. That is convenient, but it keeps you away from the core code. MiniMind implements the key algorithms from scratch in native PyTorch: no framework wrapper stands between you and the attention mechanism, the optimiser step, or the loss function. The project’s own metaphor is that building a plane from Lego yourself is far more exciting than sitting in first class, and the codebase follows that belief.
The second difference is completeness. Many projects show pretraining and stop. MiniMind ships the data for every stage, the tokenizer training code, the evaluation harness for benchmarks such as C-Eval, C-MMLU and OpenBookQA, and the conversion scripts that export models for other frameworks. It also ships the results: a published model list that runs from the original 108M minimind-v1 in September 2024, through the minimind2 series of 26M, 104M and 145M models in April 2025, to minimind-3 and minimind-3-moe in April 2026.
What Are the Honest Limits of a 64M Model?
A 64-million-parameter model will not write your essays, pass hard benchmarks, or replace a frontier model, and MiniMind does not pretend otherwise. Its training data is small, its knowledge is limited, and its answers can be wrong, repetitive or shallow on topics outside its data. The evaluations in the repository compare it with other small models and show the same pattern: it chats, reasons a little, and follows instructions, but its ceiling is low. That is the trade for a model you can train in an afternoon and read end to end.
Two practical limits belong here as well. First, the README is written mostly in Chinese, with an English version available, so some of the deeper documentation rewards a translation tool if you do not read Chinese. Second, the “2 hours” claim is specific to one SFT epoch on one 3090 with the mini datasets; the full pretraining run and the larger data options take longer, and the project says so. Treat MiniMind as a laboratory, not a product: the value is in what you learn by running it, breaking it, and reading the code that makes it work.

Who Should Use MiniMind?
MiniMind fits students and self-taught developers first. If you have read about transformers but never trained one, this is the shortest honest path from theory to a model that talks back. It also fits engineers who use LLMs at work and want to understand what fine-tuning, RLHF and distillation actually do under the hood, because reading the implementation beats reading a diagram. Researchers prototyping a training idea get a small, fast loop: change the code, train for an hour, see the difference.
It also fits teachers. A course on LLM training needs a model students can train on shared or rented hardware, and a 64M model on a single GPU is exactly that. Stitch Skills for Google Stitch shows the same instinct in another tool: package a proven way of working once, reuse it many times. Who should skip it? If you need a capable model for production work, download a larger open model instead; MiniMind is for learning, not for serving users.

Frequently Asked Questions
What is MiniMind?
MiniMind is an open-source project that trains a 64-million-parameter language model completely from scratch in about two hours on a single GPU, publishing the model, the data and the full training pipeline.
How long does it take to train MiniMind?
One epoch of supervised fine-tuning takes about two hours on a single NVIDIA 3090, according to the project. Pretraining and the larger data options take longer, and all scripts support resuming from checkpoints.
What hardware do I need for MiniMind?
A single consumer GPU such as an NVIDIA 3090 is enough for the default reproduction. Multi-GPU training is supported with torchrun, and CPU or Apple Silicon runs are possible but much slower.
What does the MiniMind pipeline include?
Pretraining, supervised fine-tuning, LoRA, knowledge distillation, RLHF with DPO, RLAIF with PPO, GRPO and CISPO, tool calling, adaptive thinking and Agentic RL, all implemented from scratch in PyTorch.
Can I chat with MiniMind without training it?
Yes. Download the released minimind-3 weights from Hugging Face or ModelScope and run python eval_llm.py --load_from ./minimind-3, or use the Streamlit web demo, Ollama, vLLM or llama.cpp.
Conclusion
MiniMind is a small model with a large effect: it turns LLM training from an untouchable industrial process into an afternoon project. With 66,346 stars, 8,700 forks and a pipeline that runs from tokeniser to reinforcement learning in plain PyTorch, it is clearly solving a problem learners feel every day. The model will not beat a frontier system, and it does not try to. Its job is to show you how the magic works, line by line, until you can build it yourself. Clone it, train it, and chat with a model that started as random numbers.