Back to all resources
minimind-3 · 64M params Apache-2.0 · free Single GPU, PyTorch native LIVE

Train the model instead of just prompting one.

Fine-tuning someone else's model teaches you the API, not what is happening inside it. MiniMind is a complete language model pipeline, pretraining, supervised fine-tuning, LoRA, RLHF and reinforcement learning, written from scratch in PyTorch with no high-level abstraction hiding the steps. The full pipeline needs real GPU time and money. One epoch of the fine-tuning stage alone is the part that runs in about two hours on a single 3090.

By Raj Singh · September 2026 · 60k stars · 64M to 198M params, your choice · 6 min read

WHAT IT LOOKS LIKE

The training loss curve dropping over a single run, next to the minimal Streamlit chat UI the finished model talks through. No managed platform, no hosted dashboard, both run on the machine that trained the model.

A line chart of pretraining loss decreasing over training steps
A finished run, and the chat UI it powersjingyaogong / minimind
BEFORE YOU INSTALL IT

The two-hour figure is one stage. It is the measured time for one epoch of supervised fine-tuning on a single NVIDIA 3090, not the full pipeline from raw pretraining to a working chat model. Pretraining is separate GPU time on top of it.

You supply your own PyTorch. torch, torchvision and peft are commented out in requirements.txt on purpose. Install the build that matches your CUDA version yourself rather than taking whatever pip resolves.

Two model sizes ship today. minimind-3 at 64M dense parameters and minimind-3-moe at 198M total with 64M active, both released April 2026 and aligned to the Qwen3 architecture family.

It plugs into real inference engines. Trained checkpoints work with llama.cpp, vllm and ollama, plus an included OpenAI-API-compatible server, so the model you trained is not stuck in a research notebook.

Licence, in plain English: Apache-2.0. Free for commercial work, fine to embed in your own tools, no obligation beyond keeping the licence file.

Honest limitA 64M-parameter model trained on a single GPU is a teaching tool for understanding the pipeline, not a production chatbot. Expect the reasoning quality of a much smaller model than the one you talk to every day.
Read the whole setup

Get the setup that works.

Drop your email and unlock the rest: what you need, the pipeline in the order to run it, the config values that decide model size, and where the checkpoints land.

One email. No follow-up unless I ship something that fits.

WHAT YOU NEED
  • An NVIDIA GPU. A single 3090 is the reference card the timing claims are measured against
  • Python with PyTorch installed for your specific CUDA version, before anything else
  • A cloud GPU rental, if you do not own one. Renting by the hour is the cheaper path to the reference timing
INSTALL

Clone shallow, install the rest yourself

The shallow clone skips the training history, which is large. Install PyTorch for your GPU before the rest of requirements.txt, since the file leaves it commented out on purpose.

The install

terminalsingle GPU machine
$ git clone --depth 1 https://github.com/jingyaogong/minimind $ pip install torch --index-url https://download.pytorch.org/whl/cu124 $ cd minimind && pip install -r requirements.txt

Pretraining scripts and datasets live under dataset/ and trainer/, staged so you can run pretrain, then SFT, then the alignment stages in sequence without rewriting paths.

Prove itRun the SFT stage for one epoch on the smallest dataset variant first. A completed run in roughly two hours on a 3090-class card confirms your environment matches the reference timing.
CONFIGURE

Model size is a config choice

Dense versus MoE and the parameter count are set before training starts, not after. Pick the size that matches the GPU memory you actually have.

training configmy values
# dense, 64M, fits an 8-12GB card comfortably model_type: dense, dim: 512 # MoE, 198M total / 64M active, needs more VRAM headroom
SettingDefaultWhy I change it
model_typedenseMoE gets more effective capacity from the same active-parameter compute, worth it once dense training runs cleanly.
wandb / swanlab loggingoffTurn one on before a multi-hour run. Watching the loss curve live catches a bad learning rate long before the run finishes.
GPU memoryThe reference 3090 has 24GB. A smaller card should start with the dense 64M configuration, not the MoE variant, until you have confirmed it fits.
DAILY DRIVING

The pipeline runs in stages

Each stage is a separate script and produces a checkpoint the next stage reads. Running them out of order is the most common way to waste GPU hours.

  • Pretrain first. Learns language structure from raw text. This is the expensive stage the two-hour figure does not include.
  • Then SFT. Supervised fine-tuning on instruction data, one epoch, the stage the timing claim describes.
  • Then align, if you want it. LoRA, DPO, or the PPO/GRPO/CISPO reinforcement stages layer on top of a working SFT checkpoint.

Serve the finished checkpoint with the included OpenAI-compatible server, or export it to llama.cpp or ollama for a lighter runtime.

WHEN IT DRIFTS

Two failures, both configuration

Out of memory partway through
The MoE configuration or a batch size sized for a 24GB card was used on a smaller GPU. Drop to the dense 64M model and reduce batch size before anything else.
Loss does not move
PyTorch installed without matching CUDA support silently falls back to CPU or a broken kernel. Re-check the PyTorch install against your driver version first.
ResumingTraining supports checkpoint resume across an interrupted run, including across a different GPU count, so a cloud rental timing out mid-run does not mean starting over.
THE SHAPE OF IT

Where everything lives

dataset/the pretrain, SFT and RLAIF data files model/the from-scratch model architecture code trainer/one script per pipeline stage scripts/conversion, LoRA merge and serving utilities images/the loss curves and architecture diagrams from the README

A finished checkpoint is a plain PyTorch state file. Nothing about serving or exporting it depends on this repo staying installed.

That is the whole setup

Pretrain, fine-tune, align, all from scratch, all on one GPU. The two-hour, one-epoch fine-tuning run is the fast part. Understanding what happened in it is the actual point.

Open on GitHub →

↑ Unlocks the moment you submit the form above.

RS
WRITTEN BY

Raj Singh

I'm Raj Singh, founder of DebtOps.ai and a Claude certified partner. Over the last five years I've managed $25M in ads, built AI solutions for Fortune 100 companies, and installed AI operating systems and AI brains inside small businesses. Everything here is something I've shipped, debugged, or watched a client ship. My goal with AgileSingh is to make you irreplaceable in this AI age.

$25M
Ads managed · 5 yrs
F100
Enterprise AI builds
Claude
Certified partner
22
Guides shipped
More guides

Now put a small model to work.

A model you trained yourself is a good teaching exercise. The AI infrastructure guide covers where a model like this actually earns its place in a real stack.