24 KB Assembly OS Boots Qwen3 Without Linux and Beats llama.cpp in Decode Tests

15 Min Read
24 KB Assembly OS Boots Qwen3 Without Linux and Beats llama.cpp in Decode Tests

A computer with one job: running Qwen3

Alexey Fateev released asm-llm-os.elf on 26 November 2026, Japan time: a bootable operating system whose sole purpose is to run Alibaba's Qwen3-0.6B language model. Its kernel occupies 24,252 bytes, reaches an interactive chat prompt 74 to 94 milliseconds after starting, and uses neither Linux nor Windows. Fateev wrote the system in x86-64 NASM assembly, without C, C++, Rust, libc, libm, a dynamic linker or other runtime dependencies. The code is available in the alesha-pro/llm.asm repository under the MIT license.

Contents
  1. A computer with one job: running Qwen3
  2. What 24,252 bytes does and does not include
  3. How the kernel starts the machine
  4. What the chat console can do
  5. The benchmark behind the 54 percent claim
  6. Removing Linux is not the main speedup
  7. Exact outputs across different processor counts
  8. How to boot it with zero disk storage
  9. The limits of an operating system for one model
  10. The other two programs in llm.asm
  11. What the experiment offers programmers and home labs
  12. What to Know

The release also comes with an unusually bold performance claim. Fateev's measurements on an AMD EPYC 7642 show the system decoding text as much as 54 percent faster than llama.cpp running natively on Linux. At 16 virtual CPUs inside QEMU/KVM, it produced 134.94 tokens per second, compared with 103.03 for llama.cpp. Tokens are the pieces of text that a language model reads and generates, so a higher decoding rate means answers appear faster. These are the developer's own results, not independent measurements.

Fateev, who publishes under the GitHub handle alesha-pro, introduced the experiment on X with a description of both its extreme minimalism and its speed.

I deleted Linux completely, baked Qwen3-0.6B into a 24 KB pure x86-64 assembly OS, and it runs up to 54% faster than native Linux llama.cpp.

Assembly language sits close to the processor's own instructions. Writing an entire inference engine and operating system in it means implementing mathematics, memory management, processor coordination, text tokenisation and hardware input directly. This release is Phase 2 of llm.asm: Phase 1 runs the same model as a small Linux program, while Phase 2 replaces Linux with Fateev's own kernel.

Advertisement

What 24,252 bytes does and does not include

The default kernel uses a build setting called FAST_Q8=1. Its executable code section occupies 17,143 bytes, while 2,772 bytes hold data that remains constant during operation. A legacy build, FAST_Q8=0, retains floating point activations in FP32 and produces a slightly smaller file of 23,612 bytes. Both versions are stripped, statically linked Multiboot 1 kernels with no dynamic dependencies. Multiboot provides a standard way for loaders such as GRUB2 and QEMU to start a kernel.

A further 2.1 MiB is reserved as a section named .bss. This space is initialised to zero when the machine starts and is marked NOBITS, meaning those bytes do not have to be stored in the kernel file. The 24 KB figure therefore describes a real executable, but it does not describe all the memory the running system reserves.

The model is separate and vastly larger. Qwen3-0.6B has about 600 million parameters, the numerical values learned during training. The project stores them in Q8_0, a quantised format that uses compact integer blocks and scaling values to reduce memory traffic. Its .asmbin version 2 file occupies 613.66 MiB with FP16 scaling values, usually rounded to 614 MiB. The equivalent GGUF Q8_0 file used for llama.cpp in the comparison occupies 604.15 MiB. An older .asmbin version with FP32 scaling values requires 649 MiB.

Another 449 MiB is reserved for the KV cache and temporary working space. The KV cache holds information about earlier tokens so the model can continue a conversation without recomputing everything from the beginning. The small kernel, large model and cache must all fit in RAM.

How the kernel starts the machine

The boot code first checks the Multiboot 1 identification value, 0x2BADB002, clears the reserved memory and constructs four levels of page tables. It uses an identity map covering the first 4 GiB, meaning the numerical addresses used by software match the physical addresses in RAM. Each page covers 2 MiB rather than the conventional 4 KiB. The region used by the processor's Local APIC hardware is marked uncacheable so device accesses are not served from stale cached data.

