<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Information-Theory on RockB</title><link>https://baeseokjae.github.io/tags/information-theory/</link><description>Recent content in Information-Theory on RockB</description><image><title>RockB</title><url>https://baeseokjae.github.io/images/og-default.png</url><link>https://baeseokjae.github.io/images/og-default.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 12 Aug 2026 13:01:55 +0000</lastBuildDate><atom:link href="https://baeseokjae.github.io/tags/information-theory/index.xml" rel="self" type="application/rss+xml"/><item><title>Why Compression Is Prediction: The Information-Theoretic View of LLMs</title><link>https://baeseokjae.github.io/posts/compression-is-prediction-llm-guide-2026/</link><pubDate>Wed, 12 Aug 2026 13:01:55 +0000</pubDate><guid>https://baeseokjae.github.io/posts/compression-is-prediction-llm-guide-2026/</guid><description>Compression is prediction: an LLM that predicts the next token is secretly a world-class data compressor, and the reverse is true too.</description><content:encoded><![CDATA[<p>Compression is prediction, and prediction is compression: these are two sides of the same information-theoretic coin. Any model that accurately predicts the next token can be turned into a lossless data compressor, and any compressor can be turned into a generative model. This guide explains why that equivalence holds, how DeepMind and Meta proved it in 2023, and why it reframes how you should think about large language models.</p>
<h2 id="what-does-it-mean-that-compression-is-prediction">What Does It Mean That Compression Is Prediction?</h2>
<p>Compression is prediction because a good predictor implicitly assigns low code lengths to likely sequences, which is exactly what a compressor does. When you predict &ldquo;the&rdquo; follows &ldquo;of the&rdquo;, you are acting like an entropy coder that gives &ldquo;the&rdquo; a short code because it is probable. The tighter your predictions match the real distribution of data, the fewer bits you need to store that data.</p>
<p>The reverse is the deeper insight. If a program can compress a corpus to a small size, then it has extracted the statistical regularities in that corpus — the same regularities that let it predict what comes next. A file that compresses well is a file whose next symbols you can guess well. This is why researchers call language modeling &ldquo;implicit compression&rdquo; of the training distribution.</p>
<h2 id="the-information-theoretic-core-entropy-probability-and-code-length">The Information-Theoretic Core: Entropy, Probability, and Code Length</h2>
<p>Claude Shannon&rsquo;s information theory gives the exact mathematical link. The entropy of a source, measured in bits, is the minimum average number of bits needed to encode each symbol from that source:</p>
<p><strong>H = −Σ p(x) log₂ p(x)</strong></p>
<p>The key practical result is that the optimal code assigns shorter code lengths to more probable symbols. This is the principle behind entropy coding — Huffman coding and arithmetic coding both do exactly this. If a symbol appears with probability p, its optimal code length is approximately −log₂(p) bits.</p>
<p>Here is where prediction enters. When a model predicts the probability of the next token, it is estimating p for each candidate symbol. A well-calibrated language model naturally assigns shorter codes to tokens it thinks are likely, and longer codes to surprising ones. Feed those probabilities into an arithmetic coder and you have converted prediction into lossless compression. The better the predictions, the shorter the compressed output.</p>
<p>This is not an analogy; it is a theorem. Shannon showed in 1948 that there is no way to compress below entropy on average, and that entropy-coding schemes can approach that limit arbitrarily closely given accurate probabilities.</p>
<h2 id="the-predictioncompression-equivalence-and-the-deepmindmeta-result">The Prediction–Compression Equivalence (and the DeepMind/Meta Result)</h2>
<p>The formal equivalence between prediction and compression is a long-established result in information theory: predictive models can be transformed into lossless compressors, and vice versa. The 2023 paper <em>Language Modeling Is Compression</em> (DeepMind/Meta, arXiv 2309.10668) turned this abstract theorem into a striking empirical demonstration.</p>
<p>The researchers took large language models that were trained only to predict the next token — nothing else — and used them as compressors on data they had never seen and were not specifically trained on. Because arithmetic coding can consume model probabilities as a prior, a language model can be plugged directly into an arithmetic coder to compress arbitrary sequences.</p>
<p>The results were remarkable. A Chinchilla 70B model, trained mostly on text, compressed ImageNet image patches to <strong>43.4%</strong> of their raw size — beating PNG, the purpose-built image codec, which achieved only <strong>58.5%</strong>. On audio, the same model compressed LibriSpeech to <strong>16.4%</strong> of raw size, beating FLAC at <strong>30.3%</strong>. A text-trained model outperformed domain-specific codecs on images and audio it was never trained on.</p>
<table>
  <thead>
      <tr>
          <th>Data type</th>
          <th>Chinchilla 70B</th>
          <th>Domain codec</th>
          <th>Codec result</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>ImageNet patches</td>
          <td>43.4% of raw</td>
          <td>PNG</td>
          <td>58.5% of raw</td>
      </tr>
      <tr>
          <td>LibriSpeech audio</td>
          <td>16.4% of raw</td>
          <td>FLAC</td>
          <td>30.3% of raw</td>
      </tr>
  </tbody>
