# Overfitted a 900KB Transformer to Compress a 100MB CSV into…

I built an experiment that uses an overfitted transformer and arithmetic coding to compress individual files. Instead of training the model to generalize, I train a 900KB transformer to memorize a single file and predict the next byte. Those predictions are fed into an arithmetic coder to produce t…

- **Page:** https://magpie.gallery/i/overfitted-a-900kb-transformer-to-compress-a-100mb-ud3o
- **Type:** Link to an idea elsewhere
- **Category:** AI & dev
- **Tags:** compression, transformer, arithmetic-coding, experiment

## Source

Web · spidy__: Overfitted a 900KB Transformer to Compress a 100MB CSV into 7MB

- **Original:** https://news.ycombinator.com/item?id=48644463

> I built an experiment that uses an overfitted transformer and arithmetic coding to compress individual files. Instead of training the model to generalize, I train a 900KB transformer to memorize a single file and predict the next byte. Those predictions are fed into an arithmetic coder to produce the compressed output. On a 100MB NYC taxi CSV, it compresses to about 7MB (~0.5 bits/byte). On a 100MB slice of enwik9, it compresses to about 21MB (~1.68 bits/byte). It's pretty slow right now (roughly 20–30 minutes of training and 45 minutes each for compression and decompression on my AMD 7800XT). Checkout the repo - https://github.com/samyak112/pym-particles

## GitHub projects

- https://github.com/samyak112/pym-particles

## Rules for reuse

- Build your own version: don't copy another product's code, look, icons, colours or copy.
- The original belongs to its author; Magpie only links to it.
- The original content's copyright belongs to its creator. Magpie doesn't download or re-upload it; we only show the link and the official preview.
