r/programming • • Oct 17 '26

Compression is prediction

https://ngrok.com/blog/compression-is-prediction
293 Upvotes

45 comments sorted by

View all comments

32

u/reddit_user13 Oct 17 '26

Compression can be a bit lossy or lossless. You can get back the input, or in the case of the source code example, something close enough to be functional.

Crunching input texts into an LLM model is very lossy, and you can't get anything like the source text(s) back.

37

u/NuclearVII Oct 17 '26

You can absolutely can get training material out of an LLM - or any kind of generative neural network. Proprietary LLMs simply have guardrails to prevent this, because it would reveal just how much theft has gone into the making of said LLM.

This does not stop researchers from trying, however: https://www.businessinsider.com/openais-latest-chatgpt-version-hides-training-on-copyrighted-material-2023-8

Equating network training to compression is not a new take, and one that I am increasingly convinced is closer to reality than what the word "training" would suggest.

3

u/QuaternionsRoll Oct 17 '26

Has this been tested on modern open-weights models? I haven’t really heard anything about it despite it presumably being much easier to prove that open-weights models encode copyrighted text for obvious reasons. I kind of assumed the absence of more recent examples meant that the 2023 issues were caused by overtraining and could be fixed.

2

u/NuclearVII Oct 17 '26 edited Oct 17 '26

Has this been tested on modern open-weights models? I haven’t really heard anything about it despite it presumably being much easier to prove that open-weights models encode copyrighted text for obvious reasons

Yeah? What would those obvious reasons be? Because guess what - all open weight models worth anything are still proprietary. Open weight is not open source, and we don't know what goes into the training corpus of those models either. AFAIK, no one takes the actual open source models seriously, because they don't appear to be very good at what people want out of generative AI. It's almost as if the techs only value is laundering IP...

As an aside - this lack of openness is one of the reasons why the academic machine learning field is so garbage these days. Everyone in the field wants to publish about LLMs (because that's where the money is), and none of that research is reproducible. The field is chock full of papers that try to ask questions about the capabilities of LLMs, without ever being able to verify if those capabilities are emergent or trained. Consequently, pretty much all machine learning conferences and publications are commercial events these days. Yes, I am angry about this.

I kind of assumed the absence of more recent examples meant that the 2023 issues were caused by overtraining and could be fixed.

Overtraining really isn't a problem (I am simplifying wildly here, but in general) in modern deep learning, at least if you know what you're doing and you have a dataset appropriate for deep learning.

17

u/DLCSpider Oct 17 '26

It's not always lossy enough. The German music industry used popular lyrics and Suno AI always produced the same same song (basically a shitty version of the original). They recently won in court.

7

u/PaperMartin Oct 17 '26

LLM spit back training data near-verbatim all the time what are you talking about, half of all headlines from like 2023 to 2025 were about shit like Midjourney spitting out a near perfect replica of an existing star wars poster upon being given a prompt for something sci-fi without any mention of star wars

4

u/Pdan4 Oct 17 '26

You definitely can get the source texts back, but this is usually trained out on purpose (lest the courts realize what is truly going on). Even now though, you can still get excerpts.

5

u/shoot_your_eye_out Oct 18 '26 edited Oct 18 '26

Compression can be a bit lossy or lossless

Video engineer here; surprisingly, this is a common misconception.

All compression does is: exploit redundancy in the data. That's it. "Lossy compression" first discards information deemed less important, then uses the same kinds of lossless techniques to encode the remaining data more efficiently. The distinction is whether information is discarded, not whether the compression algorithms themselves are fundamentally different.

In other words, lossy compression is a combination of lossy information reduction and lossless entropy coding. The latter part can be perfectly lossless even though the overall process isn't reversible.

Example: JPEG. JPEG discards data by converting image data into the frequency domain via a discrete cosine transform. It then "quantizes" high-frequency data your eyes aren't particularly sensitive to; this is where data is discarded. Then, it does some clever packaging, and finally uses a combination of huffman (sometimes arithmetic encoding) and run-length encoding to exploit redundancy in the data.

The point is: the compression algorithms used are the same, and separate from the process of selectively discarding data.

edit: another example is the 4:2:0 chroma sub-sampling common in the YCbCr colorspace. This colorspace deliberately discards color information your eye isn't particularly sensitive to. It isn't "compression," per say, even though it results in less information. It's just a smart way to dump data that doesn't matter much to us humans.

2

u/nsaisspying Oct 17 '26

In the case of the LLM, when you say 'source text', do you mean the training data? Or the prompt?

4

u/rationalguy2 Oct 17 '26

The training data would be the source text. So a lossless LLM that trained on every book in the 20th century could recite any paragraph of The Lord of the Rings.

That said, LLMs likely use prompts as training data, in which case, both are the source text. (I don't enter sensitive information in a prompt.)

2

u/Bunslow Oct 17 '26

LLMs absolutely spit out training material verbatim, such as open source codebases (regardless of the legality of that)

1

u/CommercialHour6660 Oct 19 '26

You can make any lossy compression lossless by combining it with an entropy coder. 

This is how lossless versions of WebP and similar work. You use the predictions from the lossy encoder to reduce the space needed for the original.

LLM can be used for lossless compression. The main issue is that inference engines aren't deterministic. They trade precision for speed.

1

u/guillaume-mohamed50 Oct 21 '26

For a neural predictor, the probabilities aren't free: the decoder needs the same weights and tokenizer. If that model isn't already shared, its size can swamp the savings on ordinary files.

1

u/Ok-Craft4844 Oct 17 '26

Even before they could use tools, you could ask the early gpts "what's the national anthem" and you got the text back, so "you can get anything like the source text back" seems hyperbolic

1

u/dashingThroughSnow12 Oct 17 '26

Compression can be a byte lossy too.