stories15M-kansai
A 15M-parameter Llama that writes short children's stories in Kansai dialect (้ข่ฅฟๅผ), narration
and dialogue alike: exactly the shape of
karpathy/tinyllamas' stories15M.bin
(dim=288, n_layers=6, n_heads=6, hidden_dim=768, vocab_size=32000, max_seq_len=256, tied
classifier), with a Kansai vocabulary of its own. Made for
transformer-dojo, whose participants implement this
model's forward pass themselves: swapping in these weights and this tokenizer makes their finished
code tell stories in Kansai dialect.
ใใใใใใใใชใชใผใฃใกใ ใๅๅใฎๅฐใฃใกใใชๅฅณใฎๅญใใใฃใใๅฝผๅฅณใฏใใๆฐใซๅ ฅใใฎใใใใชใใฌในใ็ใใใๅคงๅฅฝใใใฃใใใใๆฅใๅฝผๅฅณใฏใๅ้ใจ้ใถใใใซๅ ฌๅใธ่กใฃใใ
้ใใงใๆใใชใชใผใฏๅฐ้ขใซใญใฉใญใฉๅ ใๅฎ็ณใ่ฆใคใใใฃใใๅฝผๅฅณใฏใใใๆพใไธใใฆใใๅ้ใซ่ฆใใใใฟใใชใใใฃใกใใใใใใชใใจๆใใใ
ใใใจ็ช็ถใใๅ้ใฎใธใฃใใฏใใใใฃใใใใฎๅฎ็ณใ่ฝใจใใฆใใใใๅฎ็ณใฏๅฐ้ขใซ่ฝใกใฆใใใฉใใฉใซๅฃใใฆใใใใใใ
ใชใชใผใฏใๅคงๅใชๅฎ็ณใใชใใใฆใใใใใใใใใใๆฒใใใ ใๅฝผๅฅณใฏใใใไบๅบฆใจ่ฆใคใใใใธใใฎใจใกใใใใใจใไฝๅบฆใไฝๅบฆใๆณฃใใใ
(greedy, INT4, prompt ใใใใใใใใใ, told by a participant's code through transformer-dojo's kernel)
Files
| File | What it is | sha256 |
|---|---|---|
model.bin |
fp32 weights, llama2.c's v0 checkpoint format (what run.c reads) |
82e175e89dc74120c2c91c711a1a50354dc623425d27bccd9c8a5468289d0286 |
tokenizer.bin |
the vocabulary in llama2.c's tokenizer.bin format |
71e65910d3a1a89eac8d6d68b79b90894fc25276dde976d4d1c8e6dbddb04e03 |
tokenizer.model |
the same vocabulary as a sentencepiece model | ab78bfd667fc3b0a89f24a4b721c65594a3082984484083665a4347ca6516d31 |
train_config.json, log-*.jsonl |
how the model was made: the vocabulary transplant, then each training stage's configuration and evaluation log |
model.bin and tokenizer.bin run unchanged in llama2.c:
./run model.bin -z tokenizer.bin -i "ใใใใใใใ". transformer-dojo quantizes model.bin to
its INT4 format itself (dojo-dev quantize; the INT4 file is not published here) and reads the
vocabulary as tokenizer.json (dojo-dev export-tokenizer tokenizer.bin tokenizer.json).
How it was made
- Data: opsbr/TinyStories-Kansai โ TinyStories-JA rewritten into Kansai dialect story by story, 2,087,086 train stories kept by its filters.
- Vocabulary: sentencepiece BPE, 32,000 pieces, byte fallback, trained on the first 200,000 kept Kansai stories, in llama2.c's layout. Kansai forms are single pieces (ใ่จใใใใใใฃใกใใ ใใธใใใฃใใใใใใใใใใใใ): a story is 117 tokens at the median against 158 under stories15M-ja's vocabulary, so a 200-token continuation holds a whole story.
- Transplant: opsbr/stories15M-ja moved onto the Kansai vocabulary. Every tensor but the embedding (the classifier, tied) is copied; the embedding rows of the 19,752 pieces both vocabularies share are copied, and each of the 11,989 new pieces starts as the mean of the stories15M-ja rows its text splits into.
- Fine-tune: two epochs over the corpus (668M tokens), lr 1e-3, AdamW (ฮฒโ 0.95, weight decay 0.1), linear warmup 200 steps then cosine decay to 0, batch 128 ร 4 ร 256 tokens, bf16.
- Quantization-aware fine-tune: a quarter epoch at lr 1e-4 with the forward pass through transformer-dojo's INT4 (group size 32, f16 scales, straight-through gradients), so the weights are tuned for the INT4 the participants' kernel runs.
One RTX 5090: about 20 minutes of training, after about 27 hours of converting the corpus.
Evaluation
On the 40 held-out validation stories (the Kansai rewrites of the same 40 stories stories15M-ja is gated on), under transformer-dojo's INT4:
- Held-out NLL rises โ0.72% from fp32 to INT4 (2.211 โ 2.195; the gate allows +20%), and no greedy continuation of the 20 gate prompts repeats a 4-gram four times running.
- NLL per character 0.673 under INT4, on text common to every vocabulary compared: the lowest of the variants that passed (stories15M-ja fine-tuned without changing its vocabulary: 0.675; stories15M-ja itself on Kansai text: 2.660).
- Narration in ใงใใปใพใ: none of 20 continuations (stories15M-ja: 99%).
Limits
A model this small forgets its own plot and can repeat a sentence it has already said; about a quarter to half of greedy continuations repeat one, as stories15M-ja's do. When it loops, it tends to loop on ใใใฃใกใใ, the corpus's word for "very". The Kansai is the corpus's: machine-made from a machine translation, common Osaka-flavoured Kansai told as a grown-up telling a story aloud, with some standard Japanese left in dialogue (ใ่จใฃใใ, ใใใใญใ). It knows children's-story vocabulary only.
Licence and provenance
- Weights and tokenizer: MIT.
- Data: opsbr/TinyStories-Kansai, CDLA-Sharing-1.0 โ TinyStories (Ronen Eldan, Yuanzhi Li;
arXiv:2305.07759), translated to Japanese by Naoki Shibata
(shibatch/TinyStories-JA), rewritten into
Kansai dialect by
google/gemma-4-26B-A4B-it(Apache-2.0). A trained model is a "Result" of the data (ยง1.11), and ยง3.5: "This Agreement imposes no obligations or restrictions on Your Use or Publication of Results." - Starting point: opsbr/stories15M-ja, MIT.
- Code: transformer-dojo's
tools/train/, trimmed from llama2.c by Andrej Karpathy, MIT.
Model tree for opsbr/stories15M-kansai
Base model
opsbr/stories15M-ja