PromptisePromptise
Why PromptiseUse casesRoadmapDocs
GitHubGet started
Promptise - AI Framework LogoPromptise

The foundation layer for agentic intelligence. Build, secure and operate autonomous AI systems with Promptise Foundry.

pip install promptise

[01] Foundry

  • MCPcast
  • The Promptise Agent
  • Reasoning Engine
  • MCP
  • Agent Runtime
  • Prompt Engineering
  • Execution Engine
  • Agent Identity

[02] Resources

  • Documentation
  • GitHub
  • Guides
  • Learning Paths
  • Questions

[03] Company

  • About
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Subprocessors

© 2026 Promptise by Manser Ventures. All rights reserved.

Open source · Python

← Guides> Prompt Engineering

LLMs as Lossy Compression: Why They Can't Quote Exactly

Why an LLM is a lossy compression of its training data: it keeps gist and loses exact wording, quotes and URLs. What to ask it for, with a real example.

Level
Intermediate
Reading time
4 min
Published
Sep 20, 2025
Last updated
Oct 18, 2026
By
Promptise Team
  • LLM Mental Models
  • How LLMs Work
  • Hallucinations
  • Grounding and Citations
Contents · 6 sections↓
  1. 01Is an LLM a lossy compression of its training data?
  2. 02Why it's true
  3. 03Example: "quoting" the Python docs
  4. 04What it changes in practice
  5. 05Frequently asked questions
  6. 06Next steps

Ted Chiang called ChatGPT "a blurry JPEG of the web". The comparison holds up better than most metaphors: a model squeezes a huge amount of text into a fixed set of weights, keeps the patterns and loses the exact bytes. This essay, part of the Mental Models learning path, explains what that means technically, which outputs survive compression (gist, structure, style) and which don't (quotes, URLs, signatures, numbers), with a real example of the model "quoting" Python documentation.

[01]

Is an LLM a lossy compression of its training data?

In a useful sense, yes. Predicting the next token well is mathematically equivalent to compressing text well, and a model's weights are far smaller than the text it trained on, so it can't keep everything. What it keeps are the regularities: how ideas relate, how documents are structured, how a topic is usually explained. Exact wording is kept only for text repeated many times. When you ask for a verbatim string, the model reconstructs something plausible from the pattern.

Key takeaways:

  • Ask the model for gist; get exact strings from the source. Quotes, URLs, version numbers and API signatures are where compression shows.

  • Fluent is not faithful. A reconstruction reads as smoothly as the original.

  • Transforming text you supply is the model's strong suit. Summarizing, restructuring and explaining work from the real bytes in the prompt.


[02]

Why it's true

Language Modeling Is Compression (Delétang et al., ICLR 2024) makes the equivalence concrete: any model that predicts the next symbol can drive an arithmetic coder, and better prediction means smaller files. Chinchilla 70B, trained mainly on text, compressed ImageNet patches to 43.4% of raw size and LibriSpeech audio to 16.4%, beating PNG (58.5%) and FLAC (30.3%).

The size gap does the rest. Meta's Llama 3 paper (2024) describes training on over 15 trillion tokens; the largest model has 405 billion parameters. The weights are a fraction of the training text, so most passages can't be stored word for word. Some are: Extracting Training Data from Large Language Models (Carlini et al., 2021) recovered memorized sequences from GPT-2, and Quantifying Memorization (Carlini et al., 2023) found memorization grows with model size, with how often a sequence is duplicated in the data, and with how much context the prompt gives. Frequent text comes back close to exact; ordinary text comes back as its gist.

Chiang's New Yorker essay (2023) drew the practical conclusion: compression artifacts in text look like plausible facts, which is what makes them hard to spot.

Over 15 trillion tokens of training text are compressed into 405 billion parameters: patterns such as gist, structure and style are kept, frequent text comes back close to exact, and exact details like quotes, URLs, signatures and numbers are reconstructed, so get exact strings from the source.
FigureAn LLM as lossy compression: what survives in the weights and what gets reconstructed

[03]

Example: "quoting" the Python docs

Text
Quote, verbatim and complete, the docstring of each of these Python standard library objects (CPython 3.12). Use a heading line '### name' before each docstring and output nothing else.
textwrap.dedent
shutil.copy2
itertools.groupby
str.partition

The model's str.partition:

Output
Split the string at the first occurrence of sep, and return a 3-tuple
containing the part before the separator, the separator itself, and the
part after the separator.
…

The real CPython 3.12 docstring (inspect.getdoc(str.partition)):

