Skip to content

Qwen3-0.6B inference (12 KB), bare-metal bootable OS (22 KB), and from-scratch Mini-GPT trainer with live Braille TUI (32 KB) in 100% pure x86-64 NASM assembly. Zero C, zero libc, zero dependencies.

6.3 KB
Raw Blame

06 · Zero-App Ephemeral OS (113 KB Pure x86-64 NASM)

0 preinstalled apps. 0 GB disk. 0 lines of C. 0 gcc calls. 115,160 bytes of handwritten x86-64 NASM that boots a 2.5B LLM on bare-metal CPU, writes playable x86-64 assembly apps at runtime, and self-heals Ring-0 #PF/#UD faults in ~0.3s.

  • Pre-trained weights (BF16, Q8_0 GGUF, bare-metal NVDIMM .zappm) + ready-to-boot 12 MB ISO: huggingface.co/alesha-pro/I-Deleted-Linux-ZeroApp-2B
  • Kernel ELF: 115,160 bytes (113 KB) across 19,138 lines of handwritten x86-64 NASM (src/*.asm, src/*.inc)
  • Base model: openbmb/MiniCPM5-2B fine-tuned with SFT + 120-step live QEMU KVM GRPO + v2.1 arcade pass

Live Screenshots (0 GB Disk, 0% GPU)

flappy bird (0-shot, 1,595 tok, 230 instr, 1,074 B) arkanoid (0-shot, 1,243 tok, 177 instr, 755 B)
Flappy Bird generated on bare-metal CPU Arkanoid generated on bare-metal CPU
Ring-0 #PF Hardware Trap HUD 27-Color Emerald Mandelbrot after 10-tok PATCH (~0.3s)
Ring-0 Page Fault diagnostic HUD Emerald Mandelbrot recovered at 60 Hz

Build From Source (Pure NASM, Zero gcc)

Requires nasm and GNU binutils (ld, objcopy). Optional for ISO: grub-mkrescue, xorriso, mtools.

cd 06-zero-app-os
make          # builds build/zero-app-os.elf (115,160 bytes)
make iso      # builds build/zero-app-os.iso (11.6 MB bootable GRUB2 ISO)

Boot in QEMU KVM (10 Seconds)

1. Download bare-metal Q8_0 weights (~2.50 GiB)

hf download alesha-pro/I-Deleted-Linux-ZeroApp-2B \
  zappm/minicpm5-2b-zeroapp-v21-q8_0.zappm \
  --local-dir .

2. Boot with NVDIMM weight mapping (0 GB disk, 0% GPU)

Requires an x86-64 CPU with AVX2 + FMA + F16C:

qemu-system-x86_64 -enable-kvm -cpu host \
  -machine pc,nvdimm=on \
  -smp 16 \
  -m 3G,slots=2,maxmem=8G \
  -vga std \
  -object memory-backend-file,id=zmodel,mem-path=zappm/minicpm5-2b-zeroapp-v21-q8_0.zappm,size=2684620800,readonly=on \
  -device nvdimm,id=nv1,memdev=zmodel,unarmed=on \
  -kernel build/zero-app-os.elf

To boot through GRUB2 instead of -kernel, replace -kernel build/zero-app-os.elf with -cdrom build/zero-app-os.iso.

3. Boot on Proxmox VE (Diskless VM, 0 GB Storage)

Copy minicpm5-2b-zeroapp-v21-q8_0.zappm and zero-app-os.elf to /var/lib/vz/zero-app-os/ on the Proxmox host, create a VM with 0 GB disk, cpu: host, cores: 16, memory: 3072, vga: std, bios: seabios, and add:

args: -machine type=pc+pve0,nvdimm=on -m 3G,slots=2,maxmem=8G -object memory-backend-file,id=zmodel,mem-path=/var/lib/vz/zero-app-os/minicpm5-2b-zeroapp-v21-q8_0.zappm,size=2684620800,readonly=on -device nvdimm,id=nv1,memdev=zmodel,unarmed=on -kernel /var/lib/vz/zero-app-os/zero-app-os.elf

4. Interactive Console (zero-app>)

  • Zero-shot generated games: type flappy bird, tetris, arkanoid, pong, dino, or falling sand and press Enter. The model streams raw x86-64 assembly into the Ring-0 micro-assembler (src/uasm.asm) and executes it inside a hardware-isolated Ring-3 W^X/NX sandbox (src/sandbox.asm).
  • Instant Ring-0 #PF/#UD/#DE self-healing demos: press 1 through 5 + Enter (Ocean Waves, 27-color Emerald Mandelbrot, Cyan Matrix Rain, 28-color Blue Mandelbrot, Canary Crossing).
  • Press ESC at any time to kill the sandbox and return to zero-app>.

Pure NASM vs GCC -O3 & Prefix KV-Cache

Porting the final 3 C modules (zapp_smp, zapp_llm, zapp_ai) to handwritten NASM shrank the kernel by 37.6% (181 KB -> 115,160 B), matched C greedy output byte-for-byte, beat GCC -O3 on both prefill and decode, and added a bare-metal Longest-Common-Prefix (LCP) KV-Cache.

Pure NASM vs GCC -O3 and Prefix KV-Cache speedup

Benchmark (20T AMD EPYC 7642, Q8_0, 0% GPU) C+ASM (GCC -O3) 100% Pure NASM Delta
Kernel ELF size 181 KB 115,160 B (113 KB) -37.6%
Prefill throughput 248.7 tok/s 277.6 tok/s +11.6%
Decode throughput 34.3 tok/s 37.6 tok/s +9.6%
2,354-token Prefix KV-Cache (cold -> warm) 13,277 ms 93 ms 142.8x faster

RL Training (4x RTX 3090 + 16 Live QEMU KVM Oracles)

Pure SFT collapsed on held-out prompts (0/32 compiled) due to unrolled memory-loop repetition. Running 120 steps of GRPO against 16 live QEMU KVM oracles (verifying assembly, 60-frame Ring-3 survival, multicolor animation, and input response) plus a v2.1 QEMU-verified arcade pass fixed both zero-shot generation and surgical Ring-0 PATCH repair.

Zero-App OS RL and GRPO training metrics

  • Held-out 0-shot compile_ok: 0.0% (SFT) -> 56.2% (GRPO step 90)
  • Validation closed-loop pass@6: 0.0% -> 24.7% across 73 prompts
  • Ring-0 surgical PATCH@1: 100% on #DE divide-by-zero and #PF null deref, 87.5% on #UD and #PF framebuffer guard (avg 11.8 tokens, ~0.3s)
  • v2.1 arcade pass: validation PATCH@1 = 90.0% (18/20), token accuracy 93.04% (eval_loss = 0.2427)

Source Layout

  • src/boot.asm, src/ap_trampoline.asm, src/zapp_smp.asm - Multiboot entry, 64-bit Long Mode, APIC SMP wake-up, 64B cache-line barrier, idle HLT
  • src/zapp_llm.asm, src/avx_asm.asm - 5,647-line pure NASM MiniCPM5-2B Q8_0 AVX2+FMA+F16C inference engine with LCP Prefix KV-Cache
  • src/zapp_ai.asm, src/zapp_demos_broken.inc - NVDIMM loader, split-screen HUD, 6-step Ring-0 PATCH loop, presets 1..7
  • src/uasm.asm, src/sandbox.asm - In-kernel x86-64 micro-assembler + Ring-3 W^X/NX hardware sandbox and #PF/#UD/#DE trap handler
  • src/kernel.asm, src/drivers.asm, src/frame160.asm, src/demos.asm - Shell, PS/2 keyboard/mouse, VGA/framebuffer, 160x120 4x scaler
  • scripts/ - GRUB2 ISO builder (mkiso.sh), NVDIMM weight packer (pack_zapp_model.py), QEMU verification suite (verify_qemu.py, verify_stage3.py, qemu_validator.py)
  • train/ - SFT & QEMU-oracle GRPO training scripts and YAML configs