The article explores whether the DEFLATE compression algorithm, utilized by gzip, can function as a language model without neural networks or learned parameters. Based on the principle that compression and prediction are mathematically equivalent—where the bits required to encode a symbol is $-\log_2 p$—the author developed GziPT, a tool that uses a compressor as a scoring mechanism. Instead of training, the model is "primed" by including a corpus within the compressor's 32 KiB sliding window. To generate text, GziPT employs a beam search to overcome the quantization noise caused by the integer-based nature of compressed byte lengths. The algorithm maintains a beam of the most compressible partial sequences, extending them by every byte present in the corpus and scoring them based on the resulting compressed length of the context plus the candidate. By evaluating sequences over a look-ahead horizon rather than selecting single bytes, the system can identify patterns that compress efficiently. While the raw output lacks full coherence, it successfully captures structural elements of the training text, such as Shakespearean dialogue, by leveraging the DEFLATE algorithm's ability to use cheap back-references for recurring byte sequences within its sliding window.

Read original