I built a version control system where the storage medium is a neural network. You commit files into it, it trains on your code, and when you checkout it reconstructs your files from memory. Sometimes it remembers everything. Sometimes it doesn't
I wanted to see what happens when you take the git interface seriously but replace the storage layer with an MLP. No content-addressable objects, no packfiles, no deltas. Just a neural network that tries to memorize your bytes
You lgit commit and the network trains on your file contents. You lgit checkout and it runs inference to reconstruct them. The diff between what went in and what comes back is the lossy artifact. It's like a game of telephone where the middleman is a neural network
This isn't trying to replace git. It's more of a fun experiment to see what happens when you use a neural network as a storage medium, and partly a joke. But it's also a real tool you can run, and some of the results are genuinely interesting
It even warns you. Fair enough
Let's start with something tiny
62 bytes, 0.1 seconds, 100% accuracy. The network didn't even break a sweat. But you have to wonder: can I get those bytes back?
Perfect reconstruction. The network memorized every byte and gave them all back. Ok but that was 62 bytes. Let's see what happens when we actually push it
I wrote a small game, 2,574 bytes. Coin collector with enemies, movement, collision detection, rendering. Real code, not a toy. Then I deliberately gave it a network that's too small for the job, just to see what breaks
95.8% with the main network. A second "error corrector" network catches most of the remaining mistakes (more on that below). But 10 bytes still got through. Let's see what the network thinks my code looks like
Look at those errors. self.check_collisions() became self.check_collis ons(). range became rance. if not became nf not
These aren't random. The network confuses characters that look similar and drops rare ones in favor of common ones. It's pattern-matching, not storing. It gets the shape of your code right but fumbles the specifics. Like someone who read your code once and is trying to type it back from memory
So the main network isn't perfect. Can we fix that? I added a second neural network that trains specifically on the first one's mistakes. At commit time, the main model makes its predictions, the corrector sees where those predictions were wrong, and it learns to fix them
The corrector looks at each byte position, the main model's prediction, and 5 bytes of context on each side. It learns which predictions are probably wrong and what they should actually be. The key trick: it only applies fixes where it's more than 80% confident, so it doesn't introduce new errors while fixing old ones. In this case, 98 out of 108 errors fixed, zero new ones introduced
The example above was deliberately undersized. In practice you don't want to think about hidden units and layer counts. So lgit picks the network dimensions automatically based on how much data you're committing
Same 2,574-byte game, but this time let the system choose
Auto-sizing picked 64 hidden units and 3 layers instead of 32/2. Perfect recall in 1.1 seconds. The tradeoff is a bigger model file. Which brings us to the real punchline
I ran capacity benchmarks across different data sizes. Look at the model size column
| Data | Network | Accuracy | Time | Model Size |
|---|---|---|---|---|
| 24 B | 32h / 2l | 100% | 0.1s | ~40 KB |
| 62 B | 32h / 2l | 100% | 0.1s | ~53 KB |
| 322 B | 24h / 2l | 100% | 0.3s | ~39 KB |
| 2.6 KB | 64h / 3l | 100% | 1.1s | ~100 KB |
| 9 KB | auto | 100% | 2.8s | ~150 KB |
| 72 KB | 256h / 4l | 100% | 6.8s | ~1.1 MB |
The model is always bigger than the data it stores. Always. To perfectly memorize 62 bytes you need ~53 KB of neural network weights. That's an 850x expansion. gzip would compress the same file to about 40% of its original size
This is, by every conceivable metric, the worst version control system ever built. And that's the whole point
Every commit tells you how well the network remembers your code. git gives you a hash. lgit gives you an accuracy percentage and a parameter count. I know which one I find more interesting
The architecture is simple. Each byte in your files gets a normalized position from 0.0 to 1.0. Positions go through Fourier feature encoding (sin/cos at multiple frequencies), then an MLP maps them to 256-class byte values. The file manifest (names, offsets, lengths) is stored separately so filenames always survive perfectly. Only the raw byte content goes through the network
This is the single most important implementation detail. Raw position values are too smooth for the network to learn sharp byte transitions. Without Fourier features, accuracy caps at about 16%, which is basically useless. With them: 100%. Same insight that makes NeRF (2020) and COIN (2021) work
A few ideas I want to try
def looks like after a round trip through pixel-space