AboutAbout the project

Chat models that run as brainfuck programs

Five real chat models, from 135 million to 1.54 billion weights, each written out as one brainfuck program: SmolLM2-135M, Qwen2.5-0.5B, Qwen2.5-1.5B, Qwen3.5-0.8B and Qwen2.5-Coder-0.5B. brnfck-qwen3.5-0.8b-vision runs Qwen3.5-0.8B with its part for pictures as well.

In short

Brainfuck is a programming language made as a joke. It has eight commands: step left, step right, add one, take one off, read a letter, print a letter, and two for repeating. This site runs four real chat models in it. Each is one program of 1 to 11.4 billion characters. The only thing a program reads is your question, and the only thing it prints is the answer. brnfck-smollm2-135m, the smallest, is fast and often wrong. brnfck-qwen2.5-0.5b and brnfck-qwen2.5-1.5b are slower and get simple sums and facts right. Brainfuck runs each of them faithfully, mistakes included. brnfck-qwen3.5-0.8b runs Qwen3.5-0.8B, a newer generation than Qwen2.5. Its model has the same kind of layers as Qwen3.8-27B, a much larger model: 18 of its 24 layers keep a memory of fixed size, and after every three of them comes one that looks back at every earlier word piece. A fifth program, brnfck-qwen3.5-0.8b-vision, runs the same model with its part for pictures: it reads a picture before the question.

Explore the mapEvery character of the program is on it. Zoom in until you can read the commands.
The whole program of brnfck-qwen2.5-1.5b, Qwen2.5-1.5B-Instruct: 11,430,468,880 characters of brainfuck, folded into one square. A colour is one part of Qwen2.5-1.5B; the engine that does the sums is the small patch in the corner. On the map you can zoom in to single commands, for brnfck-smollm2-135m, brnfck-qwen2.5-0.5b, brnfck-qwen2.5-1.5b, brnfck-qwen3.5-0.8b, brnfck-qwen3.5-0.8b-vision and the four programs that train a network.

What is the capital of France?The capital of France is Paris.

What is 12 + 30?12 + 30 equals 42.

What is 12 + 30? (Answer with the number only, e.g. "7"; no words!)12 + 30 = 32

Three real answers. The first two were printed by the program of brnfck-qwen2.5-0.5b, Qwen2.5-0.5B-Instruct. The third, for comparison, was printed by the program of brnfck-smollm2-135m: it is wrong. A smaller model is faster and wrong more often.

Open the Chatbot Ask the small, faster model Read how it works first

brnfck-qwen2.5-0.5b starts a download of 749 MB and needs about 4 GB of free memory. brnfck-smollm2-135m downloads 180 MB and needs about 1.5 GB of memory. Both need a desktop computer. Not the moment? How it works needs nothing.

What this is

A chat model is a very long list of numbers, called weights, and a fixed recipe of sums. Here five such models, SmolLM2-135M, Qwen2.5-0.5B, Qwen2.5-1.5B, Qwen3.5-0.8B and Qwen2.5-Coder-0.5B, are each written out as a single program in which every character is one of the eight commands. Almost all of a program writes the model's numbers into memory. The last part does the thinking. The only thing a program reads is your question, and the only thing it prints is the answer. brnfck-qwen3.5-0.8b-vision reads a picture first.

chat programs, of five models counted
6
different commands, and nothing else counted
8
input command in each program of text: it reads your question counted
1
characters in the program of brnfck-qwen2.5-1.5b counted
11,430,468,880

"Counted" means counted in the program file itself; for brnfck-smollm2-135m you can repeat the count in your browser (on How it works, under "How do I know it is real?"). "Measured" means timed on one computer.

The models, compared

The same idea at four sizes. A bigger model answers better, and you wait longer for it. brnfck-qwen3.5-0.8b runs Qwen3.5, a newer generation than Qwen2.5, with a different kind of layer. brnfck-qwen3.5-0.8b-vision runs the same model with its part for pictures.

