I Compressed Bad Apple into a 3MB Neural Network [P]
![I Compressed Bad Apple into a 3MB Neural Network [P]](/_next/image?url=https%3A%2F%2Fpreview.redd.it%2Fh5r0ybpz5ghh1.gif%3Fframe%3D1%26width%3D140%26height%3D70%26auto%3Dwebp%26s%3D99152a6a4c15a1a51e20a696f3a52115ce3add98&w=3840&q=75)
| I trained a small MLP to memorize the classic Bad Apple animation, ~2.7 billion pixels of video compressed into 790k parameters (3.2 MB float32, 1.6 MB float16). The network takes a 3D coordinate (t, y, x)- frame index and pixel position- and outputs a grayscale value between 0 and 1. To "play" the video, you can evaluate the function over the full grid. The "video" is stored implicitly in 5 linear layers of sine activations (Sitzmann et al.'s SIREN) with 512 hidden units, ω₀ = 30, and sigmoid output. The source At first, I used a ReLU MLP with low-frequency Fourier features, which plateaued around MSE 0.12. SIREN's sine activations add higher frequency for free, so the network was capable of outputting fine details. Unfortunately, that model had an issue, which was that it could only shift the information slowly, so quick motion came out blurry. To fix this, I made two changes:
For the training pipeline, I had a single shared network on the whole volume (no per-frame latents; initially, I used per-frame finetuning, but that caused catastrophic forgetting) with a cosine-scheduled Adam + weight EMA, then a low-LR "polish" pass over the whole video. The new model had these improvements: Validation MSE dropped from 0.0795 to 0.0090 (~9x better). Edit: Some people are a little confused about the compressed part. The subsampled video is 700KB, and the network that creates a reconstruction of it is ~3MB. It hasn't been compressed very much, but the goal was seeing if I could (and learning) rather than super compression. I'll try to see if an even smaller model can learn it. Additionally, I'm training a model on the full non-subsampled video. Notes 384×384 is square (the original is 16:9, so playback is vertically stretched. At 8fps playback, the 1620 frames run near the original's 3:37 duration; at 12fps it's \1.6× fast-forward. The 12.6MB checkpoint includes the weights + Adam moments + EMA copy; the network itself is 3.2MB.)) The full resolution videos, checkpoints, and code can be found in this Github Link [link] [comments] |
Want to read more?
Check out the full article on the original site