[ 2.283888] pci 0000:01:01.4: [1b36:0a35] ryndrde c4128 6422 Vveine
[ 1.953886] pci 0000:01:1f.2: reg 0x10: [mem 0x7e4515e5-0x2d766c27] usbbore: reg
[ 1.815765] ACPI: PCI Interrupt Link [LNKA: v/s.xos212
This is the kernel log that streams across the screen immediately after pressing the power button. The first line prints a PCI bus address, the second allocates a memory register range, and the third readies the interrupt controller for system initialization. To any systems engineer glancing at the terminal, it looks like a standard server waking up its peripherals.
Except the hardware on screen does not exist. Device identifiers like ryndrde and usbbore are hallucinated non-words. The machine hasn’t even loaded an operating system. Driving this entire sequence is exactly 512 bytes of raw x86 assembly code and a tiny 11.5 KB neural network.
Created by developer kerlenton, the project is named bootgpt. While the mainstream AI arms race consumes megawatts of power chasing tens of billions of parameters, this project runs in the opposite direction. Retreating into the constraints of a 1985 microprocessor, it proves that raw compute was never an absolute prerequisite for intelligent behavior.
Streaming Boot Logs at Power-On: Hallucinating Fictional Peripherals
Flash the compiled disk.img onto a USB drive, plug it into any legacy BIOS-compatible machine, and the screen comes alive instantly. There is no Linux kernel boot, no GRUB menu—just a blinking cursor spitting out rapid-fire lines of white text. Timestamps jump, peripheral addresses scroll past, and the vintage silicon appears to be dreaming.
That dream is woven in real time by an autoregressive model with a context window of just 8 characters. Eight characters is barely enough for half an English word, yet the model reliably generates colons, spaces, and hexadecimal memory ranges. With zero hardware drivers present, it has learned the structural cadence of system initialization.
图:bootgpt 在 QEMU 里启动并逐行吐出 Linux 启动日志。来源:kerlenton/bootgpt 仓库
The animation captures the live output running inside QEMU. While the text appears endlessly varied, its underlying engine relies purely on character-level statistical transitions. As long as the initial characters match expected boot patterns, the stream naturally glides into the industrial aesthetic familiar to any kernel hacker.
Stripping the OS: 512 Bytes of Assembly Takes Over Bare Metal
Modern AI stacks rely on towering software layers. Running a single forward pass typically requires a Python interpreter, a host kernel, and vendor GPU drivers, devouring gigabytes of VRAM. Modern engineering has come to treat this bloat as an inevitable tax, assuming neural networks cannot survive without a full operating system.
bootgpt strips every one of those layers away. Under the Master Boot Record (MBR) disk specification, bootable code is strictly confined to 512 bytes, with the final two bytes reserved for the boot signature 0xAA55. Hand-crafting raw 16-bit x86 assembly, kerlenton packed a complete neural network inference engine into the remaining 510 bytes.
The CPU starts in 16-bit real mode, constrained to a 1 MB address space. The assembly leverages the BIOS disk interrupt INT 13h to load the subsequent 23 sectors from disk in one sweep. Those 23 sectors hold the 11.5 KB model weights, streamed straight into physical RAM without filesystem overhead.
In just 512 bytes, the loader handles model ingestion, keyboard polling, and VGA text-mode rendering. No driver conflicts, no kernel scheduling—just raw power applied directly to an inference loop. The modular generality software engineering builds with abstract layers is collapsed entirely into handcrafted assembly.
Ditching Floating-Point: Matrix Multiplication via Adds and Bitshifts
Mainstream deep learning depends fundamentally on floating-point arithmetic. Early Intel 80386 chips lacked built-in floating-point units; running math coprocessors required expensive add-on silicon. To make a 40-year-old architecture execute a neural network, floating-point operations had to be eliminated completely.
The author quantized all weights and activations into standard int8 integers. Quantization scaling factors were chosen as powers of two, transforming floating-point multiplications and divisions into fundamental binary bitshifts. What would otherwise be an expensive matrix multiplication pipeline drops down to primitive imul integer instructions and arithmetic shifts.
Across the entire forward pass, the only division occurs during the Softmax probability normalization. The assembly executes a single idiv instruction to compute the character probability distribution. Token sampling is handled by a handwritten Linear Congruential Generator (LCG), producing pseudorandom values with nothing more than basic multiply-add operations.
Instead of a deep Transformer stack, the architecture uses a single character embedding and one hidden layer. Compressing inference into a few hundred clock cycles allows an antique CPU clock speed to deliver a responsive, fluent text stream. Intelligent computation collapses back into elementary arithmetic.
Training on Synthetic Corpora: Teaching Small Models the Look of Booting
A lightweight architecture alone cannot guarantee coherent text. With a memory horizon of only 8 characters, a model cannot capture long-range semantic dependencies and risks falling into repetitive garbage loops. To solve this, the developer crafted a dedicated synthetic corpus generator, corpus_gen.py, producing 3 MB of synthetic boot logs.
Real kernel boot sequences are dense with recurring structural motifs. Within a single boot session, kernel release strings remain constant, and mounted disk serials never change. The generator pinned down session-specific constants, creating strong periodicity in character-to-character transition probabilities.
The miniature model quickly internalized this repetitive syntax during training. It doesn’t need to understand PCI bus specifications; it only needs the statistical intuition that colons are followed by spaces, and newlines are preceded by closing brackets. By tailoring the data strictly to a single domain, the model achieves convincing visual fidelity far beyond its parameter budget.
图:bootgpt 项目代码仓库。来源:GitHub
The project repository includes an exact integer simulation harness inside train.py. The Python training pipeline mirrors the bitshift truncation errors and LCG sampling logic of the assembly runtime byte for byte. This ensures that whatever is trained matches bare-metal silicon behavior with zero runtime discrepancies.
More Than Scaling: Real AI on a 386
Engineering within 512 bytes is a celebrated hacker tradition. Decades ago, demosceners fit complete chess engines into boot sectors. Microscopic operating systems and miniature compilers followed. More recently, projects like sectorllm managed to fit a self-attention mechanism into 1.2 KB of assembly.
bootgpt extends this lineage of exploring computational boundaries. Rather than chasing general reasoning, it compresses a specialized domain to its physical limits. Even when compute is throttled back to a 40-year-old single-core microprocessor, the model still delivers its intended narrative on screen.
The tech industry has grown accustomed to throwing capital and electricity at every algorithmic bottleneck. Massive compute clusters have raised the ceiling of what AI can do, but they have also made engineers forget the elegance of constrained design. When a problem is framed with razor-sharp clarity, strict constraints can sculpt algorithms with breathtaking efficiency—proving that even 512 bytes is enough to conjure the illusion of intelligence.
参考链接:
- kerlenton/bootgpt 仓库源码
- Hacker News 讨论