🎉 Giảm 20% cho đơn hàng đầu tiên!✦🚚 Miễn phí vận chuyển cho đơn trên 500.000₫✦⚡ Flash Sale — Số lượng có hạn!✦🎁 Quà tặng kèm cho đơn từ 1.000.000₫✦🎉 Giảm 20% cho đơn hàng đầu tiên!✦🚚 Miễn phí vận chuyển cho đơn trên 500.000₫✦⚡ Flash Sale — Số lượng có hạn!✦🎁 Quà tặng kèm cho đơn từ 1.000.000₫✦
MiniMind: Train a 64M-Parameter LLM From Scratch in 2 Hours on an RTX 3090 for 3 RMB
Quay lại Blog

MiniMind: Train a 64M-Parameter LLM From Scratch in 2 Hours on an RTX 3090 for 3 RMB

3 tháng 12, 202610 phút đọcVũ Khôi
English
#English#AI tạo sinh#Lập trình
Vũ Khôi

Vũ Khôi

Tác giả tại Wotech Electronics Blog

MiniMind: Train a 64M-Parameter LLM From Scratch in 2 Hours on an RTX 3090 for 3 RMB

On GitHub there is a repo with nearly 75,000 stars and 10,000 forks, maintained by one programmer in his spare time. This codebase lets you train a 64-million-parameter LLM from scratch. According to the author's estimate, the whole process takes only about 2 hours on a rented RTX 3090 GPU, costing around 3 RMB (just over 10,000 VND).

That is MiniMind (jingyaogong/minimind) — from Tùng Nguyễn's post in the AI Việt Nam group on 02/12/2026. The model is about 2,700 times smaller than GPT-3, compact enough to run on a personal computer. All the main steps are rewritten from scratch in PyTorch instead of hidden behind packaged libraries, so you can read every line of code to understand the mechanism underneath.

Quick answer

  • What is MiniMind: an open-source repo (Apache 2.0) that trains a small LLM from scratch in pure PyTorch — without transformers, trl, or peft doing the work. The current model, minimind-3, has about 64 million parameters (exactly 63,912,192 per an independent count), 8 layers, hidden size 768, vocabulary 6,400. There is also an MoE variant, minimind-3-moe: 198 million total parameters, 64 million active.
  • The repo is verified real: github.com/jingyaogong/minimind, public since August 2024; as of 02/12/2026 it has 74,596 stars and 9,897 forks — matching the post's "nearly 75,000 stars and 10,000 forks". It reached #1 GitHub Trending Repository of the Day.
  • Cost and time — stated precisely: the README's cost table lists pretrain (mini) ≈ 1.21 hours + SFT (mini) ≈ 1.10 hours = total ≈ 2.31 hours, ≈ 3.0 RMB on a single RTX 3090 rented at ~1.3 RMB/hour. The "2 hours" slogan in the README is actually the measured time of a single SFT epoch (per the README's own footnote) — the full pretrain + SFT pipeline is about 2.3 hours. The post's "about 2 hours" is the author's shorthand; the detailed figure is 2.31 hours.
  • It covers the full 5 stages of a modern LLM: Pretrain to learn next-word prediction, SFT to learn question-answering, DPO and RL to optimize answers, LoRA to fine-tune on private data (this step runs on CPU), and finally tool calling with reasoning. The repo also ships an OpenAI-compatible API server so you can connect straight to familiar chat interfaces.
  • The most telling detail: asked about Hangzhou specialties, the model trained for 2 hours answered with great confidence but listed only generic, unrelated dishes. Fluency can be created very quickly and cheaply; correct knowledge costs much more.
  • Limits: for learning purposes only (requires Python and the command line), not for production environments. Code is open under Apache 2.0, but some accompanying datasets do not allow commercial use, so read carefully if you plan to put it in a product.

Why MiniMind differs from most "learn LLMs" tutorials

Most "learn LLMs" content stops at inference or LoRA — using an existing model and lightly fine-tuning it. MiniMind keeps everything in one tree: model code, tokenizer training, datasets, and RL scripts, so you can see how attention, MoE routing, and chat templates connect. The main steps are rewritten from scratch in pure PyTorch, so reading each line of code teaches you the mechanism underneath, instead of calling a library function and guessing what happens inside.

The minimind-3 configuration (per the README, confirmed by an independent audit on 21/11/2026):

Component Specification
Parameters 63,912,192 (~64M) — the README's "about 64M" is exact
Architecture Decoder-only Transformer, 8 layers, hidden 768, 8 query heads / 4 KV heads, RoPE with YaRN, vocab 6,400, tied embeddings
MoE variant minimind-3-moe: 198M total, ~64M active (4 experts, top-1)
Pipeline Tokenizer → Pretrain → SFT → DPO → PPO/GRPO/CISPO RL → LoRA → Tool calling → Agentic RL → Distillation
Server OpenAI-compatible (serve_openai_api.py, with reasoning_content and tool_calls fields)
Inference ~50 tokens/second on 2 CPU cores (per an independent review run in a CPU-only container)

5 stages in one repo: the full life cycle of an LLM

Running the project takes you through the complete 5 stages of a modern LLM:

  1. Pretrain — learning to predict the next word. The model learns next-word prediction on raw text. This stage creates the foundational "language ability".
  2. SFT — learning to answer questions. Supervised Fine-Tuning teaches the model to respond in conversational format, from existing Q&A data.
  3. DPO and RL — optimizing answers. Direct Preference Optimization and reinforcement learning (PPO/GRPO/CISPO) teach the model to pick answers humans prefer, rather than merely grammatically correct ones.
  4. LoRA — fine-tuning on private data. Low-Rank Adaptation trains only a small fraction of parameters, so this step runs on CPU — the cheapest and most practical step for anyone wanting to try with their own data.
  5. Tool calling with reasoning. The model learns to use <think> tags to reason and call tools — a step toward agentic behavior, not just chat.

