llm.asm is a tiny operating system that boots straight into a chat with a small AI model and runs nothing else. Alexey Fateev created it and wrote the operating system in x86-64 assembly, the instructions a PC processor runs directly, with no C code and no C library. The kernel wakes the processor cores, finds the model in memory, does all the math itself, and drives the screen and keyboard. The project is free on GitHub under the MIT license.
The kernel we built is a single 29,520 byte file. The model it runs is Qwen3 0.6B, a small open model with about 600 million parameters, and the exported model file next to the kernel is 643 MB. You don’t need to know assembly to try it. You need a Linux PC, a few build tools, and about 5 GB of free disk space for the downloads.
The runs in this guide used Omarchy on an Intel N100 mini PC with four cores and 12 GB of memory. The operating system booted in a QEMU virtual machine with KVM turned on, so the virtual machine runs at close to the processor’s full speed. We gave it three of the four cores and 2 GB of memory. We built the project at commit 31ec3af from November 30, 2026. The project changes often, so sizes and commands in newer versions may differ from ours.

What you need
llm.asm needs an x86-64 processor with the AVX2, FMA and F16C instructions, which the project’s README puts at Intel Haswell or AMD Excavator and newer. This command prints the three names when your processor has them:
grep -o -w -E 'avx2|fma|f16c' /proc/cpuinfo | sort -u
For KVM, the file /dev/kvm must exist and your user must be able to open it. On our Omarchy box it was readable and writable by every user, so QEMU used KVM with no group change. Without KVM, the virtual machine runs far slower.
On Omarchy and other Arch-based systems, install the assembler and QEMU with its desktop window:
sudo pacman -S --needed nasm qemu-desktop
On Ubuntu or Debian, the project’s README lists sudo apt install nasm binutils qemu-system-x86 instead. You also need git and Python 3 for the one-time weight export; on Ubuntu or Debian, also install python3-venv.
Let an AI agent read the repo before you build
llm.asm is a third-party project. You’re about to run its Makefile, a Python script, and a downloaded kernel. Before you build, open the folder in a coding agent such as Claude Code or Codex and ask it to read the code first. This prompt asks for a read only:
Read the Makefile, scripts/export_weights.py, and the build and run steps in
README.md, 02-baremetal-os/README.md and 06-zero-app-os/README.md. Tell me what
each command downloads, writes, or runs, whether any step needs sudo or network
access, and anything that looks risky. Do not run or change anything.
The answer is a plain-language map of what the commands below will do, and a chance to stop if a step downloads or runs something you did not expect. It is not a full security audit.
Build the kernels
Clone the project and build it. make all builds the first three parts of the project, including the 29 KB kernel at build/asm-llm-os.elf. The second make builds the bigger Zero-App OS in its own folder.
git clone https://github.com/alesha-pro/llm.asm.git ~/llm.asm
cd ~/llm.asm
git checkout 31ec3af # optional: the commit we tested
make all
cd 06-zero-app-os && make
cd ~/llm.asm
Both builds finished in under a second on the N100. Zero-App OS came out at 115,160 bytes. The project’s README lists the bare-metal kernel as 27.2 KB, but our build of this commit was 29,520 bytes, so expect a slightly different size if you build a newer version.
Download and export the models
The weight export runs once, in Python. We put the Python packages in a virtual environment so they stay out of the system Python:
python3 -m venv ~/llmasm-venv
source ~/llmasm-venv/bin/activate
pip install numpy huggingface_hub gguf
huggingface_hub brings the hf command. The first download is Qwen3 0.6B from Hugging Face, about 1.5 GB. The second is the Zero-App OS model, a single 2.5 GiB file:
mkdir -p models
hf download Qwen/Qwen3-0.6B \
config.json model.safetensors tokenizer.json \
--local-dir models/qwen3-0.6b-bf16
hf download alesha-pro/I-Deleted-Linux-ZeroApp-2B \
zappm/minicpm5-2b-zeroapp-v21-q8_0.zappm \
--local-dir models/zeroapp-2b
Each download took under a minute for us. Without a Hugging Face sign-in, hf prints a warning about HF_TOKEN. Both models are public, so you can ignore it.
Last, convert the Qwen3 download into the single .asmbin file the kernel loads:
python scripts/export_weights.py --model-dir models/qwen3-0.6b-bf16 --out models/qwen3-0.6b-q8_0.asmbin --scale-dtype fp16
The export took 11.6 seconds and wrote a 643,469,504 byte file. You can compare the two sizes with ls -l build/asm-llm-os.elf models/qwen3-0.6b-q8_0.asmbin. Omarchy’s ls is eza, so we used ls -lB to get bytes with commas.

