Spaces:
Running
Running
Deploy experimental model005: cosine refinement
Browse filesPublish the selected 110,387-parameter cosine-refined checkpoint, matching browser weights, training record and reproducible source. Character regression loss is 4.29% lower than the archived width-64 baseline; the test is previously observed. All 12 quality samples still fail grammar/coherence, so the app and model card explicitly label this experimental. Preserve prior revision 3185cd49f7abccc7ad2b30c4b73b04672415da76 for rollback.
Files changed (16)
- BROWSER_CHECKS.md+3-3
- MODEL_CARD.md+8-18
- QUALITY_REVIEW.jsonAdded+429
- README.md+13-21
- RELEASE_CHECKS.json+13-50
- REPRODUCE.md+17-18
- SECURITY_UPDATE.json+7-9
- SHA256SUMS.jsonAdded+23
- app.js+7-6
- checkpoint.pt+2-2
- index.html+4-4
- model.json
- source.zip+2-2
- test_generation.cjs+17
- test_inference.cjs+1-1
- training.json
12345# Model004 release browser checksCandidate weights are unchanged from the measured story experiment. Browser verification must load matching model.json/training.json and pass numerical parity before enabling generation.Required: deterministic generation, stop/restart, invalid prompt/seed focus, missing/corrupt-model failure, worker recovery, hash navigation, desktop/phone overflow checks, validation-only curve with finite coordinates and recorded points. Verify training-record metrics against training.json and inspect desktop/phone screenshots. RELEASE_CHECKS.json records this release's actual results; optional screenshot baselines are separate from functional checks.12345# Experimental model 005 browser checksLocal CUA browser checks completed October 30, 2026: 110,387 parameters and SHA e39b99ce8ba9 displayed after verification; generation starts in a worker; Stop preserves partial text and restores controls; unsupported Unicode reports an inline error and focuses Prompt; invalid negative seed reports an inline error and focuses the seed. Training navigation shows 2,400 additional steps, validation CE1.130, regression CE1.138 versus archived1.189, training loss “Not recorded”, and the failed quality screen. The validation curve uses only recorded validation checks.At a390×844 viewport, document width equals viewport width390 and the training metrics remain readable. Existing visual identity and styles are retained. This covers the tested browser, not assistive technology or physical iOS testing. Node export tests additionally verify deterministic complete generation, input rejection, streaming and long-history cropping.
12345678910111213141516171819202122232425# Imperial LLM: character model 004A 30,643-parameter causal Transformer continued from Imperial model 003. Two blocks, four heads, 32-dimensional embeddings, 64-character context and 51-character vocabulary. No external pretrained weights, instruction tuning, retrieval or safety training. It remains an educational story-continuation model, not an assistant.## Training and selectionFull-parameter AdamW continuation on the 512 packaged normalized TinyStories training stories. Two runs share initialization, seed 1729, uniform story/window training draws, batch 16 and gradient clip 1.0. Windows never cross story boundaries. One run uses constant LR 0.001; the other cosine LR 0.0003→0.00003. Both execute 2400 optimizer steps; validation is checked every 200 steps, retaining the minimum including step 0. Early stopping patience 3 is configured but neither run stops early. The constant schedule at step 2400 wins by validation CE alone. Training/validation runtime of selected run: 89.3s on CPU, PyTorch 2.2.2, one thread. Its inherited model 003 had 2400 earlier continuation steps; this release adds 2400 more.## EvaluationFresh final test CE, nats per normalized character: **1.615683 → 1.515439**, **6.20% lower**. Sampled loss improves on62/64 stories; largest per-story increase: 0.022554. Baseline and candidate use the same inputs and targets. Four seeded 64-character windows per story yield16,384 predictions; windows may overlap. Final test is scored after checkpoint and schedule selection; it is never used for gradients or retuning.Validation CE: 1.610060 → 1.508940; selected-checkpoint training CE: 1.480559. These use story-contained windows, so they are not directly comparable to model 003's published stream-window losses. Only validation was recorded over time; no training curve is fabricated. The page displays a validation-only curve and the separately measured selected-checkpoint training CE.## Data and licenseModified normalized TinyStories V2 GPT-4 by Ronen Eldan and Yuanzhi Li, revision f54c09fd23315a6f9c86f9dc80f725de7d8f9c64. Data license: [CDLA-Sharing-1.0](https://cdla.dev/sharing-1-0/); code: MIT. Training and validation reuse 512 and 64 whole stories, respectively. The fresh test comprises 64 additional complete official-validation-source stories whose normalized hashes are absent from all 640 packaged train/validation/old-test stories. Exact duplicates are excluded; near duplicates were not assessed. Normalization retains the original model 002 alphabet: curly apostrophes become ASCII, unsupported capitals become lowercase, other unsupported characters become spaces. Corpus files, original notices, attribution and exact membership hashes are included in source.zip.## LimitsLower next-character cross-entropy does not establish improved story coherence, reasoning, instruction following, safety or out-of-domain generalization. Generated samples remain misspelled and often incoherent. The same-domain final sample is small; one training seed and overlapping sampled windows do not establish statistical significance. The inherited validation set already informed model 003. The 64-character context is a major constraint.## Identity and reproductionCandidate JSON SHA-256:`986699bbf0668f6d1aa5da67c373fe53770f7ce5e9efb3e337b5c0d7a42fe376`. Baseline JSON SHA-256:`f68c3ffac926081593dca074191c9845aa1a09c5830be1c1f088f9c63b147f0a`. Checkpoint and JSON contain identical weights; training.json carries hashes, three Python logit cases, schedule histories and corpus provenance. Read REPRODUCE.md. The source includes models/story-baseline003 for exact reinitialization. The full upstream Python suite is not green on the measured legacy runtime; see RELEASE_CHECKS.json for executed release checks and documented upstream failures.123456789101112131415# Model 005 experimental cardModel 005 is an educational character-level story-continuation Transformer:110387 parameters, width 64, two blocks, four heads, context 64, vocabulary 51. Its intended use is inspecting a small model's behavior and training evidence. It has no established assistant, factual-answering, instruction-following or dependable storytelling capability.**Release quality gate failed:0/12 reviewed cosine continuations passed grammar and sustained coherence.** Five contain clear malformed words. All 12 contain broken grammar. Review was unblinded agent screening over four frozen prompts and three seeds, not a human study. Deployment was requested by the owner despite this failed gate; deployment authorization does not turn the gate into a pass.The selected candidate warm-starts the unpublished wide model selected at original step 14000. Two 2400-update arms reset AdamW and share seed 1729, batch 16,64-character contexts, clip 1 and default weight_decay 0.01. Validation alone selects the cosine policy and step 2400, including unchanged step 0 as eligible. Cosine 0.0003→0.00003 and constant 0.001 differ in scale as well as shape. Neither final optimizer state nor RNG state is preserved, so exact resume is unsupported.Matched baseline/candidate validation CE is 1.183765/1.130293. Previously observed regression-test CE is 1.188995/1.137958,4.29% lower. This test contains 128 stories with 32768 sampled target characters; windows may overlap. It is not a fresh independent test. Repeated validation, one training seed and same-domain data limit interpretation. Earlier live004 is a smaller model with different history and cannot isolate this intervention. Semantic near duplicates were not assessed. Lower CE is not proof of better grammar or generalization.Data comprises 4096 training stories and 128 validation stories from normalized TinyStories V2 GPT4, Ronen Eldan and Yuanzhi Li, revision `f54c09fd23315a6f9c86f9dc80f725de7d8f9c64`. Dataset terms are [CDLA-Sharing-1.0](https://cdla.dev/sharing-1-0/); preserve modification notices and source manifests. Legacy normalization and the fixed 51-character vocabulary remove unsupported punctuation and other characters. No unrelated GitHub prose was added as training data. Code is MIT licensed.Supported Linux CPU PyTorch 2.14.1+cpu completed training,38 focused Python tests and both browser export suites, including hash and Python/JavaScript parity checks, bounded inputs, seeded worker generation and long-history cropping. These are focused engineering checks, not a safety certification. Checkpoint deserialization requires stable PyTorch ≥2.6 with restricted weights-only loading and current security fixes. Do not bypass this guard on Torch 2.2.2.The browser model, checkpoint, training record and source artifacts must stay together. See REPRODUCE.md. Previous HF revision `3185cd49f7abccc7ad2b30c4b73b04672415da76` is the rollback target. Retain the failed quality findings whenever sharing this candidate.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429{ "method": "Unblinded qualitative agent screening of all12 complete stored rows and all36 continuations, without reading aggregate metrics. Not a human study or standardized accuracy measure.", "criteria": "All12 cosine continuations must use valid words, grammatical sentences and sustained prompt-related coherent continuation. Fixed-length trailing fragments alone are not failures.", "malformed_word_policy": "Conservative clear misspellings/fused forms only; valid but misplaced words counted under grammar/coherence, not spelling. Absence of a flagged malformed word is not a complete dictionary certification.", "samples_sha256": "20628a057e5202c8e5e9ef5e7f00368c1960fb30123acfd769980a83b190eb16", "rows": [ { "prompt": "anna found a small bird in the rain. she decided to", "seed": 42, "judgments": { "baseline": { "clear_malformed_words": true, "malformed_examples": "stome", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "They felt sad off, and they stome", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "make a big, but he was fun together", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": true, "malformed_examples": "tombed", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "The found tombed, but he was a big careful", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "anna found a small bird in the rain. she decided to", "seed": 1729, "judgments": { "baseline": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "play with her have cat to play with", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "Thank you have could not the learned to be town", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": true, "malformed_examples": "magiconow", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "she was that he was a tiny magiconow", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "anna found a small bird in the rain. she decided to", "seed": 2026, "judgments": { "baseline": { "clear_malformed_words": true, "malformed_examples": "mewalked", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "her heart and kind up the mewalked", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": true, "malformed_examples": "pland", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "you should many and the big away. It fly", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "help Sara was not sure the ball was so happy", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "ben put his toy boat in the pond. the boat began to", "seed": 42, "judgments": { "baseline": { "clear_malformed_words": true, "malformed_examples": "stome", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "They felt sad off, but they stome", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": true, "malformed_examples": "pigz", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "Tim looks were having a big pigz", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "They had a laughed started", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "ben put his toy boat in the pond. the boat began to", "seed": 1729, "judgments": { "baseline": { "clear_malformed_words": true, "malformed_examples": "carefull / owers", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "they carefull owers", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": true, "malformed_examples": "ressected / hidde", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "together and ressected to make a big hidde box", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "He was scared that she hard", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "ben put his toy boat in the pond. the boat began to", "seed": 2026, "judgments": { "baseline": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "her heard and kept to help her scared", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "Yes, you can around", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "the other dog never was always", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "mia wanted to share her apple with her friend. she", "seed": 42, "judgments": { "baseline": { "clear_malformed_words": true, "malformed_examples": "rane", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "she was rane ball", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": true, "malformed_examples": "mustures", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "the rock of the fish mustures", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "she was ran he friends when Tim", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "mia wanted to share her apple with her friend. she", "seed": 1729, "judgments": { "baseline": { "clear_malformed_words": true, "malformed_examples": "Shere / firest / magiconother", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "Shere was very happy", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": true, "malformed_examples": "stown", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "She stown the pond asked him", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": true, "malformed_examples": "boton", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "Tom would not wanted to talk together", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "mia wanted to share her apple with her friend. she", "seed": 2026, "judgments": { "baseline": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "she had her mom was so happy", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": true, "malformed_examples": "rever", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "played to be scared fun and rever happy", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "so happy to was full different", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "a little fox could not find his way home. then he", "seed": 42, "judgments": { "baseline": { "clear_malformed_words": true, "malformed_examples": "bowly", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "He was all who happy towed to the bowly", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": true, "malformed_examples": "pands", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "so he little girl with the pands", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": false, "malformed_examples": "", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "Let's started", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "a little fox could not find his way home. then he", "seed": 1729, "judgments": { "baseline": { "clear_malformed_words": true, "malformed_examples": "firest / magiconother", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "he was she idea", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": true, "malformed_examples": "ideren / tuon", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "he sung he ideren the cat", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": true, "malformed_examples": "boton", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "She put the boton a ball named Tom", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } }, { "prompt": "a little fox could not find his way home. then he", "seed": 2026, "judgments": { "baseline": { "clear_malformed_words": true, "malformed_examples": "headow", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "The took should find more", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "constant": { "clear_malformed_words": true, "malformed_examples": "flowel", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "They put is took him", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." }, "cosine": { "clear_malformed_words": true, "malformed_examples": "Mambe", "broken_grammar": true, "sustained_prompt_related_coherence": false, "quality_pass": false, "failure_excerpt": "Mambe the card outside more the ball the bear too", "continuity_note": "Continuation does not sustain the prompt situation; clauses, references or events cease to form a coherent narrative." } } } ], "counts": { "baseline": { "reviewed": 12, "clear_malformed_words": 9, "broken_grammar": 12, "coherence_failures": 12, "quality_passes": 0 }, "constant": { "reviewed": 12, "clear_malformed_words": 9, "broken_grammar": 12, "coherence_failures": 12, "quality_passes": 0 }, "cosine": { "reviewed": 12, "clear_malformed_words": 5, "broken_grammar": 12, "coherence_failures": 12, "quality_passes": 0 } }, "cosine_release_quality_gate_passed": false, "promotion": false}6 unmodified lines789101112131415161718192021222324252627282930313233343536373839404142436 unmodified linesapp_file: index.htmlpinned: falselicense: mitshort_description: A small story Transformer running in your browser.---# Imperial LLM: character model 004A 30,643-parameter causal Transformer continued from Imperial model 003. Two blocks, four heads, 32-dimensional embeddings, 64-character context and 51-character vocabulary. No external pretrained weights, instruction tuning, retrieval or safety training. It remains an educational story-continuation model, not an assistant.## Training and selectionFull-parameter AdamW continuation on the 512 packaged normalized TinyStories training stories. Two runs share initialization, seed 1729, uniform story/window training draws, batch 16 and gradient clip 1.0. Windows never cross story boundaries. One run uses constant LR 0.001; the other cosine LR 0.0003→0.00003. Both execute 2400 optimizer steps; validation is checked every 200 steps, retaining the minimum including step 0. Early stopping patience 3 is configured but neither run stops early. The constant schedule at step 2400 wins by validation CE alone. Training/validation runtime of selected run: 89.3s on CPU, PyTorch 2.2.2, one thread. Its inherited model 003 had 2400 earlier continuation steps; this release adds 2400 more.## EvaluationFresh final test CE, nats per normalized character: **1.615683 → 1.515439**, **6.20% lower**. Sampled loss improves on62/64 stories; largest per-story increase: 0.022554. Baseline and candidate use the same inputs and targets. Four seeded 64-character windows per story yield16,384 predictions; windows may overlap. Final test is scored after checkpoint and schedule selection; it is never used for gradients or retuning.Validation CE: 1.610060 → 1.508940; selected-checkpoint training CE: 1.480559. These use story-contained windows, so they are not directly comparable to model 003's published stream-window losses. Only validation was recorded over time; no training curve is fabricated. The page displays a validation-only curve and the separately measured selected-checkpoint training CE.## Data and licenseModified normalized TinyStories V2 GPT-4 by Ronen Eldan and Yuanzhi Li, revision f54c09fd23315a6f9c86f9dc80f725de7d8f9c64. Data license: [CDLA-Sharing-1.0](https://cdla.dev/sharing-1-0/); code: MIT. Training and validation reuse 512 and 64 whole stories, respectively. The fresh test comprises 64 additional complete official-validation-source stories whose normalized hashes are absent from all 640 packaged train/validation/old-test stories. Exact duplicates are excluded; near duplicates were not assessed. Normalization retains the original model 002 alphabet: curly apostrophes become ASCII, unsupported capitals become lowercase, other unsupported characters become spaces. Corpus files, original notices, attribution and exact membership hashes are included in source.zip.## LimitsLower next-character cross-entropy does not establish improved story coherence, reasoning, instruction following, safety or out-of-domain generalization. Generated samples remain misspelled and often incoherent. The same-domain final sample is small; one training seed and overlapping sampled windows do not establish statistical significance. The inherited validation set already informed model 003. The 64-character context is a major constraint.## Identity and reproductionCandidate JSON SHA-256:`986699bbf0668f6d1aa5da67c373fe53770f7ce5e9efb3e337b5c0d7a42fe376`. Baseline JSON SHA-256:`f68c3ffac926081593dca074191c9845aa1a09c5830be1c1f088f9c63b147f0a`. Checkpoint and JSON contain identical weights; training.json carries hashes, three Python logit cases, schedule histories and corpus provenance. Read REPRODUCE.md. The source includes models/story-baseline003 for exact reinitialization. The full upstream Python suite is not green on the measured legacy runtime; see RELEASE_CHECKS.json for executed release checks and documented upstream failures.## Checkpoint security update — 24 October 2026The source download now contains restricted Python checkpoint loading with stable PyTorch >=2.6.0 required and no unrestricted pickle fallback. Historical executed-script evidence remains historical and is not an active entrypoint. The published model weights, browser application and training results are unchanged.The corrected package passed editable installation, 28 targeted checkpoint/security/resume tests, the full 235-test suite, and both JavaScript checks on Ubuntu 24.04 with Python 3.12 and CPU PyTorch 2.14.1+cpu. Exact versions are included in the source download. See [verified GitHub run](https://github.com/pablorod11/ML-AI-Projects/actions/runs/40060934840) and SECURITY_UPDATE.json. The historical Intel macOS/PyTorch 2.2.2 environment is refused for checkpoint loading; custom-object legacy checkpoints may also be rejected.6 unmodified lines78910111213141516171819202122232425262728293031323334356 unmodified linesapp_file: index.htmlpinned: falselicense: mitshort_description: Experimental character model; grammar remains unreliable.---# Imperial LLM: experimental model 005**Experimental release: all 12 reviewed continuations failed the grammar/coherence screen.** Published as an experimental research checkpoint. This release does not pass the project's story-quality gate and is not a reliable assistant or storyteller.Model 005 is a 110,387-parameter causal character Transformer with width 64, two blocks, four heads, context 64 and a 51-character vocabulary. Generation runs locally in the browser. It uses no external pretrained foundation-model weights, instruction tuning or retrieval.## Measured changeThe comparison baseline is the strongest archived, unpublished width 64 model, selected at step 14000 of a 14400-update training run. Both new policies start from those weights with fresh AdamW optimizers and execute 2400 additional updates. Cosine learning rate0.0003→0.00003 is selected by minimum validation loss, including step 0, over constant 0.001. Cosine step 2400 wins. This compares learning-rate policies differing in scale and shape, not schedule shape alone.Validation character cross-entropy falls from 1.183765 to 1.130293. On the **previously observed regression test**, loss falls from 1.188995 to 1.137958, a 4.29% reduction. These are nats per normalized predicted character. The test has128 stories and four fixed64-character windows per story,32768 predictions; windows can overlap. This is reused regression evidence, not a fresh held-out generalization claim. Validation has also informed earlier experiments. The former live model 004 has 30,643 parameters and a different training history; it is not the matched baseline for these percentages.All 12 cosine continuations contain broken grammar and fail sustained prompt-related coherence; five contain clear malformed words. The screen covers four frozen prompts ×three seeds, temperature 0.7, top 20 and 160 generated characters. It is unblinded agent screening, not a human study or standardized grammar score. Lower character loss does not establish fluency, reasoning, instruction following or broad reliability.## Data, reproducibility and verificationTraining uses 4096 normalized whole TinyStories stories and 128 validation stories, with 51-character vocabulary and story-contained windows. TinyStories V2 GPT4 is by Ronen Eldan and Yuanzhi Li, pinned to revision `f54c09fd23315a6f9c86f9dc80f725de7d8f9c64`, under [CDLA-Sharing-1.0](https://cdla.dev/sharing-1-0/). Corpus manifests retain source URLs, membership hashes and modification notices. This run retains legacy normalization, including removal of unsupported punctuation; do not describe it as the later terminator-repair corpus. Source code is MIT licensed; that does not replace the corpus license.The supported Linux run uses CPU PyTorch 2.14.1+cpu, one thread and deterministic operations. The 38 focused Python tests and both browser export suites passed. Python/JavaScript numerical parity, model hashes, input validation, seeded generation and context cropping were checked. These checks establish implementation consistency, not story quality or universal safety. Python checkpoint loading requires stable PyTorch ≥2.6 with restricted loading and current security fixes; the old local IntelMac Torch 2.2.2 runtime must not deserialize checkpoints.The selected checkpoint stores weights and primitive metadata, not optimizer/RNG state. The refinement resets AdamW; it is not an exact continuation of the archived optimizer trajectory. Source.zip preserves the old baseline, new source and experiment artifacts. See MODEL_CARD.md and REPRODUCE.md. No training curve is invented; recorded history is validation loss.Rollback target: Hugging Face Space revision `3185cd49f7abccc7ad2b30c4b73b04672415da76` (previous model 004 release).
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152{"release": "004","prepared_date": "2026-10-21","destination": "PabloRod11/imperial-llm","based_on_space_revision": "d82cd96378ef7088905dcc5de8976a731607709e","model_sha256": "986699bbf0668f6d1aa5da67c373fe53770f7ce5e9efb3e337b5c0d7a42fe376","checkpoint_sha256": "dfcb696518896e99ae313e1f008d9e46e69c1154582b29aa2b6ec7a53c5facfd","weights_unchanged_from_measured_candidate": true,"final_test_rescored_for_release": false,"focused_python": {"passed": 18,"failed": 0},"browser": {"passed": 36,"failed": 0,"skipped": 4,"projects": ["chromium","firefox","webkit","phone"],"skip_reason": "Optional reviewed pixel baselines"},"python_javascript_parity": {"passed": true,"maximum_absolute_error": 9.306707654310742e-06,"tolerance": 0.0001},"node_worker_generation": "PASS","node_syntax": "PASS","lint_touched_python": "PASS","python_syntax": "PASS","new_regressions": {"validation_only_browser_chart": "RED then GREEN","validation_history_export": "RED then GREEN"},"manual_browser": "In-app browser training record and validation curve visually inspected; desktop and phone Playwright screenshots inspected.","ui_scope": "Existing identity preserved; version labels, selected-run metric labels, validation-only series, explanatory note.","ui_audit": "Touched chart/copy checked against current Vercel Web Interface Guidelines: https://raw.githubusercontent.com/vercel-labs/web-interface-guidelines/main/command.md . No new actionable in-scope findings.","full_upstream_python": "NOT GREEN on legacy runtime; prior broad run interrupted with6 failures,119 passes and1 skip. Config failure resolved by project-root rerun; compile/RMSNorm/distributed runtime issues remain. See evidence/full-tests.log and evidence/upstream-runtime-check.log.","coverage": "NOT MEASURED","physical_mobile_device": "UNVERIFIED","remote_deployment": "NOT PERFORMED","authentication": "No HF_TOKEN, HUGGING_FACE_HUB_TOKEN or cached Hugging Face token present.","limitations": ["Lower sampled CE does not establish better coherence or assistant capability.","Single-seed, same-domain evaluation; near duplicates not assessed.","Retained64-character context and51-character vocabulary."]}123456789101112131415{"release": "model005-experimental","model_sha256": "e39b99ce8ba9803969c063025dff1d6d3f645b2bc15c9146ac8454bcc943d1b5","checkpoint_sha256": "29fdd846a4fb71cb7080d578524f13a1eba11c20b3a79fa48ba204334aa64b26","linux_run": "https://github.com/pablorod11/ML-AI-Projects/actions/runs/41122597620","python_checks_passed": 38,"browser_exports_passed": true,"max_js_logit_error": 2.5604187596783845e-06,"quality_gate_passed": false,"quality_samples_passed": 0,"quality_samples": 12,"user_requested_deployment": true,"test_status": "Previously observed regression set; not an untouched final test.","browser_ui_checks": "Local CUA: verified model load, generation/stop, Unicode and seed errors/focus, training metrics, 390px layout without horizontal overflow."}
123456789101112131415161718192021222324252627# Reproduce model004Extract source.zip and enter imperial-llm. The exact model003 starting weights are in models/story-baseline003; space/ contains the selected model004. Use Python3.12 with the measured PyTorch2.2.2 CPU runtime (macOS x86_64). Normalized licensed corpus and fresh test membership are bundled; no dataset download is required.```shpython3.12 -m venv .venv.venv/bin/python -m pip install -r requirements-story.txt.venv/bin/python -m pytest tests/test_finetune_stories.py -q.venv/bin/python scripts/finetune_stories.py --baseline models/story-baseline003 --output experiments/reproduction-new.venv/bin/python scripts/prepare_story_release.py --run experiments/reproduction-new --output experiments/browser-preview-newnode experiments/browser-preview-new/test_inference.cjsnode experiments/browser-preview-new/test_generation.cjs```Choose a new output directory. Test evaluation occurs only after validation selection; subsequent reruns are reproducibility checks, not new independent holdouts. No retraining or fresh-test rescoring was performed to prepare this release. The exact original executed training script is preserved in evidence/finetune_stories.executed.py. Later edits add an explicit baseline path and import formatting; weights are unchanged.For the packaged release:```shnpm cinpm run test:modelnpx playwright install chromium firefox webkitnpm run test:browserpython3 -m http.server 4173 --bind 127.0.0.1 --directory space```The browser suite covers generation, stop, invalid inputs, failure recovery, deep links, keyboard focus, desktop/mobile layout and the validation-only learning curve. Four optional screenshot-baseline tests remain skipped unless explicitly enabled and reviewed on matching OS/browser. Full upstream Python tests require a newer supported PyTorch/Python environment for compile/RMSNorm and available distributed loopback. Passing focused/release checks does not imply the broad suite is green.1234567891011121314151617181920212223242526# Reproduce experimental model 005Use a supported Linux host with Python 3.12, Node 24 and a maintained patched CPU PyTorch runtime. The recorded run used PyTorch 2.14.1+cpu and the exact package snapshot in requirements-linux-verified.txt. That snapshot records versions; it is not a wheel-hashed supply-chain lock. The legacy IntelMac Torch 2.2.2 environment cannot safely reload project checkpoints and must not bypass the loader guard.Extract source.zip and enter its imperial-llm project directory. Keep the archived baseline and experiment evidence unchanged. The package contains original corpus notices, the archived wide baseline and new source/artifacts; do not mix the terminator-repair corpus into this reproduction.```shpython3.12 -m venv .venv.venv/bin/python -m pip install torch==2.14.1+cpu --index-url https://download.pytorch.org/whl/cpu.venv/bin/python -m pip install -r requirements-linux-verified.txt.venv/bin/python -m unittest discover -s scripts -p test_late_refinement.py -v.venv/bin/python scripts/prepare_refinement_inputs.py.venv/bin/python scripts/late_refinement.py --root . --output experiments/refinement-newnode experiments/refinement-new/constant/test_inference.cjsnode experiments/refinement-new/constant/test_generation.cjsnode experiments/refinement-new/cosine/test_inference.cjsnode experiments/refinement-new/cosine/test_generation.cjs```Choose a new output directory; the runner refuses to overwrite existing evidence. Preparation reconstructs the recorded baseline inputs; it does not authorize publishing. Check the preserved workflow for the additional focused checkpoint/security/resume and wide-budget tests used by the recorded run. Preserve the exact installed environment, logs, protocol and hashes alongside new results.Both policies start from the same archived selected step 14000 weights, with fresh AdamW state. Each executes 2400 updates, batch 16, context 64, seed 1729, clip 1 and default weight_decay 0.01. Cosine 0.0003→0.00003 and constant 0.001 are compared. Checkpoints and policy are selected only by reused validation CE, checked every 200 updates, including step 0. The recorded cosine candidate selects step 2400. Saved weights lack optimizer/RNG state; this is not an exact optimizer continuation.The existing 128-story test is already observed. Reproduction can verify regression measurements; it cannot make this test fresh or establish new generalization. Keep frozen prompt/seed outputs for all models and inspect full text. The recorded candidate's 0/12 grammar/coherence passes remain a failed quality gate despite lower CE. Publication requires explicit authorization; these commands only train and verify.Dataset: modified TinyStories V2 GPT4, Ronen Eldan and Yuanzhi Li, revision `f54c09fd23315a6f9c86f9dc80f725de7d8f9c64`, [CDLA-Sharing-1.0](https://cdla.dev/sharing-1-0/). Preserve membership/provenance manifests and modification notices. Rollback Space revision: `3185cd49f7abccc7ad2b30c4b73b04672415da76`.
1234567891011{"kind": "source-security-update","verification_commit": "2d7cfc718a4bb0ab8d7d3207a1fd1adb37a636ff","ci_run": "https://github.com/pablorod11/ML-AI-Projects/actions/runs/40060934840","targeted_tests": 28,"full_suite_tests": 235,"model_sha256": "986699bbf0668f6d1aa5da67c373fe53770f7ce5e9efb3e337b5c0d7a42fe376","source_sha256": "63d04ef04fd7c00815cb872729dbb26c18001a3cbf4533c5fdf9d723fd2f1c75","model_changed": false,"training_changed": false}123456789{"kind": "checkpoint-security-policy-preserved","release": "model005-experimental","runtime": "2.14.1+cpu","minimum_checkpoint_loader": "stable PyTorch>=2.6.0; weights_only=True; no unsafe fallback","model_sha256": "e39b99ce8ba9803969c063025dff1d6d3f645b2bc15c9146ac8454bcc943d1b5","checkpoint_sha256": "29fdd846a4fb71cb7080d578524f13a1eba11c20b3a79fa48ba204334aa64b26","linux_run": "https://github.com/pablorod11/ML-AI-Projects/actions/runs/41122597620"}
1234567891011121314151617181920212223{ "BROWSER_CHECKS.md": "7a3bdccd25e4cf6deafdba6a3d03f37eebefe4720343602ce443d7f4d6aa67b7", "DESIGN.md": "828c1e5602703124e3c7c090a1ea59521da2a6b71b55f698ef77ee18b39dc67f", "LICENSE": "3af7509fdf483718aa1b8ab030d8ed639b9e43ae273321d9e7b75ddbf0e07f13", "MODEL_CARD.md": "080e539829ba112881481490bd524ba9e36861c5eacd0c70504a82dc9f695aa8", "QUALITY_REVIEW.json": "57af60fe4984c3d8f5eee2a5abbc7afcb8bb7f52b921adcc4676a996739abfce", "README.md": "605c0c33aafd71e82a03dab873385b1bcb28c113fd5e041854370787f3068bd5", "RELEASE_CHECKS.json": "609f3691a7b3fe56e8a29c8876d7f897e60645648550cd4cbe2b56717f51189d", "REPRODUCE.md": "eab8affcbf11bbfff28460e3df03f2d2ae0ec299704ad71fecb94767e41bab01", "SECURITY_UPDATE.json": "ff95510560b998db4ffff7dee36e208515d1e77bc3ba3c7205c5f346ddfaa3a0", "app.js": "675505dd789323e40db4c00583b49082c2d18e660db33efa9fa375c987a16749", "checkpoint.pt": "29fdd846a4fb71cb7080d578524f13a1eba11c20b3a79fa48ba204334aa64b26", "generation-worker.js": "5e97bf0db507c3462ca9b0ebd1fbe61614911c8d7d71c0d8f39c7a65de6ffafc", "index.html": "24a5d692eb86c4262b0e4990e242ae315ae478813abfb80d93538f98b33304d8", "inference.js": "b3c70c34d6be5bb9b37238f90e935823b6467c4b81d994c1bfe8dea4750c6c85", "model.json": "e39b99ce8ba9803969c063025dff1d6d3f645b2bc15c9146ac8454bcc943d1b5", "source.zip": "6df28df68927391c01f4e4e35a22ac95fea45244277f06515c26eb38777630e9", "style.css": "789bfd541c9f06658ac410d968e9c39fa8c63a48a08643b36071b984c699a9f4", "styles.css": "10394d70d98f0e81e76ff2b74a3dcb30bf17d85ec6fcddfb20b2cfcbef63debf", "test_generation.cjs": "ffb7acbe58f83f84b88c95f36badd6ff5739120cebe7c6ac7fe06cebc658cf08", "test_inference.cjs": "8fb0c8dcfc49af8cd837e75c7b3fc4a91078eed91ce2acad056c645d49d93175", "training.json": "62589fb373d89e32391aad52710ddc295ef8fbdca7f54f53a9ae5ebeced79627"}75 unmodified lines767778798081821 unmodified line848586878889907 unmodified lines989910010110210310410510610710810911011175 unmodified linesdocument.querySelector('.chart-card h3').textContent=validationOnly?'Validation curve':'Learning curve';svg.setAttribute('aria-label',validationOnly?'Recorded validation cross entropy by optimizer step':'Recorded training and validation cross entropy by optimizer step');note.hidden=!validationOnly;if(validationOnly)note.textContent='Training loss was measured only at the selected checkpoint. The curve shows recorded validation checks.';const maxStep=Math.max(...points.map(r=>r.step)), low=0, high=Math.ceil(Math.max(...points.flatMap(r=>series.map(([key])=>r[key])).filter(Number.isFinite)));const x=s=>50+s/Math.max(1,maxStep)*820, y=v=>235-(v-low)/Math.max(1,high-low)*210;for(let i=0;i<=4;i++){const v=low+(high-low)*i/4; add('line',{x1:50,x2:870,y1:y(v),y2:y(v),stroke:'var(--line)','stroke-width':1}); add('text',{x:35,y:y(v)+4,fill:'var(--muted)','font-size':11,'text-anchor':'end'},v.toFixed(1));}1 unmodified linefor(const [key,color] of series) add('polyline',{points:points.filter(r=>Number.isFinite(r[key])).map(r=>`${x(r.step)},${y(r[key])}`).join(' '),fill:'none',stroke:color,'stroke-width':2.5});}try {const responses = await Promise.all(['model.json','training.json'].map(async path=>{const response=await fetch(path);if(!response.ok)throw new Error(`${path}: ${response.status}`);return response;}));const bytes=await responses[0].arrayBuffer();payload=JSON.parse(new TextDecoder().decode(bytes)); record=await responses[1].json();const digest=[...new Uint8Array(await crypto.subtle.digest('SHA-256',bytes))].map(x=>x.toString(16).padStart(2,'0')).join('');7 unmodified linesif(!Number.isFinite(maxError) || maxError>(record.parity_tolerance??0.0001))throw new Error('Browser and Python model outputs disagree.');const meta=record.meta??record, history=record.history??record.curves??[], last=history.at(-1)??{};$('param-count').textContent=(meta.parameters??meta.parameter_count).toLocaleString(); $('block-count').textContent=config.N_BLOCKS; $('context-count').textContent=config.context_length;$('steps').textContent=(record.steps??meta.train_steps??meta.steps).toLocaleString(); $('train-loss').textContent=Number(meta.train_loss??last.train_loss??last.train).toFixed(3); $('val-loss').textContent=Number(meta.val_loss??last.val_loss??last.val).toFixed(3); $('train-time').textContent=`${Number(meta.runtime_seconds).toFixed(1)}s`;if($('selected-step'))$('selected-step').textContent=String(record.selected_step??meta.train_steps??record.steps);const hasTest=Number(record.split?.test_characters)>0;const format=value=>Number(value).toLocaleString();$('data-description').textContent=`${record.provenance} ${format(record.corpus_bytes)} characters total. ${format(record.split?.train_characters)} training; ${format(record.split?.val_characters)} validation${hasTest?`; ${format(record.split.test_characters)} test`:''}. ${hasTest?'The fixed earlier character alphabet is retained; whole normalized stories are split and exact duplicates removed.':'Character inventory comes from the original corpus; validation transitions are excluded from optimization.'}`;if($('test-metrics'))$('test-metrics').hidden=!hasTest;if(hasTest){$('baseline-test-loss').textContent=Number(record.evaluation.baseline_test_loss).toFixed(3);$('test-loss').textContent=Number(record.evaluation.candidate_test_loss).toFixed(3);}$('verification').textContent=`Browser/Python logit parity passed on ${cases.length} contexts (maximum absolute error ${maxError.toExponential(2)}). Training runtime: PyTorch ${record.torch_version}, CPU. ${hasTest?'The checkpoint was selected on validation. A separate test split was evaluated once after selection; fixed sampled context windows may overlap.':'Validation data was used for selection, with no independent test set.'}`;$('model-id').textContent=`MODEL SHA-256\n${digest}`; chart(history);$('load-status').textContent=`Model verified · ${payload.vocab.length} characters · weights SHA-256 ${digest.slice(0,12)}…`;$('run').disabled=false;75 unmodified lines767778798081821 unmodified line848586878889907 unmodified lines989910010110210310410510610710810911011111275 unmodified linesdocument.querySelector('.chart-card h3').textContent=validationOnly?'Validation curve':'Learning curve';svg.setAttribute('aria-label',validationOnly?'Recorded validation cross entropy by optimizer step':'Recorded training and validation cross entropy by optimizer step');note.hidden=!validationOnly;if(validationOnly)note.textContent=record.chart_note??'Training loss was measured only at the selected checkpoint. The curve shows recorded validation checks.';const maxStep=Math.max(...points.map(r=>r.step)), low=0, high=Math.ceil(Math.max(...points.flatMap(r=>series.map(([key])=>r[key])).filter(Number.isFinite)));const x=s=>50+s/Math.max(1,maxStep)*820, y=v=>235-(v-low)/Math.max(1,high-low)*210;for(let i=0;i<=4;i++){const v=low+(high-low)*i/4; add('line',{x1:50,x2:870,y1:y(v),y2:y(v),stroke:'var(--line)','stroke-width':1}); add('text',{x:35,y:y(v)+4,fill:'var(--muted)','font-size':11,'text-anchor':'end'},v.toFixed(1));}1 unmodified linefor(const [key,color] of series) add('polyline',{points:points.filter(r=>Number.isFinite(r[key])).map(r=>`${x(r.step)},${y(r[key])}`).join(' '),fill:'none',stroke:color,'stroke-width':2.5});}try {const responses = await Promise.all(['model.json','training.json'].map(async path=>{const response=await fetch(path,{cache:'no-store'});if(!response.ok)throw new Error(`${path}: ${response.status}`);return response;}));const bytes=await responses[0].arrayBuffer();payload=JSON.parse(new TextDecoder().decode(bytes)); record=await responses[1].json();const digest=[...new Uint8Array(await crypto.subtle.digest('SHA-256',bytes))].map(x=>x.toString(16).padStart(2,'0')).join('');7 unmodified linesif(!Number.isFinite(maxError) || maxError>(record.parity_tolerance??0.0001))throw new Error('Browser and Python model outputs disagree.');const meta=record.meta??record, history=record.history??record.curves??[], last=history.at(-1)??{};$('param-count').textContent=(meta.parameters??meta.parameter_count).toLocaleString(); $('block-count').textContent=config.N_BLOCKS; $('context-count').textContent=config.context_length;const lossText=value=>value==null||!Number.isFinite(Number(value))?'Not recorded':Number(value).toFixed(3);$('steps').textContent=(record.steps??meta.train_steps??meta.steps).toLocaleString(); $('train-loss').textContent=lossText(meta.train_loss??last.train_loss??last.train); $('val-loss').textContent=lossText(meta.val_loss??last.val_loss??last.val); $('train-time').textContent=`${Number(meta.runtime_seconds).toFixed(1)}s`;if($('selected-step'))$('selected-step').textContent=String(record.selected_step??meta.train_steps??record.steps);const hasTest=Number.isFinite(record.evaluation?.baseline_test_loss)&&Number.isFinite(record.evaluation?.candidate_test_loss);const format=value=>Number(value).toLocaleString();$('data-description').textContent=record.data_description??`${record.provenance} ${format(record.corpus_bytes)} characters total. ${format(record.split?.train_characters)} training; ${format(record.split?.val_characters)} validation${hasTest?`; ${format(record.split.test_characters)} test`:''}. ${hasTest?'The fixed earlier character alphabet is retained; whole normalized stories are split and exact duplicates removed.':'Character inventory comes from the original corpus; validation transitions are excluded from optimization.'}`;if($('test-metrics'))$('test-metrics').hidden=!hasTest;if(hasTest){$('baseline-test-loss').textContent=Number(record.evaluation.baseline_test_loss).toFixed(3);$('test-loss').textContent=Number(record.evaluation.candidate_test_loss).toFixed(3);}$('verification').textContent=record.verification_note??`Browser/Python logit parity passed on ${cases.length} contexts (maximum absolute error ${maxError.toExponential(2)}). Training runtime: PyTorch ${record.torch_version}, CPU. ${hasTest?'The checkpoint was selected on validation. A separate test split was evaluated once after selection; fixed sampled context windows may overlap.':'Validation data was used for selection, with no independent test set.'}`;$('model-id').textContent=`MODEL SHA-256\n${digest}`; chart(history);$('load-status').textContent=`Model verified · ${payload.vocab.length} characters · weights SHA-256 ${digest.slice(0,12)}…`;$('run').disabled=false;
123version https://git-lfs.github.com/spec/v1oid sha256:dfcb696518896e99ae313e1f008d9e46e69c1154582b29aa2b6ec7a53c5facfdsize 142562123version https://git-lfs.github.com/spec/v1oid sha256:29fdd846a4fb71cb7080d578524f13a1eba11c20b3a79fa48ba204334aa64b26size 461941
12345678910111213141516<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="A small Transformer trained from scratch. Run its actual weights in your browser, inspect the model and reproduce the experiment."><meta name="theme-color" content="#f3f2ed"><title>Imperial LLM — Model laboratory</title><link rel="stylesheet" href="styles.css"><script src="inference.js" defer></script><script src="app.js" defer></script></head><body><a class="skip-link" href="#main-content">Skip to model laboratory</a><header><a class="brand" href="#generate" translate="no"><span class="mark" aria-hidden="true">Ⅲ</span> Imperial <b>LLM</b></a><span class="header-note">Character model · Experiment 004</span><a class="source-link" href="source.zip" download>Download source <span aria-hidden="true">↗</span></a></header><main id="main-content" tabindex="-1"><section class="intro" aria-labelledby="lab-title"><div><h1 id="lab-title">Model laboratory</h1><p class="lede">Give a small Transformer a starting point. Inspect what it predicts, one character at a time.</p></div><span class="status">Runs in your browser</span></section><nav aria-label="Laboratory sections"><a class="tab active" href="#generate" data-panel="generate" aria-current="page">Generate</a><a class="tab" href="#experiment" data-panel="experiment">Training record</a><a class="tab" href="#inside" data-panel="inside">Model notes</a></nav><p id="load-status" role="status">Loading model weights…</p><noscript><p>This laboratory needs JavaScript for generation. You can still download the source and checkpoint to run the experiment in Python.</p></noscript><section id="generate" class="panel"><div class="workbench"><div class="controls"><div class="section-head"><h2>Your starting point</h2></div><label for="prompt">Prompt</label><p id="prompt-help" class="hint">Continue a short story using characters from the training corpus.</p><textarea id="prompt" name="prompt" rows="3" maxlength="300" spellcheck="false" autocomplete="off" aria-describedby="prompt-help input-error">The little</textarea><p id="input-error" class="input-error" role="alert" aria-live="polite"></p><div class="examples"><span>Try</span><button data-prompt="The little">The little</button><button data-prompt="One day">One day</button><button data-prompt="The sun">The sun</button></div><button id="run" class="primary" disabled>Generate continuation <span aria-hidden="true">↗</span></button><button id="stop" hidden>Stop generation</button><details class="generation-settings"><summary>Sampling settings</summary><div class="slider-head"><label for="temperature">Temperature</label><output id="temperature-value" for="temperature">0.7</output></div><input id="temperature" name="temperature" type="range" min="0.1" max="1.5" value="0.7" step="0.1"><p class="hint">Lower is more predictable. Higher takes more chances.</p><div class="settings"><div><label for="length">New characters</label><select id="length" name="length"><option>64</option><option selected>128</option><option>256</option></select></div><div><label for="seed">Random seed</label><input id="seed" name="seed" autocomplete="off" aria-describedby="seed-help input-error" type="number" value="42" min="0" max="4294967295"></div></div><p id="seed-help" class="hint">Use the same seed and settings to repeat a result.</p></details><p class="boundary">An educational character model trained on a small story corpus. Expect imperfect spelling and repetition.</p></div><div class="result"><div class="section-head"><h2>The continuation</h2><span id="run-status" role="status" aria-live="polite">Ready for a prompt</span></div><div id="output" class="output" role="region" aria-label="Generated continuation" tabindex="0"><span class="placeholder">Your continuation will appear here.<br>Choose a prompt, then generate.</span></div><div class="result-footer"><span id="performance">Actual model weights · local execution</span><button id="copy" disabled>Copy text</button></div><details><summary>Inspect the next-character prediction</summary><p class="hint">Top probabilities at the end of the current text, before temperature or sampling filters.</p><div id="predictions">Generate text to inspect the distribution.</div></details></div></div><aside class="model-facts" aria-label="Loaded model facts"><div><strong id="param-count">—</strong><span>parameters</span></div><div><strong id="block-count">—</strong><span>attention blocks</span></div><div><strong id="context-count">—</strong><span>character context</span></div><a href="checkpoint.pt" download>Download checkpoint <span aria-hidden="true">↗</span></a></aside></section><section id="experiment" class="panel" hidden><div class="section-heading"><h2>Training record</h2><p>Training and validation loss come from the recorded Python run. Browser inference uses the exported weights from that checkpoint.</p></div><div class="metrics"><div><span>Optimizer steps · selected run</span><strong id="steps">—</strong></div><div><span>Checkpoint training loss</span><strong id="train-loss">—</strong></div><div><span>Checkpoint validation loss</span><strong id="val-loss">—</strong></div><div><span>Selected checkpoint step</span><strong id="selected-step">—</strong></div><div><span>Training time · selected run</span><strong id="train-time">—</strong></div></div><div id="test-metrics" class="metrics" hidden><div><span>Model 003 · fresh test loss</span><strong id="baseline-test-loss">—</strong></div><div><span>Model 004 · fresh test loss</span><strong id="test-loss">—</strong></div></div><div class="chart-card"><div class="section-head"><h3>Learning curve</h3><span>Cross entropy · Lower is better</span></div><svg id="loss-chart" viewBox="0 0 900 280" role="img" aria-label="Recorded training and validation cross entropy by step"></svg><div class="legend"><span>Training</span><span>Validation</span></div><p id="curve-note" class="hint" hidden></p></div><div class="evidence-grid"><div><h3>The data</h3><p id="data-description">Dataset provenance, exact split information and hashes are included with the source.</p><a href="training.json">Inspect the full run record ↗</a><p class="hint">Story data: <a href="https://huggingface.co/datasets/roneneldan/TinyStories" target="_blank" rel="noopener">TinyStories</a> · <a href="https://cdla.dev/sharing-1-0/" target="_blank" rel="noopener">CDLA-Sharing-1.0</a>. Project code remains MIT licensed.</p></div><div><h3>What this establishes</h3><p>Tokenization, causal attention, gradient descent, serialization and browser generation work together. A tiny corpus and small model do not establish general language ability.</p><p id="verification" class="hint"></p></div></div></section><section id="inside" class="panel" hidden><div class="section-heading"><h2>Model notes</h2><p>The classic Transformer architecture comes from Fareed Khan’s open training project. We train a compact character model, then execute its operations directly in JavaScript.</p></div><ol class="pipeline"><li><div><h3>Characters become numbers</h3><p>A corpus-derived character vocabulary maps your text to token IDs. Unsupported characters are reported explicitly.</p></div></li><li><div><h3>Attention reads the context</h3><p>Learned token and position embeddings pass through causal multi-head attention, layer normalization, residual connections and ReLU feed-forward layers.</p></div></li><li><div><h3>One more character</h3><p>The output layer scores the vocabulary. Temperature and top-k sampling select the next character. The context window advances as the text grows.</p></div></li></ol><div class="evidence-grid"><div><h3>Reproduce the work</h3><p>The source bundle contains the upstream architecture, our training and export script, the exact corpus, inference implementation and parity checks.</p><a href="source.zip" download>Download the project ↗</a></div><div><h3>Provenance & limitations</h3><p>Based on <a href="https://github.com/FareedKhan-dev/train-llm-from-scratch" target="_blank" rel="noopener">train-llm-from-scratch</a>, MIT licensed. This demo has no instruction tuning, retrieval or safety training. Training happens in Python; this public Space runs inference only.</p><p id="model-id" class="digest"></p></div></div></section></main><footer><span>Imperial LLM · An experiment in understanding</span><a href="https://github.com/FareedKhan-dev/train-llm-from-scratch" target="_blank" rel="noopener">Built on open source ↗</a></footer></body></html>12345678910111213141516<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="A small Transformer trained from scratch. Run its actual weights in your browser, inspect the model and reproduce the experiment."><meta name="theme-color" content="#f3f2ed"><title>Imperial LLM — Model laboratory</title><link rel="stylesheet" href="styles.css"><script src="inference.js" defer></script><script src="app.js?v=model005" defer></script></head><body><a class="skip-link" href="#main-content">Skip to model laboratory</a><header><a class="brand" href="#generate" translate="no"><span class="mark" aria-hidden="true">Ⅲ</span> Imperial <b>LLM</b></a><span class="header-note">Character model · Experimental 005</span><a class="source-link" href="source.zip" download>Download source <span aria-hidden="true">↗</span></a></header><main id="main-content" tabindex="-1"><section class="intro" aria-labelledby="lab-title"><div><h1 id="lab-title">Model laboratory</h1><p class="lede">Give a small Transformer a starting point. Inspect what it predicts, one character at a time.</p></div><span class="status">Runs in your browser</span></section><nav aria-label="Laboratory sections"><a class="tab active" href="#generate" data-panel="generate" aria-current="page">Generate</a><a class="tab" href="#experiment" data-panel="experiment">Training record</a><a class="tab" href="#inside" data-panel="inside">Model notes</a></nav><p id="load-status" role="status">Loading model weights…</p><noscript><p>This laboratory needs JavaScript for generation. You can still download the source and checkpoint to run the experiment in Python.</p></noscript><section id="generate" class="panel"><div class="workbench"><div class="controls"><div class="section-head"><h2>Your starting point</h2></div><label for="prompt">Prompt</label><p id="prompt-help" class="hint">Continue a short story using characters from the training corpus.</p><textarea id="prompt" name="prompt" rows="3" maxlength="300" spellcheck="false" autocomplete="off" aria-describedby="prompt-help input-error">The little</textarea><p id="input-error" class="input-error" role="alert" aria-live="polite"></p><div class="examples"><span>Try</span><button data-prompt="The little">The little</button><button data-prompt="One day">One day</button><button data-prompt="The sun">The sun</button></div><button id="run" class="primary" disabled>Generate continuation <span aria-hidden="true">↗</span></button><button id="stop" hidden>Stop generation</button><details class="generation-settings"><summary>Sampling settings</summary><div class="slider-head"><label for="temperature">Temperature</label><output id="temperature-value" for="temperature">0.7</output></div><input id="temperature" name="temperature" type="range" min="0.1" max="1.5" value="0.7" step="0.1"><p class="hint">Lower is more predictable. Higher takes more chances.</p><div class="settings"><div><label for="length">New characters</label><select id="length" name="length"><option>64</option><option selected>128</option><option>256</option></select></div><div><label for="seed">Random seed</label><input id="seed" name="seed" autocomplete="off" aria-describedby="seed-help input-error" type="number" value="42" min="0" max="4294967295"></div></div><p id="seed-help" class="hint">Use the same seed and settings to repeat a result.</p></details><p class="boundary">Experimental model 005. All 12 reviewed continuations failed grammar and coherence checks. Expect misspellings, repetition and loss of story context.</p></div><div class="result"><div class="section-head"><h2>The continuation</h2><span id="run-status" role="status" aria-live="polite">Ready for a prompt</span></div><div id="output" class="output" role="region" aria-label="Generated continuation" tabindex="0"><span class="placeholder">Your continuation will appear here.<br>Choose a prompt, then generate.</span></div><div class="result-footer"><span id="performance">Actual model weights · local execution</span><button id="copy" disabled>Copy text</button></div><details><summary>Inspect the next-character prediction</summary><p class="hint">Top probabilities at the end of the current text, before temperature or sampling filters.</p><div id="predictions">Generate text to inspect the distribution.</div></details></div></div><aside class="model-facts" aria-label="Loaded model facts"><div><strong id="param-count">—</strong><span>parameters</span></div><div><strong id="block-count">—</strong><span>attention blocks</span></div><div><strong id="context-count">—</strong><span>character context</span></div><a href="checkpoint.pt" download>Download checkpoint <span aria-hidden="true">↗</span></a></aside></section><section id="experiment" class="panel" hidden><div class="section-heading"><h2>Training record</h2><p>This experimental checkpoint adds 2,400 optimizer updates to the archived width-64 model. Lower character loss did not establish story coherence.</p></div><div class="metrics"><div><span>Additional optimizer steps</span><strong id="steps">—</strong></div><div><span>Checkpoint training loss</span><strong id="train-loss">—</strong></div><div><span>Checkpoint validation loss</span><strong id="val-loss">—</strong></div><div><span>Selected checkpoint step</span><strong id="selected-step">—</strong></div><div><span>Training time · selected run</span><strong id="train-time">—</strong></div></div><div id="test-metrics" class="metrics" hidden><div><span>Archived width-64 · regression loss</span><strong id="baseline-test-loss">—</strong></div><div><span>Experimental 005 · regression loss</span><strong id="test-loss">—</strong></div></div><div class="chart-card"><div class="section-head"><h3>Learning curve</h3><span>Cross entropy · Lower is better</span></div><svg id="loss-chart" viewBox="0 0 900 280" role="img" aria-label="Recorded training and validation cross entropy by step"></svg><div class="legend"><span>Training</span><span>Validation</span></div><p id="curve-note" class="hint" hidden></p></div><div class="evidence-grid"><div><h3>The data</h3><p id="data-description">Dataset provenance, exact split information and hashes are included with the source.</p><a href="training.json">Inspect the full run record ↗</a><p class="hint">Story data: <a href="https://huggingface.co/datasets/roneneldan/TinyStories" target="_blank" rel="noopener">TinyStories</a> · <a href="https://cdla.dev/sharing-1-0/" target="_blank" rel="noopener">CDLA-Sharing-1.0</a>. Project code remains MIT licensed.</p></div><div><h3>What this establishes</h3><p>Tokenization, causal attention, gradient descent, serialization and browser generation work together. A tiny corpus and small model do not establish general language ability.</p><p id="verification" class="hint"></p></div></div></section><section id="inside" class="panel" hidden><div class="section-heading"><h2>Model notes</h2><p>The classic Transformer architecture comes from Fareed Khan’s open training project. We train a compact character model, then execute its operations directly in JavaScript.</p></div><ol class="pipeline"><li><div><h3>Characters become numbers</h3><p>A corpus-derived character vocabulary maps your text to token IDs. Unsupported characters are reported explicitly.</p></div></li><li><div><h3>Attention reads the context</h3><p>Learned token and position embeddings pass through causal multi-head attention, layer normalization, residual connections and ReLU feed-forward layers.</p></div></li><li><div><h3>One more character</h3><p>The output layer scores the vocabulary. Temperature and top-k sampling select the next character. The context window advances as the text grows.</p></div></li></ol><div class="evidence-grid"><div><h3>Reproduce the work</h3><p>The source bundle contains the upstream architecture, our training and export script, the exact corpus, inference implementation and parity checks.</p><a href="source.zip" download>Download the project ↗</a></div><div><h3>Provenance & limitations</h3><p>Based on <a href="https://github.com/FareedKhan-dev/train-llm-from-scratch" target="_blank" rel="noopener">train-llm-from-scratch</a>, MIT licensed. This demo has no instruction tuning, retrieval or safety training. Training happens in Python; this public Space runs inference only.</p><p id="model-id" class="digest"></p></div></div></section></main><footer><span>Imperial LLM · An experiment in understanding</span><a href="https://github.com/FareedKhan-dev/train-llm-from-scratch" target="_blank" rel="noopener">Built on open source ↗</a></footer></body></html>
123version https://git-lfs.github.com/spec/v1oid sha256:63d04ef04fd7c00815cb872729dbb26c18001a3cbf4533c5fdf9d723fd2f1c75size 26265286123version https://git-lfs.github.com/spec/v1oid sha256:6df28df68927391c01f4e4e35a22ac95fea45244277f06515c26eb38777630e9size 31409632
17 unmodified lines18192017 unmodified linesassert.throws(()=>generate({...request,temperature:0},()=>{}),/Temperature/);assert.throws(()=>generate({...request,seed:-1},()=>{}),/seed/);console.log('PASS: deterministic seeded generation, 64-character output, batched streaming, final logits, invalid request rejection.');17 unmodified lines181920212223242526272829303132333435363717 unmodified linesassert.throws(()=>generate({...request,temperature:0},()=>{}),/Temperature/);assert.throws(()=>generate({...request,seed:-1},()=>{}),/seed/);console.log('PASS: deterministic seeded generation, 64-character output, batched streaming, final logits, invalid request rejection.');// Exercise history beyond both candidate context windows with supported vocabulary.const cropSize=payload.config.context_length;const safeToken=payload.vocab.find(c=>c.trim().length>0);assert.ok(safeToken);const longPrompt=safeToken.repeat(Math.max(129,cropSize+17));assert.ok(longPrompt.length>128 && longPrompt.length<=300);const longRequest={...request,prompt:longPrompt,length:64};const longFirst=generate(longRequest,()=>{});const longRepeat=generate(longRequest,()=>{});const suffixOnly=generate({...longRequest,prompt:longPrompt.slice(-cropSize)},()=>{});assert.equal(longFirst.text,longRepeat.text,'long history must be reproducible');assert.equal(longFirst.text,suffixOnly.text,'worker must crop history to actual context');assert.deepEqual(longFirst.logits,suffixOnly.logits);assert.equal([...longFirst.text].length,64);assert.ok(longFirst.logits.every(Number.isFinite));console.log('PASS: long-history deterministic generation and context cropping.');
12 unmodified lines13141516171812 unmodified linesassert.throws(()=>model.encode('🤖'),/Unsupported character/);assert.throws(()=>model.forward([]),/Context/);assert.throws(()=>model.forward([999]),/Context/);assert.throws(()=>model.forward(Array(65).fill(0)),/Context/);const broken=structuredClone(data);broken.weights['lm_head.weight'][0][0]=null;assert.throws(()=>new ImperialModel(broken),/Invalid model tensor/);console.log(`PASS: checksum, three Python/JS logit cases (max error ${maximum}), roundtrip, input bounds, tensor validation.`);12 unmodified lines13141516171812 unmodified linesassert.throws(()=>model.encode('🤖'),/Unsupported character/);assert.throws(()=>model.forward([]),/Context/);assert.throws(()=>model.forward([999]),/Context/);assert.throws(()=>model.forward(Array(data.config.context_length+1).fill(0)),/Context/);const broken=structuredClone(data);broken.weights['lm_head.weight'][0][0]=null;assert.throws(()=>new ImperialModel(broken),/Invalid model tensor/);console.log(`PASS: checksum, three Python/JS logit cases (max error ${maximum}), roundtrip, input bounds, tensor validation.`);
BROWSER_CHECKS.md+3-3
MODEL_CARD.md+8-18
QUALITY_REVIEW.jsonAdded+429
README.md+13-21
RELEASE_CHECKS.json+13-50
REPRODUCE.md+17-18
SECURITY_UPDATE.json+7-9
SHA256SUMS.jsonAdded+23
app.js+7-6
checkpoint.pt+2-2
index.html+4-4
model.json
source.zip+2-2
test_generation.cjs+17
test_inference.cjs+1-1
training.json