A self-evolving Ring-0 AI operating system and GPU inference engine written in pure x86-64 NASM and hand-assembled NVIDIA Ampere SASS.
Boots straight onto an RTX 3090 from UEFI with zero Linux, zero CUDA, zero NVIDIA driver, and zero libc — running Qwen4-35B-A3B (64K context in 22 GB VRAM) while writing, compiling, and hot-reloading live Ring-0 C apps in a split-pane framebuffer as you interact with them.
Flagship OS · Performance · Architecture · Quick Start · What Else Is in This Repo · Ecosystem · Contributing
Live 1280x800 UEFI GOP framebuffer of llm.asm running Qwen4-35B-A3B at 149.0 tok/s (PEAK 150.6) with live set_theme(preset=cyberpunk) + nvtop GPU HUD, 22398 / 24576 MiB VRAM, x86-64 Ring0 (ZERO OS), and 192.168.1.204:8080 [e1000].
Modern AI stacks pull in gigabytes of Linux, Python, PyTorch, CUDA runtime, and kernel drivers before generating a single token. llm.asm replaces the entire stack with bare metal: a UEFI Ring-0 executable in x86-64 assembly that brings up the GPU from cold silicon, runs a 35B Mixture-of-Experts model locally, and lets the model modify the live OS and build native apps while you use it.
|
|
Live 3D wireframe + golden inner cube hot-reloaded in Ring-0 at 138.8 tok/s ( 9.4K ctx)
|
Live 3-ball neon Arkanoid with dual lasers compiled by Tiny C at 143.2 tok/s ( 6.5K ctx)
|
All numbers below were measured on a single NVIDIA RTX 3090 (24 GB GDDR6X) with zero Linux kernel, zero nvidia.ko, and zero CUDA runtime underneath (plus Linux static ELF comparison runs where noted):
| Metric | Measured Result | Notes |
|---|---|---|
VRAM Footprint (64K FP16 KV) |
22,398 / 24,576 MiB |
22 GB total on 1x RTX 3090 (65,536 context window + weights + buffers) |
| Short-Context Decode | 145–150 tok/s |
Peak 153.5 tok/s bare-metal decode (MTP K=1) |
Long-Context Decode (12.2K ctx) |
134.8 tok/s |
121.7 tok/s at 11.3K ctx (up from 79.8 tok/s at 10.1K after batched split-K + batch-2 GEMV/HMMA) |
Prompt Prefill (pp512) |
3,093 tok/s |
HMMA Tensor Core prefill (Q5_K, Q6_K, BF16, grouped IQ4_XS/Q5_K MoE) |
| Custom SM86 SASS Audit | 26,641 slots · 0 violations |
Hand-assembled 128-bit Ampere machine code, verified by sass-toolchain |
| Mode | Model | Quant | Context | Prefill | Decode | vs llama.cpp CUDA |
|---|---|---|---|---|---|---|
| Bare-Metal UEFI | Qwen3.5-35B-A3B |
Q4_K_M (20.5 GiB) |
65,536 (FP16 KV) | — | 194–226 tok/s | Zero Linux / zero nvidia.ko |
| Bare-Metal UEFI | Qwen3-0.6B |
Q8_0 |
4,096 | — | 711.3 tok/s | Zero Linux / zero nvidia.ko |
| Linux Static ELF | Qwen3.5-35B-A3B |
Q4_K_M |
65,536 (FP16 KV) | 5,609.5 tok/s (pp512) |
224.55 tok/s (tg64) |
+46.3% decode / +9.8% prefill |
| Linux Static ELF | Qwen3.5-0.8B |
Q8_0 |
8,192+ | 28,935.6 tok/s (pp512) |
696.83 tok/s (tg64) |
+66.8% decode |
flowchart LR
UEFI["UEFI Ring-0 Boot<br/>(loader.asm + BlockIO >4 GiB)"] --> GPU["PCIe BAR0 + VBIOS FWSEC<br/>R610 GSP-RM + GMMU v2 (0xC7C0/0xC7B5)"]
GPU --> SASS["SM86 SASS Engine<br/>(bm_qwen35 + qwen35-moe + PLE + MTP)"]
SASS --> HAL["hal/llm_ops.inc + chat_families.inc"]
HAL --> AGENT["Agent Harness<br/>(/effort + Tool Loop + /reset)"]
AGENT --> TINYC["Tiny C Compiler + 16-Slot RAM-FS<br/>(tiny_c.inc + app_fs.inc)"]
TINYC --> FB["1280x800 Split-Pane GOP FB<br/>(Chat + nvtop HUD + ~22 Hz App Canvas)"]
HAL --> NET["Pure-ASM e1000 TCP/IPv4 (:8080)<br/>(OpenAI SSE + /health + /apps/* + Web UI)"]
Interactive OS Controls, Slash Commands & Model Tools (Verified in 00-engine/baremetal/os/)
| Key | Action |
|---|---|
TAB / Ctrl+W |
Switch focus between Left Chat pane and Right Pane |
F1 |
Switch Right Pane to live nvtop GPU HUD (temp, P-state, PCIe link, VRAM, tok/s sparkline) |
F2 |
Switch Right Pane to RAM-FS App Launcher (Up/Down or j/k + Enter, or 1–9 to run) |
F3 |
Switch Right Pane to active C / Web app (preloaded with built-in sysmon on boot) |
ESC |
Return focus to Left Chat pane |
/effort off|low|high|xhigh·/think— Set native Qwen4 reasoning effort with live violet[THINK]streaming while preserving the live KV cache/reset— Factory reset: clears KV cache, chat log, theme, RAM-FS apps, and Web UI; restores HUD, chat focus,effort=low, andtools=on/clear— Reset KV cache and clear chat log/tools·/apps·/hud·/focus·/stats·/net·/help·/shell·/reboot·/shutdown
inspect_os()— Live theme, GPU telemetry, IP address, active pane/app, and installed appsset_theme({...})— Instant RAM palette update (default,matrix,doom,cyberpunk,amber,solar, or custom colors)app_write(name, code, lang="c"|"web", open=true)·app_read(name)·app_list()·app_run(name)— Atomic Ring-0 C compile & hot-reload (<os.h>canvas464x664) or HTML/JS served atGET /apps/<name>read_web_ui()·patch_web_ui(...)— Live-edit the:8080Ring-0 Web Chat UI in RAM (64 KiBbuffer)
# Build host dependencies (no gcc, clang, libc, or CUDA toolkit needed)
sudo apt-get install nasm binutils dosfstools mtools xorriso python3
git clone https://github.com/alesha-pro/llm.asm.git && cd llm.asm
# Qwen4-35B-A3B (primary GGUF + 11 GiB PLE N-gram shard) -> bootable UEFI ISO:
make -C 00-engine/baremetal iso \
GGUF=/path/to/Qwen4-35B-A3B-UD-IQ4_XS.gguf \
PLE_GGUF=/path/to/Qwen4-35B-A3B-PLE.gguf \
TARGET=nvidia-ga10x \
ISO_OUT=llm-asm-qwen4.iso
# Single-GGUF models (e.g. Qwen3.5-35B-A3B):
make -C 00-engine iso MODEL=/path/to/Qwen3.5-35B-A3B-Q4_K_M.gguf TARGET=nvidia-ga10x OUT=llm-asm-35b.isoWrite the resulting ISO to a USB drive or attach it as a UEFI CD-ROM (q35, OVMF, VFIO GPU passthrough, RAM >= 1.5x total GGUF/PLE size, standard VGA/GOP 1280x800 + optional COM1 serial). Attach an Intel e1000/e1000e NIC (8086:100E, 10D3, 100F, 1004) to expose :8080 (GET /, GET /apps/<name>, GET /health, GET /v1/models, POST /v1/chat/completions) via DHCPv4 with 192.168.1.250/24 fallback.
cd 00-engine
make # Builds asm-llm-gpu, qwen35, multi-arch, asm-llm-server, llm-asm, asm-llm-gpu-os, BOOTX64.EFI
make verify-static # Verifies 0 dynamic libs, 0 libc, non-executable RW stack
make test-cpu # Runs HTTP server, CLI, and scheduler CPU test suites
./bin/llm-asm serve /path/to/model.gguf -- --port 8080make all # Builds Phase 1 (asm-llm, test_math), Phase 2 (asm-llm-os.elf), Phase 3 (asm-gpt-train)Beyond the flagship bare-metal GPU OS, llm.asm spans seven zero-bloat low-level AI systems across bare metal, Ring -1 hypervisors, Linux 6.12 eBPF, and pure x86-64 assembly:
| Module | What It Is | Stack & Size | Verified Highlights |
|---|---|---|---|
00-engine/ |
Bare-Metal GPU OS & Static GPU Engines | Pure x86-64 NASM + SM86/SM89 SASS (BOOTX64_QWEN35.EFI / BOOTX64.EFI) |
Flagship UEFI AI OS (Qwen4-35B-A3B & Qwen3.5-35B-A3B), static Linux /dev/nvidia* engines, llm-asm CLI, epoll HTTP/SSE server, paged/radix scheduler, sass-toolchain, and Ada SM89 unified target |
01-qwen3-inference/ |
Qwen3-0.6B Linux CPU Engine | 33.2 KB (33,248 B) pure x86-64 NASM |
126.8 tok/s peak on EPYC 7642 (40T), +18%..+36% vs llama.cpp CPU, 64/64 PyTorch greedy parity, supports .asmbin v1/v2 (Q8_0) & v4 (Q4_0/Q4_K), optional AVX1=1 fallback |
02-baremetal-os/ |
Bootable SMP CPU Bare-Metal OS | 50 KB (50,668 B) pure x86-64 NASM |
74–94 ms cold boot, 134.9 tok/s KVM (16 vCPUs), Proxmox 0 GB disk (55.4 tok/s), built-in usb2ps2.asm xHCI USB driver, SSE2=1 / AVX1=1 / CHAT_SESSIONS=1..4 builds, os-qwen35 for Qwen3.5-2B |
03-minigpt-train/ |
From-Scratch Mini-GPT Trainer + TUI | 33.9 KB (33,872 B) pure x86-64 NASM |
27,662 tok/s training (24T EPYC 7642), 1.0000000000 gradient cosine across all 21 tensors vs PyTorch CPU, live 80x24 UTF-8 Braille TUI |
04-ring1-kernel-surgeon/ |
Ring -1 AMD SVM Kernel Surgeon |
75.4 KB (75,424 B) NASM + freestanding zero-libc C |
Type-1 hypervisor running MiniCPM5-2B across 24 NPT-isolated LAPIC cores to live-patch Linux Ring-0 #PF/#DE/#UD faults (97.54% pass@1, 0% dangerous) |
05-ebpf-jev/ |
Linux 6.12 eBPF LSM Recurrent Guard |
21.3 KB (21,280 B) INT8 RNN in eBPF C |
5.65 µs median hook latency, 0 floats, 21,457 verified insns, 500/500 0-LSB parity, h[32] across fork/exec, atomic weight hot-swap |
06-zero-app-os/ |
Zero-App Ephemeral CPU OS | 116 KB (119,256 B, 19,363 lines NASM) |
0 preinstalled apps, 0 C, 0 GB disk: MiniCPM5-2B generates x86-64 games (uasm.asm) into a Ring-3 W^X/NX sandbox + Ring-0 #PF/#UD self-healing (ISO & weights) |
shared/ |
Shared x86-64 Assembly Core | 12,323 lines across 14 NASM files |
Reusable math.asm, matmul.asm, matmul_sse2.asm, transformer.asm, tokenizer.asm, pretok.asm, threads.asm, usb2ps2.asm, ctxshift.asm, and syscalls.asm |
scripts/ & tests/ |
Tooling, Exporters & QA Harnesses | Python + Shell + C++ reference | .asmbin exporters, ISO/UEFI image builders, ISA profile checks (check_isa.py), differential parity & benchmark suites |
CPU Benchmarks, Bare-Metal CPU OS Screenshots, Braille TUI & Build Quick Reference
| Threads | llm.asm (FAST_Q8=0) |
llama.cpp (Q8_0) |
llm.asm (FAST_Q8=1) |
vs llama.cpp |
Bare-Metal OS KVM |
|---|---|---|---|---|---|
| 1 | 7.18 tok/s | 16.63 tok/s | 20.70 tok/s | 1.24x (+24.5%) | 23.67 tok/s |
| 4 | 28.12 tok/s | 51.08 tok/s | 69.24 tok/s | 1.36x (+35.6%) | 78.89 tok/s |
| 8 | 53.09 tok/s | 80.79 tok/s | 103.64 tok/s | 1.28x (+28.3%) | 118.08 tok/s |
| 16 | 77.50 tok/s | 103.03 tok/s | 121.86 tok/s | 1.18x (+18.3%) | 134.94 tok/s |
| 40 | 98.50 tok/s | 105.08 tok/s | 125.86 tok/s (peak 126.81) | 1.20x (+19.8%) | — |
Phase 2: QEMU KVM · AMD EPYC 7642 (16 vCPUs) |
Phase 2: Proxmox VE · Intel Xeon E5-2670 v3 (0 GB Disk) |
╭──────────────────────────────────────────────────────────────────────────────╮
│ asm-gpt-train │ 100% Pure x86-64 Assembly (Zero libc, AVX2+FMA) │
│ L=6 D=192 H=6 FF=512 V=65 │ params=2681664 │ B=16 T=128 │ threads=20 │
├──────────────────────────────────────────────────────────────────────────────┤
│ Loss Curve (0..400) ⣿⣿⣿ train ◆ val best_val=1.8399 │
│ 4.34 ┤◆ · · · · · · · · · · · · · · · · · │
│ │⡇ │
│ 3.61 ┤⢱ · · · · · · · · · · · · · · · · · │
│ │ ⢱ │
│ 2.87 ┤· ⠣⣀· · · · · · · · · · · · · · · · · │
│ │ ⠑⠢⠤⣀◆ │
│ 2.14 ┤· · ·⠉⠉⠑⠒⠒⠢⠤⠤◆⠤⣀⣀⣀⡀⣀⣀◆ · · ◆ · · · · · · · · · │
│ │ ⠈ ⠉⠉⠉⠊⠉⠊⠒⠊⠒⠊⠒⠔⠒⠢⠤⠤⠔⠢◆⠤⠤⠤⢄⣀⣀⢄◆⣀⣀⣀⣀⡀⣀⣀⢀◆⡀ ⡀⢀ ⣀◆ │
│ 1.40 ┤· · · · · · · · · · · · · · ⠈ ⠁⠁⠈⠉⠈⠁⠉⠉⠉·⠈ │
│ └step 0 ───────────────────────── 200 ────────────────────────── 400 │
├──────────────────────────────────────────────────────────────────────────────┤
│ Step 400/400 [████████████████████████████] 100% │ elapsed 35.2s │
│ loss=1.6604 val=1.8399 best=1.8399 gnorm=0.53 lr=0.000200 25470 tok/s │
╰──────────────────────────────────────────────────────────────────────────────╯
- 01 · Qwen3 CPU Inference:
python3 scripts/export_weights.py --model-dir models/qwen3-0.6b-bf16 --out models/qwen3-0.6b-q8_0.asmbin --scale-dtype fp16 && ./build/asm-llm -m models/qwen3-0.6b-q8_0.asmbin --chat -t 16→ 01-qwen3-inference/README.md - 02 · Bare-Metal CPU OS:
make os-run MODEL=models/qwen3-0.6b-q8_0.asmbin SMP=16(make os-isofor hybrid BIOS+UEFI USB ISO;make os-qwen35for Qwen3.5-2B;make BUILD=build-sse2 SSE2=1 osfor SSE2 baseline) → 02-baremetal-os/README.md - 03 · Mini-GPT Trainer:
./build/asm-gpt-train --data data/tinyshakespeare.txt --steps 400 --seq 128 -t 16 --save checkpoints/shakespeare.ckpt→ 03-minigpt-train/README.md - 04 · Ring
-1Kernel Surgeon:cd 04-ring1-kernel-surgeon && make hv && python3 verifier/kvm_verifier.py --selftest→ 04-ring1-kernel-surgeon/README.md - 05 · Linux
6.12eBPF LSM:cd 05-ebpf-jev && bash testbed/build.sh && testbed/run_vm.sh verify→ 05-ebpf-jev/README.md - 06 · Zero-App Ephemeral OS:
cd 06-zero-app-os && make && make iso→ 06-zero-app-os/README.md
Built on llm.asm:
ringzero— Rustno_stdLimine OS running thellm.asmengine in ring 0.jpr5/llm.asm— AArch64 Linux port of Phase 01 in pure A64 assembly (AWS Graviton, Apple silicon), byte-identical to the x86 engine in its exact mode, plus an HTTP front end and amd64/arm64 container images.sapotero/llm.asm-macos— native macOS (Apple silicon) port of Phase 01 in AArch64 assembly.sidx04/llm.asm(riscvbranch) — RISC-V (RV64GC, LP64D) Linux port of Phase 01 in pure riscv64 assembly, built on the AArch64 port above.pochi111222/llm.asm-extended— UEFI-native bare-metal OS based onllm.asm, with 64-bit memory management above 4 GiB and 1-4 core inference.
Want to port llm.asm to a new GPU (RTX 4090 sm89, RTX 5090 sm120, AMD RDNA3, Intel Arc)? Start with 00-engine/PORTING_GPU.md and 00-engine/PORTING_SM89.md. Building an external port, language binding, or downstream OS? Host it in your own repository and open an issue or PR with a link to list it here.
We keep main strictly focused on zero-bloat x86-64 assembly, hand-assembled GPU SASS, bare-metal OSes, hypervisors, and in-kernel ML with hard numerical verification. Read CONTRIBUTING.md before opening a PR.
License: MIT



