{"slug": "pengpt-a-tiny-transformer-that-learns-to-hold-a-pen", "title": "PenGPT: A Tiny Transformer That Learns to Hold a Pen", "summary": "Independent researcher Sam Greydanus published PenGPT on November 12, 2026, a pair of small transformers — a ~6M-parameter handwriting model and a 54M-parameter drawing model — that generate pen strokes one move at a time, with released weights of 5.8 MB and 50 MB running inference in NumPy. Greydanus's ablations found data, augmentation and multi-word training sequences mattered most: cutting data to one-tenth raised held-out loss by 0.050 nats per pen move, removing augmentation raised it 0.028, and training on one word per sequence worsened style rank from 1.9 to 6.0, while doubling parameters improved loss by only 0.004. The preprint has stated limits — sampled handwriting is read correctly 54% of the time versus 66% for real ink, and the drawing model cannot reliably bind words to each other — and the 495,590-word, 1,255-writer handwriting dataset and 477,670-sketch drawing dataset are not released, though the appendix explains how to rebuild them.", "body_md": "On November 12, 2026, independent researcher Sam Greydanus published **PenGPT**, a small transformer that writes handwriting and draws sketches one pen move at a time.\n\nIt reached the Hacker News front page on November 25, and its thread showed 399 points and 77 comments at my last check. This post covers how it works, what the experiments show, and where it falls short.\n\n**Not to be confused with** the \"PenGPT\" AI smart pens sold on online stores, which are unrelated consumer gadgets.\n\n## TL;DR\n\n- Two small models: a **~6M-parameter** one that writes print and cursive and imitates unseen writers from a few of their words, and a**54M-parameter** one that draws from a text prompt.\n- The released weights are **5.8 MB and 50 MB** , and inference runs in NumPy.\n- The author's main finding: **data, augmentation and how training sequences are built mattered most.** Clever architecture mattered little.\n- It is a preprint with real limits: sampled handwriting is read correctly less often than real ink (54% vs 66%), and the drawing model can't reliably bind words to each other.\n\n## How it works\n\n**Tokenizer.** Pen points are snapped to a grid, and motion becomes a walk in eight directions, plus two symbols for pen down and pen up.\n\nByte-pair encoding then merges common runs of moves into short-stroke tokens (512 merges for handwriting, 1,024 for drawings). That's the only modality-specific part, and the same tokenizer serves both models.\n\n**Model.** A decoder-only transformer with cross-attention in every block, trained with the Muon and AdamW optimizers.\n\nThe handwriting model is told the text to write. The drawing model is told a single SigLIP 2 vector, so a typed phrase can stand in for a picture.\n\n**Imitating a new hand, without a style encoder.** Each handwriting training sequence holds up to four words by the same writer. That teaches the model that later words look like earlier ones, so at sampling time you give it one to three real words and it carries on in that hand.\n\n**From a photo.** There is also a photo route: trace a few words with the InkSight model and fit one new writer vector to them, leaving all other weights frozen.\n\n## The data (the real effort)\n\n|  | Handwriting | Drawings | \n|---|---|---|\n| Size | 495,590 words, 1,255 writers, 7 sources | 477,670 sketches, 10 sources | \n| Notes | Mostly traced from scanned pages, including letters, diaries and research collections | Best 0.5% of Quick, Draw!'s 50M, plus nine other datasets | \n\nFew collections of English pen strokes exist, so the author built one from scans, in four steps:\n\n1. **Find:** a vision-language model (the paper names Claude) grades pages for legibility and scan quality.\n2. **Cut:** pages are transcribed and cut into words.\n3. **Trace:** InkSight turns each word image into strokes.\n4. **Check:** automated checks drop bad traces.\n\nBetween a third and a half of words survive this process. The datasets are **not released**, though the paper's appendix explains how to rebuild them.\n\n## What the ablations show\n\nEach row changes one thing about the base recipe. Score is held-out nats per pen move, so lower is better.\n\n| Handwriting | Score change | Style rank* | Legible | \n|---|---|---|---|\n| PenGPT base | 0.716 | 1.9 | 54% | \n| Graves-style LSTM, same tokens | +0.029 | 2.2 | 49% | \n| One-tenth of the data | +0.050 | 3.0 | 47% | \n| No augmentation | +0.028 | 2.0 | 52% | \n| One word per sequence | +0.009 | 6.0 | 52% | \n| Pen-position features removed | +0.001 | 1.9 | 52% | \n| Twice the parameters | −0.004 | 1.9 | 55% | \n| Real ink |  |  | 66% | \n\n*How well the model tells whose hand it's continuing: 1 is best, 8.5 is chance.\n\nFor drawings, SigLIP 2 picked a drawing's own label for **76%** of drawings and its own caption phrase for **43%**. A same-token LSTM managed 40% and 20%. Removing augmentation dropped those figures to roughly 4% and 6%.\n\n**Takeaways**\n\n- Cutting data or augmentation hurts most.\n- Training on several words at once is what makes new-hand transfer work.\n- A vocabulary 60x larger from another tokenizer changed nothing, and the BPE merges mainly buy speed (sequences are 3.2x shorter).\n- The drawing model needed **captions** : trained on picture vectors alone, it scribbled and followed typed prompts only 4–6% of the time.\n\nThe author traces that last result to SigLIP 2's sketch vectors sitting in a narrow cone nearly at right angles to its text vectors.\n\nTraining is cheap: about 8 minutes (handwriting) and 35 minutes (drawings) on an eight-GPU node. The post and release notes say A100s, though the author's Hacker News reply says H100s.\n\nThe author's earlier Cursive Transformer needed over 10 hours on one A100 and learned a single hand.\n\n## Try it\n\n- **Code and weights:** the GitHub repo and its releases page, under Apache 2.0 according to a third-party index of the repo.\n- **Released models:** handwriting (6.1M parameters, 1,192 known hands, 5.8 MB), drawing (54M, 50 MB), plus SigLIP 2's text encoder (375 MB) to turn typed prompts into vectors. Weights are stored at 8 bits.\n- **Run:** CLI commands for`write` and`draw` in`inference/pen.py` . There is also an in-browser demo linked from the post.\n\n## Limitations\n\n### From the author\n\n- The drawing model gets one pooled vector, close to a bag of words, so \"facing left\" and \"facing right\" produce the same drawing, and \"who wears the hat\" fails.\n- Most handwriting was traced from scans, so stroke order is an inference, and the training words lean short and neat.\n- Drawing quality is scored by the same model family that conditions it.\n- All baselines are the author's own implementations, and each ablation is a single run read against the noise of three base seeds.\n\n### From Hacker News\n\n- Poor results with Spanish and Polish accented characters.\n- Cursive strokes that don't follow the proper stroke order.\n- A muddled pelican riding a bicycle, since the model blends ideas rather than binding them.\n- Wobbly slanted lines that look like aliasing from the coarse grid.\n\nOn the wobble, the author replied that he chose the coarsest grid he could for speed, which cut iteration time to roughly five minutes, and that a small post-processing change has mostly fixed it.\n\nOne commenter argued the grid is itself human-injected knowledge that more data can't fix, which sits awkwardly with the bitter-lesson framing.\n\n### Misuse\n\nThe impact statement flags that a model which picks up someone's hand from a few words could be used to imitate their writing. The author judges that risk modest next to generative models of faces, voices and video.\n\nOne Hacker News commenter called it a forgery tool and was uneasy that the code is public.\n\n### A note on sourcing\n\nOn Hacker News the author said the post's body text (all but the conclusion) was written by Claude, apologized for it, and said his other posts are handwritten. A commenter said the paper reads similarly.\n\nThe figures in this blog are the author's reported numbers from the paper and release notes, and I haven't reproduced them.\n\n## Why it matters\n\nPenGPT is a clean case study in the \"bitter lesson\": the author reports spending about 80% of the effort on data, 15% on training speed and 5% on architecture.\n\nThe result is a model small enough to run in a browser, and the measurements say where its quality came from.", "url": "https://wpnews.pro/news/pengpt-a-tiny-transformer-that-learns-to-hold-a-pen", "canonical_source": "https://zyvop.com/pengpt-a-tiny-transformer-that-learns-to-hold-a-pen-wdu9v", "published_at": "2026-11-26 11:28:02+00:00", "updated_at": "2026-11-26 11:45:02.208853+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "ai-research", "generative-ai"], "entities": ["Sam Greydanus", "PenGPT", "InkSight", "SigLIP 2", "Quick, Draw!", "Claude", "Hacker News", "Muon"], "also_reported_by": [], "takeaway": "Training on sequences of up to four words by the same writer, rather than adding a style encoder, is what lets the ~6M-parameter PenGPT imitate an unseen hand — dropping to one word per sequence worsens style rank from 1.9 to 6.0 — while removing augmentation costs 0.028 nats per pen move and cuttin", "recommendation": {"advice": "Build training sequences with several samples from the same writer so later words condition on earlier ones, and keep augmentation on; the ablations show removing it costs 0.028 nats per pen move and one word per sequence degrades style rank from 1.9 to 6.0.", "playbook": "training-data", "playbook_url": "https://wpnews.pro/playbooks/training-data"}, "alternates": {"html": "https://wpnews.pro/news/pengpt-a-tiny-transformer-that-learns-to-hold-a-pen", "markdown": "https://wpnews.pro/news/pengpt-a-tiny-transformer-that-learns-to-hold-a-pen.md", "text": "https://wpnews.pro/news/pengpt-a-tiny-transformer-that-learns-to-hold-a-pen.txt", "jsonld": "https://wpnews.pro/news/pengpt-a-tiny-transformer-that-learns-to-hold-a-pen.jsonld"}}