{"slug": "54-faster-llm-token-generation-by-removing-the-linux-os-and-llama-cpp", "title": "54% faster LLM token generation by removing the Linux OS and llama.cpp", "summary": "A from-scratch 24,252-byte Multiboot OS written in pure x86-64 assembly, with no Linux, C, Rust or libc, runs Qwen3-0.6B up to 54% faster than native Linux llama.cpp on the same AMD EPYC 7642, the project's author reports. The bare-metal build hit 78.89 tok/s at 4 threads versus llama.cpp's 51.08, 118.08 vs 80.79 at 8 threads, and 134.94 vs 103.03 at 16 threads (136.6 peak), while a 14.7 KB Linux ELF build using INT8xINT8 AVX2+F16C beat llama.cpp by 18% to 36% from 1 to 40 threads. The OS boots in 74 to 94 ms into 64-bit Long Mode, maps the 614 MiB Q8_0 weights directly from physical RAM, and produces output that stays bit-exact across thread counts and matches all 64 greedy tokens against PyTorch FP32 at 0.99965 cosine.", "body_md": "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.\nThe entire Multiboot OS binary (asm-llm-os.elf) is 24,252 bytes, written from scratch without Linux, Windows, C, Rust, or libc. It boots in 74 to 94 ms straight into 64-bit Long Mode, wakes every CPU core over APIC, maps the 614 MiB Q8_0 weights directly from physical RAM, and drops you into a live multi-turn KV-cache chat over VGA, PS/2 keyboard, and serial.\nI ran head-to-head CPU benchmarks against llama.cpp (Q8_0, -ngl 0) on the same AMD EPYC 7642:\n- 1 thread hits 23.67 tok/s vs 16.63 (+42%)\n- 4 threads hit 78.89 tok/s vs 51.08 (+54%)\n- 8 threads hit 118.08 tok/s vs 80.79 (+46%)\n- 16 threads hit 134.94 tok/s vs 103.03 (+31%, 136.6 peak)\nOn a diskless 0 GB Proxmox VM (2014 12-core Intel Xeon E5-2670 v3, 2 GiB RAM), it boots straight to the prompt in under 5 seconds (95 ms kernel boot) and runs live out of RAM at 78 tok/s decode and up to 111.5 tok/s prefill, with a hybrid BIOS+UEFI ISO builder included too. Output stays bit-exact across thread counts and matches all 64 greedy tokens against PyTorch FP32 (0.99965 cosine).\nThe 14.7 KB Linux ELF build (FAST_Q8=1 INT8xINT8 AVX2+F16C) also beats llama.cpp by 18% to 36% from 1 to 40 threads, and booting bare metal with 2 MiB huge pages squeezes out another 10% on top.\nRepo, ISO builder, and Proxmox setup guide are in the reply below.", "url": "https://wpnews.pro/news/54-faster-llm-token-generation-by-removing-the-linux-os-and-llama-cpp", "canonical_source": "https://twitter.com/superalesha/status/2125682626056839259", "published_at": "2026-11-28 05:30:51+00:00", "updated_at": "2026-11-28 05:42:14.526139+00:00", "lang": "en", "topics": ["large-language-models", "ai-infrastructure", "machine-learning", "ai-research"], "entities": ["Qwen3-0.6B", "llama.cpp", "AMD EPYC 7642", "Intel Xeon E5-2670 v3", "Proxmox", "PyTorch"], "also_reported_by": [], "takeaway": "Stripping the OS and llama.cpp runtime for a 24 KB bare-metal assembly kernel lifted Qwen3-0.6B Q8_0 decode from 51.08 to 78.89 tok/s at 4 threads (+54%) on an AMD EPYC 7642, with 2 MiB huge pages adding another 10%.", "recommendation": {"advice": "When serving small models on CPU, cut runtime and OS overhead and map quantized weights directly from physical RAM with 2 MiB huge pages; the source measured up to 54% higher decode throughput than llama.cpp.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/54-faster-llm-token-generation-by-removing-the-linux-os-and-llama-cpp", "markdown": "https://wpnews.pro/news/54-faster-llm-token-generation-by-removing-the-linux-os-and-llama-cpp.md", "text": "https://wpnews.pro/news/54-faster-llm-token-generation-by-removing-the-linux-os-and-llama-cpp.txt", "jsonld": "https://wpnews.pro/news/54-faster-llm-token-generation-by-removing-the-linux-os-and-llama-cpp.jsonld"}}