Skip to main content
TT
Lab
Learn
Sandbox
Community
Language Learning (in Korean)
Get started
Learn
Learning paths
Courses
MiniMind — Train a Small Language Model Yourself, End to End
Bake a small model from tokenizer to DPO on two CPUs
고급 · Lessons 30 · Lab 10
Start the lab
Curriculum
Tokenizer
A borrowed tokenizer splits Korean into bytes
reading
Measure Korean with the MiniMind tokenizer and train a small vocabulary yourself
lab
Quiz: Tokenizer
quiz
Data preparation — padding and packing
Padding wastes compute; packing blurs document boundaries
reading
Measure the compute padding wastes and pack the corpus
lab
Quiz: Padding and packing
quiz
Model architecture
A MiniMind layer is made of six decisions
reading
Shrink the MiniMind config into a model and check each layer decision with numbers
lab
Quiz: MiniMind architecture
quiz
Pretraining and the loss curve
The loss curve shows what a model learns first
reading
Pretrain for 300 steps with MiniMind's training loop and read the loss curve
lab
Quiz: Pretraining and the loss curve
quiz
Checkpoints and resuming
A resume file holds three things besides the weights
reading
Stop and resume yet match an uninterrupted run — what goes in the resume file
lab
Quiz: Checkpoints and resuming
quiz
SFT and loss masking
SFT teaches only the answer — loss masking draws that line
reading
Run SFT in chat format and measure what loss masking changes
lab
Quiz: SFT and loss masking
quiz
LoRA
LoRA adds a side branch without touching the weights
reading
Change only the style with MiniMind's LoRA and confirm the base weights are unchanged
lab
Quiz: LoRA
quiz
DPO — preference learning
DPO teaches 'this one is better' without a reward model
reading
Shift the style with DPO and check the content was preserved
lab
Quiz: DPO
quiz
Inference — KV cache and sampling
A KV cache remembers what need not be recomputed
reading
Measure the KV cache and sampling with MiniMind's generate
lab
Quiz: KV cache and sampling
quiz
Evaluation and limits
In a small model the line between memorizing and learning is sharp
reading
Separate what a small model can and cannot do with numbers
lab
Quiz: Evaluation and limits
quiz
Reference docs
MiniMind 저장소
MiniMind README(영문)
PyTorch 문서
HuggingFace tokenizers
LoRA 논문
DPO 논문