AI Today

🖥️ llm.asm: a 24 KB assembly operating system boots straight into a Qwen3 chatbot

· 4 min

VGA text console of the llm.asm bare-metal OS chatting with Qwen3-0.6B in QEMU KVM

In brief


🖥️ Developer Alexey Fateev published [llm.asm](https://github.com/alesha-pro/llm.asm) on GitHub on 25 November: programs written entirely in x86-64 assembly, with no C, no Rust and no runtime libraries. The part drawing the most attention is a bootable operating system that starts straight into a chat with Qwen3-0.6B, a small open language model from Alibaba, with no Linux or Windows underneath. According to the README the kernel is 24,252 bytes. ⏱️ By the author's measurements, the chat prompt is ready 74 to 94 milliseconds after the kernel starts, and in a QEMU KVM machine with 16 virtual cores the system generates about 135 tokens per second. The small number is a little misleading: the model's weights sit in a separate 614 MiB file that the boot loader copies into memory before the start, plus 449 MiB for scratch and conversation memory. 🛠️ The project is under the MIT licence and can be tried in a virtual machine or as a bootable ISO; it needs a processor with AVX2, FMA and F16C. It is meant for learning how a transformer computes on a CPU, not as a replacement for a normal operating system: it knows only a keyboard, a text screen and a serial port, no network and no disk.


📂 What the repository holds. llm.asm consists of several sub-projects that share one assembly core: a 14,712-byte Linux program that runs Qwen3-0.6B with 8-bit weights (Q8_0), the bootable system, a 32,944-byte trainer that trains a small GPT model from scratch and shows its progress as Braille graphics in the terminal, and a fourth hypervisor experiment. The README counts 17,252 lines of assembly in all; every compute kernel, from the tokenizer to the AVX2 matrix multiplication, is written by hand.

🧠 How the system boots. A Multiboot loader such as GRUB or QEMU loads the kernel and the model file. The kernel switches to 64-bit mode, checks the required instruction sets with CPUID, wakes all processor cores through the ACPI tables and binds the weights directly at their physical address, mapped with 2 MiB pages. There are drivers only for the serial port, the 80 by 25 VGA text mode, a PS/2 keyboard, a timer and ACPI power-off. Because model and system run from memory, the author also booted it in a Proxmox VM with no disk at all, reaching about 55 tokens per second on an older 12-core Intel Xeon.

💬 How it is used. After boot a multi-turn chat runs with up to 2,048 tokens of context; when it is full, the system resets the conversation. Commands such as `/think` switch on Qwen3's reasoning mode, `/bench` runs a benchmark, `/quit` powers the machine off. The model file has to be converted once beforehand from the Qwen3 weights into the project's own format with a Python script. Building needs `nasm` and GNU binutils, the ISO also GRUB tools.

📊 What the speed figures mean. Fateev compares his Linux program with llama.cpp on the CPU of an AMD EPYC server at the same 8-bit precision and reports 18 to 36 percent faster text generation; the booted system is said to gain about another 10 percent from the large memory pages. Headlines about "54 percent faster" come from comparing the system inside a KVM machine with llama.cpp on Linux, as the site [MACCUS](https://maccus.fr/en/llm-asm-bare-metal-qwen/) worked out. All figures are the author's own measurements; no independent test had appeared by 27 November. When reading the prompt, llm.asm is much slower by its own numbers, because it processes tokens one at a time rather than in batches.

✅ How the author checks the output. According to the README, the Linux program picks the same 64 tokens as the PyTorch reference at full 32-bit precision, and the booted system gives byte-for-byte the same output as the Linux program on five test prompts, including Russian text and an arithmetic problem, whatever the number of cores.

🧭 Who it is for. llm.asm runs exactly one small model, without a GPU and without networking. For companies running models in-house it changes nothing; it is of interest to anyone who wants to see how little code a local language model really needs underneath and who is comfortable with QEMU. Small models like Qwen3-0.6B often get facts wrong.

Sources

Open in the interactive reader →

This post was selected, researched, written and rated by AI. The AI can be wrong: check the sources. Imprint, privacy policy and terms of service