Output
Partition the string into three parts using the given separator.

This will search for the separator in the string.  If the separator is found,
returns a 3-tuple containing the part before the separator, the separator
itself, and the part after it.
…

Same meaning, different words. The model's version is almost word for word the entry in the online library reference, a different and much more widely copied text. Asked for one text, it returned the more frequent one. For itertools.groupby it went further and added an example that is not in the docstring:

Output
    >>> for key, group in groupby('AaaBBcCc'):
    ...     print(key, list(group))
    A ['a', 'a']
    B ['a']
    …

Running that code prints A ['A'], then a ['a', 'a'], then B ['B', 'B']. The invented example has invented output. The textwrap.dedent and shutil.copy2 "quotes" were also paraphrases with different content from the real docstrings. Results vary by model, but no current model can promise a verbatim quote from memory.


[04]

What it changes in practice

  • Split requests into gist and exact parts. "Explain how groupby works" is a good use of compressed knowledge. "Give me the exact signature" or "quote the clause" needs the source.

  • Put exact strings in the context, or give the model a tool. Paste the document, run help(), fetch the page, or expose a lookup tool through tool calling. Then ask the model to quote from what it was given, and check the quote is a substring of the source in code.

  • Distrust specifics that arrive without a source. Citations, URLs, statistics, version numbers and legal wording from memory are reconstructions. Treat them as leads to check, not facts.


[05]

Frequently asked questions

What does "ChatGPT is a blurry JPEG of the web" mean?

It is Ted Chiang's 2023 analogy: like a JPEG, a language model stores a compressed approximation of its input. It keeps the overall picture and loses fine detail, and when you ask for detail it fills in something plausible, the way a JPEG decoder fills in pixels.

Do LLMs memorize their training data?

Some of it. Text that appears many times, such as famous quotes, licenses and popular code, can be reproduced nearly verbatim, and larger models memorize more. Most text is not stored word for word.

Why can't the model give me an exact quote or URL?

Because exact strings are the details lossy compression drops first. The model generates a string that fits the pattern of the source, which is often close and sometimes entirely made up. Supply the source and verify quotes mechanically.

Is lossy compression the same as hallucination?

It is one cause. Reconstructing a detail that wasn't stored produces a confident, plausible error. Hallucinations also come from missing knowledge and from training that rewards guessing.


[06]

Next steps

  • Why LLMs get niche facts wrong: how often a fact appears predicts whether it survives.

  • LLM hallucinations: quick checks: includes a quote-matching check in Python.

  • Grounding LLM answers: put the source in the prompt.

  • LLM as a tool orchestrator: fetch exact data through tools.

  • Mental Models: How to Think with LLMs: the full learning path.

Contents

  1. 01Is an LLM a lossy compression of its training data?
  2. 02Why it's true
  3. 03Example: "quoting" the Python docs
  4. 04What it changes in practice
  5. 05Frequently asked questions
  6. 06Next steps

Learning paths

Want more structure? Paths put guides in order, like a short course.

See the paths →

> Read next

Related guides

  • // 01Beginner · 5 minAre LLMs Stochastic Parrots? What the Term Gets RightAre LLMs stochastic parrots? What Bender et al. meant, what next-token prediction implies, where the term falls short, and the habit it should give you.
  • // 02Beginner · 4 minWhy Can't LLMs Count Letters? Tokens and ProbabilityWhy LLMs miscount letters, reverse strings wrong and miss word limits: tokenization, sampling, real failures, and why exact work belongs in your code.
  • // 03Intermediate · 5 minWhy LLMs Get Niche Facts Wrong: Popularity and Training DataWhy LLMs know popular facts but invent niche ones: accuracy tracks how often a fact appears in training data. When to retrieve instead. Real example.
  • // 04Intermediate · 5 minWhy LLMs Fail Modified Puzzles: Pattern-Matching BiasWhy LLMs answer the famous version of a changed puzzle: training-data priors, research on counterfactual tasks, a real failure and how to prompt around it.
  • // 05Intermediate · 4 minAI Code Hallucinations: Why Plausible Output Fools YouWhy LLM code looks right but fails: plausibility vs correctness, hallucinated packages, a real regex that broke, and how to verify output by running it.
  • // 06Intermediate · 5 minHow LLMs Generate Text: Next-Token Probabilities ExplainedHow LLMs generate text one token at a time: probabilities, temperature, top-p, and why early words commit the rest. Real example of a verdict-first error.

Keep going.

Browse every guide by topic and level, or follow a learning path that puts them in order.

All guidesLearning paths