The repo also ships an OpenAI-compatible API server, so you can connect your own model to familiar chat interfaces without writing an extra client.

The lesson from Hangzhou specialties: fluency is cheap, correctness is expensive

Even without programming, the demo of the model after 2 hours of training is worth watching. Asked about Hangzhou specialties, it answered with great confidence but listed only generic, unrelated dishes.

This reflects a reality: fluency can be created very quickly and cheaply, while correct knowledge costs much more. An AI system that writes smoothly is like a novice MC — perfect pronunciation and well-timed pauses, but not necessarily a grasp of the news content. When applying AI to work, what needs verifying is the data source, not how beautiful the wording is.

This is also why the author stresses: MiniMind is a learning tool, not a production model. At 64 million parameters and a few GB of training data, it offers basic dialogue, not reliable facts, summaries, or code.

2 notes before using it: what "2 hours" means, and benchmark data

First, "2 hours" is a narrow figure. Per the README's own cost table: pretrain (mini) ≈ 1.21 hours + SFT (mini) ≈ 1.10 hours = ≈ 2.31 hours, ≈ 3.0 RMB for a rented RTX 3090. The README's footnote says "2 hours" is the measured time for a single SFT epoch. In other words: pretrain + SFT on the mini datasets takes about 2.3 hours — still very cheap, but don't read it as "every stage takes only 2 hours". The DPO/RL/LoRA/tool-calling stages are additional.

Second, don't blindly trust its benchmark scores. An independent audit (SoloSoft, measured 21/11/2026 on commit cc9629e) found the repo's 52,762-row LoRA sample overlaps 99.25% with the C-Eval test split — the fine-tuning data nearly coincides with the test set, so scores on that benchmark say nothing about real capability. This lesson matches the post's own message: use MiniMind to learn how an LLM is built, not to show off scores or ship it in a product.

Apply it now

  1. Clone and try the mini path: git clone --depth 1 https://github.com/jingyaogong/minimind, pip install -r requirements.txt, then follow "Step 0" in the README (download the minimind-3 checkpoint from ModelScope/Hugging Face to chat with it before training).
  2. Use it to understand LLMs from first principles: engineering teams can read the pretrain → SFT → DPO/RL code to see what each stage does to the model, instead of treating "fine-tune" as a black box.
  3. Try LoRA on your own data before spending on large infrastructure: the LoRA step runs on CPU — see which data actually changes the model's voice, then decide whether to invest in GPUs for the heavier stages.
  4. Connect the model to a familiar chat interface: use the built-in OpenAI-compatible server (serve_openai_api.py) to chat with your model through any client supporting the OpenAI standard.
  5. Don't use it in production: 64M parameters are not reliable for facts, summaries, or code. And read the accompanying data licenses carefully — some sources do not allow commercial use.
  6. When evaluating any "small but good" model, verify two things: the data source (what it learned from, whether it overlaps the test set) and the real cost (how many hours, how many epochs, on mini or full datasets) — not how beautiful the demo wording is.

Frequently asked questions

What is MiniMind?

An open-source repo (Apache 2.0) by jingyaogong/minimind that trains a ~64-million-parameter LLM from scratch in pure PyTorch on a single RTX 3090 GPU. Public since August 2024; as of 02/12/2026 it has 74,596 stars and 9,897 forks. Its purpose is teaching how LLMs are built, not shipping a product.

How long does training take, and how much does it cost?

Per the README's cost table: pretrain (mini) ≈ 1.21 hours + SFT (mini) ≈ 1.10 hours = ≈ 2.31 hours, ≈ 3.0 RMB on a single RTX 3090 rented at ~1.3 RMB/hour. The "2 hours" in the README's slogan is actually the measured time of a single SFT epoch; the DPO/RL/LoRA/tool-calling stages are additional.

What can a 64-million-parameter model do?

Basic dialogue, compact enough to run on a personal machine (about 50 tokens/second on 2 CPU cores). It is not reliable for facts, summaries, or code — in the post's example, asked about Hangzhou specialties, it answered confidently but listed unrelated dishes. Its value lies in learning, not in capability.

What training stages does MiniMind cover?

The full 5 stages of a modern LLM: Pretrain (learning next-word prediction), SFT (learning Q&A), DPO and RL (optimizing answers), LoRA (fine-tuning on private data, runs on CPU), and tool calling with reasoning. The repo also includes an OpenAI-compatible API server for connecting to familiar chat interfaces.

Can it be used in a commercial product?

No. The author states clearly the repo is for learning purposes only, not for production environments. Code is open under Apache 2.0, but some accompanying datasets do not allow commercial use. Also, an independent audit found the repo's LoRA sample overlaps 99.25% with the C-Eval test split, so its benchmark scores are not trustworthy.

Source: Post by Tùng Nguyễn in the AI Việt Nam Facebook group, 02/12/2026; the GitHub repo jingyaogong/minimind verified as real (Apache 2.0, public since 8/2024, 74,596 stars / 9,897 forks as of 02/12/2026). Cost/time figures come from the repo README's cost table (pretrain mini ≈ 1.21h + SFT mini ≈ 1.10h = ≈ 2.31h, ≈ 3.0 RMB); the note that "2 hours" is one SFT epoch per the README's footnote is Wotech's verification addition, based on the independent audit by SoloSoft (21/11/2026) and the review by andrew.ooo (02/12/2026), including the finding that the LoRA sample overlaps 99.25% with the C-Eval test split. The cover is the README screenshot from the original post.