The kernel then enters Long Mode, installs a table for 32 processor exceptions and checks the CPU through CPUID. AVX2, FMA and F16C are mandatory instruction extensions. They accelerate vector arithmetic, combined multiplication and addition, and conversion involving 16 bit floating point values. XSAVE and AVX support are also checked before the relevant processor registers are configured.

Fateev linked the kernel as a 64 bit ELF executable and converted its container to ELF32 with objcopy so standard Multiboot loaders can accept it. That packaging detail explains why build tools identify the file as an Intel 80386 executable even though its boot code quickly switches the processor to execute 64 bit instructions.

The runtime validates the model file's ASML identifier and reads its weights directly from the physical address where the loader placed them. It does not copy the 614 MiB file into another allocation. The 449 MiB working arena comes from the largest suitable region in the memory map supplied at boot.

Support for several processor cores required another substantial piece of operating system work. The kernel walks the ACPI RSDP, RSDT or XSDT, and MADT tables to discover processors. It places a small startup routine at physical address 0x8000 and wakes the remaining cores through Local APIC INIT-SIPI-SIPI signals. Matrix multiplication and attention work are then distributed with a barrier that avoids locks and gives each core a separate cache line, reducing contention between cores. The operating system portion comprises 4,167 lines of assembly, alongside shared modules for mathematics, matrix operations, tokenisation and the transformer.

Advertisement

What the chat console can do

The completed boot sequence leads to the asm-llm> prompt with all available cores active. A user can type through a PS/2 keyboard and read responses on an 80 by 25 colour VGA text console. The same session can run through the COM1 serial port at 115200 baud, using eight data bits, no parity and one stop bit. The kernel polls both input paths. Its remaining hardware support covers timing through PIT and RDTSC, plus an orderly ACPI S5 power off.

Conversation state survives between turns. Each new message processes only its new Qwen3 chat tokens rather than recomputing the earlier conversation. The statistics line displays context consumption as ctx=X/2048. The default limit is 2,048 tokens, including the prompt, generated answer and retained conversation. When the next exchange would approach that ceiling, the console prints a context full message, resets the KV cache and continues with a clean conversation.

Several commands control the session:

  • /clear, /new and /reset erase the retained conversation.
  • /think enables Qwen3's reasoning mode, while /nothink requests direct answers and is the default.
  • /bench clears the cache and runs the included speed test.
  • /halt or /quit shuts down through ACPI, and /help lists the commands.

Boot options can also supply a batch prompt, set a generation ceiling different from the default 128 tokens, change the context size, limit active cores or request automatic shutdown. Sampling defaults to a temperature of zero, which selects the highest scoring next token, with a top-p threshold of 0.95 available when sampling is enabled.

The benchmark behind the 54 percent claim

Fateev compared three arrangements on the same AMD EPYC 7642 system, which had 47 cores online, 256 MiB of L3 cache and DDR4 memory. llama.cpp used only the CPU, with GPU offload disabled through -ngl 0. The tests used Qwen3-0.6B weights in Q8_0 format, a prompt of 34 tokens and 64 generated tokens. Each result is an average of three runs.

The operating system's decoding results against native Linux llama.cpp were:

  • One thread: 23.67 tokens per second against 16.63, a 42 percent advantage.
  • Four threads: 78.89 against 51.08, a 54 percent advantage and the largest lead.
  • Eight threads: 118.08 against 80.79, a 46 percent advantage.
  • Sixteen threads: 134.94 against 103.03, a 31 percent advantage, with a single-run peak of 136.6.

The operating system measurements came from QEMU/KVM virtual CPUs. KVM allows guest instructions to execute directly on the host processor, but the test was not run on a dedicated physical machine outside virtualisation. The kernel itself still runs without a guest Linux installation.

A separate boot table records readiness at 73.47 milliseconds with one virtual CPU, 84.88 milliseconds with 16 and 94.27 milliseconds with 24. Those figures put the entire range within the advertised 74 to 94 milliseconds after rounding.

Advertisement

Removing Linux is not the main speedup

