Open & local AI

Running a tiny language model inside a 510-byte boot sector

A new project called bootgpt runs a char-level neural network in the Master Boot Record, generating fake Linux logs on bare metal without an operating system.

A circuit board shaped like a floppy disk on a motherboard
Illustration generated for this article

Developer kerlenton has released bootgpt, a project that executes a small language model directly from the Master Boot Record (MBR) of a computer. Published in late October 2026, this tool runs entirely in 16-bit real mode on legacy BIOS hardware, requiring no operating system or C runtime to function.

What happened

The project demonstrates a neural network that wakes up with the machine and generates hallucinated Linux boot logs. Instead of loading a traditional operating system, the code reads its own sectors from the disk, loads an 11.5 KB model stored in subsequent sectors, and begins printing text to the screen using basic BIOS interrupts. The output mimics timestamps, PCI bus addresses, and ACPI events for hardware that does not actually exist on the host machine.

This approach differs significantly from recent attempts to run larger models like Llama-2 during the boot process. While other projects such as sectorllm use over 1.2 KB of assembly to run transformer models with attention mechanisms, bootgpt restricts itself to the strict 510-byte limit of the MBR code space. The weights and vocabulary tables are kept in data sectors, allowing the inference engine to remain incredibly compact while still producing coherent, albeit nonsensical, system messages.

The repository includes tools to generate training data, train the model, and record demonstrations. Users can write the provided disk image to a USB stick and boot any BIOS-compatible box to see the effect. The system is designed to be self-contained, reading only its own sectors and rebooting upon any keypress.

How it works

The core of the system is a char-level neural network with a single hidden layer. To fit within the severe constraints of the boot sector, the developer quantized all model parameters to int8 format using power-of-two scales. This specific choice allows the 16-bit real mode processor to perform the entire forward pass using only integer multiplication (imul) and a single integer division (idiv) instruction, avoiding the need for complex floating-point emulation.

Training is handled by a Python script that generates 3 MB of fake dmesg logs. The generator varies kernel versions and disk configurations per session to prevent the model from simply memorizing repetitive strings. This variation forces the tiny network to learn the structural patterns of boot logs rather than just repeating static text. The training script also simulates the exact integer mathematics that the assembly code will execute, including a Linear Congruential Generator (LCG) for sampling. This ensures that the output from the Python training environment matches the boot sector output character for character.

The runtime assembly code, contained in boot.asm, handles the heavy lifting. It uses interrupt 13h to load the weights from the disk and interrupt 10h to print characters to the video buffer. Activation functions are implemented via softclip using cdq and idiv instructions, while sampling relies on noise seeded by the system timer. Because the MBR is limited to 512 bytes, with the last two bytes reserved for the boot signature, the executable code must fit within 510 bytes.

Key details

  • The inference engine fits entirely within the 510-byte code limit of the Master Boot Record.
  • The model uses int8 quantization with power-of-two scales to enable efficient integer-only math on 386-era hardware.
  • Training data consists of 3 MB of synthetic Linux boot logs with varied kernel versions and disk setups.
  • The system runs in 16-bit real mode, using BIOS interrupts for disk I/O and video output.
  • Weights, strings, and the vocabulary table are stored in the 23 sectors following the MBR, totaling 11.5 KB.
  • Any keypress triggers a reboot, and the demo can be recorded headlessly via QEMU monitor sockets.

Why it matters

For engineers working on edge AI and embedded systems, bootgpt serves as an extreme example of resource-constrained inference. It demonstrates how careful quantization and architectural simplification can allow neural networks to run on hardware with negligible memory and processing power. While most modern AI deployment focuses on GPUs and large RAM footprints, this project highlights the viability of integer-only operations on legacy CPUs, which remains relevant for low-power microcontrollers and specialized IoT devices.

The project also underscores the importance of simulation fidelity in embedded ML development. By ensuring the Python training loop exactly mimics the integer arithmetic of the target assembly environment, the developer avoided subtle bugs that often plague cross-platform model deployment. This method of verifying that training and inference produce identical results is a valuable practice for anyone deploying models to non-standard or restricted hardware environments where floating-point support is absent or inconsistent.

What you can do

  • Clone the bootgpt repository and inspect the build scripts to understand the quantization pipeline.
  • Use the provided corpus_gen.py to create synthetic datasets for other structured text generation tasks.
  • Experiment with the int8 quantization strategy in your own embedded projects to reduce model size.
  • Run the disk image in QEMU to observe the boot process without risking physical hardware.
  • Study the boot.asm source to learn how BIOS interrupts handle I/O in real mode environments.
  • Compare the architecture with sectorllm to understand the trade-offs between model complexity and code size.
  • #embedded ai
  • #boot sector
  • #quantization
  • #assembly
  • #edge computing

Tools from the Bytechap store

$89

DocBento

Self-hosted document management that reads every scan and answers with page citations.

Live demo

Keep reading

All stories