Add README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
datasets:
|
| 5 |
+
- roneneldan/TinyStoriesInstruct
|
| 6 |
+
base_model: singhpratech/tiny-storyteller
|
| 7 |
+
tags:
|
| 8 |
+
- tiny
|
| 9 |
+
- instruction-tuning
|
| 10 |
+
- chat-template
|
| 11 |
+
- prompt-masking
|
| 12 |
+
- pytorch
|
| 13 |
+
- educational
|
| 14 |
+
- text-generation
|
| 15 |
+
- emc2
|
| 16 |
+
---
|
| 17 |
+
# e=mc² Lesson 05: Instruction tuning from scratch
|
| 18 |
+
|
| 19 |
+
Lesson page: https://theaivibe.org/emc2/instruction-tuning-from-scratch-tiny-storyteller
|
| 20 |
+
|
| 21 |
+
Lesson 05 of e=mc², a learn-by-building course by Prateek Singh. It takes `tiny-storyteller-v2`
|
| 22 |
+
(Lesson 04, repo `singhpratech/emc2-lesson-04-fine-tune`) and teaches it to follow a request, with two new
|
| 23 |
+
special tokens, a chat template and prompt masking.
|
| 24 |
+
|
| 25 |
+
## Contents
|
| 26 |
+
- `lesson_05.ipynb`: the lesson, unexecuted (Colab T4, Apple-silicon Mac or CPU).
|
| 27 |
+
- `RESULTS.md`: every number from the run on 2026-10-11 (Apple M4 Max).
|
| 28 |
+
- `tiny-storyteller-instruct/`: the instruction-tuned model (vocab 4,098) with `chat_template.json`.
|
| 29 |
+
- `pairs/`: the instruction pairs as JSONL (`train`, `heldout`, `test50`, `familiar50`, `crossworld20`).
|
| 30 |
+
- `story_pairs.py`: builds instruction pairs from the Momo and Zuri story generators.
|
| 31 |
+
|
| 32 |
+
## Result (string match: character AND place in the generated story, 50 held-out instructions)
|
| 33 |
+
| | both | character | place |
|
| 34 |
+
|---|---|---|---|
|
| 35 |
+
| before tuning | 12% | 68% | 14% |
|
| 36 |
+
| after 500 steps | 44% | 100% | 44% |
|
| 37 |
+
|
| 38 |
+
Held-out instructions ask for character + scene + place combinations that never appear together in training.
|
| 39 |
+
On 50 familiar combinations the same model scores 86%; across the two characters' worlds, 5% of 20.
|
| 40 |
+
|
| 41 |
+
## Template
|
| 42 |
+
`<|endoftext|><|instruction|>{instruction}<|story|>{story}<|endoftext|>` - generate after `<|story|>`
|
| 43 |
+
until `<|endoftext|>`. Model class: Lesson 01's `GPT`, unchanged (in the notebook).
|
| 44 |
+
|
| 45 |
+
Licences: code and weights MIT. Pairs derived from TinyStories-Instruct (CDLA-Sharing-1.0) keep that licence;
|
| 46 |
+
generator pairs are MIT.
|