Minimal assembly OS runs LLM and games at bare-metal speeds

Alexey Fateev built a 115,160-byte x86-64 assembly operating system that dispenses with Linux Windows C Rust and gcc. The kernel named zero-app-os-elf comprises 19,138 lines of handwritten NASM and starts directly in 64-bit Long Mode without a conventional bootloader. It initializes the platform by waking every CPU core via APIC and maps a 2.50 GiB Q8_0 MiniCPM5-2B model directly over NVDIMM making the large language model available to user code at the earliest stage.

The OS includes a Ring-0 micro-assembler that streams x86-64 assembly and implements a hardware-isolated Ring-3 W^X sandbox. When a generated application triggers a hardware page fault PF or undefined opcode UD the kernel traps the CPU exception extracts the faulting line and CR2 address and returns a surgical patch of 10 to 20 tokens to the LLM in approximately 0.3 seconds. This closed-loop mechanism lets the model self-heal code at runtime.

Benchmarks: assembly beats C+ASM on throughput and latency

Head-to-head measurements on a bare-metal CPU Q8_0 with 0% GPU show the assembly advantage. The kernel binary of 115,160 bytes is 37.6% smaller than a 181 KB C+ASM build that requires gcc calls. In token processing Pure NASM achieves 277.6 tokens per second on prefill and 37.6 tokens per second on decode against GCC -O3s 248.7 and 34.3 respectively a roughly 11.6% and 9.6% improvement while producing byte-exact output to the C baseline. A bare-metal Prefix KV-Cache using LCP reduces a 2,354-token prefill from 13.3 seconds to 93 milliseconds a 142.8x speedup.

From OS prompt to Flappy Bird in seconds

The most visible demonstration is a diskless Proxmox VM running on 2014 Intel Xeon E5-2670 v3 hardware with 16 vCPUs and 0 GB of disk. The VM boots straight out of RAM and upon prompt compiles a playable 20-color Flappy Bird. The bird game consists of 1,595 tokens 230 instructions and 1,074 bytes of machine code assembled at runtime. No preinstalled game engine or graphics library is used the entire experience emerges from the assembly runtime.

Other experiments in the thread include Tetris Arkanoid a Ring-0 page-fault self-healing reinforcement learning loop and four charts documenting 3090 RL training. The model and repository links are posted in the final reply to the original tweet.

Practical implications for edge inference and constrained LLMs

This work demonstrates that a completely kernel-mode-free gcc-free C-free operating footprint can still host a 2.5-billion-parameter LLM and render interactive applications at interactive speeds. The combination of a handwritten NASM kernel NVDIMM-resident model mapping and an exception-driven self-patching loop suggests a different pathway for embedded or constrained LLMs where every kilobyte and every cycle counts. Teams working on edge inference bare-metal orchestration or runtime code generation may find the exception-to-patch pattern especially relevant for fault tolerance without external toolchains.

Project perspective and measured baseline

The project exists as a proof of concept that the boundary between operating system runtime and application can be compressed into a fraction of the usual size when all layers are expressed in pure assembly. Whether the approach scales to larger models or more complex workloads remains an open question. The concrete numbers smaller binary higher token throughput sub-100-millisecond KV-cache initialization and in-bootstrapping a game from RAM provide a measurable baseline for future comparison.