Gzip cannot generate prose in the ordinary sense. A small experiment by Nathan Barry, published on nathan.rs, shows that a standard compression algorithm can nevertheless be used to choose text that resembles a supplied corpus. The distinction matters: the project does not give gzip learned weights, a neural network, or the broad generalization associated with contemporary language models. It exposes an equivalence between prediction and lossless compression, then builds a conditional generator around that equivalence.

The experiment, called GziPT, uses Python's zlib rather than launching a separate gzip process. Barry says the two rely on DEFLATE. DEFLATE searches for repeated byte sequences within a recent 32 KiB window and represents a match as a back-reference when doing so is cheaper than emitting literal bytes. A continuation that repeats or closely echoes material already visible to the compressor can therefore receive a short encoding. That compressed length becomes a score: a candidate producing a smaller encoded file is treated as more predictable from the current context.

This scoring rule follows a standard information-theoretic relationship. If a model assigns probability p to a symbol, an optimal code uses approximately −log₂(p) bits for it. Likely symbols cost fewer bits; surprising symbols cost more. The arXiv paper “Language Modeling Is Compression,” first submitted on September 19, 2023 and revised on March 18, 2024, describes predictive models and lossless compressors as transformable into one another. Its abstract also says the equivalence can be used to construct a conditional generative model from any compressor, including gzip. That is the theoretical opening Barry tests.

Scoring is not the same as generating. Selecting the single next byte with the lowest immediate compressed length performs poorly because gzip reports whole-byte lengths, creating many ties and obscuring the signal. GziPT instead uses beam search over byte sequences. It extends surviving candidates with bytes found in the corpus, compresses each proposed span, retains the beam_width most-compressible partial continuations, and repeats the process for a horizon of bytes. It then commits the best span, or samples among finalists when a positive temperature is set, before beginning again.

Interactive replay of GziPT comparing candidate continuations
A frame from the source replay shows beam search comparing candidate continuations.Screenshot from Nathan Barry, "Can gzip be a language model?"

The replay makes the beam-search step concrete: GziPT scores several possible continuations by compressed length and chooses among the finalists. The source page does not state image-use rights.

The context design is especially revealing. Barry says the scoring context combines the corpus window with only the recent tail of the prompt and generated text. Keeping the full history available would make literal repetition cheap, encouraging the generator to fall into loops. Restricting the tail limits that failure mode, but it also limits coherence: the generator cannot maintain a long argument, plot, or set of constraints. Its apparent knowledge is therefore local and mechanical, not evidence that DEFLATE has acquired an independent representation of language.

The supplied article includes one unedited, 200-byte continuation generated after priming on Tiny Shakespeare and the prompt “MENENIUS:”. The output contains recognizable names and theatrical fragments, but it is not coherent dialogue. Barry characterizes the result as knowing something about the text while not being exactly coherent. That assessment is consistent with the sample, but it remains an author's qualitative evaluation rather than a benchmark result. The packet supplies no perplexity, human rating, comparison against stronger baselines, or controlled study of output quality.

The paper's own abstract says an earlier attempt using this approach performed poorly, while Barry reports that beam search substantially improved generation quality. Those statements should not be collapsed into a claim that gzip now competes with neural language models. The paper evaluates large foundation models primarily as compressors and reports separate compression results for Chinchilla 70B; those results do not validate GziPT's Shakespeare output or establish a ranking among general-purpose text generators.

The practical lesson is conceptual. Compression gives an observable, quantitative way to ask whether a continuation fits patterns already present in a context, and the same machinery can support conditional generation. The limitation is equally important: a compressor rewards compressibility, not truth, usefulness, originality, or semantic understanding. GziPT demonstrates a clever bridge between information theory and generation, but the evidence supports calling it a compression-scored experiment—not a general language model.