The Linux version of Fateev's engine is itself faster than llama.cpp in the same decoding test. Its 14,712 byte executable leads by 18.3 to 35.6 percent across tests using one to 40 threads. At 16 threads, it produces 121.86 tokens per second. Moving that code into the bootable kernel raises the figure to 134.94, an additional 10.7 percent. Most of the advantage therefore comes from the shared inference implementation rather than from deleting Linux alone.

The recent FAST_Q8=1 mode supplied the largest mathematical change. It converts activations to eight bit integers for each matrix multiplication and performs INT8 by INT8 dot products with AVX2 instructions. F16C converts the model's FP16 block scaling values during calculation. Before this change, the project was 2.9 times slower with one thread and trailed llama.cpp across the tested configurations.

Memory layout supplies another gain. Generating a token requires reading the model's approximately 614 MiB of weights. A 2 MiB huge page covers 512 times as much memory as a 4 KiB page, so the processor needs fewer address translations while streaming those weights. Fateev attributes roughly another 10 percent to the kernel's huge page mapping. llama.cpp can also use huge pages on Linux, but no comparison with that option enabled has been published.

All three engines stop gaining much beyond 16 threads. llama.cpp levels off near 104 tokens per second, the Linux assembly program near 124 and the bootable system near 133. At that point, delivering weights from memory becomes a more convincing constraint than adding further arithmetic capacity.

Decoding is only half of an inference workload. Prefill is the initial processing of the user's prompt. llama.cpp batches that work and reached as much as 1,113 tokens per second, against llm.asm's best figure of 160.8. That is nearly seven times faster at the listed peaks. The difference has little effect on a short chat message, but it matters when software must ingest a long document.

Advertisement

Exact outputs across different processor counts

The correctness tests may be more useful than the headline speed. An automated suite compares the Linux and bootable implementations across five prompts, including Russian text and a run using reasoning mode. The project reports matching prompt tokens, generated tokens and UTF-8 output, with identical bytes from one through 32 KVM virtual CPUs.

The Linux inference engine was also checked against a PyTorch FP32 reference. All 64 tokens in a greedy decoding test matched, and the final logits recorded a cosine similarity of 0.99965. Logits are the numerical scores from which the next token is selected; cosine similarity measures how closely two sets of scores point in the same direction.

Shared source files explain how two very different environments can produce the same output. A compilation setting replaces Linux system calls with physical memory handling, processor barriers and console drivers, while retaining the same transformer, mathematics and tokeniser. For developers testing an inference engine, that arrangement provides a demanding check that changing thread counts or boot environments does not silently change an answer.

How to boot it with zero disk storage

A compatible machine needs an x86-64 processor with AVX2, FMA and F16C. Building the core system requires NASM, binutils and QEMU, while the optional ISO build adds GRUB components, mtools and xorriso. The user must also export a file named qwen3-0.6b-q8_0.asmbin. The repository's shortest build sequence is make os FAST_Q8=1, followed by make os-run with the model path and an SMP value such as 16.

QEMU can load the kernel and model as separate arguments. Alternatively, make os-iso packages GRUB2, the kernel and the 649 MiB model into a bootable image of approximately 661 MiB. The image supports both legacy BIOS and UEFI startup.

The Proxmox VE demonstration gives this design its most tangible party trick: a virtual machine with no virtual hard disk at all. Everything arrives through the ISO and remains in RAM. On an Intel Xeon E5-2670 v3 with 12 cores and 2 GiB assigned to the guest, the prompt appeared in under five seconds, including the virtual platform's startup work. The kernel's own share was about 95 milliseconds.

The 2 GiB allocation equals 2,048 MiB. The 649 MiB model and 449 MiB cache arena total 1,098 MiB, leaving 950 MiB before the kernel and other structures are counted. Proxmox must expose the host CPU features, and memory ballooning must be disabled so the guest retains a fixed, contiguous allocation. Users can interact through the web console or a virtual serial terminal.

The project table records 55.4 tokens per second on that diskless Proxmox machine. Fateev's X announcement gives 78 tokens per second for the same setup, and no explanation for the difference accompanies the figures.

Advertisement

The limits of an operating system for one model

