GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
ICLR 2024

Language Modeling Is Compression

A model that predicts the next byte well can compress it well. Chinchilla 70B beat PNG and FLAC on image and audio chunks it never trained on, until its 140 GB of weights were counted.

Breakdown by FDE Interviews · 11 min read · Updated

About the original · 2023
AUTHORS
Delétang, Ruoss, Duquenne, Catt et al.
FROM
Google DeepMind, Meta AI and Inria
PUBLISHED
Sep 2023 · ICLR 2024
CITED BY
322Semantic Scholar · Nov 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 24% of this breakdown.

01

The paper in one minute

Shannon's source coding theorem ties prediction to compression: if a model assigns probability p to the next symbol, an ideal code spends -log2 p bits on it. Arithmetic coding achieves this almost exactly. So a better predictor is a better compressor, and minimizing a language model's log loss is the same as minimizing the length of a compressed file. The reverse also holds: any compressor defines a predictor, because the symbol that compresses best next is the one it considers most likely.

The authors use this view to study large models. They chunk 1 GB each of English Wikipedia (enwik9), grayscale ImageNet patches and LibriSpeech audio into 2,048-byte pieces, compress each piece with arithmetic coding driven by a model, and compare with gzip, LZMA2, PNG and FLAC. Models include small Transformers trained on enwik8, Llama 2 7B and Chinchilla 1B, 7B and 70B.

The large models, trained mostly on text, compressed all three modalities better than the classical compressors on the same chunks, including image patches and audio they were not trained on. But a decompressor needs the model too. Counting each parameter as 2 bytes, a 70-billion-parameter model adds 140 GB to the cost of compressing 1 GB, and its "adjusted" rate becomes 14,008%. Small Transformers trained on enwik8 show the tradeoff directly: each dataset size has an optimal model size, after which bigger models compress worse once their size is counted.

The paper adds three observations. Tokenizers act as a first compression step: larger vocabularies shorten sequences, but small models compressed better with simpler ones. In-context compression is limited by context length. And a compressor such as gzip can generate text by sampling the continuation it compresses best, though the samples are poor. The headline sentence of the abstract cites 43.4% for images and 16.4% for audio, numbers that do not appear in the current version's Table 1.

THE IDEA, VISUALLY
RAW RATE ON 2048-BYTE CHUNKS (TABLE 1, %) enwik9 (text) gzip 48.1 LZMA2 50.0 PNG 80.6 FLAC 88.9 Llama 2 7B 8.9 Chinchilla 70B 8.3 ImageNet (image) gzip 68.6 LZMA2 62.4 PNG 61.7 FLAC 60.9 Llama 2 7B 53.4 Chinchilla 70B 48.0 LibriSpeech (audio) gzip 38.5 LZMA2 38.2 PNG 37.6 FLAC 30.3 Llama 2 7B 23.1 Chinchilla 70B 21.0 Adjusted for model size on 1 GB: Chinchilla 70B 14,008%. Abstract: 43.4% and 16.4%; this table: 48.0% and 21.0%. arXiv 2309.10668 v2, Google DeepMind and Meta, ICLR 2024 OUR RUN: 300 KB OF PAPER TEXT (%) byte model, 0-byte context 61.0 byte model, 2-byte context 38.8 byte model, 4-byte context 32.6 gzip -9 34.7 LZMA -9 30.3 gzip, 2048-byte chunks 49.4 Code length = sum of -log2 p(next byte), what an arithmetic coder achieves within a few bytes. A better predictor is a smaller file. Chunking costs gzip 15 points because it restarts with no history. Reversed, zlib as a predictor scored 27 candidate next characters with only 3 distinct probabilities.
Left: Table 1's raw compression rates on 2048-byte chunks of text, image and audio, for classical compressors and two language models; lower is better. Right: our run on 300 KB of paper text: an adaptive byte predictor turned into a code length, against gzip and LZMA.
Research notes: the problem, approach and results
8.3%

Chinchilla 70B's raw compression of enwik9 text in 2048-byte chunks, against 48.1% for gzip on the same chunks (Table 1)

48.0% vs 61.7%

ImageNet patches: Chinchilla 70B against PNG, both on 2048-byte chunks; the abstract's 43.4% vs 58.5% mixes setups

14,008%

Chinchilla 70B's adjusted rate on 1 GB once its 140 GB of float16 weights are counted (Table 1)

THE PROBLEM

Prediction and lossless compression are mathematically the same problem, but the equivalence was mostly a textbook point. Large language models are now very good predictors; how good are they as compressors, and what does that view reveal?

THE IDEA

Turn models into compressors with arithmetic coding, where a symbol predicted with probability p costs about -log2 p bits, and compare them with gzip, LZMA2, PNG and FLAC on 1 GB each of text, images and audio, both before and after counting the model's own size.

THE RESULT

On 2048-byte chunks, Chinchilla 70B compressed Wikipedia text to 8.3%, image patches to 48.0% and audio to 21.0%, below each modality's specialized compressor. Counting 2 bytes per parameter, its rate on 1 GB becomes 14,008%; the best model size depends on the amount of data.

02

Why it matters to an FDE

Log loss is bits. Perplexity and cross-entropy, the numbers on model cards and training curves, are compression rates in disguise. Bits per byte is the most comparable form across tokenizers, which is why it appears in evaluations of models with different vocabularies.

General models are general predictors. A text model compressing image patches better than PNG shows how much generic pattern-matching sits inside large models. It is also a reason to test them on unexpected data types in a customer's domain before ruling them out.

Counting the model changes the answer. The raw rates look magical; the adjusted ones are terrible for 1 GB. The same logic applies to customer decisions: a large model's quality has to be weighed against its serving cost and footprint for the volume at hand, and the best size depends on how much work it will do.

Context length is a hard limit. In-context compression can only use what fits in the window; chunking cost gzip 15 points in our run because each chunk starts with no history. Large documents processed in chunks lose cross-chunk information the same way.

Compression-based checks are useful tools. Compression ratios can flag duplicated or templated data, detect unusual inputs, or give a quick, model-free similarity measure between documents.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 290 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The equivalence, arithmetic coding, raw vs adjusted rates, modalities, scaling, tokenizers

    Free account
  2. 04How it works

    Arithmetic coding, datasets and chunking, how rates are computed, scaling and tokenizer studies

    Premium
  3. 05The numbers that matter

    Table 1 raw and adjusted, the abstract's mismatched numbers, Table 2's tokenizers

    Premium
  4. 06Try it yourself

    Recompute the adjusted rates, compress real text with a predictor, and use zlib as a predictor

    Premium
  5. 07Where it breaks

    Chunked comparisons, model size, slow coding, and numbers that changed between versions

    Premium
  6. 08Using it on a deployment

    Report bits per byte, size models to the workload, chunk with care, use compression as a signal

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →