Views
No views yet
⚠️ Educational / demo model. TinyBuddy-30M is a from-scratch tiny GPT-style language model (~30M parameters) trained for ~12 minutes on a 2-core CPU. It is not a useful assistant — it is a working end-to-end demonstration of the LM training pipeline. See the Limitations section.
| Hyperparameter | Value |
|---|---|
| Parameters | 30,371,840 (~30.37M) |
| Layers | 6 |
| Attention heads | 8 |
| Embedding dim | 256 |
| MLP hidden dim | 1024 (mlp_ratio = 4) |
Context length (block_size) | 512 |
| Vocab size | 50,000 (BPE; ~18k actually used) |
| Activation | GELU |
| Norm | LayerNorm (pre-norm) |
| Attention | Causal SDPA |
| Position embeddings | Learned absolute |
| Weight tying | No (separate LM head) |
| Precision | float32 |
TinyStoriesV2-GPT4-valid.txt,
27,630 short children's stories, ~5.3M BPE tokens after tokenization).batch_size=4, block_size=128 (≈ 512 tokens / step).step 0 | train 10.88 | val 10.88
step 150 | train 4.83 | val 4.68
step 300 | train 4.32 | val 4.28
step 600 | train 3.85 | val 3.90
step 900 | train 3.71 | val 3.77
step 1200 | train 3.57 | val 3.55
step 1500 | train 3.53 | val 3.43trust_remote_code=True when loading it.1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4repo = "YOUR_USERNAME/TinyBuddy-30M" # or local path to this folder
5
6tokenizer = AutoTokenizer.from_pretrained(repo)
7model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True)
8model.eval()
9
10prompt = "Once upon a time, there was a little girl named Lily."
11input_ids = torch.tensor([tokenizer.encode(prompt).ids
12 if hasattr(tokenizer.encode(prompt), "ids")
13 else tokenizer.encode(prompt)])
14
15# TinyBuddy ships a custom `.generate(...)` (top-k sampling). Use it directly:
16out = model.generate(input_ids, max_new_tokens=120, temperature=0.8, top_k=50)
17print(tokenizer.decode(out[0].tolist()))transformers entirely, you can use the raw
tokenizers library + the included modeling file:1from tokenizers import Tokenizer
2from safetensors.torch import load_file
3from modeling_tinybuddy import TinyGPT, GPTConfig
4import json, torch
5
6cfg = GPTConfig(**{k: v for k, v in json.load(open("config.json")).items()
7 if k in GPTConfig.__dataclass_fields__})
8model = TinyGPT(cfg)
9model.load_state_dict(load_file("model.safetensors"))
10model.eval()
11
12tok = Tokenizer.from_file("tokenizer.json")
13ids = tok.encode("Once upon a time").ids
14out = model.generate(torch.tensor([ids]), max_new_tokens=80, temperature=0.8, top_k=50)
15print(tok.decode(out[0].tolist()))Once upon a time, there was a little girl named Lily. They loved to play with their parents. One day, Tom went to the park. The sun loved the box and had many friends. One day, they went for a small tree, a lot of friends. He said, "What is better. But you want to find your friends, Bob?" …
Tom and Sam were playing in the park when they were very much. Once upon a time, there was a girl named The cat with her mom. They had a little girl named Mia. She loved to play with her friends and play with her mom. …
<|endoftext|>) are respected.| Factor | This model | A good TinyStories-class model |
|---|---|---|
| Tokens seen | ~0.77 M | ~10⁹+ |
| Hardware | 2 CPU cores | 1+ GPUs |
| Wall time | ~12 min | many hours |
| Final loss | ~3.5 | ~1.3–1.6 |
| Perplexity | ~30 | ~4–5 |
@misc{tinybuddy30m,
title = {TinyBuddy-30M: a from-scratch ~30M-parameter transformer trained on TinyStories},
year = {2026},
note = {Educational demonstration model.}
}@article{eldan2023tinystories,
title = {TinyStories: How Small Can Language Models Be and Still Speak Coherent English?},
author = {Eldan, Ronen and Li, Yuanzhi},
journal = {arXiv preprint arXiv:2305.07759},
year = {2023}
}