SmolLM2-135M, Qwen2.5-0.5B, Qwen2.5-1.5B and Qwen3.5-0.8B as five brainfuck programs; brnfck-qwen2.5-coder-0.5b, which runs Qwen2.5-Coder-0.5B, has its own page, Brainfuck that writes brainfuck. Read down a column for one program, or along a row to compare. Counts are counted in the program files; times are measured on one desktop computer.
brnfck-smollm2-135mbrnfck-qwen2.5-0.5bbrnfck-qwen2.5-1.5bbrnfck-qwen3.5-0.8bbrnfck-qwen3.5-0.8b-vision
ModelSmolLM2-135M-InstructQwen2.5-0.5B-InstructQwen2.5-1.5B-InstructQwen3.5-0.8B [8]Qwen3.5-0.8B with its part for pictures [8]
Made byHugging FaceAlibaba CloudAlibaba Cloudthe Qwen team of Alibaba Cloudthe Qwen team of Alibaba Cloud
Weights135 millionabout 494 millionabout 1.54 billionabout 752 million, in the text partabout 853 million: 752 million in the text part, 101 million in the part for pictures
Program, in characters1,030,902,3804,169,659,60811,430,468,8807,709,034,8558,931,101,427
Of which write the tape1,004,387,4434,100,831,73311,334,697,7447,448,657,4508,214,809,705
Tape, in cells of 32 bits188,012,789657,597,1141,827,870,0141,067,424,7721,197,356,368
Start-upabout 9 to 16 s33 to 47 s2 min 27 s2 min 10 s to 2 min 37 s in the browser; 103 s from the command line1 min 40 s in the browser, then 13 min 43 s for the picture and the question; 86.5 s from the command line, then 650 s
Time for one word pieceabout 0.6 to 1.0 sabout 2.3 s7 to 12 sabout 5.6 s in the browser; 5.56 s from the command line (median)6.59 s from the command line (median)
Same next word piece as the original model94.8% (345 of 364)96.6% (477 of 494)97.2% (318 of 327)95.1% (214 of 225), its whole-number version against the original97.5% (79 of 81) on four photos, its whole-number version against the original
Simple sums and factsoften wrongusually rightusually rightusually rightnot asked: it is asked about pictures
Download the programbrnfck-smollm2-135m.bf, 1.03 GBbrnfck-qwen2.5-0.5b.bf, 4.17 GBbrnfck-qwen2.5-1.5b.bf, 11.43 GBbrnfck-qwen3.5-0.8b.bf, 7.71 GBbrnfck-qwen3.5-0.8b-vision.bf, 8.93 GB
Where it runsin your browserin your browser, about 4 GB of memoryin a desktop browser, about 8 GB of free memory (ran in one desktop Chromium browser), or from the command line, about 10 GiB freein your browser, about 5 GB of memoryin a desktop browser, about 7 GB of free memory, or from the command line

Each program can be downloaded as it is: one text file of nothing but the eight commands. Nothing is fetched until you press a button.

brnfck-smollm2-135m.bf (brnfck-smollm2-135m, 1.03 GB)
brnfck-qwen2.5-0.5b.bf (brnfck-qwen2.5-0.5b, 4.17 GB)
brnfck-qwen2.5-1.5b.bf (brnfck-qwen2.5-1.5b, 11.43 GB)
brnfck-qwen3.5-0.8b.bf (brnfck-qwen3.5-0.8b, 7.71 GB)
brnfck-qwen3.5-0.8b-vision.bf (brnfck-qwen3.5-0.8b-vision, 8.93 GB)
brnfck-qwen2.5-coder-0.5b.bf (brnfck-qwen2.5-coder-0.5b, 4.22 GB)
The training programs, what they printed, the whole Shakespeare run and the trained coder models: the dataset on Hugging Face.

SmolLM2-135M-Instruct, Qwen2.5-0.5B-Instruct, Qwen2.5-1.5B-Instruct, Qwen3.5-0.8B and Qwen2.5-Coder-0.5B-Instruct were published under the Apache 2.0 licence [1] [2] [8]. Each program holds only the eight commands, with one output command. The programs of text have exactly one input command; brnfck-qwen3.5-0.8b-vision has three: one reads the picture, two the question (its first character, then the others). Brainfuck has whole numbers only, so each model was first converted to whole numbers. The row "Same next word piece as the original model" of Table 1 says how often that version agrees with the original [7].

