---
title: "llm.asm: A 24 KB Assembly OS That Boots Straight Into an LLM"
description: "llm.asm boots a PC into Qwen3-0.6B chat with no Linux or libc, in 24 KB of hand-written x86-64 assembly. How the code works, the benchmarks and the catches."
url: https://launchkudos.com/blog/llm-asm-bare-metal-assembly-os-qwen3
section: AI
author: "Arnab Gupta"
published: 2026-11-27T15:53:56.994Z
updated: 2026-11-28T01:52:53.282Z
tags: [llm-asm, bare-metal, assembly, qwen3, local-llm]
---

# llm.asm: A 24 KB Assembly OS That Boots Straight Into an LLM

*llm.asm boots a PC into Qwen3-0.6B chat with no Linux or libc, in 24 KB of hand-written x86-64 assembly. How the code works, the benchmarks and the catches.*

On November 25, developer Alexey Fateev published [llm.asm](https://github.com/alesha-pro/llm.asm): a 24 KB operating system, written entirely in x86-64 assembly, that boots a computer straight into a chat with the Qwen3-0.6B model. There's no Linux, Windows, C library or Python at run time. The author's benchmarks also claim it generates text faster than llama.cpp, the standard tool for running models on a CPU.

The repo collected about 1,900 stars in its first two days. We read the source code to see how it works and where the claims stop.

> **> **Update, 28 Nov 2026:** On November 27, Fateev added a fourth project to the repo: [Ring -1 Kernel Surgeon](https://github.com/alesha-pro/llm.asm/tree/main/04-ring1-kernel-surgeon), a 75 KB AMD hypervisor that runs a 2B model beneath Linux and rewrites crashing kernel code live. Unlike parts 01–03, it's mostly freestanding C. We explain how it works, and its limits, in [a separate article](https://launchkudos.com/blog/ring-minus-1-kernel-surgeon-llm-hypervisor-explained).**

- 24,252 B · Size of the bootable OS kernel · llm.asm README
- 74–94 ms · Boot to chat prompt, under KVM · llm.asm README
- +18% to +36% · Decode speed vs llama.cpp, 1–40 threads · Author's benchmark
> **> - llm.asm launched as three projects in about 17,000 lines of NASM assembly: a 14.7 KB Linux chat program, a 24 KB bootable OS, and a small GPT trainer. A fourth, a hypervisor, followed on November 27.**
> - The OS takes over the machine itself. It switches the CPU to 64-bit mode, wakes every core, drives the screen, serial port and keyboard, then runs the model from RAM.
> - The author reports 134.9 tokens/sec on an AMD EPYC under KVM, against 103.0 for llama.cpp on the same chip. Nobody has independently reproduced that yet.
> - It runs exactly one model, reads prompts much more slowly than llama.cpp, and has only been tested in virtual machines.

Post on X: https://x.com/i/status/2125682626056839259
## What did llm.asm actually build?

The [README](https://github.com/alesha-pro/llm.asm) describes "three complete LLM projects written in 100% pure x86-64 NASM assembly." All three were pushed in [three commits on November 25](https://github.com/alesha-pro/llm.asm/commits/main):

| Part | Size | What it does |
|---|---:|---|
| 01-qwen3-inference | 14,712 B | A static Linux program that chats with Qwen3-0.6B |
| 02-baremetal-os | 24,252 B | A bootable OS that does the same with no Linux underneath |
| 03-minigpt-train | 32,944 B | Trains a tiny GPT from scratch, with a live text-mode loss chart |

The model itself isn't inside those 24 KB. The weights are a separate 614 MiB file that the boot loader puts in memory next to the kernel. The 24 KB is all the code needed to run them.

It's MIT licensed. The only non-assembly piece is a one-off Python script that converts Qwen's published weights into the project's own file format.

## How does an OS boot straight into a model?

The [OS README](https://github.com/alesha-pro/llm.asm/blob/main/02-baremetal-os/README.md) and `kernel.asm` lay out the steps:

1. **GRUB loads two things:** the 24 KB kernel and the model file, passed in as a boot "module."
2. **`boot.asm` moves the CPU from 32-bit to 64-bit mode.** It maps the first 4 GB of memory using 2 MB pages and checks for the AVX2, FMA and F16C vector instructions. If they're missing, it stops with an error.
3. **`smp.asm` wakes up the other cores.** A PC starts with one core running. The kernel reads the firmware's list of cores, copies a small piece of startup code to low memory and sends each core the standard wake-up signals. Each core switches itself to 64-bit mode and waits for work.
4. **The model is used where GRUB left it**, without being copied. Memory is only set aside for working buffers and the conversation history.
5. **A chat loop starts.** It reads text from a PS/2 keyboard or the serial port and writes replies to the text-mode screen and the serial port.

The author shows it running in QEMU with KVM on 16 virtual CPUs of an AMD EPYC 7642, and on a Proxmox virtual machine with no disk attached at all. Everything lives in RAM.

## Why can the same code run with and without Linux?

The model code is written once and shared. Both builds link the same `transformer.asm`, `matmul.asm`, `tokenizer.asm` and `math.asm`. Each build only swaps in a different bottom layer that provides the same few functions: print text, allocate memory, read a clock, and split a job across cores.

![Diagram: the shared model core (transformer, matmul, tokenizer, math) sits above two platform layers, one for Linux using syscalls and threads, one for the bootable OS using its own boot, SMP and driver code](https://launchkudos.com/media/b42e9911a1d6a6ebe1af.webp)

On Linux, cores are started with the `clone()` system call. In the OS, `smp.asm` exports functions with the same names but starts the cores itself. The model code never knows which one it's running on.

## How does each token get generated?

`transformer_forward` in `shared/transformer.asm` is Qwen3's design written out by hand, with no general-purpose machinery. For each new token it looks up the token's embedding, then runs 28 layers. Each layer does normalisation, attention and a feed-forward block. A final step scores every possible next token.

By default it picks the highest-scoring token, so the same prompt always gives the same answer. Temperature and top-p sampling are optional.

## Why is it faster than llama.cpp?

Almost all the time goes into multiplying model weights by the current activations. `matmul.asm` stores weights as 8-bit integers in blocks of 32, each block with its own scale. It also squeezes the activations to 8 bits, then multiplies 8-bit by 8-bit with AVX2 integer instructions. It works through 128 bytes at a time and asks memory for the next row before it needs it.

Other choices help too. The three attention projections run as one job, and so do the two feed-forward input projections. The work is always split across cores the same way, so the output is bit-for-bit identical on 1 core or 40. In the README's words, the OS gains "another ~10% from 2 MiB huge-page identity mapping": with large pages, the CPU rarely has to look up where memory lives.

![Line chart: decode speed for Qwen3-0.6B on an AMD EPYC 7642 at 1 to 32 threads. The llm.asm OS peaks at 134.9 tokens/sec, the llm.asm Linux binary at about 124, llama.cpp at about 104](https://launchkudos.com/media/f57ad00692b305aa15a8.webp)

All of these numbers are the author's own, from one machine, as the chart notes. The README reports the Linux binary beating llama.cpp by between 18% and 36% across 1 to 40 threads. The "up to 54%" in the launch tweet compares a different pair: the OS under KVM at 4 threads (78.89 tokens/sec) against llama.cpp (51.08), from the same table. The README also reports 64 out of 64 identical tokens compared with the reference PyTorch model.

> **llm.asm README, 25 Nov 2026**
> "Zero C, zero C++, zero Rust, zero libc, zero libm, zero runtime dependencies."

## What are the catches?

- **One model only.** The shape of Qwen3-0.6B is built into the code. A different model means rewriting assembly.
- **Prompts are slow.** llm.asm handles a prompt one token at a time. The README puts its prompt speed at 26.7 to 160.8 tokens/sec, against 56 to 1,113 for llama.cpp, which processes prompts in batches. For long prompts, llama.cpp wins easily.
- **Only tested in virtual machines.** Both published runs (KVM on EPYC, and Proxmox on a Xeon E5-2670 v3 at 55.4 tokens/sec) are virtual machines. We found no report from a real PC booted directly.
- **It still needs a boot loader.** GRUB loads it, then the kernel does everything else. That's a different approach from [NightRun](https://cnx-software.com/2026/07/30/nightrun-uefi-application-boots-a-local-llm-on-raspberry-pi-5-and-x86-pcs-without-an-os), the July project that boots PCs into an LLM but keeps using the firmware's own services the whole time.
- **No networking, no disk, no memory protection.** It's a demonstration, not something to deploy.
- **Unverified benchmarks.** Nobody outside the project has reproduced the speed numbers yet.

> **> We cloned the repository on November 27, 2026 at commit 48feccb and read the source (`boot.asm`, `kernel.asm`, `smp.asm`, `transformer.asm`, `matmul.asm`, `threads.asm`, `tokenizer.asm`, the Makefile and the weight export script). All benchmark figures come from the project's README files. We did not build or run the code, so the speed and boot-time numbers are the author's claims. The chart plots the README's table. Star count from the GitHub repo page on November 27.**

For more of this month's open-source releases, see our [trending GitHub repos for November 2026](https://launchkudos.com/blog/trending-github-repos-november-2026).

## Background explainers

- [CPU privilege rings and hypervisors: Ring 3, Ring 0 and Ring -1](https://launchkudos.com/blog/cpu-privilege-rings-hypervisors-explained)
- [How a PC boots: BIOS, UEFI, GRUB and Multiboot](https://launchkudos.com/blog/how-a-pc-boots-bios-uefi-grub-multiboot-explained)
- [LLM quantization: what Q8_0 and Q4_K_M mean](https://launchkudos.com/blog/llm-quantization-q8-0-q4-k-m-explained)
- [Prefill, decode and the KV cache](https://launchkudos.com/blog/prefill-decode-kv-cache-tokens-per-second-explained)
- [Distillation, LoRA and GRPO](https://launchkudos.com/blog/distillation-lora-grpo-explained)

## FAQ

### What is llm.asm?
An open-source project by Alexey Fateev that runs the Qwen3-0.6B language model in pure x86-64 assembly. It comes as a Linux program and as a bootable operating system, plus a small GPT trainer.

### Does llm.asm really run without an operating system?
Yes, apart from the boot loader. GRUB loads the 24 KB kernel and the model file. After that, the kernel handles the CPU, memory, cores, screen and keyboard itself. So far it has only been shown running inside virtual machines.

### Is llm.asm faster than llama.cpp?
At generating text, by the author's own benchmark: 18% to 36% faster on an AMD EPYC 7642. At reading prompts it is far slower. The numbers haven't been reproduced independently.

### What hardware does llm.asm need?
An x86-64 CPU with AVX2, FMA and F16C: Intel Haswell or AMD Excavator, or newer. Building it needs `nasm` and `binutils`. Converting the model weights needs Python with NumPy.

### Can llm.asm run other models?
Not without rewriting code. It's built for Qwen3-0.6B's exact architecture.

> **> Would you boot a machine straight into a local model if it were reliable on real hardware? Tell us below.**

Reader poll: Would you run an LLM with no operating system underneath? (Yes, for a dedicated offline box / Only as a demo / No, I need an OS / Not sure)
