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.

Or try one of these

    Which program answers

    Six programs: four that read text, brnfck-qwen3.5-0.8b-vision, which also reads a picture, and brnfck-qwen2.5-coder-0.5b, which answers with a brainfuck program

    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

    1. brnfck-smollm2-135m1,030,902,380
    2. brnfck-qwen2.5-0.5b4,169,659,608
    3. brnfck-qwen2.5-coder-0.5b4,221,543,730
    4. brnfck-qwen3.5-0.8b7,709,034,855
    5. brnfck-qwen3.5-0.8b-vision8,931,101,427
    6. brnfck-qwen2.5-1.5b11,430,468,880
    Each bar is as long as its program. In green the one that runs here, in about 1.5 GB of memory; the others need 4 to 8 GB in one browser tab. On a computer this page also shows how the program is built and races the programs on one question.

    Try the Lab here

    Three programs that do more than chat. Each one works right here.

    See it work: nine figures from the real programs

    Everything on the site

    1. 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.
    2. 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.
    3. Lab2 articlesWatch three programs train a network themselves, and one program look at a picture.
    4. 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.

    Memory cells
    . printed—

    Press a key. Try , then + then . to turn A into B.

    A small machine of its own, for trying the commands. It does not touch the chat model. While the chatbot works, the filled key is the command it is at.

    The cell holds 66, so the program prints B. The chat model uses these same commands on a much longer row of cells.

    Learn the eight commandsWrite your own program

    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

      Each square has the area of its number of characters, and lies inside the square it is part of. The letters are a real block of the writing part, in the colours of the eight commands. Where a square lies is not where it lies in the program: the map shows that.

      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.

      Look inside the program

      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?

      The photo it is shown: a tabby cat with blue eyesPhoto and questionDescribe this picture in one sentence.

      + writes the model into memory, reads the question, and the photo before it. prints the answer

      All four programs of text answer Paris; brnfck-qwen3.5-0.8b then writes on until its limit of 30 word pieces. Reading a word piece of the question takes about as long as printing one: the program does nearly the same work for both. brnfck-qwen3.5-0.8b-vision reads the photo first, 196,608 bytes, and looks at its 256 squares through 12 layers; the photo becomes 64 word pieces, and with the question that makes 85 to read before its first word of the answer, the long green stretch. It prints the same sentence, to the letter, as the original model's reference. The times are the middle of each range in the table below, for brnfck-qwen3.5-0.8b-vision those of one run, all from one desktop computer; download time comes on top. All five bars are on one scale.
      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.8BQwen3.5-0.8B, with its part for pictures
      Program, in characters1,030,902,3804,169,659,60811,430,468,8807,709,034,8558,931,101,427
      Download, compressed180 MB749 MBabout 2.1 GB (estimated)1.36 GB1.51 GB
      Memory in the tababout 1.5 GBabout 4 GBabout 8 GBabout 5 GBabout 7 GB
      Start-up9 to 16 s33 to 47 s2 min 27 s2 min 10 s to 2 min 37 s1 min 40 s, then 13 min 43 s for the photo and the question (one run)
      One piece of an answer0.6 to 1.0 sabout 2.3 sabout 9 sabout 5.6 s5.6 s (median of one run)
      Simple sums and factsoften wrongusually rightusually rightusually rightreads 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

      Sources

      1. SmolLM2-135M-Instruct, brnfck-smollm2-135m. Made by Hugging Face, Apache 2.0 licence: huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct.
      2. 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.
      3. 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.
      4. Brainfuck, a language designed by Urban Müller in 1993.
      5. Measurements of this project: the full table and how each figure was obtained. About the project.