r/AskComputerScience • u/Careful-World-8089 • Jan 29 '25
Could AI Be Used for Extreme File Compression?
I probably have a super limited understanding of AI, but here’s a thought:
From what I know, training an AI model works like this: • You feed in a massive dataset. • An algorithm processes it in a way that it builds a neural network that allows it to recreate similar outputs later.
Isn’t that basically a form of compression?
For example, training a model might require hundreds of terabytes of data, but the final trained model could be just a few hundred gigabytes. So could the same concept be applied to normal file compression?
Let’s say I have a 1GB file. Could an AI “compress” it into a tiny neural network and later reconstruct it perfectly when needed? Would that work for general files, or are there limits to how much AI can compress data without loss?
Even if it can’t achieve perfect lossless compression, could it still potentially compress it in a lossy way?
Thank you in advance
6
u/atamicbomb Jan 29 '25
It can definitely compress in a lossy way. The question is how much loss is acceptable.
AI could compress a very limited set of data into a tiny neural network. But there doesn’t exist a neural network for every data set. On decomposition, it would be shoved into one of the data sets it would work on. This could actually work for things like video game environmental assets.
It could do lossless data too, but I don’t know if it would be better than traditional algorithms. Maybe if it was trained for that specific data type, like images of people. It’s basically just finding patterns and simplifying it, which AI is good at.
3
u/lneutral Jan 29 '25
Yes, it is possible to view a neural network as a compressor, and this is even what some networks are designed to do. Autoencoders can be seen as using a lossy compression + decompression to do tasks, and while it is relatively rare to use them as a primary compression method, it's absolutely a fair analogy.
The primary concerns of _practical_ compression are different: for many types of files, you want "perfect reconstruction." Another is: neural networks are often not the best "structure" for representing data in a smaller form - they'd be considered very wasteful, and by nature, people use ML techniques when they want the true structure to be "discovered empirically" rather than using some known structure of the data.
Consider the wavelet representation of JPEG2000: they can use the fact that much of image data is texture that changes gradually between edges of photographed objects, and use what amounts to scaling and differences between neighboring values. In neural networks, this has to be discovered or built into the architecture, but in the case of "discovered" you'd better hope it can reach that same representation by gradient descent or somesuch, and in the case of "built in" the extreme end of that side of the spectrum is designing _everything_.
Depending on _why_ you're compressing data, ML-based methods have advantages or disadvantages, but one thing that's worth mentioning is that there is a "theoretical maximum" on how much you can compress something, and if simpler methods (and those with _no_ training data requirement) get very close to that, it'll usually be the case that those general methods are the right choice for tasks that don't have some specific reason to involve a network.
1
u/dmazzoni Jan 29 '25
So your analogy is that machine learning algorithms train on huge amounts of data and produce a small model. First of all, this is definitely lossy - no ML model memorized its entire input.
However, the idea of spending a huge amount of time compressing in order to get a smaller file is indeed sometimes applied, to things like video. It doesn’t use AI algorithms, but video compression relies on finding patterns, and the more time you spend looking the more patterns you find.Typical results might be that you spend 10x as long compressing to get a 1% smaller file.
Here’s an interesting project that uses LLMs to compress text.
https://bellard.org/ts_zip/
1
u/0ctobogs MSCS, CS Pro Jan 29 '25
Stuff like this existed before the LLM boom. You basically are imputing what the data was before data loss. Check out matrix completion using SVD as an example. It's only any good for very lossy data, like a photo for example.
1
u/SocksOnHands Jan 30 '25
Sounds like you are describing training an autoencoder. As others had said, this would be a lossy compression. The encoder would encode data into a lower dimension representation, and then later the decoder can decode it back to something resembling the original data (though maybe not exactly).
1
u/nyc_nudist_bwc Mar 22 '25
More likely that ai coding knowledge could generate better data encoders maybe? Just a thought I was having
1
u/Top_Share_6938 Nov 03 '25
Very slow reply but, I was a computer science student at Birmingham university in 2000. I was also a tour guide for Prospective students who visited the campus. We took many of the groups to hear a brief talk from a PhD student who was using neural networks to compress image files. His algorithm could compress files to smaller files than regular algorithms and he explained this could save a lot of network traffic, the problem was that it took a day to compress the file with this technique, but his hope was that this would improve... This was 25 years ago 🙂
1
u/smstal Dec 05 '25
Try beams.cc
1
u/Life_Ask_747 Jun 29 '26
Well, I'm a little late, but I tested it, it doesnt work, but there is potential in the data recovery of corrupted compressed files.
Https://www.github.com/stelliro/puffinzipai/
If anyone uses or attempts to use it, let me know how it goes honestly.
It could probably get a lot of optimisation, but right now it "works" compressing files about 60% compared to other files, so it is possible, just not likely.
1
u/lowbercoder 9d ago
Shannon Entropy theory states that you can't comrpess any file with certain entropy score a file can't get beyond its high entropy. I am working on AI based file comrpession model and I am able to compress the file upto 1 percent of entropy at highest at 7.95 entcoy score, behind that it does better comrpession for arbitary files then the commercial tools available in traditional compression like zx, zlib, rar, etc. I am looking forward to sell this technology as It could compress in a lossless format for alrady compressed jpeg at more than 10 percent and sometimes even 20 percent
-3
u/[deleted] Jan 29 '25 edited Jan 29 '25
[removed] — view removed comment