Loading…
Loading…
A small GPT-2-style decoder-only transformer, written from scratch in PyTorch (no transformers classes), trained on a
laptop CPU on a subset of TinyStories. It continues short children's stories.
Code, training logs and the full write-up are in the GitHub repository.
| Architecture | pre-norm GPT, 6 layers, d_model 256, 8 heads, context 256, learned positions, tied embeddings |
| Parameters | 5,853,184 |
| Tokenizer | byte-level BPE, vocabulary 4096, trained on the training split only (tokenizer.json) |
| Files | model.safetensors, model_config.json (our ModelConfig), tokenizer.json, model_info.json |
| Model | Validation loss | Perplexity |
|---|---|---|
| Uniform guess | 8.32 | 4096 |
| Unigram counts | 5.88 | 357 |
| Bigram counts | 3.65 | 38.4 |
| This model | 1.688 | 5.41 |
Perplexity is per BPE token with this 4096-token tokenizer, on TinyStories text, so it is not comparable to numbers from other tokenizers or datasets.
Learning, demos and experiments with small language models; generating simple children's-story-style text.
docs/RESULTS.md include failures, not just good examples.Code and weights in this repository are released under the MIT licence. The training data, TinyStories by Ronen Eldan and Yuanzhi Li, is licensed CDLA-Sharing-1.0 on the dataset card; please credit it and check the dataset card for current terms.
git clone <github repo> && cd tiny-gpt && make setup
TINYGPT_HF_REPO=<this repo id> TINYGPT_MODEL_DIR=./model uv run uvicorn tinygpt.serving.app:create_app --factory