TL;DR

Last verified: December 2, 2026.

MiniMind (jingyaogong/minimind) is a single repository that trains a small language model from random weights. It covers the whole pipeline: tokenizer, pretraining, supervised fine-tuning (SFT), LoRA, DPO, PPO/GRPO/CISPO reinforcement learning, tool calling, agentic RL and distillation. The training code is written in plain PyTorch, without transformers, trl or peft doing the work. The current main model, minimind-3, has about 64 million parameters. There is also a minimind-3-moe variant (198M total, 64M active).

As of December 2, 2026 the repository has 74,596 stars, 9,897 forks and 34 open issues. It is licensed Apache-2.0. The last commit is 96de892 (November 26, 2026). The newest GitHub release tag is still v2 (October 2025), but the minimind-3 weights were published on April 1, 2026 on Hugging Face and ModelScope. It was on GitHub’s daily Trending list on December 2, 2026.

We ran it in a CPU-only container (record below). Everything we tried worked: the install, the released model chatting at about 50 tokens per second, and a 32-step pretraining run from scratch. The headline “2 hours” is real but narrow. It is the project’s own figure for one epoch on a single RTX 3090 using the mini datasets, and the resulting model hallucinates freely. Use MiniMind to learn how an LLM is built, not to ship one.

What it actually is

The README states the goal plainly: train a ~64M model “completely from scratch” for about 3 RMB of GPU rental and about 2 hours, and keep every core algorithm readable.

What you get in the repository:

PartWhat it containsWhere
ModelDecoder-only Transformer (dense + MoE), aligned with Qwen3 / Qwen3-MoE configmodel/model_minimind.py
Tokenizer6,400-token BPE vocabulary with <think>, <tool_call>, <tool_response> markersmodel/tokenizer.json, trainer/train_tokenizer.py
Training scriptsPretrain, full SFT, LoRA, DPO, PPO, GRPO, agentic RL, distillationtrainer/train_*.py
InferenceCLI chat, Streamlit web demo, OpenAI-compatible server, weight convertereval_llm.py, scripts/
DataPre-cleaned JSONL datasets for every stageModelScope / Hugging Face (minimind_dataset)

The architecture is standard for 2026: pre-norm with RMSNorm, SwiGLU, RoPE with YaRN extrapolation, grouped-query attention (8 query heads, 4 KV heads), 8 layers at width 768, and a 32,768-token position limit. The MoE variant uses 4 experts with top-1 routing and no shared expert. The README explains why: a bigger expert count was much slower to train in native PyTorch without fused MoE kernels. The project reports the 4-expert setup is about 50% slower than the dense model.

The small vocabulary is deliberate. Llama 3 uses 128,000 tokens; at 64M parameters a vocabulary that size would spend most of the budget on the embedding and output layers. MiniMind keeps 6,400 and accepts worse compression.

Because the config mirrors Qwen3, the trained weights convert to transformers format and run in llama.cpp, vLLM and Ollama (ollama run jingyaogong/minimind-3).

MiniMind first went public in August 2024, so this is not a launch. The April 2026 minimind-3 release reworked the structure, tokenizer and data, merged tool-call data into the main SFT set, added <think>-based adaptive thinking, and added train_agent.py for multi-turn tool-use RL. A wave of explainer posts followed in November, and the repo landed on the daily Trending list again in early December.

How the pipeline works

The documented quick path has three stages, run from the trainer/ directory:

git clone --depth 1 https://github.com/jingyaogong/minimind
cd minimind && pip install -r requirements.txt

# download pretrain_t2t_mini.jsonl (1.2 GB) and sft_t2t_mini.jsonl (1.6 GB) into ./dataset
cd trainer
python train_pretrain.py      # -> out/pretrain_768.pth
python train_full_sft.py      # -> out/full_sft_768.pth
cd .. && python eval_llm.py --weight full_sft

All training scripts accept --from_resume 1, which restores the model, optimizer and step from ./checkpoints/. Multi-GPU runs use torchrun --nproc_per_node N train_xxx.py (DDP), and DeepSpeed is supported.

After SFT, the optional stages build on the same weights:

  • LoRA (train_lora.py): hand-written low-rank adapters. The README’s examples are a medical adapter and an identity adapter, and it says LoRA training “can usually be completed fairly quickly even on CPU”.
  • DPO (train_dpo.py): preference pairs sampled from DPO-En-Zh-20k.
  • RLAIF (train_ppo.py, train_grpo.py): PPO, GRPO and CISPO with a decoupled rollout engine, so the generation backend can be swapped.
  • Agentic RL (train_agent.py): multi-turn tool use with delayed rewards scored over the whole trajectory.
  • Distillation (train_distillation.py): white-box distillation from a larger teacher.