The current system has no network stack, storage driver or memory protection. It runs Qwen3-0.6B in one quantisation format on compatible x86-64 processors, and its default conversation memory resets after roughly 2,048 tokens. Supporting another model architecture would require changes to assembly code rather than loading a new configuration.

llama.cpp occupies the opposite position. It supports hundreds of architectures, several quantisation formats, GPU backends and batched prompt processing. The comparison therefore pits a portable inference platform against code tightly fitted to one model and one processor family.

Virtualisation also qualifies the phrase bare metal in the performance numbers. The kernel supplies its own operating system inside the guest, but the EPYC test used a Linux KVM host and the second demonstration used Proxmox VE. Both show that the guest needs no Linux installation; neither is a published timing run on an otherwise idle physical server.

No independent benchmark run has yet been published. The repository supplies scripts and commands for reproduction, but it does not give a date for testing larger models, expanding hardware support or turning the demonstration into a maintained appliance.

The other two programs in llm.asm

Phase 1 remains useful on its own. The static Linux executable implements Qwen3's 28 layer forward pass, byte pair encoding, grouped query attention, QK-Norm, rotary position encoding, SwiGLU and a cache-preserving chat interface. It shares approximately 3,857 lines of core assembly with the other projects and needs no standard C or mathematics library.

Phase 3 moves from inference to training. Its 32,944 byte executable builds a small GPT from initialisation, with an analytical backward pass, the AdamW optimiser and a terminal display that draws loss curves using Unicode Braille characters. The gradient check reports cosine values of 1.0000000000 across all 21 tensors when compared with PyTorch on CPU.

The trainer reaches 27,662 training tokens per second in the project's listed configuration. On TinyShakespeare, its validation loss falls from 4.19 to 1.51 in four minutes. The three executables total 17,252 lines of assembly: 14,712 bytes for Linux inference, 24,252 for the bootable OS and 32,944 for the trainer.

Advertisement

What the experiment offers programmers and home labs

Public attention arrived quickly after the repository's release. Its progression can be summarised in three dates:

  • 25 November 2026: llm.asm launched, and the repository gained 203 GitHub stars that day.
  • 26 November: Fateev announced the Qwen3 operating system, the project reached the Hacker News front page, and GitHub added 1,288 stars and 137 forks.
  • 27 November: another 40 stars arrived, taking the gains for 24 to 27 November to 1,531 stars and 174 forks.

Trendshift, which tracks repository activity, lists the project as MIT licensed and maintained by one contributor. Its Trendshift tracking data records no merged pull requests during that four day period, consistent with a very young release rather than an established community project.

A home lab user can already treat the ISO as an experimental, local chat appliance: assign 2 GiB to a compatible virtual machine, attach no disk and communicate through its console. The absence of networking keeps that experiment local, while the context reset and single model support sharply limit its usefulness.

Inference engineers get a more transferable lesson. The shared Linux binary captured most of the decoding lead before the operating system was removed, and huge pages supplied an additional gain by reducing address translation work while weights streamed from RAM. The project also provides a compact example of Long Mode startup, ACPI processor discovery, SIMD arithmetic and deterministic testing in one codebase. Its practical value lies in those techniques and measurements, not in replacing general inference servers with a 24 KB kernel.

What to Know

  • Alexey Fateev's MIT licensed asm-llm-os.elf boots directly into Qwen3-0.6B chat without a guest Linux or Windows installation.
  • The default kernel is 24,252 bytes, but the model requires about 614 MiB and the KV cache arena reserves another 449 MiB.
  • The prompt appears in 74 to 94 milliseconds; a diskless Proxmox virtual machine reaches it from ISO in under five seconds.
  • Fateev's EPYC tests show decoding leads of 31 to 54 percent over llama.cpp at one to 16 threads, peaking at 136.6 tokens per second.
  • The Linux assembly engine already provides most of that lead; optimised integer arithmetic and memory layout matter more than removing Linux alone.
  • llama.cpp remains much faster at batched prompt prefill and supports far more models and hardware.
  • The project reports identical output between its Linux and bootable versions across five prompts and one to 32 virtual CPUs.
  • The system requires AVX2, FMA and F16C, has no networking or storage driver, and its performance claims still await independent reproduction.
Share This Article

You May also Like