A chatbot written in eight characters
Brainfuck is a programming language with eight commands. Here, those commands run a language model. Type a question and the program prints an answer.
Chatbot
Nothing is downloaded until you ask.
The phone ran out of memory
The page reloaded while the program was running: the phone stopped this tab to free memory. brnfck-smollm2-135m needs about 1 GB, which an older phone may not have. Closing other apps and tabs makes room.
What it answers on a phone with room
What is the capital of France?The capital of France is Paris.
HelloHello! How can I help you today?
On every phone: three commands to try and the Lab further down, the lessons and the Playground. On a computer all six programs answer.
Or try one of these
Run the program it wrote
8-bit cells, and a comma at the end of the input reads 0: the settings of the Challenges, which it was taught with.
- Memory of this conversation
position 1
Opening lines, in the programYour questionThe answerBrighter: a larger key than the other slots of its layer
This did not work
Which program answers
A bigger model answers better, and you wait longer for it.
The five larger programs need 4 to 8 GB of memory in one tab, more than a phone gives a page. They answer on a computer.
Download this program (.bf)
A billion characters on a phone
Each chatbot here is one brainfuck program. brnfck-smollm2-135m, the one above, is the smallest: 1,030,902,380 characters, and the only one a phone has room for. The other five answer on a computer.
The six chat programsin characters, to scale
- brnfck-smollm2-135m1,030,902,380
- brnfck-qwen2.5-0.5b4,169,659,608
- brnfck-qwen2.5-coder-0.5b4,221,543,730
- brnfck-qwen3.5-0.8b7,709,034,855
- brnfck-qwen3.5-0.8b-vision8,931,101,427
- brnfck-qwen2.5-1.5b11,430,468,880
Try the Lab here
Three programs that do more than chat. Each one works right here.
-
brnfck-train-names-mlp-7k
A training program, built in this browser
Starts from random numbers, reads 1,402 names and learns to guess the next letter, all in brainfuck. Then it prints a second program that makes up new names.
the recorded run of brnfck-train-names-mlp-7k your run · the loss of every step
Press Train: brnfck-train-names-mlp-7k trains in this browser, and the loss of every step appears.
-
brnfck-qwen2.5-coder-0.5b
758 MB · start-up 35 to 70 s · about 2.2 s per word piece
Asked in words, it answers with a brainfuck program. This answer comes from a run of the program itself:
-
brnfck-qwen3.5-0.8b-vision
1.51 GB · ready after 1 min 40 s · its first word piece about 14 min later
It reads a photo as 256 squares, and every square takes in something from every other. Point at a square to see where it looks.
See it work: nine figures from the real programs
Every character on one mapbrnfck-qwen3.5-0.8b-vision: 8,931,101,427 characters in one square, the picture part in red.
Where the program looksThe square on the left eye of the cat, in layer 4 of 12, takes in most from the other eye.
What every layer would saybrnfck-qwen2.5-1.5b on “What is the capital of France?”: Paris wins from layer 23 of 28.
Every program at one scaleFrom 756 weights to 1,543,714,304, on a scale of factors of ten.
Shakespeare, trained in brainfuckThe child of brnfck-train-shakespeare-attn-55k on “our disconte”: where it looks, and r as its guess.
Brainfuck that writes brainfuckbrnfck-qwen2.5-coder-0.5b asked for the larger of two digits: 236 characters that pass every test.
Each program prints the nextbrnfck-train-names-bigram-756 in 20 generations, each printed by the one before: the table every one learned.
A program that prints itselfMost of a generation is its own body written as data, so that the body can print itself again.
Names through the generationsWhat the child of each generation writes: random letters at gen0, addosa, javie and rylit at gen20.
Everything on the site
- +Learn2 courses, 21 lessonsStart from the eight commands. Each lesson has a small program you run and change. Then the patterns that come back again and again.
- -Insights3 articles, 1 mapRead how a question becomes an answer and what each part of the program does, see every character of a program on the map, and compare the models.
- []Lab2 articlesWatch three programs train a network themselves, and one program look at a picture.
- .PlayEditor and exercisesWrite your own brainfuck, run it step by step, and solve 51 checked exercises.
Try three commands
You can see the same commands at work without loading a model. Brainfuck keeps its numbers in a row of memory cells, and a pointer marks the cell it is working on.
Press , to read the letter A into the cell. The cell becomes 65, the number computers use for A. Press + to add one, then . to print.
Press a key. Try , then + then . to turn A into B.
The cell holds 66, so the program prints B. The chat model uses these same commands on a much longer row of cells.
Numbers first, then words
The program has two parts. The first writes the model's numbers into memory. In brnfck-qwen2.5-1.5b, the largest program, that is 11,334,697,744 of its 11,430,468,880 characters. It reads nothing and prints nothing.
From one command to the whole programbrnfck-qwen2.5-1.5b, every square to scale
one command, one character
- Across
- In view
The second part, the engine, reads your question and uses those numbers to work out which piece of text should come next. It prints that piece, then does the same again with the new piece included. An answer grows one piece at a time.
The enginebrnfck-qwen2.5-1.5b: what it is made of, and where its time goes
Its textwhat the program file holds:
Its workwhat it does for one word piece of the answer:
Every section, on Inside the program
Text in and outWord piecesAttentionMemoryFeed-forwardScaling and roundingWalkingOutput table
Point at a section in either bar, or press it, to read what it does. The arrow keys work too.
The program does not train a model. It runs one that Hugging Face or Alibaba Cloud trained earlier.
Five programs, five costs
There are four programs of text. brnfck-smollm2-135m loads quickest and often gets simple questions wrong. The larger ones need more memory and take longer for every piece of an answer. A fifth, brnfck-qwen3.5-0.8b-vision, is brnfck-qwen3.5-0.8b with the part of its model that looks at pictures: it reads a photo before the question. Looking at a picture shows how. A sixth, brnfck-qwen2.5-coder-0.5b, answers with a brainfuck program of its own, which runs under its answer: Brainfuck that writes brainfuck.
brnfck-qwen3.5-0.8b runs Qwen3.5-0.8B, a newer generation than Qwen2.5. It has the same kind of layers as Qwen3.8-27B, a much larger model: 18 of its 24 layers are Gated DeltaNet, a memory of fixed size, and the other 6 look back at every earlier word piece, one after every three DeltaNet layers. Compare the models explains that kind of layer. Ask it yourself on that page runs the model in floating point with its DeltaNet layers in whole numbers: close to the program, but not what it computes. The program follows its own whole-number recipe exactly.
Two questions, five programs
QuestionWhat is the capital of France?
Photo and questionDescribe this picture in one sentence.
+ writes the model into memory, reads the question, and the photo before it. prints the answer
| brnfck-smollm2-135m | brnfck-qwen2.5-0.5b | brnfck-qwen2.5-1.5b | brnfck-qwen3.5-0.8b | brnfck-qwen3.5-0.8b-vision | |
|---|---|---|---|---|---|
| Model | SmolLM2-135M-Instruct | Qwen2.5-0.5B-Instruct | Qwen2.5-1.5B-Instruct | Qwen3.5-0.8B | Qwen3.5-0.8B, with its part for pictures |
| Program, in characters | 1,030,902,380 | 4,169,659,608 | 11,430,468,880 | 7,709,034,855 | 8,931,101,427 |
| Download, compressed | 180 MB | 749 MB | about 2.1 GB (estimated) | 1.36 GB | 1.51 GB |
| Memory in the tab | about 1.5 GB | about 4 GB | about 8 GB | about 5 GB | about 7 GB |
| Start-up | 9 to 16 s | 33 to 47 s | 2 min 27 s | 2 min 10 s to 2 min 37 s | 1 min 40 s, then 13 min 43 s for the photo and the question (one run) |
| One piece of an answer | 0.6 to 1.0 s | about 2.3 s | about 9 s | about 5.6 s | 5.6 s (median of one run) |
| Simple sums and facts | often wrong | usually right | usually right | usually right | reads a picture first |
Measured on one desktop computer in Chromium 152 on Windows, with the program on its own disk. Download time comes on top, and another computer will differ. Every measurement
brnfck-qwen3.5-0.8b has a tape of 1,067,424,772 cells and passed all 11 checks: only the eight commands, one , and one ., the tape equal to the model, and the reference answer to “What is the capital of France?” to the letter. From the command line on the same computer it starts in 103 s and takes 5.56 s per word piece of the answer. Ask brnfck-qwen3.5-0.8b
brnfck-qwen3.5-0.8b-vision has a tape of 1,197,356,368 cells and passed all 21 checks. In the browser, shown the photo of the cat and asked “Describe this picture in one sentence.”, it was ready after 1 min 40 s, printed its first word piece 13 min 43 s later and the next 24 at 5.6 s each: 17 min 44 s from start to the end of the answer. From the command line it starts in 86.5 s and takes 6.59 s per word piece. Show brnfck-qwen3.5-0.8b-vision a photo
What to expect
- Answers can be wrong. These are small models, and running one in brainfuck does not make it smarter.
- Each question starts fresh. A question is at most 200 characters. The program does not remember earlier ones; the list on the page is only a record of this visit. brnfck-qwen3.5-0.8b cannot yet clear its memory after an answer, so the Chatbot loads it again for each question.
- The numbers were rounded. Brainfuck has whole numbers only, so each model was converted to whole-number arithmetic. brnfck-smollm2-135m, brnfck-qwen2.5-0.5b and brnfck-qwen2.5-1.5b then pick the same next piece of text as the original model in 94.8%, 96.6% and 97.2% of the tested cases. For brnfck-qwen3.5-0.8b it is 95.1%: its whole-number version, which the program follows exactly, against the original at 225 positions of its answers. That measures agreement with the original, not whether an answer is true.
- It is heavy. The first question downloads the program, and the tab needs the memory listed for that program. Of the six, only brnfck-smollm2-135m runs on a phone.
Sources
- SmolLM2-135M-Instruct, brnfck-smollm2-135m. Made by Hugging Face, Apache 2.0 licence: huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct.
- Qwen2.5-0.5B-Instruct and Qwen2.5-1.5B-Instruct, brnfck-qwen2.5-0.5b and brnfck-qwen2.5-1.5b. Made by Alibaba Cloud, Apache 2.0 licence: huggingface.co/Qwen/Qwen2.5-0.5B-Instruct and huggingface.co/Qwen/Qwen2.5-1.5B-Instruct.
- Qwen3.5-0.8B, brnfck-qwen3.5-0.8b. Made by the Qwen team of Alibaba Cloud, Apache 2.0 licence: huggingface.co/Qwen/Qwen3.5-0.8B.
- Brainfuck, a language designed by Urban Müller in 1993.
- Measurements of this project: the full table and how each figure was obtained. About the project.