Entire inference engine is 510 bytes of MBR, weights, vocab, and strings reside in the sectors following MBR. Small char-level neural network was trained on dmesg generated by machine, so machine produces Linux boot messages infinitely.
train.py performs precisely the same integer arithmetic operations as the asm code does and thus produces an output identical character-by-character to the one produced by QEMU. The difference analysis revealed my favorite bug. The characters at the beginning matched those generated by the simulator, but then the output diverged. I retrieved the hidden layer via QEMU’s debug port and compared the neurons' values with those of the simulator, one neuron at a time. Only the value of the first neuron was correct. The activation involves idiv, and idiv stores its remainder in edx. The pointer to the biases table was stored in edx, which resulted in the first neuron being biased correctly and the following ones using garbage. Now the bias' address is determined from the loop counter, and no pointers have to survive the division. Another bug I found simply by looking at the code before I did my first run-through: the BIOS print routine zeros out bx, but bx contains the predicted character number. This explains the push and pop of bx surrounding the print.
sectorllm is the most similar to my project, as it runs an actual 5-layer llama2 with attention mechanism in just 1.2K of assembly code. It is the trade-off in the opposite direction, as my engine needs to fit into one sector and therefore my network has just one hidden layer of int8 operations for dreaming the dmesg.
I need reminders sometimes that the world is filled with humans doing wierd things to share with one another.
Not everything is about economic value or practicality. Making silly shit can be the goal.
https://news.ycombinator.com/item?id=50319510
It very much reminded me of what the web was like 15 years ago. Just people sharing cool stuff with each other. I'm glad we still have that here.
The surrounding also plays its role here, even greater than one might think at first. If the people around you create such things, sooner or later, you will want to do it as well, and you only need to channel this need in the right way. For instance, my team lead at work takes time to reverse engineer electric cars. It is still wizardry to me, but one thing that is for sure is that it motivates me to do this type of stuff.