Boot llm.asm in QEMU
From ~/llm.asm, this is the command we used:
qemu-system-x86_64 -enable-kvm -cpu host -m 2G -smp 3 -vga std -display gtk,show-menubar=off -kernel build/asm-llm-os.elf -initrd models/qwen3-0.6b-q8_0.asmbin -append max_tokens=768
QEMU loads the kernel and hands it the model file as its initial RAM disk. A window opens on the banner and the asm-llm> prompt. It took about a second from Enter to the prompt, and the banner reported its own boot time as 98.95 ms. The terminal also prints multiboot knows VBE. we don't, a QEMU message you can ignore. We pressed super f to make the window full screen.
Our command differs from the one in the 02-baremetal-os README in four places:
-smp 3instead of-smp 16. The N100 has four cores. In runs with no display window,/benchdecoded at 37.9 tokens a second with three cores and 38.8 with all four, so we left one core free for the desktop.-display gtk,show-menubar=offis new. It hides QEMU’s menu bar. We left outzoom-to-fit, which stretches the console to fill the screen: QEMU draws the scaled picture on the same cores the guest uses, and in back-to-back/benchruns it cut the speed from about 35 to about 26 tokens a second.-append max_tokens=768is new. This is a boot option from the README. The default is 128 tokens per reply, and a longer answer stops with a hint to type/more. With 768, longer replies finish in one go.-serial stdiois gone. That option copies every console line to the terminal. We watched the window instead. Add it back if you want a text log, for example with| tee llmasm.logat the end.
The README’s own shortcut is make os-run MODEL=models/qwen3-0.6b-q8_0.asmbin SMP=16. On a four-core machine, change SMP=16 to the number of cores you want to give it.
Make the chat longer with ctx=
The banner shows ctx=2048. That is the chat’s context length, the number of tokens the model keeps from the conversation. When a chat fills up, llm.asm prints [chat] context full, resetting KV-cache and starts the conversation over. The ctx= boot option sets the length, and two options go in quotes:
-append "max_tokens=768 ctx=4096"
We used the default 2048 and did not test a longer context.
Chat, benchmark, and power off
Type a question at the asm-llm> prompt and press enter . We asked for a haiku about a tiny computer, then for a three-sentence answer on what an operating system does. Each answer ends with two speed lines. Prefill is how fast the model reads your prompt, and decode is how fast it writes the answer, both in tokens, the small pieces of words a model reads and writes. The haiku decoded at 37.72 tokens a second and appeared in about a second. The operating system answer decoded at 37.61.

