Can gzip be a language model?

(nathan.rs)

95 points | by networked 2 hours ago

10 comments

  • Culonavirus 1 hour ago
    This tracks perfectly with Winrar being more profitable than OpenAI... coincidence? I think not!
    • wolfi1 1 hour ago
      winrar is profitable? sure? well, on the other hand, they sure don't make losses
      • shezi 33 minutes ago
        They are a German GmbH and must publicly state their financials: https://www.northdata.de/win%C2%B7rar%20GmbH,%20Berlin/Amtsg...

        Looks pretty profitable to me.

        • amiga386 23 minutes ago
          They're one of the few companies that actually manage to sell "boxed software" (i.e. has not changed much in years but new customers keep buying it)

          That said, Windows users should use 7-Zip. Better compression format, unpacks more kinds of archives

        • jurgenburgen 23 minutes ago
          That’s surprising. Seems there is a niche for everything.
  • montebicyclelo 28 minutes ago
    This is fun, but historically people have gone a bit overboard with saying that models like this, or n-gram language models, are anywhere close to large neural network models. There is certainly a connection though.
  • GodelNumbering 21 minutes ago
    3blue1brown did a series on this topic: https://www.youtube.com/watch?v=l6DKRf-fAAM https://www.youtube.com/watch?v=GlYgs6v2YfU (i think one more is yet to release)
  • mg 1 hour ago

        give it a normal text prompt, and it
        continues that prompt by searching
        for the byte sequences that compress
        best.
    
    One moment, how are we supposed to know how well that search was done? There is no way to search a meaningful part of the search space.

    So the result only gives us some lower bound of how well gzip works as a "plausibility tester" of a continuation of a text. The space of possible sequences is many orders of magnitude larger than what was searched. So there might be sequences in there that compress much better.

    The text mentions beamsearch, but I don't see a discussion about how well beamsearch performs in finding the global optima when it comes to gzip compressibility of a text?

    • shoo 19 minutes ago
      That's a fair question. Suppose we have a way to find a byte sequence x that globally minimises len(gzip(context + prompt + x)) over all sequences x of length n. Here + denotes string concatenation.

      It's unclear if this is very useful.

      The reason it may not be very useful is that one of Deflate's ingredients is a pass that replaces repeated substrings with backreferences to the earlier occurrence in the plaintext input stream.

      E.g. suppose we want to find an n=200 byte sequence x that minimises len(gzip(context+prompt+x)).

      If there exists any 200 byte sequence y such that prompt+y is a substring of context, then Deflate can encode prompt+y as a backreference to that earlier sequence - it needs to store a match-length & a distance-length, encoded using its Huffman trees. This candidate solution y may not be a global minima to our stated objective function, but if not, it's probably going to be a very good near-optimal approximate solution.

      Taking a step back, repeating huge chunks of the input context produces something that's great for minimising compressed output size but doesn't seem particularly helpful as a generative model.

  • tromp 46 minutes ago
    I'm more interested in the converse question: how well does an LLM perform as a compressor, compared to gzip (ignoring its insanely lower speed)?
    • gkbrk 42 minutes ago
      Top contestant in the Hutter Prize uses a neural network for compression. So fair to say, LLMs would perform pretty well compared to gzip.
      • computably 19 minutes ago
        Even ignoring speed per GP, the Hutter Prize's metric includes the size of the decompressor. LLMs would be disqualified for being larger than 1GB.
    • anax32 10 minutes ago
      hallucinations are lossy compression artefacts
    • asdfsa32 42 minutes ago
      lossless vs lossy is the question.
      • anon48293 9 minutes ago
        How lossy? Because I can lossy compress anything into 0 bits.
  • Tornhoof 50 minutes ago
    Previous discussions of that specific page https://news.ycombinator.com/item?id=48557691
  • mentalgear 30 minutes ago
    Interesting approach, I wonder how this could be used as a classifier. :)
  • bob1029 1 hour ago
    Not without attention or something approximating it.

    The fact that gzip is relatively fast should be your first clue that something important is missing.

    Gzip is great at predicting the next token for one very specific narrative. LLMs can predict next tokens for entire universes of narratives. Searching for the correct next token across this space scales ~quadratically with the input size. Gzip scales linearly. I can gzip a one terabyte file. Imagine feeding that much into an LLM. These are wildly different animals that happen to overlap in a very small way. Equating compression to intelligence looks increasingly silly to me.

    If we must compare language models to compression, they are much more like jpeg and mp3 than they are gzip and flac. I can go fuck with a jpeg file pretty severely at the bitstream level and still have something resembling performance on the other side. Gzip cannot remotely approach this.

    • Retr0id 50 minutes ago
      > Gzip scales linearly. I can gzip a one terabyte file.

      In part because gzip only has a 32KiB window size, and I think it'd be at least quadratic within that window if you were going for optimal compression.

      • bob1029 28 minutes ago
        I'll concede the window part, but Gzip runs within the physical confines of a single cpu core and is typically entirely resident in local caches. The point is not just the quadratic scaling but also what it scales with.

        Show me an LLM that can run at 300 megabytes per second. Even dedicated ASICs with weights burned in will never move this fast.

      • Sesse__ 42 minutes ago
        Match-finding does not need to be quadratic. However, truly optimal gzip block splitting is very slow, indeed.
    • amelius 57 minutes ago
      Perhaps a better question is if LLMs are used as compressors, how well is that expected to work.
      • magicalhippo 47 minutes ago
        > if LLMs are used as compressors, how well is that expected to work

        Quite well. This project[1], by Fabrice Bellard of ffmpeg fame, is quite old in AI years and uses an ancient LLM, but still beats xz by a solid margin.

        [1]: https://bellard.org/ts_zip/

      • Retr0id 49 minutes ago
        Extremely well, aside from speed.
        • bob1029 44 minutes ago
          > aside from speed.

          And energy consumption.

    • fedeb95 25 minutes ago
      I agree, but also equating LLMs with intelligence is wrong.
  • 0x20cowboy 29 minutes ago
    .