brnfck-smollm2-135mabout 0.6 to 1.0 s brnfck-qwen2.5-0.5babout 2.3 s brnfck-qwen2.5-1.5b7 to 12 s brnfck-qwen3.5-0.8babout 5.6 s
The time for one word piece of an answer, drawn to scale from 0 to 12 seconds. These are the times of Table 1. The solid part of a bar is the shortest time measured; the hatched part reaches to the longest. An answer of seven word pieces takes seven of these bars.

Where to go

Questions people ask first

How it was built

Twelve steps, each one small enough to test before the next. Figure 4, under the list, shows what they did to the length of the program.

  1. A tiny network that answers fixed questionsA small recurrent network that answers a fixed set of questions. It showed that a brainfuck program can do the sums of a neural network at all.
  2. Faster building blocksBrainfuck can only count. Dividing and rounding a number by counting took 1.2 to 1.5 million steps. By pushing bits out of a cell one at a time (the "bit peel") it takes about 100. You can try it in lesson 5 of the model lessons, "peeling off bits".
  3. A story model, weights written into the programA real language model with 260 thousand weights that writes children's stories [3]: 4,597,324 characters of brainfuck, and about a third of a second for a story of 64 word pieces.
  4. An engine that reads its weights as inputWriting every weight as plus signs does not scale. So the program became an engine: it reads the model's numbers first, the way a music player reads a song.
  5. A chat model with 135 million weightsSmolLM2-135M-Instruct [1], converted to whole numbers because brainfuck has no others. The converted model picks the same next word piece as the original in 94.8% of the tested cases (345 of 364) [7].
  6. Cutting text into word pieces, in brainfuckThe model reads word pieces, not letters. The program finds them itself, with a lookup table (a hash table) laid out on the tape.
  7. One program from text to textThe engine of step 4 and the text handling of step 6 joined: 30,841,969 characters that read 355,761,802 bytes of model data, then your question, and print the answer.
  8. The self-contained programThe model data that the program of step 7 read moved into the program itself: a billion characters that write the weights onto the tape. Nothing is read but the question. This is brnfck-smollm2-135m on this site.
  9. brnfck-qwen2.5-0.5b: 494 million weightsQwen2.5-0.5B-Instruct [2] as one program of 4,169,659,608 characters. It still runs in the browser: the chat with brnfck-qwen2.5-0.5b.
  10. brnfck-qwen2.5-1.5b: 1.54 billion weightsQwen2.5-1.5B-Instruct [2] as one program of 11,430,468,880 characters. Its tape of 1,827,870,014 cells takes 6.81 GiB, so it needs an interpreter with 64-bit memory. It runs from the command line, and on 11 October 2026 it ran from start to answer in one desktop Chromium browser: the chat with brnfck-qwen2.5-1.5b. Ready in 2 min 27 s, then 9.0 seconds per word piece (measured).
  11. brnfck-qwen3.5-0.8b: a different kind of layerQwen3.5-0.8B [8], about 752 million weights, is the smallest model with the same kind of layers as Qwen3.8-27B, a much larger model. 18 of its 24 layers are Gated DeltaNet layers: a memory of fixed size, whatever the length of the conversation. The other 6 look back at every earlier word piece, one after every three DeltaNet layers. As one program it has 7,709,034,855 characters. Its tape of 1,067,424,772 cells takes 3.98 GiB and fits a 32-bit memory, unlike that of brnfck-qwen2.5-1.5b. All 11 checks pass: only the eight commands, one input and one output command, the tape equal to Qwen3.5-0.8B as loaded, in 1,018 SHA-256 sums, and the reference answer to “What is the capital of France?”, 30 word pieces, to the letter. The program follows its whole-number recipe exactly, with weights of 10 bits; that recipe picks the same next word piece as the original model at 214 of 225 positions (95.1%). Compare the models explains the new kind of layer. Ask it yourself there runs Qwen3.5-0.8B in floating point with its DeltaNet layers in whole numbers: close to the program, but not what it computes. The chat with brnfck-qwen3.5-0.8b.
  12. brnfck-qwen3.5-0.8b-vision: a pictureQwen3.5-0.8B [8] also has a part that was trained on pictures, about 101 million weights: 12 layers that look at a picture of 256 by 256 pixels in squares of 16 by 16, and turn every block of four squares into one word piece for the text model. brnfck-qwen3.5-0.8b-vision is brnfck-qwen3.5-0.8b with that part at the end of its tape: one program of 8,931,101,427 characters that reads the 196,608 bytes of the picture, then the question. Its tape of 1,197,356,368 cells takes 4.46 GiB, so it needs 64-bit memory, as brnfck-qwen2.5-1.5b does. All 21 checks pass: only the eight commands, the tape equal to the loaded model, and for six questions about four photos the text of the reference to the letter. Looking at a picture shows where every square looks. The chat with brnfck-qwen3.5-0.8b-vision.
