TinyStories v8.13 width 512: full TinyStories V2 file, one pass
Browse files
tinystories-v813-w512/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
tags: [text-generation, tinystories, small-language-model, research]
|
| 4 |
+
datasets: [roneneldan/TinyStories]
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# TinyStories v8.13 (width 512): short stories from a 26,294,477-parameter model
|
| 8 |
+
|
| 9 |
+
A base model for short children's stories, trained on the whole TinyStories V2 (GPT-4) training file in one
|
| 10 |
+
pass. Part of the speed-check-ai-traning project (branch `paper-faithful-hrm`); the FineWeb-Edu 71M model
|
| 11 |
+
lives in the repository root.
|
| 12 |
+
|
| 13 |
+
## Architecture (v8.13)
|
| 14 |
+
- 6 blocks, width 512, 16 attention heads, MLP 2048, vocabulary 4,096 (byte-level BPE)
|
| 15 |
+
- Forgetting attention (FoX, no position encoding); blocks 1, 2, 4, 5 see a 64-token window, blocks 3 and 6
|
| 16 |
+
the whole story; Canon layers; QK-norm; ReLU^2 MLP; value residual; U-net skips; soft-capped logits
|
| 17 |
+
- **NextLat** (Teoh et al., NeurIPS 2025): a training-only loss that makes the model predict its own next
|
| 18 |
+
hidden state from the next token. The small predictor (1,572,864 parameters) is included in the weights
|
| 19 |
+
but not used when generating; 24,721,613 parameters are used at inference.
|
| 20 |
+
|
| 21 |
+
## Training
|
| 22 |
+
- TinyStories V2 (GPT-4) train file, about 500M tokens, one pass over all-new stories, 66,082 steps
|
| 23 |
+
- Muon + Adam-atan2, learning rate 0.0032 held, then decayed linearly to 0 over the last 50% of steps,
|
| 24 |
+
EMA weights exported; bf16; one RTX 5080, 32.9 minutes
|
| 25 |
+
|
| 26 |
+
## Results (official TinyStories V2 validation stories)
|
| 27 |
+
- held-out loss 1.1075
|
| 28 |
+
- token accuracy 69.0%
|
| 29 |
+
- live (non-averaged) weights: loss 1.0909
|
| 30 |
+
- same recipe at smaller scale: v8.3 1.451 (3 passes over 80 MB) -> v8.13 1.165 (full file, width 384)
|
| 31 |
+
|
| 32 |
+
## Example (temperature 0.7, top-k 40; prompt in bold)
|
| 33 |
+
**Once upon a time, in a warm and sunny place, there was a big pit.** In the pit, there was a little frog
|
| 34 |
+
named Fred. Fred was sad because he could not jump high like his friends. One day, Fred met a big, friendly
|
| 35 |
+
dog named Max. Max saw Fred was sad and asked, "Why are you sad, Fred?" Fred said, "I want to jump high like
|
| 36 |
+
my friends, but I am too small." Max thought for a moment and said, "Let's try together!" So, Fred and Max
|
| 37 |
+
tried to jump high. They jumped and jumped, but they could not jump very high. They felt sad and sat down.
|
| 38 |
+
Then, something unexpected happened. A big wind came and blew Fred into the pit. Max was scared and said,
|
| 39 |
+
"Don't worry, Fred! I will help you!" Max jumped into the pit and helped Fred out. They were both happy and
|
| 40 |
+
became best friends.
|
| 41 |
+
|
| 42 |
+
## Limitations
|
| 43 |
+
Simple children's-story vocabulary only; occasional logic slips and repeated words; some stories are dark
|
| 44 |
+
(the training set contains them); malformed prompts (for example starting mid-word) can loop. Not for real use.
|
| 45 |
+
|
| 46 |
+
## Loading and generating
|
| 47 |
+
Needs the model code from the project (`src/hrm_text`). Prompts are formatted as the story beginning followed
|
| 48 |
+
by the separator token (id 1); the model writes the rest and ends with the end token (id 2).
|
| 49 |
+
|
| 50 |
+
```python
|
| 51 |
+
import json, torch
|
| 52 |
+
from safetensors.torch import load_file
|
| 53 |
+
from tokenizers import Tokenizer
|
| 54 |
+
from hrm_text.models.hrm import ModelConfig, build_model
|
| 55 |
+
|
| 56 |
+
config = ModelConfig.from_saved(json.load(open("config.json"))["model_config"])
|
| 57 |
+
model = build_model(config)
|
| 58 |
+
model.load_state_dict(load_file("model.safetensors"))
|
| 59 |
+
model.eval()
|
| 60 |
+
tokenizer = Tokenizer.from_file("tokenizer.json")
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
Or use `tools/talk.py --tinystories` from the project (temperature 0.7, top-k 40).
|
tinystories-v813-w512/config.json
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_config": {
|
| 3 |
+
"vocab_size": 4096,
|
| 4 |
+
"max_seq_len": 512,
|
| 5 |
+
"hidden_size": 512,
|
| 6 |
+
"num_heads": 16,
|
| 7 |
+
"num_kv_heads": null,
|
| 8 |
+
"n_layers": 4,
|
| 9 |
+
"expansion": 4.0,
|
| 10 |
+
"intermediate_override": null,
|
| 11 |
+
"h_cycles": 2,
|
| 12 |
+
"l_cycles": 3,
|
| 13 |
+
"tie_embeddings": false,
|
| 14 |
+
"mtp": false,
|
| 15 |
+
"vocab_multiple": 256,
|
| 16 |
+
"init_type": "lecun_normal",
|
| 17 |
+
"init_std": null,
|
| 18 |
+
"norm_eps": 1e-06,
|
| 19 |
+
"rope_theta": 10000.0,
|
| 20 |
+
"dropout": 0.0,
|
| 21 |
+
"prefix_lm": false,
|
| 22 |
+
"scale_embeddings": true,
|
| 23 |
+
"chunk_size": 8,
|
| 24 |
+
"l_blocks": 3,
|
| 25 |
+
"kernel_size": 3,
|
| 26 |
+
"l_mixer": "conv",
|
| 27 |
+
"h_blocks": 2,
|
| 28 |
+
"h_inner": 1,
|
| 29 |
+
"h_expansion": null,
|
| 30 |
+
"v3_pattern": "ggs|ggs|",
|
| 31 |
+
"gdn_version": 2,
|
| 32 |
+
"gdn_heads": 4,
|
| 33 |
+
"gdn_head_dim": 64,
|
| 34 |
+
"gdn_chunk": 32,
|
| 35 |
+
"gdn_backend": "torch",
|
| 36 |
+
"swa_window": 64,
|
| 37 |
+
"think_tokens": 2,
|
| 38 |
+
"think_mode": "chunk",
|
| 39 |
+
"n_loops": 1,
|
| 40 |
+
"n_loops_min": 0,
|
| 41 |
+
"position_coupling": false,
|
| 42 |
+
"coupling_offset": 24,
|
| 43 |
+
"canon": false,
|
| 44 |
+
"fox": false,
|
| 45 |
+
"gdn_bf16": false,
|
| 46 |
+
"v8_pattern": "llgllg",
|
| 47 |
+
"mlp_groups": 1,
|
| 48 |
+
"ngram_buckets": 0,
|
| 49 |
+
"ngram_layer": 1,
|
| 50 |
+
"nextlat": 0.5,
|
| 51 |
+
"value_embeds": 0,
|
| 52 |
+
"mudd": false,
|
| 53 |
+
"kv_heads": 0,
|
| 54 |
+
"loss_chunk": 1024,
|
| 55 |
+
"fold_forget": false,
|
| 56 |
+
"v8_learning": "backprop",
|
| 57 |
+
"fused_loss": true,
|
| 58 |
+
"bf16_residual": true,
|
| 59 |
+
"graph_masks": false,
|
| 60 |
+
"lean_kernels": false,
|
| 61 |
+
"forget_spread": false,
|
| 62 |
+
"forget_min": 8.0,
|
| 63 |
+
"forget_max": 2048.0,
|
| 64 |
+
"v9_prelude": "l",
|
| 65 |
+
"v9_core": "ld",
|
| 66 |
+
"v9_coda": "g",
|
| 67 |
+
"bp_loops": 0,
|
| 68 |
+
"gdn_negative": false,
|
| 69 |
+
"v11_core": "ldg",
|
| 70 |
+
"v11_halt": 0.01,
|
| 71 |
+
"v11_max_loops": 16,
|
| 72 |
+
"v12_state": 64,
|
| 73 |
+
"v12_rounds": 4,
|
| 74 |
+
"v12_stream": 0,
|
| 75 |
+
"v12_learn_dynamics": false,
|
| 76 |
+
"v12_seed": 0,
|
| 77 |
+
"v12_gated": false,
|
| 78 |
+
"v12_attention": 0,
|
| 79 |
+
"v13_state": 128,
|
| 80 |
+
"v13_rank": 64,
|
| 81 |
+
"v13_head_rank": 0,
|
| 82 |
+
"v13_local": true,
|
| 83 |
+
"v13_global_every": 10,
|
| 84 |
+
"v13_aux": 1.0,
|
| 85 |
+
"v13_plastic": false,
|
| 86 |
+
"tcn_layers": 26,
|
| 87 |
+
"tcn_kernel": 3,
|
| 88 |
+
"tcn_context": 512,
|
| 89 |
+
"tcn_mlp": false,
|
| 90 |
+
"arch": "v8"
|
| 91 |
+
},
|
| 92 |
+
"architecture": "hrm_text v8 (v8.3)",
|
| 93 |
+
"parameters": 26294477,
|
| 94 |
+
"non_embedding_parameters": 22100173,
|
| 95 |
+
"training": {
|
| 96 |
+
"lr": 0.0032,
|
| 97 |
+
"lr_schedule": "wsd",
|
| 98 |
+
"cooldown_ratio": 0.5,
|
| 99 |
+
"ema": 0.9999,
|
| 100 |
+
"optimizer": "muon",
|
| 101 |
+
"token_budget": 8192,
|
| 102 |
+
"epochs": 1
|
| 103 |
+
},
|
| 104 |
+
"results": {}
|
| 105 |
+
}
|
tinystories-v813-w512/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b1623275028817b00741c09c493745c2277f15f83699f7b8b2718fd0e789aa94
|
| 3 |
+
size 105186724
|
tinystories-v813-w512/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|