</table>
<p>The paper&rsquo;s conclusion is a powerful statement of the compression-is-prediction thesis: LLMs are not merely text statistics learners but general-purpose predictors, and their ability to compress across modalities is direct evidence that they capture general predictive structure.</p>
<h2 id="how-an-llm-compresses-the-world-training-as-implicit-compression">How an LLM &ldquo;Compresses&rdquo; the World: Training as Implicit Compression</h2>
<p>You can think of every training run as a search for a compressed representation of the training distribution. The language model&rsquo;s weights, which might occupy a few gigabytes, encode statistical knowledge distilled from terabytes of text. That is compression on an enormous scale: the model is a lossy, learned codebook that captures the regularities of human language.</p>
<p>The framing explains a counter-intuitive fact: the model does not memorize the data; it summarizes it. A 70-billion-parameter model trained on trillions of tokens cannot possibly store every string. Instead, it stores the predictive patterns — which is exactly what a compression algorithm stores. What it cannot predict well, it must store with more detail or fail to reproduce.</p>
<p>This is why larger models compress better. A bigger model has more capacity to capture subtle predictive regularities, which shows up in information-theoretic terms as better compression of the training distribution. The connection to scaling laws is direct: as models scale, their ability to predict (and hence compress) improves, following the smooth power-law curves that scaling-law research has documented.</p>
<h2 id="cross-modal-evidence-beating-png-and-flac-with-a-text-trained-model">Cross-Modal Evidence: Beating PNG and FLAC With a Text-Trained Model</h2>
<p>The most surprising part of the DeepMind/Meta result is the cross-modal generalization. Chinchilla 70B compressed ImageNet patches and LibriSpeech audio better than codecs designed specifically for those modalities, despite being trained almost entirely on text.</p>
<p>Why does this matter? A model that only learned surface text statistics — common word pairs, punctuation rules — would fail completely on images and raw audio, which share no symbols with text. The fact that it succeeds suggests the model learned something more general: a predictive model of the world that transcends the token modality.</p>
<p>Compressing an image patch or an audio segment well means the model has a good probabilistic model of what images and sounds are like, not just what words look like. This is evidence that next-token prediction, far from being a narrow task, forces the model to learn deep structure about how the world generates data. The compressor&rsquo;s loss, measured in bits, is a direct, objective measure of how much the model &ldquo;understands&rdquo; the source.</p>
<h2 id="the-gzip-surprise-zero-parameter-compression-as-understanding">The Gzip Surprise: Zero-Parameter Compression as Understanding</h2>
<p>The compression-is-prediction thesis does not require a billion-parameter model. A 2022 paper, <em>Less Is More: Parameter-Free Text Classification with Gzip</em> (Jiang et al., arXiv 2212.09410), showed that a simple string compressor plus a nearest-neighbor classifier can rival trained models.</p>
<p>The approach uses Normalized Compression Distance (NCD): the compressed size of two documents concatenated, minus their individual compressed sizes, normalized. Documents that share a lot of statistical structure compress well together, indicating they are semantically similar. Gzip captures word and phrase repetition — a proxy for topical overlap.</p>
<p>The results were striking: with zero parameters and zero training, gzip + kNN achieved state-of-the-art accuracy on several text classification benchmarks (on 5 of 12 benchmarks in the original study), beating methods that required full training runs. The practical lesson is that compression distance IS a form of understanding. If a compressor finds two documents similar, it is capturing genuine semantic overlap without any learned representations at all.</p>
<table>
  <thead>
      <tr>
          <th>Method</th>
          <th>Parameters</th>
          <th>Training</th>
          <th>Benchmark performance</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Gzip + kNN</td>
          <td>0</td>
          <td>None</td>
          <td>SOTA on 5 of 12 benchmarks</td>
      </tr>
      <tr>
          <td>TF-IDF + classifier</td>
          <td>Small</td>
          <td>Required</td>
          <td>Beaten by gzip on several</td>
      </tr>
      <tr>
          <td>Trained embeddings</td>
          <td>Large</td>
          <td>Required</td>
          <td>Beaten by gzip on several</td>
      </tr>
  </tbody>