These slash commands work at the prompt:
/benchruns the same fixed prompt every time, so one run compares with the next. Ours decoded 53 tokens at 37.15 tokens a second on three cores./clearclears the model’s chat history. The text stays on the screen./haltpowers the virtual machine off, and the QEMU window closes.
The banner also lists /think, which turns on the model’s reasoning mode, and /more, which continues a reply that hit the max_tokens limit. With no display at all, /bench reached about 38.5 tokens a second. The window costs a little, and about 37 is what we saw on screen. The banner’s CPU line shows a clock speed in MHz that is the guest’s own measure under KVM, not the N100’s real clock.
Boot Zero-App OS and write Flappy Bird
Zero-App OS is the project’s bigger build. It runs MiniCPM5 2B, a model with about two and a half billion parameters, which Alexey Fateev trained to write small programs in assembly. It maps the 2.5 GiB model file into the virtual machine as a memory device, and the command gives the guest 3 GB of memory on top of that. Run it from the 06-zero-app-os folder:
cd ~/llm.asm/06-zero-app-os
Z=$HOME/llm.asm/models/zeroapp-2b/zappm/minicpm5-2b-zeroapp-v21-q8_0.zappm
qemu-system-x86_64 -enable-kvm -cpu host -machine pc,nvdimm=on -smp 3 -m 3G,slots=2,maxmem=8G -vga std \
-display gtk,show-menubar=off \
-object memory-backend-file,id=zmodel,mem-path=$Z,size=2684620800,readonly=on \
-device nvdimm,id=nv1,memdev=zmodel,unarmed=on -kernel build/zero-app-os.elf
This is the README command with the same two changes as before: -smp 3 instead of 16, and the GTK display without the menu bar. To keep a text log of the run, add -serial file:/tmp/llmasm-06.log. That part is optional.
The screen splits in two. The left pane, AI STREAM, has the zero-app> prompt and seven numbered demos. The right pane is the RING-3 SANDBOX, where a finished program runs walled off from the kernel. Type flappy bird and press enter , and the model writes the game’s assembly code in the left pane while the top bar counts tokens.

On the N100, the model wrote 1,595 tokens at 7.5 tokens a second, which took about three and a half minutes. Zero-App OS then assembled the code into a 1,074 byte program and started it in the sandbox. space makes the bird flap up, esc stops the game and returns to the prompt, and halt at the zero-app> prompt powers the virtual machine off.

The generation time changed a lot between our runs on the same mini PC. The first run, with the model file read cold from disk, took 3 minutes 52 seconds. A second run took under two minutes, and a third took 3 minutes 32 seconds, both with the file already in memory. We did not find the cause. The model writes the same game each time, with the same 1,595 tokens and 1,074 bytes, because it always picks the most likely next token. To time a run, read the model file once first so it sits in memory: cat the .zappm file to /dev/null.
Limits
The first build is set up for Qwen3 0.6B. The export script also reads the larger Qwen3 1.7B and 4B models, but the bare-metal README covers only 0.6B, and we did not try a bigger model in the kernel. The chat holds 2,048 tokens by default and starts over when it is full.
A model this small gets things wrong. In one of our runs with /think on, it answered a train timetable question correctly from a fresh boot and wrongly after a few earlier questions in the same chat. Check anything it tells you. Both preset games we tried, Flappy Bird and Pong, built and ran, but the 06 README reports that it compiles on about 56% of new prompts it has not seen before.
Everything here ran in a virtual machine on Linux, so Omarchy and QEMU still sat under the 29 KB kernel. The README describes building a bootable ISO with make os-iso and writing it to a USB flash drive to run llm.asm on real hardware with nothing else under it. We did not test that.
llm.asm is a project to learn from. Every step of running a language model, from the tokenizer to the matrix math, is in the repo as plain assembly you can read, and the result runs at a usable speed on a cheap four-core mini PC. For a local AI setup you use every day, a regular model runner on a normal Linux install is the practical choice; our guide to mini PCs for local LLMs covers the hardware side, and Intel N100 vs N150 compares the N100 with its successor.
Troubleshooting
If QEMU fails to start with an error about KVM, check that virtualization is on in your PC’s firmware settings and that /dev/kvm exists. If the build stops with an error about nasm, the assembler is missing; install the nasm package. If the chat window opens but answers stop after a paragraph with a hint about /more, you started QEMU without -append max_tokens=768; type /more or add the option. If the speed is much lower than ours, check for zoom-to-fit in the display option and give the guest fewer cores than your PC has, so the desktop keeps one.
To remove everything afterwards, close QEMU, delete ~/llm.asm (about 4.6 GB with the models), ~/llmasm-venv and ~/.cache/huggingface, and on Omarchy remove the packages with sudo pacman -Rns qemu-desktop nasm.