The data is the quiet strength here. Every stage has a ready-made, cleaned and deduplicated JSONL file: a plain {"text": ...} line for pretraining, or a conversations array for SFT that can include tools and tool_calls fields. You skip the week of data wrangling that usually kills “train your own LLM” weekends.

What the “2 hours, 3 RMB” claim covers

The project’s cost table, for a single RTX 3090 rented at about 1.3 RMB per hour:

ModelPretrain (mini)SFT (mini)Mini pipeline total
minimind-3 (64M)≈1.21 h≈1.10 h≈2.31 h, ≈3.0 RMB
minimind-3-moe (198M-A64M)≈1.69 h≈1.54 h≈3.23 h, ≈4.2 RMB

The project labels these as estimates, and its footnote says “2 hours” is the measured time for one SFT epoch on one 3090. This is the mini data path; the full pretrain and SFT files are 10 GB and 14 GB. Read “2 hours” as “a first working chat model”, not “the released checkpoint”.

Hands-on test (December 2, 2026)

We ran MiniMind in our lab: a throwaway GitHub Actions runner with the python:3.12-bookworm image, 2 CPUs, 8 GB RAM and no GPU, at commit 96de892. All five steps passed, in 293.3 seconds total. The recorded commands and output are shown in the evidence box on this page.

  1. Install (98.9 s). We cloned the repo, installed the CPU build of PyTorch, then ran pip install -r requirements.txt. It finished cleanly with torch 2.15.0+cpu and transformers 4.57.6. torch is commented out of requirements.txt, so you choose the build (CUDA, CPU or MPS) yourself.
  2. Weights download (2.6 s). We pulled jingyaogong/minimind-3 from Hugging Face. model.safetensors is 127,834,168 bytes, so about 128 MB for the full model.
  3. Chat with the released model (23.4 s). We ran the README’s eval_llm.py --load_from ./minimind-3 on CPU in auto-test mode with a 120-token cap. It reported 63.91M parameters and generated at 49.4–51.0 tokens per second on two CPU cores. It answered all eight built-in prompts, which are in Chinese.
  4. Pretraining from scratch (165.3 s). We pretrained on a 256-line toy dataset built from the project’s own README: 32 steps, batch 8, sequence length 128, on CPU. Loss went from 7.82 at step 4 to 6.10 at step 32, and the script wrote a 137,684,407-byte pretrain_768.pth.

What worked well. The install has no surprises, and the released model is genuinely usable as a toy on a laptop-class CPU. The training script runs unchanged on CPU: it falls back from bfloat16 autocast to plain fp32 without any flag. The answers are fluent and well-structured Chinese. The Fibonacci answer produced a correct iterative function before the 120-token cap cut it off.

What the output showed about quality. Read closely, the answers have the fact errors the README warns about. Asked about photosynthesis, the model says light energy is absorbed “through chlorophyll decomposition”. In reality chlorophyll is not broken down; water is split. Its Peking duck recipe cuts the duck into pieces and fries it, which is not how Peking duck is made. Its cats-versus-dogs comparison says cats “reduce the amount of physical activity humans do” and lists that as an advantage. This is the 64M ceiling: fluent shape, unreliable content.

What this test does not tell you. We did not reproduce the 2.31-hour GPU run, the full datasets, or any RL stage. A 32-step run on 256 README lines proves the training loop works. It does not prove the model learns anything useful: after step 8 the loss bounced between 6.1 and 7.2 rather than falling smoothly, which you’d expect from so little data. Our tokens-per-second figure is for two CPU cores with a 120-token cap. GPU speed and long-context behaviour will differ. We also did not test the English quality of the model, because the built-in prompts are Chinese only.

One usability note: eval_llm.py stops to ask for [0] auto test / [1] manual input on stdin. To script it, pipe the choice in (echo 0 | python eval_llm.py ...).

What the project’s own numbers say about quality

The README is unusually candid. It includes raw side-by-side answers from minimind-3, minimind-3-moe and two other ~0.2B Chinese models. It then has GPT-5.4 Thinking score them out of 100. By that subjective scoring, which the project itself calls “experiential reference, not a strict benchmark”, the results were:

ModelAccuracy /30Code /20Total /100
minimind-3-moe (0.2B-A0.06B)111868
chatlm-mini-chinese (0.2B)25362
minimind-3 (0.06B)101761
baby-llama2-chinese (0.2B)8221

The same README shows minimind-3 attributing universal gravitation to Einstein, and the MoE model saying giant pandas eat seafood. The tool-use test is more encouraging: on 20 small arithmetic tasks that require a calculator tool, the project reports the SFT model at 12/20 and the agentic-RL weights at 17/20, while noting an “alignment tax” — the RL weights hallucinate more on open-ended questions.

