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.
docs: sync exact binary sizes, auto thread default, and clean typography
Alexey Fateev47808f68ed9b
diff --git a/01-qwen3-inference/README.md b/01-qwen3-inference/README.mdindex 4c9c446..bf413e3 100644--- a/01-qwen3-inference/README.md+++ b/01-qwen3-inference/README.md@@ -1,12 +1,12 @@-# Phase 1: Qwen3-0.6B Inference in a 14 KB Pure x86-64 ELF+# Phase 1: Qwen3-0.6B Inference in a 15 KB Pure x86-64 ELFA complete inference engine for **Qwen/Qwen3-0.6B** written in **100% pure x86-64 NASM assembly** for Linux.-- **14,712 bytes** stripped static ELF executable (`FAST_Q8=1`, default) or **14,008 bytes** (`FAST_Q8=0`, legacy FP32-activation mode).+- **15,064 bytes** stripped static ELF executable (`FAST_Q8=1`, default: `.text` = 12,401 B, `.rodata` = 2,041 B, `.bss` = 27,408 B) or **14,360 bytes** (`FAST_Q8=0`, legacy FP32-activation mode).- **Zero runtime dependencies:** no `gcc`, no `libc`, no `libm`, no dynamic linker, no `.so` files.- **Full Qwen3 architecture:** GQA (`16Q / 8KV`, `head_dim = 128`), per-head QK-Norm (`RMSNorm` on Q and K before RoPE), split-half NeoX RoPE (`rope_theta = 1e6`), SwiGLU MLP, tied embeddings / LM head, persistent multi-turn KV-cache (`--chat`), greedy and temperature/top-p sampling.- **Built-in BPE tokenizer in assembly:** Fibonacci-hashed open-addressing merge table (`524,288` slots, 100% token-exact match with HuggingFace `AutoTokenizer`), UTF-8 prompt encoding (English, Cyrillic, code, numbers), Qwen3 chat template (default no-think and `--think` reasoning mode), and raw `write()` streaming to stdout.-- **`FAST_Q8=1` INT8xINT8 AVX2 + F16C engine + zero-libc thread pool:** quantizes activations to Q8_0 once per matmul, runs a 1-row sequential 4-block (`128B`) `vpabsb`+`vpsignb`+`vpmaddubsw`+`vpmaddwd` kernel with monotonic next-row prefetch, auto-detects `.asmbin` v2 FP16 scales (`vcvtph2ps`) and legacy v1 FP32 scales, runs parallel GQA attention over a contiguous head-major KV-cache, and synchronizes workers via a hybrid spin-then-futex lock-free thread pool (`0%` idle CPU in `--chat`). **126.8 tok/s** peak decode (**20.7 tok/s** 1T) on AMD EPYC 7642 — **+18% to +36% faster than `llama.cpp` CPU (`Q8_0`) across `1..40T`**, bit-exact across all thread counts.+- **`FAST_Q8=1` INT8xINT8 AVX2 + F16C engine + zero-libc thread pool:** quantizes activations to Q8_0 once per matmul, runs a 1-row sequential 4-block (`128B`) `vpabsb`+`vpsignb`+`vpmaddubsw`+`vpmaddwd` kernel with monotonic next-row prefetch, auto-detects `.asmbin` v2 FP16 scales (`vcvtph2ps`) and legacy v1 FP32 scales, runs parallel GQA attention over a contiguous head-major KV-cache, and synchronizes workers via a hybrid spin-then-futex lock-free thread pool (`0%` idle CPU in `--chat`). **126.8 tok/s** peak decode (**20.7 tok/s** 1T) on AMD EPYC 7642, **+18% to +36% faster than `llama.cpp` CPU (`Q8_0`) across `1..40T`**, bit-exact across all thread counts.---@@ -44,7 +44,7 @@ hf download Qwen/Qwen3-0.6B \Convert the BF16 safetensors and `tokenizer.json` into a single 64-byte aligned, directly `mmap()`-able `.asmbin` file:```bash-# Compact v2 format with IEEE-754 FP16 block scales (default, 613.66 MiB — saves ~35.5 MiB/tok RAM bandwidth)+# Compact v2 format with IEEE-754 FP16 block scales (default, 613.66 MiB - saves ~35.5 MiB/tok RAM bandwidth)python3 scripts/export_weights.py \--model-dir models/qwen3-0.6b-bf16 \--out models/qwen3-0.6b-q8_0.asmbin \@@ -59,23 +59,23 @@ python3 scripts/export_weights.py \Both formats are auto-detected at load time (`model_init`) by `HDR_VERSION` / `HDR_FLAGS` in both `FAST_Q8=1` and `FAST_Q8=0` builds.-### 3. Build the 14 KB Pure x86-64 Binary+### 3. Build the 15 KB Pure x86-64 BinaryFrom the repository root, choose the compile-time `FAST_Q8` mode (`FAST_Q8=1` is the default):```bash-# Default fast path: INT8xINT8 AVX2+F16C matmul + parallel GQA attention + contiguous KV-cache (14,712 B)+# Default fast path: INT8xINT8 AVX2+F16C matmul + parallel GQA attention + contiguous KV-cache (15,064 B)make inference test-math FAST_Q8=1make check-# Legacy reference path: exact Q8_0 x FP32 activations (14,008 B)+# Legacy reference path: exact Q8_0 x FP32 activations (14,360 B)make inference test-math FAST_Q8=0```Expected ELF inspection output (`FAST_Q8=1`):```text--rwxr-xr-x 1 user user 14712 build/asm-llm+-rwxr-xr-x 1 user user 15064 build/asm-llmbuild/asm-llm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, strippedThere is no dynamic section in this file.```@@ -104,7 +104,7 @@ There is no dynamic section in this file.-p "Объясни в двух предложениях, как работает стек вызовов в процессоре." -n 128 -t 16```-> **Note — `<think>` blocks stay in chat history (known deviation, #12):**+> **Note: `<think>` blocks stay in chat history (known deviation, #12):**> In `--chat`, the KV cache is append-only, so the prompt tokens of each> assistant turn stay in the history of every later turn. In no-think mode> that includes the empty `<think>\n\n</think>\n\n` block that the Qwen3@@ -127,7 +127,7 @@ There is no dynamic section in this file.| `-m <path>` | *(required)* | Path to `.asmbin` weight file || `-p <text>` | built-in | User prompt (UTF-8) || `-n <int>` | `128` | Maximum generated tokens |-| `-t <int>` | `32` | Worker thread count (`clone()` + `futex()` pool). The default does not adapt to the CPU: on a machine with fewer than 32 hardware threads, pass `-t` explicitly, at or below `nproc` (lower while other CPU-heavy jobs run). Oversubscribed runs have been reported to slow down by more than 20x (#9, #10) |+| `-t <int>` | `auto` | Worker thread count (`clone()` + `futex()` pool). Defaults to `min(32, max(1, avail_cpus - 1))` via `sched_getaffinity` (leaving 1 headroom core on multi-core hosts), with adaptive spin-then-futex/`sched_yield` contention backoff (#9, #10, #38) || `-c <int>` | `2048` | KV-cache context length || `--chat` | off | Interactive multi-turn chat via raw Linux `read(0)`/`write(1)` syscalls; preserves KV-cache across turns, supports `/clear` (`/new`, `/reset`), `/think`, `/nothink`, `/quit` (`/exit`, Ctrl-D), and prints `ctx=X/2048` || `--think` | off | Enable Qwen3 `<think>...</think>` reasoning mode |@@ -150,7 +150,7 @@ Designed for zero-copy `mmap()` with **64-byte alignment** for every section, ma- **Tokenizer section (~9.5 MiB):** `byte_to_tok[256]`, `tok_offsets[vocab_size+1]`, raw UTF-8 `tok_bytes` pool (`976,309` B), and a pre-built `524,288`-slot open-addressing merge table (`151,387` merges, load factor `0.289`, avg probe `1.20`).- **Tied Embeddings / LM Head (`[151936, 1024]` Q8_0):** verified bit-identical in BF16 (`max_diff = 0.0`), stored once (`157.65 MiB` in v2 / `166.92 MiB` in v1).- **28 Transformer Layers (`stride = 16,720,896 B` v2 / `17,703,936 B` v1):** 4 FP32 norm vectors (`input_layernorm`, `q_norm`, `k_norm`, `post_attention_layernorm`) followed by 7 per-row split Q8_0 matrices (`q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`). Contiguous layout allows fused QKV (`[4096, 1024]`) and gate+up (`[6144, 1024]`) matmuls in a single thread-pool barrier.-- **Per-row split Q8_0:** each row of `K` weights stores `[K int8 in -127..127][K/32 scales]`. For `K in {1024, 2048, 3072}`, row strides are `{1088, 2176, 3264}` B in v2 (`--scale-dtype fp16`) and `{1152, 2304, 3456}` B in v1 (`--scale-dtype fp32`) — all exact multiples of 64 bytes.+- **Per-row split Q8_0:** each row of `K` weights stores `[K int8 in -127..127][K/32 scales]`. For `K in {1024, 2048, 3072}`, row strides are `{1088, 2176, 3264}` B in v2 (`--scale-dtype fp16`) and `{1152, 2304, 3456}` B in v1 (`--scale-dtype fp32`), all exact multiples of 64 bytes.- **Total size:** `643,469,504` bytes (`613.66 MiB`) in v2 (`680,718,528` B / `649.18 MiB` in v1) vs `1.40 GiB` BF16 safetensors.---@@ -234,7 +234,7 @@ Head-to-head decode comparison on **AMD EPYC 7642** (47C online, 256 MiB L3, DDR**3. Russian UTF-8 (native UTF-8 BPE encode and stdout decode in assembly):**> *Prompt:* `Объясни в двух предложениях, как работает стек вызовов в процессоре.`> *Output (149.49 tok/s prefill, 96.09 tok/s decode):*-> Стек вызовов — это линейная последовательность вызовов, в которой каждый вызов ссылается на предыдущий, создавая цепочку выполнения. Он позволяет процессору эффективно обрабатывать задачи, обеспечивая стабильность и оптимизацию выполнения.+> Стек вызовов - это линейная последовательность вызовов, в которой каждый вызов ссылается на предыдущий, создавая цепочку выполнения. Он позволяет процессору эффективно обрабатывать задачи, обеспечивая стабильность и оптимизацию выполнения.**4. Reasoning mode (`--think`):**> *Prompt:* `What is 17 * 23?`diff --git a/02-baremetal-os/README.md b/02-baremetal-os/README.mdindex 8e8b6f9..ab9ec35 100644--- a/02-baremetal-os/README.md+++ b/02-baremetal-os/README.md@@ -1,8 +1,8 @@-# Phase 2: Bare-Metal Bootable Qwen3-0.6B OS in 24 KB of Pure Assembly+# Phase 2: Bare-Metal Bootable Qwen3-0.6B OS in 25 KB of Pure AssemblyA standalone bootable x86-64 operating system that runs **Qwen/Qwen3-0.6B** directly on hardware or KVM with **no Linux, no Windows, no C, no Rust, and no libc**.-- **24,508 bytes** stripped static Multiboot 1 kernel (`FAST_Q8=1`, default: `.text` = 17,367 B, `.rodata` = 2,772 B, `.bss` = 2.1 MiB `NOBITS`, zero dynamic dependencies), or **23,612 bytes** (`FAST_Q8=0`, legacy Q8_0xFP32).+- **25,404 bytes** stripped static Multiboot 1 kernel (`FAST_Q8=1`, default: `.text` = 18,151 B, `.rodata` = 2,900 B, `.bss` = 2.1 MiB `NOBITS`, zero dynamic dependencies), or **24,764 bytes** (`FAST_Q8=0`, legacy Q8_0xFP32).- **74–94 ms cold boot** to interactive `asm-llm>` multi-turn chat with persistent KV-cache across turns, all SMP cores online, and the `.asmbin` v2 (`614 MiB` FP16 scales) or v1 (`649 MiB` FP32 scales) model bound zero-copy from physical RAM on 2 MiB huge pages.- **100% token-exact and byte-for-byte parity** with [Phase 1](../01-qwen3-inference/) across `1..32` vCPUs.- **134.9 tok/s** decode on QEMU KVM (AMD EPYC 7642, 16 vCPUs; **23.7 tok/s** at 1 vCPU, **118.1 tok/s** at 8 vCPUs, **136.6 tok/s** peak) and **55.4 tok/s** live on a **0 GB disk Proxmox VE VM** (Intel Xeon E5-2670 v3, 12 cores).@@ -42,7 +42,7 @@ make os-checkExpected output (`FAST_Q8=1`):```text--rwxr-xr-x 1 user user 24508 build/asm-llm-os.elf+-rwxr-xr-x 1 user user 25404 build/asm-llm-os.elfbuild/asm-llm-os.elf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, strippedThere is no dynamic section in this file.```@@ -88,7 +88,7 @@ qemu-system-x86_64 -enable-kvm -cpu host -m 2G -smp 16 \### Option B: Bootable Hybrid BIOS+UEFI ISO-Packages the 23 KB kernel, GRUB2 Multiboot 1 config, and the 649 MiB `.asmbin` model into a single self-contained `~661 MiB` bootable ISO (`build/asm-llm-os.iso`):+Packages the 25 KB kernel, GRUB2 Multiboot 1 config, and the 649 MiB `.asmbin` model into a single self-contained `~661 MiB` bootable ISO (`build/asm-llm-os.iso`):```bashmake os-iso MODEL=models/qwen3-0.6b-q8_0.asmbindiff --git a/03-minigpt-train/README.md b/03-minigpt-train/README.mdindex 9905ebb..8488fcd 100644--- a/03-minigpt-train/README.md+++ b/03-minigpt-train/README.md@@ -1,8 +1,8 @@-# Phase 3: From-Scratch Mini-GPT Training & Inference in a 32 KB Pure x86-64 ELF+# Phase 3: From-Scratch Mini-GPT Training & Inference in a 33 KB Pure x86-64 ELFA complete Transformer training and autoregressive inference engine written in **100% pure x86-64 NASM assembly**. **Zero Python, zero C, zero libc, zero libm, and zero runtime dependencies** are needed to train a language model from scratch and generate text from it.-- **33,128 bytes (`32.4 KiB`)** stripped static Linux x86-64 ELF (`.text` = 28,218 B, `.rodata` = 4,297 B, `.bss` = 173,568 B `NOBITS`, zero dynamic libraries).+- **33,872 bytes (`33.1 KiB`)** stripped static Linux x86-64 ELF (`.text` = 28,945 B, `.rodata` = 4,299 B, `.bss` = 173,568 B `NOBITS`, zero dynamic libraries).- **Modern Llama/GPT FP32 architecture:** auto-discovered character vocabulary, pre-norm RMSNorm, split-half RoPE (FP64-precomputed cos/sin tables), Causal Multi-Head Self-Attention, SwiGLU MLP, untied `tok_emb` and `lm_head`, and numerically stable Cross-Entropy Loss.- **Hand-written `6x16` AVX2+FMA FP32 SGEMM:** 12 YMM accumulators, zero stack traffic in the inner `k`-loop, supporting `NN`, `TN`, and `NT` layouts with disjoint tile parallelism over our zero-libc `clone()` + `futex()` thread pool (**bit-exact** across `1T..24T`).- **Full analytical backward pass + decoupled AdamW:** verified per-tensor against PyTorch CPU across all **21 parameter tensors** (`worst max_abs_diff = 3.35e-8`, `min cosine_sim = 1.0000000000`), global L2 gradient clipping, linear warmup + cosine LR decay, and `.gptckpt` binary checkpoints.@@ -35,7 +35,7 @@ curl -fsSL https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinys-o data/tinyshakespeare.txt```-### 2. Build & Inspect the 32 KB Binary+### 2. Build & Inspect the 33 KB BinaryFrom the repository root:@@ -47,7 +47,7 @@ make train-checkExpected ELF inspection output:```text--rwxr-xr-x 1 user user 33128 build/asm-gpt-train+-rwxr-xr-x 1 user user 33872 build/asm-gpt-trainbuild/asm-gpt-train: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, strippedThere is no dynamic section in this file.```@@ -163,7 +163,7 @@ Captured from a real PTY (exact 80x24 cells, rendered via a single buffered `wri| `--grad-clip <float>` | `1.0` | Global L2 gradient norm clipping threshold (`0` disables) || `--warmup <int>` | `min(100, steps/10)` | Linear LR warmup steps || `--seed <uint>` | `42` | Deterministic PRNG seed (`xorshift64*` + Box-Muller init) |-| `-t <int>` | `16` | Worker thread count |+| `-t <int>` | `auto` | Worker thread count (defaults to `min(16, max(1, avail_cpus - 1))` via `sched_getaffinity`) || `--tui` / `--plain` | auto | Force live 80x24 Braille TUI or plain stdout logs (`ioctl` auto-detects TTY) || `--log-every <int>` | `50` | Plain-mode logging interval || `--eval-every <int>` | `100` | Validation evaluation interval (`0` disables) |diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex f256acd..82dbce7 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -1,6 +1,6 @@# Contributing to llm.asm-Thank you for checking out **llm.asm**! This repository explores how far extreme low-level AI can go without runtime bloat—tens of kilobytes, zero libc, deterministic math, and hard hardware verification.+Thank you for checking out **llm.asm**! This repository explores how far extreme low-level AI can go without runtime bloat: tens of kilobytes, zero libc, deterministic math, and hard hardware verification.To keep `main` focused and maintainable, please review our scope and pull request guidelines before contributing.@@ -20,7 +20,7 @@ PRs that directly strengthen the existing phases and core ethos are welcome:- **Bug fixes & safety:** Bounds checks, argument parsing safety, ELF/Multiboot/NPT edge cases, register/ABI preservation, and crash or leak fixes.- **Docs & size accuracy:** Fixing broken commands, clarifying reproduction steps, and keeping binary sizes and benchmark numbers strictly factual.- **Pure x86-64 NASM optimizations & ISA fallbacks:** Faster AVX2/FMA/F16C kernels, clean fallback paths (e.g., AVX1) that preserve `FAST_Q8=1|0` and bit-exactness, and compact zero-dependency kernel or model work.-- **Unified bare-metal boot & hardware fixes:** Real-hardware ACPI/APIC, VGA/serial, and loader fixes—please check open PRs first so we do not duplicate loaders.+- **Unified bare-metal boot & hardware fixes:** Real-hardware ACPI/APIC, VGA/serial, and loader fixes - please check open PRs first so we do not duplicate loaders.- **CI & automated verification:** Clean scripts and CI workflows covering `make all`, `make check-all`, and existing parity harnesses.## What Belongs in Your Own Fork / Repo (Out of Scope for `main`)diff --git a/README.md b/README.mdindex 534b18b..0970bd8 100644--- a/README.md+++ b/README.md@@ -2,7 +2,7 @@# llm.asm-**AI where it doesn't belong — bare metal, Ring `-1` hypervisors, and Linux kernel eBPF.**+**AI where it doesn't belong: bare metal, Ring `-1` hypervisors, and Linux kernel eBPF.***Zero libc. Zero runtime dependencies. Tens of kilobytes.*[Projects](#projects) · [Benchmarks](#benchmarks) · [Proof](#proof) · [Quick Start](#quick-start) · [Ecosystem](#ecosystem) · [Contributing](#contributing) · [MIT License](LICENSE)@@ -15,9 +15,9 @@| Phase | Target | Size | Stack | Headline Result ||---|---|---:|---|---|-| [`01`](01-qwen3-inference/) | [`01-qwen3-inference/`](01-qwen3-inference/) · `Qwen3-0.6B` static ELF | **14.7 KB** (`14,712 B`) | Pure x86-64 NASM | `126.8 tok/s` (40T), `+18%..+36%` vs `llama.cpp` CPU, `64/64` PyTorch parity |-| [`02`](02-baremetal-os/) | [`02-baremetal-os/`](02-baremetal-os/) · Bootable Bare-Metal OS | **24.5 KB** (`24,508 B`) | Pure x86-64 NASM | `74–94 ms` boot, `134.9 tok/s` KVM (16 vCPU), Proxmox `0 GB` disk (`55.4 tok/s`) |-| [`03`](03-minigpt-train/) | [`03-minigpt-train/`](03-minigpt-train/) · Mini-GPT Trainer + TUI | **33.1 KB** (`33,128 B`) | Pure x86-64 NASM | `27,662 tok/s`, `1.0000000000` grad cosine vs PyTorch, `80x24` Braille UI |+| [`01`](01-qwen3-inference/) | [`01-qwen3-inference/`](01-qwen3-inference/) · `Qwen3-0.6B` static ELF | **15.1 KB** (`15,064 B`) | Pure x86-64 NASM | `126.8 tok/s` (40T), `+18%..+36%` vs `llama.cpp` CPU, `64/64` PyTorch parity |+| [`02`](02-baremetal-os/) | [`02-baremetal-os/`](02-baremetal-os/) · Bootable Bare-Metal OS | **25.4 KB** (`25,404 B`) | Pure x86-64 NASM | `74–94 ms` boot, `134.9 tok/s` KVM (16 vCPU), Proxmox `0 GB` disk (`55.4 tok/s`) |+| [`03`](03-minigpt-train/) | [`03-minigpt-train/`](03-minigpt-train/) · Mini-GPT Trainer + TUI | **33.9 KB** (`33,872 B`) | Pure x86-64 NASM | `27,662 tok/s`, `1.0000000000` grad cosine vs PyTorch, `80x24` Braille UI || [`04`](04-ring1-kernel-surgeon/) | [`04-ring1-kernel-surgeon/`](04-ring1-kernel-surgeon/) · Ring `-1` SVM Hypervisor | **75.4 KB** (`75,424 B`) | NASM + zero-libc C | MiniCPM5-2B live kernel crash patcher, `97.54%` pass@1 (`119/122`), `0%` dangerous || [`05`](05-ebpf-jev/) | [`05-ebpf-jev/`](05-ebpf-jev/) · Linux `6.12` eBPF LSM | **21.3 KB** (`21,280 B`) | eBPF C + INT8 RNN | `5.65 µs` median hook, `0` floats, `500/500` `0-LSB` parity, atomic hot-swap |@@ -25,9 +25,9 @@## Benchmarks-**`Qwen3-0.6B Q8_0` CPU Decode** — AMD EPYC 7642 (47C online, CPU-only `-ngl 0`, `.asmbin` v2 `613.66 MiB` vs GGUF `604.15 MiB`, `pp34 / tg64`, 3-run avg):+**`Qwen3-0.6B Q8_0` CPU Decode** - AMD EPYC 7642 (47C online, CPU-only `-ngl 0`, `.asmbin` v2 `613.66 MiB` vs GGUF `604.15 MiB`, `pp34 / tg64`, 3-run avg):-| Threads | `llm.asm` (`FAST_Q8=0`) | `llama.cpp` (`Q8_0`) | **`llm.asm` (`FAST_Q8=1`, 14.7 KB)** | **vs `llama.cpp`** | **Bare-Metal OS KVM** |+| Threads | `llm.asm` (`FAST_Q8=0`) | `llama.cpp` (`Q8_0`) | **`llm.asm` (`FAST_Q8=1`, 15.1 KB)** | **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** |@@ -35,7 +35,7 @@| **16** | 77.50 tok/s | 103.03 tok/s | **121.86 tok/s** | **1.18x (+18.3%)** | **134.94 tok/s** || **24** | 91.88 tok/s | 104.11 tok/s | **123.72 tok/s** | **1.19x (+18.8%)** | **132.90 tok/s** || **32** | 96.63 tok/s | 103.82 tok/s | **122.51 tok/s** | **1.18x (+18.0%)** | **133.75 tok/s** |-| **40** | 98.50 tok/s | 105.08 tok/s | **125.86 tok/s** *(peak 126.81)* | **1.20x (+19.8%)** | — |+| **40** | 98.50 tok/s | 105.08 tok/s | **125.86 tok/s** *(peak 126.81)* | **1.20x (+19.8%)** | - |<sub>`FAST_Q8=1` uses an INT8xINT8 AVX2+F16C kernel (`vpmaddubsw`/`vpmaddwd`, `.asmbin` v2 FP16 block scales via `vcvtph2ps`), contiguous head-major KV-cache, and parallel GQA; Bare-Metal OS gains another ~10% from 2 MiB huge-page identity mapping (bit-exact across all thread counts).</sub>@@ -99,9 +99,9 @@ git clone https://github.com/alesha-pro/llm.asm.git && cd llm.asmmake all # Builds Phase 1 (asm-llm, test_math), Phase 2 (asm-llm-os.elf), Phase 3 (asm-gpt-train)```-- **01 · Qwen3 Inference (`14.7 KB`):** `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](01-qwen3-inference/README.md)-- **02 · Bare-Metal OS (`24.5 KB`):** `make os-run MODEL=models/qwen3-0.6b-q8_0.asmbin SMP=16` *(or `make os-iso` for BIOS+UEFI ISO)* → [02-baremetal-os/README.md](02-baremetal-os/README.md)-- **03 · Mini-GPT Trainer (`33.1 KB`):** `./build/asm-gpt-train --data data/tinyshakespeare.txt --steps 400 --seq 128 -t 16 --save checkpoints/shakespeare.ckpt` → [03-minigpt-train/README.md](03-minigpt-train/README.md)+- **01 · Qwen3 Inference (`15.1 KB`):** `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](01-qwen3-inference/README.md)+- **02 · Bare-Metal OS (`25.4 KB`):** `make os-run MODEL=models/qwen3-0.6b-q8_0.asmbin SMP=16` *(or `make os-iso` for BIOS+UEFI ISO)* → [02-baremetal-os/README.md](02-baremetal-os/README.md)+- **03 · Mini-GPT Trainer (`33.9 KB`):** `./build/asm-gpt-train --data data/tinyshakespeare.txt --steps 400 --seq 128 -t 16 --save checkpoints/shakespeare.ckpt` → [03-minigpt-train/README.md](03-minigpt-train/README.md)- **04 · Ring `-1` Kernel Surgeon (`75.4 KB`):** `cd 04-ring1-kernel-surgeon && make hv && python3 verifier/kvm_verifier.py --selftest` → [04-ring1-kernel-surgeon/README.md](04-ring1-kernel-surgeon/README.md)- **05 · Linux `6.12` eBPF LSM (`21.3 KB`):** `cd 05-ebpf-jev && bash testbed/build.sh && testbed/run_vm.sh verify` → [05-ebpf-jev/README.md](05-ebpf-jev/README.md)@@ -124,7 +124,7 @@ make all # Builds Phase 1 (asm-llm, test_math), Phase 2 (asm-llm-os.elf), Phas## Ecosystem**Built on `llm.asm`:**-- [`ringzero`](https://github.com/tcsenpai/ringzero) — Rust `no_std` Limine OS running the `llm.asm` engine in ring 0.+- [`ringzero`](https://github.com/tcsenpai/ringzero) - Rust `no_std` Limine OS running the `llm.asm` engine in ring 0.Building an external port, language binding, or downstream OS on `llm.asm`? Host it in your own repository and open an issue or PR with a link so we can list it here.