Lgit: Source Control for the AI Era
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
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
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
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
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。