Honest limitations

  • It is a teaching model. At 64M parameters it cannot be relied on for facts, summaries or code. The project says so, and our run agreed.
  • Chinese first. The data, the default prompts and most of the README examples are Chinese. There is an English README and the model has “some English ability”, but if you want an English-only learning project, expect to bring your own data.
  • GPU needed for the headline. The pipeline runs on CPU, as we showed, but a real pretrain plus SFT on the 2.8 GB of mini data is a GPU job. On two CPU cores, our 32 tiny steps took almost three minutes.
  • Native PyTorch has a speed cost. Writing everything without fused kernels is the point, but MoE training is slower than it would be with DeepSpeed-MoE or Megatron. The README discusses this openly.
  • One maintainer. It is a spare-time project by one developer, and GitHub release tags lag the model releases.
  • Ads in the README. Both the Chinese and English READMEs open with an affiliate banner for a third-party API reseller, unrelated to the code.

Is it safe to run?

It is plain Python with no install scripts, but requirements.txt has 33 entries (Flask, FastAPI, Streamlit, ngrok, swanlab, wandb and more), most only needed for demos and logging. Use a virtual environment. Loading the transformers weights via AutoModelForCausalLM uses trust_remote_code=True, so read model_minimind.py first.

Community reactions

Coverage is broadly positive and consistently caveated. A dev.to write-up says “the real product is the education”. Heatdrop praises how candid the docs are about hallucinations and repetitive loops. TopGit calls it “the most thorough single-repo LLM training tutorial”. The shared criticism matches ours: the capability ceiling is hard, and “2 hours” needs its footnote.

Alternatives

If you want…Look at
A GPT-2-class English model trained end to end, on a rented multi-GPU nodeKarpathy’s nanochat / nanoGPT
A book-length, chapter-by-chapter build in PyTorchSebastian Raschka’s LLMs-from-scratch
To fine-tune an existing open model for real workLLaMA-Factory, Unsloth, Axolotl (see our fine-tuning frameworks guide)
To run capable models locally rather than train themOllama, llama.cpp, LM Studio (see best local LLM tools)

MiniMind is the cheapest of these by a wide margin, and the only one that goes all the way to PPO/GRPO, agentic RL and tool calling in hand-written PyTorch.

Who should use it

  • Developers who want to understand LLM training beyond calling Trainer.train().
  • Students and teachers. A few rented 3090-hours per student is an affordable lab.
  • People experimenting with RL post-training. A 64M model makes GRPO reward design cheap to iterate on.
  • Not for anyone who needs a usable small model for production. For that, start from an open-weight model and fine-tune it. If you are picking hardware for either path, see our GPU guide for local LLMs.

Verdict

MiniMind is the best-documented “build an LLM from zero” repository we have looked at. The pipeline is complete, the data is ready, and the code is readable. It ran without a single change on a GPU-less CI box. Its honesty is part of the value: the README shows its own model getting gravity wrong, and labels its cost figures as estimates with footnotes. Treat the trained model as a specimen to study, not a tool. If that’s what you want, it is an easy recommendation.

FAQ

Can you really train an LLM from scratch in 2 hours with MiniMind?

You can train a first working chat model. The project reports ≈2.31 hours and ≈3 RMB for pretraining plus SFT on its mini datasets on a single RTX 3090. “2 hours” specifically refers to one SFT epoch. The full datasets and the RL stages take longer, and the result is a 64M-parameter model with heavy hallucinations.

Does MiniMind run without a GPU?

Yes for inference and for small experiments. In our December 2, 2026 test on two CPU cores, the released minimind-3 generated about 50 tokens per second, and a 32-step pretraining run finished in 165 seconds. A real pretrain on the 1.2 GB mini dataset is not practical on CPU.

Is MiniMind free for commercial use?

The code is Apache-2.0 (as of December 2, 2026). The datasets are assembled from several sources. The README says it follows each source’s licence, and it names terms such as CC-BY-NC-2.0 among those it complies with. Check the dataset licences before any commercial use of models you train on them.

How big is the MiniMind model?

minimind-3 has 63.91M parameters (as reported when loading it) and a 128 MB model.safetensors file. minimind-3-moe has 198M total parameters with 64M active per token. Older releases range from 26M to 145M.

Can I run MiniMind in Ollama or vLLM?

Yes. The README documents ollama run jingyaogong/minimind-3 and vllm serve on the converted transformers weights. It also ships scripts/serve_openai_api.py, an OpenAI-compatible server for UIs such as Open WebUI or Dify.

Sources