Show HN: I built a tiny LLM to demystify how language models work
TL;DR Highlight
A 9M-parameter LLM trained from scratch in a 5-minute Colab notebook
Who Should Read
A backend developer who uses LLM APIs but wants to see how a model is trained end to end
Core Mechanics
- Train a 9M LLM in about 5 minutes
- One Colab notebook on a T4 GPU covers data generation, tokenizer, model, training, and inference.
- It trains on 60K synthetic conversations across 60 topics.
- Architecture kept as simple as possible
- 6 layers, hidden dim 384, 6 heads, FFN 768 (ReLU), 4,096 BPE vocab, 128-token max sequence.
- It is a vanilla transformer with no GQA, RoPE, SwiGLU, or early exit.
- No system prompt
- Every training sample had the same one, and a 9M model can't follow instructions conditionally.
- The personality is baked into the weights, and dropping the prompt saves about 60 tokens per inference.
- Single-turn only
- Multi-turn degraded at turns 3-4 because of the 128-token context window.
- The README says long chats hit the 128-token limit and quality drops.
- Synthetic data from template composition
- About 60 templates mixed with 30 tank objects, 17 foods, and 25 activities yield about 16K unique outputs.
- The dataset (57K train / 3K test) is public on HuggingFace.
- Runs in the browser too
- A quantized ONNX model (about 10 MB) runs locally via WebAssembly with no server or API key.
- Chat locally with pip install torch tokenizers and python -m guppylm chat.
Community Reactions
- Odd answers to uppercase input
- A commenter typed HELLO and got "i don't know what it means but it's mine."
- They suggest the all-lowercase training data is the cause.
- Synthetic data process is hard to find
- One commenter couldn't find the prompts or process used to generate the data in the repo.
- Several others asked for more documentation and design references.
- Similar educational resources suggested
- Commenters asked how it compares to Karpathy's microgpt and minGPT.
- One recommended bbycroft.net/llm, a 3D visualization of a tiny LLM.
- Environment matters as much as the model
- A commenter building multi-agent worlds said the same model and prompt behave very differently with resource limits, other agents, and persistent memory.
How to Apply
- Chat with Guppy in Colab first
- Today, open use_guppylm.ipynb or the browser demo and run all cells.
- Try uppercase input and long conversations to see how it breaks.
- Run your own training on a T4
- Open train_guppylm.ipynb with a T4 runtime and run all cells for about 5 minutes.
- Change layers or hidden dim in config.py and compare results.
- Use it as team LLM training material
- Hold a reading session going through model.py, train.py, then inference.py.
- Have people swap in a dataset to build a model with their own domain voice.
- Apply small-model limits to your design
- When using a fine-tuned model, check context length and whether a system prompt is needed.
- Decide if multi-turn is needed, and simplify to single-turn if not.
Try It
pip install torch tokenizers
git clone https://github.com/arman-bd/guppylm && cd guppylm
python -m guppylm chat --prompt "tell me a joke"Terminology
Related Papers
Quadrillion-parameter transformers and how to train them
On fixed data, much bigger models with scaled weight decay and ensembling keep loss falling as compute grows.
Astra can read and write weights to improve Qwen
An LLM edited Qwen3.5-0.8B's weights directly, lifting MATH-500 from 7.9% to 48.1%.
Show HN: Qwen3-4B with the AI writing tics trained out
Distilling Qwen3-4B with LoRA cut its AI-writing slop score from 121 to 12.5 per 1000 words
Dust: Pretraining Transformers Without Backpropagation
Adding per-token noise to activations lets transformers pretrain without backpropagation, rivaling backprop.
Show HN: TurboGPT: train 22KiB transformer in 13s
A CUDA C++ project trains a tiny byte-level GPT in under a minute.
I had Gemini train its own replacement for $9
Fine-tuning GLiNER on $9 of Gemini labels reached 0.83 F1 locally.
Learning to solve hard problems in RL for LLMs by never giving up
Cutting compute on easy problems and retrying hard ones in RL raised accuracy on the hardest problems
Training a 3.8B LLM to 0.384 CORE for $998
A 3.8B LLM trained on 8 B200s in 43 hours for $998 scored 0.384 on CORE.