</table>
<h2 id="what-this-reveals-about-scaling-laws-tokenization-and-in-context-learning">What This Reveals About Scaling Laws, Tokenization, and In-Context Learning</h2>
<p>Viewing LLMs as compressors clarifies three phenomena that otherwise look mysterious.</p>
<p><strong>Scaling laws.</strong> If training is compression, then the scaling laws are compression curves. Larger models and more data compress the training distribution to fewer effective bits, which is why loss (a surrogate for compression) falls on predictable power laws. The compression viewpoint offers a principled reason why the curves are smooth and why diminishing returns appear.</p>
<p><strong>Tokenization.</strong> Tokenizers are themselves a form of compression — they map text to a vocabulary of subword units to reduce sequence length. The compression lens shows why subword tokenization works: frequent word parts get short tokens, echoing the entropy-coding principle of assigning short codes to probable symbols. Better tokenizers are better compressors of the text stream.</p>
<p><strong>In-context learning.</strong> When a model does a task in-context, it is effectively adapting its conditional distribution to the new examples in its context window. The compression framing treats this as online compression: the model uses the examples to predict (and compress) subsequent data more efficiently. This connects in-context learning to the same predictive machinery that drives compression.</p>
<h2 id="from-theory-to-practice-quantization-and-real-world-llm-compression">From Theory to Practice: Quantization and Real-World LLM Compression</h2>
<p>The information-theoretic lens is not just academic; it motivates the practical techniques used to shrink deployed models.</p>
<p><strong>Quantization</strong> reduces the number of bits per weight (from 16-bit to 8-bit, 4-bit, or even lower). From a compression viewpoint, this is lossy compression of the model&rsquo;s learned representation. The surprise is how well it works: models tolerate aggressive quantization because the weights contain redundant statistical structure — the same redundancy a compressor exploits.</p>
<p><strong>Pruning</strong> removes weights that contribute least to prediction, which is compression of the model&rsquo;s parameter space. <strong>Prompt caching</strong> and <strong>KV-cache reuse</strong> compress computation by storing and reusing predictive state across calls.</p>
<p>The practical takeaway is that LLM compression is a spectrum, and the theory tells you where the redundancy lives. Because models are compressible — because their parameters encode redundant predictive structure — they can be aggressively quantized, pruned, and cached with minimal quality loss.</p>
<h2 id="key-takeaways-why-the-information-theoretic-view-matters-for-llms">Key Takeaways: Why the Information-Theoretic View Matters for LLMs</h2>
<p>The compression-is-prediction equivalence is one of the most clarifying ideas in modern machine learning. Here is what to remember:</p>
<ul>
<li><strong>Prediction and compression are mathematically equivalent.</strong> A good predictor is a good compressor, and vice versa, via Shannon&rsquo;s entropy-coding theorem.</li>
<li><strong>LLM training is implicit compression.</strong> Every training run finds a compressed representation of the training distribution; the weights are a learned codebook.</li>
<li><strong>Text-trained LLMs are general predictors.</strong> Chinchilla 70B beats PNG and FLAC on images and audio it was never trained on — evidence of general predictive structure.</li>
<li><strong>Compression is understanding.</strong> Gzip + kNN rivals trained classifiers with zero parameters, showing compression distance captures semantic similarity.</li>
<li><strong>The lens explains scaling laws, tokenization, and in-context learning.</strong> All three are manifestations of the same predictive-compressive machinery.</li>
<li><strong>It motivates real compression techniques.</strong> Quantization, pruning, and caching all exploit the redundancy that the theory predicts.</li>
</ul>
<p>The next time you see an LLM predict the next token, remember: it is doing something far grander. It is compressing the world.</p>
<h2 id="faq">FAQ</h2>
<h3 id="what-does-compression-is-prediction-mean">What does &ldquo;compression is prediction&rdquo; mean?</h3>
<p>It means that predicting the next symbol and compressing a sequence are the same underlying operation. A model that predicts probabilities accurately can be used as a compressor (via entropy coding), and a compressor that extracts statistical regularities is implicitly predicting the data. DeepMind and Meta demonstrated this formally and empirically in their 2023 paper <em>Language Modeling Is Compression</em>.</p>
<h3 id="how-can-an-llm-be-used-as-a-compressor">How can an LLM be used as a compressor?</h3>
<p>By plugging the model&rsquo;s predicted probabilities into an arithmetic coder. Arithmetic coding encodes a sequence using the probability of each symbol; feed in the LLM&rsquo;s next-token probabilities and you get a lossless compressor whose output size reflects how well the model predicts the data. The better the predictions, the shorter the compressed output.</p>
<h3 id="did-llms-really-beat-png-and-flac">Did LLMs really beat PNG and FLAC?</h3>
<p>Yes. In the DeepMind/Meta study, a text-trained Chinchilla 70B compressed ImageNet image patches to 43.4% of raw size (PNG achieved 58.5%) and LibriSpeech audio to 16.4% (FLAC achieved 30.3%), despite never being trained on images or audio. This cross-modal result is key evidence that LLMs learn general predictive structure.</p>
<h3 id="how-does-gzip-achieve-good-text-classification-with-zero-parameters">How does gzip achieve good text classification with zero parameters?</h3>
<p>Gzip&rsquo;s Normalized Compression Distance (NCD) measures how much two documents compress when concatenated versus separately. Documents sharing statistical structure compress well together, indicating semantic similarity. Gzip + kNN classifies by finding the nearest compressed neighbor, achieving state-of-the-art results on several benchmarks with zero training.</p>
<h3 id="why-is-the-compression-viewpoint-useful-for-understanding-llms">Why is the compression viewpoint useful for understanding LLMs?</h3>
<p>It provides a single unifying lens for scaling laws (models are compressors of the training distribution), tokenization (tokenizers are subword compressors), in-context learning (online adaptation of the predictive model), and practical model compression (quantization and pruning exploit the redundancy the theory predicts). It turns fuzzy notions of &ldquo;understanding&rdquo; into an objective, measurable quantity: bits.</p>
]]></content:encoded></item></channel></rss>