alesha-pro/llm.asmRun Qwen3-0.6B inference, boot a bare-metal OS, and train Mini-GPT in pure x86-64 NASM assembly.
──────────────
⭐ 2 225 stars · 🍴 338 forks
💻 Assembly · 📜 MIT · 🟢 commit today
You are staring at a bloated software dependency tree just to run a small inference model, wondering why a simple task requires megabytes of runtime overhead.
Standard inference stacks drag in gigabytes of libraries, complex toolchains, and abstraction layers that obscure hardware execution details and bloat binary sizes.
This project strips away every abstraction layer, implementing the entire model lifecycle in pure assembly while matching or exceeding conventional CPU decode speeds.
🧭 How it works
This repository implements complete machine learning workflows directly in x86-64 assembly language using NASM. It bypasses conventional runtimes, C libraries, and interpreters by implementing custom AVX2 kernels, tokenizers, thread pools, and training logic from scratch.
The code compiles down to tiny static binaries that execute directly on Linux or boot straight onto bare metal.
✨ Key features
▸ Assemble a Qwen3-0.6B inference engine in a 14 KB static Linux ELF binary
▸ Boot a 24 KB bare-metal OS running Qwen3-0.6B with zero disk requirements
▸ Train a Mini-GPT model from scratch with a live 80x24 Braille TUI in a 32 KB binary
▸ Execute AVX2, FMA, and F16C accelerated GEMM/GEMV math kernels without external libraries
▸ Run multi-turn chat sessions utilizing a custom contiguous head-major KV cache
⚡ Quick start
git clone https://github.com/alesha-pro/llm.asm.git && cd llm.asm && make all🎯 Who should try it
Systems programmers and low-level engineers interested in bare-metal architecture and custom assembly optimization.
📌 Why it matters now
The proliferation of compact language models makes it feasible to implement complete transformer inference and training loops entirely in low-level code without massive frameworks.
✅ Verdict
An extraordinary tour de force for systems hackers and assembly enthusiasts, though obviously impractical for production application development.
──────────────
💬 Your take?
Would you ever drop down to assembly to optimize model inference speed?
🔖 Save it for later — and drop your use case in the comments.
🔗 GitHub repository
📖 Full breakdown
📣 @GitHub_Open_Source — daily open-source picks
========================================
#opensource #assembly #devtools #llm