Step 3 · the story model, 260 thousand weights4,597,324 Step 7 · the small chat model, weights read as input30,841,969 Step 8 · the same model, weights written by the program1,030,902,380 Step 9 · 494 million weights4,169,659,608 Step 10 · 1.54 billion weights11,430,468,880 Step 11 · 752 million weights, with Gated DeltaNet7,709,034,855 Step 12 · the same model, with its part for pictures8,931,101,427
The length of the program at seven of the twelve steps, in characters, drawn to scale. Look at the jump from step 7 to step 8: the model is the same, but its 355,761,802 bytes of data moved into the program. The bars of steps 3 and 7 are too short to draw at this scale; each is shown as a hairline. The other steps did not produce a program whose length this page gives.

Has this been done before?

An earlier public project (lobotoml) ran a neural network of 7 neurons in brainfuck, for the XOR function [4]. We looked for an earlier language model or chat model in brainfuck and found none. Our search was limited, so we do not claim to be the first.

The chat programs run models that were trained elsewhere. The four programs on Trained in brainfuck, brnfck-train-names-bigram-756, brnfck-train-names-mlp-7k, brnfck-train-names-attn-10k and brnfck-train-shakespeare-attn-55k, train one themselves: they start from random weights, learn from a list of names or from Shakespeare step by step, and print a second program that writes with what they learned.

Limitations

The full list is on How it works, under "What does "pure brainfuck" mean, and what does it not mean?"

Notes and sources

  1. SmolLM2-135M-Instruct, the model of brnfck-smollm2-135m. Made by Hugging Face and published under the Apache 2.0 licence: huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct.
  2. Qwen2.5-0.5B-Instruct and Qwen2.5-1.5B-Instruct, the models of brnfck-qwen2.5-0.5b and brnfck-qwen2.5-1.5b. Made by Alibaba Cloud and published under the Apache 2.0 licence: huggingface.co/Qwen/Qwen2.5-0.5B-Instruct and huggingface.co/Qwen/Qwen2.5-1.5B-Instruct.
  3. llama2.c, a project by Andrej Karpathy, published under the MIT licence, and the tinyllamas collection of model files that belongs to it (also MIT). The small story model stories260K of step 3 of "How it was built" comes from there.
  4. lobotoml, an earlier public project: a neural network of 7 neurons in brainfuck, for the XOR function.
  5. Brainfuck, a language designed by Urban Müller in 1993.
  6. Measurements of this project. Character counts are counted in the program files; times were measured on one desktop computer with the program file on its own disk. The full tables are on How it works, under "The numbers".
  7. Agreement with the original models. The same next word piece in 345 of 364 tested cases for brnfck-smollm2-135m (94.8%), 477 of 494 for brnfck-qwen2.5-0.5b (96.6%) and 318 of 327 for brnfck-qwen2.5-1.5b (97.2%). For brnfck-qwen3.5-0.8b, 214 of 225 answer positions (95.1%): its whole-number recipe, which the program computes bit for bit, against Qwen3.5-0.8B in floating point; with 8-bit weights it would be 209 of 225. See How it works, "What does "pure brainfuck" mean, and what does it not mean?"
  8. Qwen3.5-0.8B, the model of brnfck-qwen3.5-0.8b and brnfck-qwen3.5-0.8b-vision. Made by the Qwen team of Alibaba Cloud and published under the Apache 2.0 licence: huggingface.co/Qwen/Qwen3.5-0.8B. Its weights and layers are from its model files; the counts are counted in the program file, and the times were measured on one desktop computer, in the browser and from the command line.

From here