---
id: 18497
lang: en
title: "PenGPT copies someone's handwriting from 1–3 words and trains in 8 minutes on 8 GPUs"
published_at: "2026-11-28 00:30:34"
source_name: "Hacker News AI"
source_url: "https://greydanus.github.io/2026/11/12/pengpt/"
canonical_url: "https://news.hamidun.com/en/news/18497"
categories: ["research", "creative"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# PenGPT copies someone's handwriting from 1–3 words and trains in 8 minutes on 8 GPUs

> **Краткая суть (BLUF):** A developer has built PenGPT, a small neural network that needs only one to three real words of a person's handwriting to continue a text in that same hand. The 6-million-parameter model trains for 8 minutes on eight A100 GPUs, while the 54-million-parameter drawing version takes about 35 minutes.  The author put 80% of his effort into data, 15% into training speed, and 5% into architecture. For niche tasks, he argues, investing in the dataset pays off more than clever schemes.  - Data: 495,590 words from 1,255 authors, taken from scans; one-third to one-half of the words survived filtering - A vocabulary 60 times larger and a model twice as big gave the same quality - The model draws "left" and "right" identically; the prompt behaves like a bag of words

Imagine showing a neural network one to three words written by your own hand, and having it go on to write whole sentences in your handwriting. That is what PenGPT does: a small transformer that writes by hand and draws from a text description. The handwriting model has 6 million parameters and trains in 8 minutes on a server with eight A100 GPUs. The drawing version has 54 million parameters and trains for about 35 minutes. For comparison, the author's previous project, Cursive Transformer, trained for more than 10 hours on a single A100 and knew only one handwriting style. The author says 80% of his effort went into data, 15% into training speed, and only 5% into architecture. He calls it the first project built on Richard Sutton's "bitter lesson": scale and quality data ultimately outperform clever ideas.

## How PenGPT learns to write in someone else's hand

Pen movements are tied to a grid, and a word becomes a route made of eight directions plus "pen down" and "pen up." Frequent chains of movements are merged into tokens, as in standard BPE: the word "world" shrinks from 156 movements to 47 tokens. A standard decoder then conditions on the given text. For drawings, the input is a SigLIP 2 vector instead of text, so a typed phrase can replace a reference image.

The handwriting-imitation trick is very simple. Each training example contains up to four consecutive words from the same author. The model learns that the following words should resemble the preceding ones. At generation time, it is given one to three real words and continues in the same manner. There is no separate style encoder and no fine-tuning. Handwriting from 21 people who were not in the training set was generated this way. It also works from a photograph: the author traces a few words with the InkSight tool and fits a single new writer vector, while all other weights stay frozen.

## Where the result actually lies

Almost nobody records pen strokes, so the data had to be built from scans. The result is 495,590 words from 1,255 authors: two research collections plus old letters and diaries from public archives. A language model with computer vision finds readable pages and transcribes them, the pages are cut into words, InkSight reconstructs the strokes, and a set of checks discards bad traces. Between one-third and one-half of the words survive. For drawings, the author used 477,670 sketches from ten open datasets, and from the 50 million images in Quick, Draw! he kept the best 0.5%. The author does not publish the datasets themselves, but the appendix to the article describes how to assemble them.

He then changed one parameter at a time and retrained the model. "Smart" elements gave almost nothing. A hint about where the pen currently is has no effect on the handwriting. BPE merges slightly worsen the metric, but they make sequences 3.2 times shorter, which speeds things up. A vocabulary 60 times larger and a doubled model do not change quality. Even an LSTM on the same tokens only slightly lags on handwriting, but falls noticeably behind on drawings, where sequences are several times longer.

Data behaves the other way around. If the model is trained one word at a time, it stops picking up someone else's hand: the style rank (1 is perfect, 8.5 is random choice) rises from 1.9 to 6.0. Without augmentation, the drawing model stops following prompts altogether.

## Limitations and practical takeaway

The author lists the weak spots candidly. The drawing model mixes concepts without binding them: a teapot with a face comes out, but it cannot reliably say who is wearing the hat. The captions "looking left" and "looking right" produce the same drawing, because the prompt vector sits close to a "bag of words" (the cosine similarity of these two phrases is 0.999). The OCR model reads generated words correctly in 54% of cases versus 66% for real ones. The stroke order in most of the data is the model's guess, not a record of an actual pen.

There is also a lesson about captions. It is tempting to train the drawing model only on image vectors and attach the text at the end. It does not work: SigLIP vectors for sketches lie in a narrow cone, nearly at right angles to the text vectors. A model that has seen only that cone gets lost on a real phrase and produces scribbles. Training on short labels lets it draw labels (78% success), but whole phrases require detailed captions: 43% versus 10% for a model without them.

The practical conclusion for anyone building a generative model in a niche domain: first collect and clean the data, then find good hardware for fast iteration. The tokenizer and architecture can be kept simple. Part of the post, apart from the conclusion, was written by Claude; the author promises to rewrite it himself.

---
- **Первоисточник:** [Hacker News AI](https://greydanus.github.io/2026/11/12/pengpt/)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18497
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
