Artificial Intelligence1 min read

Show HN: A language model that lives in a boot sector

By · Published by Everything Blog

In short

The project features a character-level neural network configured with eight characters of context, character embeddings, a single hidden layer, and softmax. Quantized using eight-bit integers with power-of-two scales, the entire forward pass relies solely on basic multiplication and division assembly instructions. A dedicated script generated three megabytes of synthetic dmesg logs to train the model on repetitive kernel patterns. Packaged into a standalone disk image, the program can run on physical BIOS-compatible computers via a USB drive or inside the QEMU emulator.

Key points

  • Neural network inference can be executed within bare-metal boot sectors by offloading mod…: Neural network inference can be executed within bare-metal boot sectors by offloading model weights to subsequent disk sectors.
  • Power-of-two quantization enables character-level neural networks to run forward passes u…: Power-of-two quantization enables character-level neural networks to run forward passes using standard CPU arithmetic instructions.
  • The system functions independently of modern operating systems and can be executed via QE…: The system functions independently of modern operating systems and can be executed via QEMU or on physical BIOS hardware.

Sources checked by our analysis pipeline: 1

A neural network that boots your PC.

The MBR is 512 bytes of hand written asm. It loads an 11.5 KB int8 model from the next 23 sectors and runs it in 16-bit real mode on a 386. No OS, no C runtime, nothing. The machine wakes up and dreams a Linux boot log: timestamps, PCI bars, ACPI events for hardware that never existed.

Build thread: https://x.com/krlntn/status/2116514628457185757

With 8 chars of context and one hidden layer this is roughly the quality you get:

[ 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

[ 0.206596] Command line: BOOT_IMAGE=/vmlinu -5.5.2-1-generic gcc version 13.3.0, GNU ld ...

[ 1.815765] ACPI: PCI Interrupt Link [LNKA: v/s.xos212

[ 1.883084] NET: Registered protocol family 16

brew install nasm qemu

python3 -m venv .venv && .venv/bin/pip install numpy

./build.sh

./run.sh

disk.img is a normal boot image. dd it to a USB stick and boot any BIOS box if you have one. It only reads its own sectors.

corpus_gen.py

makes 3 MB of fake dmesg. One kernel version…

Artificial Intelligence