Neural network boots PC from 512-byte MBR
A new project runs an int8 language model in the Master Boot Record to generate fake Linux boot logs without an operating system.
A neural network has been developed to boot a PC by executing directly within the Master Boot Record. The MBR contains 512 bytes of hand-written assembly code that loads an 11.5 KB int8 model from the next 23 sectors. This model operates in 16-bit real mode on a 386 processor without an operating system or C runtime. The system generates a Linux boot log featuring timestamps, PCI bars, and ACPI events for non-existent hardware. It uses eight characters of context and one hidden layer to produce output.
The build process requires installing nasm and numpy via pip, utilizing a build script and a run script. A disk image named disk.img serves as a standard boot image that can be written to a USB stick. During operation, the system only reads its own sectors. A script named corpus_gen.py generates 3 MB of fake dmesg output for training. The training script uses character embeddings, one hidden layer, and softmax activation, simulating exact integer math including an LCG sampler to match Python output with boot sector output.
The boot.asm file handles int 13h to load weights, int 10h to print, softclip activation, and argmax sampling. The model is quantized to int8 with power-of-two scales for the forward pass in assembly. The boot sector contains only code, while strings, weights, and the vocabulary table reside in data sectors. Any keypress reboots the machine during execution. Oscar Toledo previously placed chess, a whole OS, and a BASIC interpreter into a boot sector. The project is compared to sectorllm, which boots a real llama2 transformer from about 1.2 KB of real mode assembly.
Sources
Every sentence of this story was checked against facts quoted from these articles. How we make the news
Spotted an error? Tell us
