PenGPT: A New Transformer for Handwriting and Sketches
Researcher Sam Greydanus has introduced PenGPT, a small transformer capable of mimicking handwriting and generating sketches from text prompts.
Source: Hacker News — front pageResearcher Sam Greydanus has developed PenGPT, a specialized transformer model designed to replicate human handwriting and generate sketches from text descriptions. This development highlights a shift toward prioritizing massive, high-quality datasets over complex architectural innovations, a concept often referred to as "The Bitter Lesson."
What is PenGPT and how does it function?
PenGPT consists of two distinct models tailored for different modalities. The first is a 6M-parameter model focused on handwriting, capable of producing both print and cursive. Notably, this model can adopt the unique handwriting style of a person after observing only a few of their words. The second is a larger 54M-parameter model dedicated to drawing sketches based on text prompts.
According to Greydanus, the technical implementation is relatively straightforward. Pen movements are mapped to a grid, turning words into a sequence of directions and pen actions. The model uses byte-pair encoding (BPE) to merge common sequences of movements into tokens, which significantly increases processing speed. For handwriting, the model attends to text input; for drawing, it utilizes SigLIP 2 vectors to translate typed phrases into visual instructions.
How was the training data constructed?
Because recorded pen stroke data is scarce, the project relied heavily on custom data engineering. For the handwriting component, Greydanus used a vision-language model to identify and transcribe legible words from scanned documents, including old letters and public archives. This was followed by a process using InkSight to trace these words back into individual strokes. The resulting dataset includes 495,590 words from 1,255 different writers.
For the sketching capabilities, the model was trained on 477,670 sketches derived from ten public datasets. Greydanus noted that while datasets like Quick, Draw! contain millions of examples, he selected only the highest quality 0.5% to ensure the model learned effective representations.
Why does the model prioritize data over architecture?
In his findings, Greydanus observed that many "clever" architectural tweaks provided little to no benefit. For example, doubling the number of parameters or using a much larger vocabulary did not significantly improve performance. He found that the most substantial improvements came from increasing the volume and quality of the training data.
This approach aligns with the principle that scaling data and compute often outperforms manual engineering of model structures. The handwriting model, for instance, achieved its ability to mimic new styles simply because the training sequences included multiple words from the same writer, teaching the model to recognize and continue specific patterns. This capability was achieved without the use of explicit style encoders or fine-tuning.
What are the current limitations of PenGPT?
Despite its successes, PenGPT faces several challenges. The drawing model can blend concepts—such as putting a face on a teapot—but it struggles with "binding" specific attributes to specific objects. It also lacks a strong sense of spatial orientation; for example, it may not distinguish between "facing left" and "facing right" because the text vectors are mathematically very similar.
In terms of handwriting, the model's legibility is lower than that of real human writing. Furthermore, because the training data was derived from scans, the stroke order produced by the model is an estimation rather than a true historical record of how the original text was written.
How can researchers explore these findings?
For researchers interested in the intersection of computer vision and generative modeling, the PenGPT project provides a clear example of how data curation can drive results in specialized modalities. While PenGPT is a specialized tool for strokes and sketches, users looking to dive deep into the academic papers or technical discussions surrounding such breakthroughs can use Grafy Reader to analyze research PDFs and explore complex documentation with AI assistance.
Frequently asked questions
Can PenGPT mimic a new person's handwriting?
Yes, the 6M-parameter handwriting model can pick up the style of a person it has never encountered during training. By providing the model with just a few real words from a new writer, it can continue writing in that specific hand without needing any additional fine-tuning or a dedicated style encoder.
Does PenGPT use a complex architecture to achieve its results?
No, the model uses a relatively simple transformer architecture. Greydanus found that complex architectural changes, such as doubling the parameters or significantly increasing the vocabulary size, did not yield meaningful improvements. Instead, the model's performance was primarily driven by the scale and quality of the training datasets.
How does the model handle drawing prompts?
To draw from text, the model uses SigLIP 2 vectors to represent the input phrase. This allows a typed prompt to act as a visual guide for the sketching model. While it can successfully blend different ideas, it sometimes struggles with precise spatial instructions or binding specific attributes to specific objects in a scene.
Source: Hacker News — front page — PenGPT: A Generative Transformer for Handwriting and Sketches


