Keal Jones

Small model lab

Experiments with language models small enough to run on a phone. Each one starts with a question, and most end with an answer I didn't expect. Every number here comes from a run in lm-experiments, and this page rebuilds itself from that repo whenever I push.

Demos you can run

Gradient Decent A one-million-weight language model writing stories in your browser with no WebGPU, WebGL or WASM. The weights are pictures, every matrix multiply is the canvas multiply blend mode, and the activation function is a colour gradient. Try it Ask first A 0.6B model trained to ask before answering learned to ask, not what to ask. Play the simulated person it faced, and see its one question: "What is your age?" Try it Draft -> fact-check A small model answers, then the same model fact-checks itself with Wikipedia. Guess whether the reviewer catches the mistake before you see what it did. Try it GPU loss and recovery Safari on iOS 27 kills WebGPU work that runs too long (a 3-second watchdog per command buffer, from the WebKit commit "Long running command buffers can hang the system"; it isn't in the release notes) and then may refuse to give the page a GPU again. Try it LFM3-1.7B → MLC / WebLLM 0.2.87 LFM3 1.7B had never been built for WebLLM. Eight failed-then-fixed jobs later it runs on an iPhone's GPU at 13.7 tokens a second. Step through the jobs, round real LFM3 weights to 4, 3 and 2 bits, and guess which build couldn't recognise "Hii". Try it Loop concept vs loop syntax Small models write loops fine in Python. Hand them the syntax for a language they've never seen and they mostly copy the example. Edit and run their attempts in your browser. Try it How much memory does a phone's browser tab get? How much memory does a web page get on your phone before the browser kills it? An iPhone 16 in Safari: 1.9 GB, one budget for JavaScript, WebAssembly and the GPU. An Android phone in Firefox: past 8 GB. Open it on your own phone and find out. Try it Random weights A tiny GPT-2 that never trains, running live in your browser. Fill its weights with random numbers and watch it get more confidently wrong than a blind guess. Try it Starting weights A tiny network learns a spiral live in your browser. Start its weights equal, tiny or huge and watch every neuron stay a copy of the others, the signal fade to nothing, or every ReLU die. Try it Context packets A front layer squeezes a 6,000-word messy chat into a 363-word packet, and Opus answers from that alone. It passed every test. Click through each chat and context style and see exactly what the model got. Try it Registers A 3.6M-parameter planner gets 8 memory slots that update as it reads. Plan in its world yourself with the state table showing, then see what the slots did to messy input: 0% to 72%. Try it Tokenizer zoo 20 ways to cut text into tokens for a small GPT, from BPE to seam tokens, vowel-free words and keyboard neighbours. Planned, not run yet: type a sentence and see what each one does to it. Try it

Every experiment

Results

Gradient Decent

a language model run by colour blending on a 2D canvas

Can a 2D canvas, using only blend modes and image scaling, run a real language model fast enough to watch?

The canvas picks the same token as a plain numpy reference on all 60 tokens of a greedy run, at about 20 tokens a second with the live tiles on and about 30 with them off.

headless Chrome 153, CPU only, no GPUOpen the demoRead the write-up
Show the numbers
checkresult
greedy tokens matching the reference60 of 60
largest logit error0.022 on values up to 14.5
gradient lookup error (SiLU)0.0036
time per token, tiles off33 ms
whole bundle (36 pictures + tokenizer)743 KB
Results

Ask first

find out what someone needs before answering

The cold test of untouched Qwen3-0.6B on the three recorded tasks (2026-10-24) showed what this targets:

it learned the script, not the habit

Results

Draft -> fact-check

small models answer with Wikipedia/Wikidata tools, then review (and fix) their own answer; Haiku baseline

Small models are bad at most things, but can one get one message right if it answers first and then a second pass of the same model reviews that answer, looks things up, and fixes it?

At 0.6–0.8B the model can read; it can't search. Give Qwen3 0.6B a paragraph containing the answer and it's right every time.

Results

GPU loss and recovery

what happens when a phone browser takes the GPU away

Safari on iOS 27 kills WebGPU work that runs too long (a 3-second watchdog per command buffer, from the WebKit commit "Long running command buffers can hang the system"; it isn't in the release notes) and then may refuse to give the page a GPU again.

Two different kinds of GPU loss on the iPhone: a single long job loses the device but the page gets a working GPU back in ~13 ms; ~3 s of back-to-back queued work loses it with "destroyed" and the page gets no GPU at all until it reloads.

iPhone 16, Safari 27.2 / iOS 27, 2026-11-12, first version of the pageOpen the demoRead the write-up
Show the numbers
What ranWhat happenedLoss reason / messageBack after
One dispatch, ramped up (run 1)lost right after a job that took 2.05 s wall time"unknown" / empty12 ms, no reload
One dispatch, ramped up (run 2)lost right after a job that took 1.83 s wall time"unknown" / empty14 ms, no reload
60 × 0.1 s submits, each waited forfine, 6.08 s total
60 × 0.1 s submits, all queued at oncelost 3.16 s in"destroyed" / empty (the page never destroyed it)never: requestAdapter returned null 26 times over 210 s, the fallback adapter too; a reload got a GPU at once
device.destroy() (control)lost"destroyed" / empty1 ms, no reload
Results

LFM3-1.7B → MLC / WebLLM 0.2.87

LFM3 1.7B on MLC / WebLLM (WebGPU)

Goal: a WebLLM-loadable MLC build of LiquidAI/LFM3-1.7B (q4f16_1 weights + a WebGPU model library .wasm + mlc-chat-config.json) that loads on @mlc-ai/web-llm 0.2.87, for Squiggle's phone path (engine-webllm.js, a model's mlcRecord).

LFM3 1.7B runs in Safari on an iPhone 16 through WebLLM at 13.7 tokens a second ; a 3-bit build loses its judgement, and a long task still runs out of the tab's ~1.9 GB.

4-bit, our own MLC buildOpen the demoRead the write-up
Results

Loop concept vs loop syntax

does a looked-up snippet let a small model write loops in a language it never saw?

Is knowing what a for loop does different from knowing how to spell one? If a small model already gets the concept (loop over this, step by that, body does X), then looking up a syntax snippet should be enough to write loops in a language it's never really seen. Free first test, no training.

A looked-up snippet does not let them carry that concept into a new spelling. With the snippet, Qwen3 0.6B solves 0 of those tasks in Zig and 1 in Plink; Qwen3 1.7B solves 3 in Zig and 5 in Plink.

Kaggle, 2x T4, 0.6 h, freeOpen the demoRead the write-up
Show the numbers
modellanguagecold: pass / syntax failsnippet: pass / syntax failtasks solved with snippet, of those solved in Pythonsnippet answers that paste the snippet's example
Qwen3 0.6BPython66% / 0%44% / 1%18 / 2222%
Qwen3 0.6BZig 0.170% / 100%0% / 74%0 / 2236%
Qwen3 0.6BPlink0% / 100%1% / 63%1 / 2266%
Qwen3 1.7BPython80% / 0%71% / 0%20 / 210%
Qwen3 1.7BZig 0.170% / 100%11% / 65%3 / 213%
Qwen3 1.7BPlink0% / 100%18% / 46%5 / 2126%
Results

How much memory does a phone's browser tab get?

On-device models in Squiggle keep killing the Safari tab on an iPhone 16. Apple doesn't publish how much memory a web page may use before iOS kills it. How much is it, is it one budget or separate ones for JavaScript, WebAssembly and the GPU, and is it the phone or the browser?

iPhone Safari gives a tab about 1.9 GB, one budget shared by JavaScript, WebAssembly and the GPU; Firefox on an Android phone went past every cap the test had.

memcap, 9 Nov 2026, lowest and best of the roundsOpen the demoRead the write-up
Show the numbers
MemoryiPhone 16, SafariAndroid 17, Firefox 160
JavaScript1.88 – 1.94 GB6.13 – ≥ 8.00 GB (8 GB was the test's cap then)
WebAssembly1.90 – 1.94 GB≥ 4.00 GB (WebAssembly's own 4 GB ceiling, 1 run)
GPU (WebGPU)1.88 – 1.91 GBnot tested: no WebGPU in this Firefox
JS + GPU together1.84 – 1.89 GB (middle run: 992 MB JS + 936 MB GPU)not tested
Results

Random weights

tiny untrained GPT-2, Qwen3 and Gemma 4 with four ways to fill their weights at random

The idea: "i wanna make a really small model... but instead of training it lets just throw random numbers in the weights."

No random weights beat a blind guess. The best one, the standard init, lands 0.009 above uniform odds: the logits are so small that the model is close to "every token equally likely", which is why it's the least wrong.

local CPU, 2026-11-03Open the demoRead the write-up
Show the numbers
initWikiText-2 lossdistinct top-1 tokens over 10,240 positions
default (normal 0.02)10.8344,250
uniform -1..123.5125
normal 1.066.159
normal 106,60862
Results

Starting weights

why random numbers, and how big

If every weight started equal, would every neuron learn the same thing, and how much does the size of the random starting numbers matter?

Equal starting weights never become different: every layer stays one neuron copied 12 times. Scaled random learns the spiral in 12 to 60 steps; tiny random never leaves the coin-flip loss; huge random kills every ReLU.

Node on CPU, step size 0.3, 3 random draws, 6,000 stepsOpen the demoRead the write-up
Show the numbers
starting weightstanh, 3 layerstanh, 6 layersReLU, 3 layersReLU, 6 layers
all zeros50%, never moves50%, never moves50%, never moves50%, never moves
all the same80%, 1 neuron per layer58%, 1 neuron per layer50%, all dead50%, all dead
tiny randomloss stuck at 0.693loss stuck at 0.693loss stuck at 0.693loss stuck at 0.693
scaled random97% by step 40–5297% by step 12–2597% by step 38–5597% by step 22–60
huge random97% by step 11–241 of 3 at step 2,417; others 68%, 75%50%, all dead50%, all dead
Results

Context packets

answer from a small packet instead of the whole conversation

If a front layer reads the whole chat and writes a ~350-word packet (a gist, what the vague words in the new message point to, and only the facts that matter), can the model answer from just that packet as well as it can from the full history?

the packet matched full history at 7% of the words

Claude Code subagents, 6 Nov 2026, ~150 agent runs, no GPU spendOpen the demoRead the write-up
Show the numbers
Model answering, and what it sawWords seen (avg, 1–12)Messy 1–8Clean 9–12Last-message 13–16All of 1–12
Opus, full history5,3758/8 pass, 8.93/4, 8.8–11/12, 8.8
Opus, Opus packet3638/8, 9.14/4, 8.84/4, 9.512/12, 9.0
Opus, Sonnet packet3888/8, 9.04/4, 8.8–12/12, 8.9
Opus, Haiku packet3587/8, 8.54/4, 8.53/4, 8.211/12, 8.5
Haiku, full history5,3757/8, 8.04/4, 8.5–11/12, 8.2
Haiku, Opus packet3637/8, 8.53/4, 6.5–10/12, 7.8
Set up, no write-up yet

Registers

a state table inside a small model

A planner has to know where the agent is, what it's holding and which doors are open. A plain transformer has no table for that, so it rebuilds the state at every word by looking back over the whole plan. This run gives the model state registers: 8 small slots carried alongside the text.

Set up. No results written up yet.

Planned

Tokenizer zoo

plan

The same model and tests as experiments/weird (a 6-layer GPT on FineWeb-Edu), changing only how text is cut into tokens. Lossless tokenizers are compared on bits per byte of the original text. Lossy ones predict different text, so they're compared on tests transformed the same way (BLiMP, plus next-word tests where BLiMP breaks).

Planned. Nothing has run yet.

Results

WebGPU on a rented GPU

can Squiggle's evals run Tilde off the phone?

Squiggle's evals (KealJones/squiggle tests/eval) drive the real app in headless Chromium. With LFM3 1.7B on Tilde, which needs WebGPU, they have so far run only on an iPhone through the phone relay: one case at a time, one run per case, and only while the phone stays awake. This asks whether a Hugging Face GPU job can do it instead.

WebGPU works on a Hugging Face T4 (webgpu-smoke-4, 2026-11-22).

Show the numbers
WhereScoreRoundsTool callsTime for the case
HF T4 (webgpu-smoke-5)1.004383 s
Modal T4 (squiggle gpu-smoke, Actions)1.0064107 s
iPhone 16, same build (phone relay)1.0054163 s
Results

Hand grades

18 of my real messages with pass rules written first; Qwen3 0.6B, 1.7B and 4B answer in their own words and are graded by hand

Strict: an answer passes only if it does what the rule says; confidently wrong extras (e.g. --hard, "Chinchilla is from Alibaba") fail it.

Strict: an answer passes only if it does what the rule says; confidently wrong extras (e.g. --hard, "Chinchilla is from Alibaba") fail it.

Show the numbers
task0.6B0.6B think1.7B think4B think
0 kill 8080✗ refused✗ treats 8080 as a PID✓✓
1 undo last commit, keep changes✗ --hard✗ revert✗ revert✓ reset HEAD~1
2 Chinchilla✗ the rodent✗✗ "Alibaba model"✗ wrong lab, no 20 tokens/param
3 frontier training time✗✗✗✗
4 tiny model, trillions of tokens✗✗✗✗
5 Opus 5.5 details✗ confused✗ made-up claims✓ says it doesn't know✓ says it can't give details
6 REN vs attention, MLP✗✗✗✗
7 many tiny specialist models✗✗ "split screens"✓ modular nets✓ modular nets
Results

Findout pilot

Findout pilot (v2)

A cheap test, before spending $20–40 on the full plan (Figure-it-out model plan), of the thing run 1 failed at: putting known steps together into a plan it has never seen.

Verdict: NOT YET for both trained arms. Held-out strict mean was 26% (gold) and 28% (teacher) against the 50% bar, with at least one held-out type at 0% in each. The untouched model scored 0% strict. Run 1 (SmolLM2-135M) also scored 0% on unseen plans, so this is progress, but short of the bar.

Sun 25 Oct 2026, run findout2-pilot-all-2, full numbers in hf-pilot-all-2/PILOT_RESULTS.mdRead the write-up
Show the numbers
strict scoreuntouchedgoldteacher
trained types, mean4%99%88%
held-out: cost-compare0%58%62%
held-out: basket30%46%46%
held-out: argmax40%25%12%
held-out: ask-diff0%0%21%
held-out: bridge-compare0%0%0%
held-out, mean0%26%28%
held-out, right answer only16%38%45%
Results

Fine-tune test

Registers v2 showed that state slots updated at every word, trained without any simulator, made a 3.6M-parameter planner far more reliable, especially on messy input. Training from scratch is expensive, so this tests the same ideas on top of small pretrained models.

Ran, but the write-up isn't in the README yet. Raw results: hf-out-followup/RESULTS.md

Results

Notes cleanup

can a pass over finished notes drop the stale lines without losing facts?

Follow-up to notes-search run 4a. The native layout made LFM3's notes small and cheap to write, but it almost never changes or deletes a line (6 changes, 1 delete in 833 passes), so old values sit next to new ones: chat 1 has "Party moved to Sunday March 22nd" and four lines still saying March 14th.

A word-overlap rule is too blunt to trust. At 60% it cleared two of test 1's stale lines and test 6's leaked score without losing an answer-key fact, but it also threw away lines that were right: run-a's 71.4 score (a later run line had different numbers), "8 inches is the corrected length" (a correction!), and test 6's "run-b: 70.3, corrected from 78.9".

Show the numbers
armfacts kept (tests 1-12)all factsstale lines t1 / t2 / t6lineswords
raw31/397/124 / 1 / 15408,111
tidy31/397/124 / 1 / 15037,540
words 50%30/397/122 / 1 / 04797,198
words 60%31/397/122 / 1 / 04907,341
words 70%31/397/124 / 1 / 04987,451
Results

Notes search

can LFM3's own notes plus a dumb search be Squiggle's fresh context?

Follow-up to whiteboard and context-packets.

The notes now hold the facts, but old versions stay next to the new ones.

Show the numbers
packetpassmean score
whole notes (6,800-13,800 tokens, over the 4K window, so 64 tokens left to reply)0/112.9
BM25 on the raw message, top 8 lines3/113.5
hybrid (BM25 + embeddings)3/113.1
LFM3 writes the query, then BM254/114.3
Planned

Register resume

a save game for a borrowed model

If a stock small model gets a few trained memory slots (the registers-v2 design) plus a LoRA, can it pick up a half-finished plan from a fresh, nearly empty prompt using only the slots? The goal is to get close to re-reading the whole transcript, while spending a fraction of the prompt tokens.

Planned. Nothing has run yet.

Results

squiggle-ft

a small phone model for Squiggle's harness

Can a tiny model (≤ ~500 MB GGUF, running in wllama 3.8.1 on an iPhone CPU) learn the habits Squiggle's harness needs: notice what it doesn't know and look it up (checking it found the right thing), plan multi-step work and finish each step with done(result), use a recipe when the prompt has one, say what's missing with need, cope with messy…

Ran, but the write-up isn't in the README yet. Raw results: hf-baselines/RESULTS.md

Results

Tiny toki pona transfer experiments

Three small experiments on one question: if a model learns toki pona first, do English words "funnel" into the spots toki pona made for each concept (water next to telo), and does toki pona survive afterwards?

Updated after v9: planting concepts in chosen neurons works, and English will use those planted spots if the languages are mixed together during a bridge stage and the planted weights are lightly protected.

at this tiny scaleRead the write-up
Results

Tiny Gemma 4

Goal (2026-10-28/29): a Gemma 4 small enough for an iPhone browser tab (wllama, CPU), by surgery on Gemma 4 E2B plus a short heal (distillation from Gemma itself; no Claude-written data).

The vocab cut is nearly free: ~99.2% of counted text covered, +1% tokens, samples identical, 4.63B → 2.72B. (Offline: 2.0% of real user writing uses tokens outside the 80K, mostly emoji and slang.)

2026-10-29, l4x1, 7.6 min, ~$0.15Read the write-up
Show the numbers
configwebcodeSquiggletotal params
full E2B-it1.421.031.594.63B
vocab 80K1.451.051.592.72B
vocab + FFN 66%1.511.291.422.19B
vocab + FFN 42%1.701.531.561.81B
vocab + skip 62.273.253.412.20B
vocab + skip 102.914.124.001.89B
vocab + skip 176.608.739.311.38B
LFM2.5-350M1.311.512.070.35B
Set up, no write-up yet

Human finding-out traces

Recordings of a person solving problems while narrating: the notice → find out → try → check loop from the "Finding Out" paper, done by a person.

Set up. No results written up yet.

Results

Weird maths in a transformer

The idea: "let's throw random math equations in front of and behind attention and MLP and just see what happens."

Two variants beat the baseline by about three times its seed spread. Both are one run each, so they're candidates, not findings. The signed log is a soft squash on how big each MLP update can be, a cousin of known stabilising tricks. It also had the best WikiText-2 perplexity of the whole run. The learned cubic gives each channel a little extra curvature to play with.

Kaggle T4, 2026-10-24, 251 minRead the write-up
Show the numbers
variantval loss vs baselineWikiText-2 ppl (baseline 507–545)
possibly bettersigned log after the MLP, sign(x)·log(1+|x|)−0.027474
possibly betterlearned per-channel cubic after attention−0.027508
noiseswap halves, noise, tanh cap, learned power, attention × MLP, running mean, fourier, random rotation, gaussian squash−0.013 to +0.015533–587
worserounding after the MLP+0.028616
worsesin after attention+0.033615
worsesign-sqrt after attention+0.056680
clearly worsemax with the neighbouring channel before the MLP+0.116704
clearly worseabs before the MLP+0.267861
Results

Whiteboard

can LFM3 1.7B keep its own notes well enough to drop the chat history?

Follow-up to context-packets. There, a big model read the whole chat and wrote a ~350-word packet. Retrieval (BM25, embeddings, query rewriters, doc2query) couldn't replace it at that size: the facts that matter are throwaway corrections ("btw we moved the party") that share no words with the later question.

Runs and spend. whiteboard-1 (vLLM, a10g-small): died at model load, pip vLLM has no native LFM3 and its generic fallback can't run the conv layers, $0.08.

Show the numbers
what happenedturnsshare
ran out of output (Squiggle's 1,536-token cap) while still thinking49271%
finished thinking, then ended its turn without a call13720%
wrote the file619%
Results

Registers v2

Follow-up to experiments/registers, same skins world, 3.6M-parameter GPT. Run 1 found that 3 taught state slots cut bookkeeping errors from 226 to 38, but seeds were noisy and periods were the only thing that triggered slot updates.

Ran, but the write-up isn't in the README yet. Raw results: kaggle-out/REGISTERS_V2_RESULTS.md

Results

Context

how Qwen3 0.6B copes with running out of room, resuming, and agent setups

Oct 31 – Nov 1, 2026. Question: when a small model runs out of context mid-task, what harness lets it pick up and finish? Then: does curating context, changing step size, a normal long-context agent, or a multi-agent team help?

Only word overlap beat the do-nothing baseline (3.0).

5 functions emptied, 3 tries each, thinking offRead the write-up
Show the numbers
MethodFully fixed (of 15)Avg score
Word overlap, top 463.67
Qwen3 0.6B picks from menu33.00
Nothing extra22.47
Everything that fits (~2.1K tokens)02.80
Qwen3-Reranker 0.6B, top 402.60
Set up, no write-up yet

Basic English → toki pona hub map

Maps all 850 words of Ogden's Basic English onto toki pona "hub" words, so a training corpus can deliberately route every English word through its hub (the mixed-bridge result in ../tiny).

Set up. No results written up yet.

Results

Gemma 4 thinking traces

results

What Gemma 4's own thinking does on 38 messy, real-style prompts (the kit from the Squiggle chat), as input to the training template for Squiggle's phone model (squiggle docs/harness.md).

Keep: the split-the-request list (it is natural and accurate), the constraint extraction, the one-paragraph triage for simple requests, and searching named things before explaining them.

Results

Finding out

teach a small borrowed model the loop, not the facts

The "Finding Out" paper's thesis, tested directly. We take a small pretrained model, SmolLM2-135M-Instruct, which already reads English, and teach it only the loop: notice a gap, look it up, note what it found, calculate exactly, ask the person, catch a stale assumption, check, answer.

The loop is learnable at 135M parameters. In the trained task types the model looks things up exactly when it needs to, never when the answer is already in the message, always uses the calculator, asks when only the person knows, and handles the stale-assumption case. The untrained model with examples does almost none of this.

Kaggle T4, 2026-10-24, 108 minRead the write-up
Show the numbers
base (7 examples in the prompt)LoRAfull fine-tune
the 7 trained task types0–78%98–100%100%
looked up when needed / when the answer was given95% / 91%100% / 0%100% / 0%
calculator for arithmetic / asked when info was missing3% / 0%100% / 100%95% / 100%
unfamiliar: a new kind of fact (people)63%98%100%
unfamiliar: three-way compare (chance 33%)25%63%60%
unfamiliar: cost-compare (two lookups, two sums, compare)22%0%0%
English perplexity (base 12.4)12.419.013.9
Results

Goals + lookup

Does learning goal-directed planning in toki pona first make a small (~3.6M parameter, 8 layers, deep and thin) model plan better in English, from only a few English examples?

The setup works. The reference model (English goals all along) solves about 80% of new episodes and 67–72% of the longer chains it never trained on. It looks things up 87–91% of the time when a fact is missing and never when it isn't.

Kaggle T4, 3 seedsRead the write-up
Results

Simple language first, with real data

The goals experiment (run 2) showed that teaching a skill in a small, clean language first lets a small model learn it in English from far fewer examples. This experiment tries the same recipe on real text, with about 17M-parameter Llama-style models.

No clear win this time. On English loss and grammar, simple-first and english are tied within noise. simple-first is 3 points ahead on bAbI, but most of that is one task (task 5: 74% vs 51%), and it's one seed.

Kaggle T4, one seedRead the write-up
Show the numbers
modelEnglish val lossBLiMPbAbI
simple-first2.67458.2%59.3%
english2.63360.3%56.3%
ceiling1.92559.4%60.7%
Set up, no write-up yet

Skins

the lesson without the nouns

Tests the "intuition block" idea: a module that pulls out the shape of a problem, with the nouns stripped away, so the lesson carries over to a domain the model has never planned in.

Set up. No results written up yet.