15 ms·
Lossless Compression of English Short Messages
- api 6y agoThis is just compression with a monster dictionary. It would be faster to just use a giant word and phrase file as such.
- nullc 6y agoGPT-2 is not just a dictionary, it's enormous non-linear function. This compressor gets compression levels which are unachievable with a dictionary. Alas, its arithmetic coder isn't bijective-- so you can't just decompress encrypted input back into english.
- blackbear_ 6y ago> GPT-2 is not just a dictionary, it's enormous non-linear function. Dictionaries are non-linear functions. > This compressor gets compression levels which are unachievable with a dictionary. I don't see why this is the case, care to elaborate?
- croddin 6y agoA dictionary doesn’t give a prediction about what the next word in string will be. GPT-2 does and those predictions can be used so save space.
- cma 6y agoA dictionary of n-grams does, which I think is what he is describing.
- sidarape 6y agoGPT is way better at next-word predictions than n-grams. However, I agree with OP that the resulting compression scheme is probably not very practical all things considered.
- TheRealPomax 6y agoA dictionary of n-grams does not change its probabilities based on "text seen so far", so you'd need an unbounded n. In practice, n-gram dictionaries don't encode for more than very low values of n, so while yes, abstractly we can say that GPT-2 is equivalent to an n-gram dictionary with some high n, those dictionary cannot be constructed, let alone used, leaving the equivalency is purely theoretical. GPT-2 is not a dictionary.
- cma 6y ago>GPT-2 is not a dictionary. I was only responding to the statement that dictionary methods don't give a prediction of the next word in a string will be. I wasn't in any way saying GPT-2 is a dictionary.
- rahimnathwani 6y ago"Alas, its arithmetic coder isn't bijective-- so you can't just decompress encrypted input back into english." OP calls it a lossless encoder. What makes you say it's not bijective?
- djbtkvehvf 6y agoIf it was bijective, any possible string of bytes could be decoded, even a random string. Here's an example of a bijective compression system—one of the first AFAIK: http://www3.sympatico.ca/mt0000/bicom/ http://www3.sympatico.ca/mt0000/bicom/
- nicoburns 6y ago> If it was bijective, any possible string of bytes could be decoded Is that true? Couldn't it is also just have a different output domain. For example the function: f: non-zero positive integers -> even non-zero positive integers f(x) = 2x is bijective.
- snakeboy 6y agoI believe here "bijective" is being used with the implicit assumption that we're talking about the same finite sets, "byte-strings up to a fixed length". From the link on BiCom: > compression with bicom is completely bijective -- any file is a possible bicom output that can be decompressed, and then recompressed back to its original form.
- nicoburns 6y ago"any possible string of bytes could be decoded" still doesn't seem like the right criteria though. Gzipping is lossless/bijective, but an arbitrary byte stream won't necessarily be a valid gzip archive.
- lidjfsljbn 6y agoLossless is not equivalent to bijective. Gzip is not bijective. The definition of bijective compression is that an arbitrary bytestream is valid for decompression. To put it another way: because there are some output files that gzip compression can never create (whatever the input), it's a not surjective function from the set of possible inputs to the set of possible outputs. For this reason it is not bijective.
- jkhdigital 6y agoYes, you can decompress a random string. Might be garbage, but arithmetic coding won’t “fail”.
- nullc 6y agoNot all random strings decompress, also termination is an explicit symbol that can only happen once, so for most random inputs it only consumes a tiny amount of the input.
- seanwilson 6y ago> This is just compression with a monster dictionary. Are there any compression methods based on this? E.g. a browser or OS that ships with huge lists of common words and sentence fragments?
- blackbear_ 6y agoHuffman coding [1] and all derived algorithms do. They find the most common "words" and assign them shorter codes. Language models, among which GPT-2, do essentially the same: they learn what is likely to appear in the text, albeit in a much more elaborated way. [1] https://en.wikipedia.org/wiki/Huffman_coding https://en.wikipedia.org/wiki/Huffman_coding
- seanwilson 6y agoYep, but you have to send the created dictionary to the client. I'm asking if there's compression setups that rely on the client already having a massive dictionary downloaded that's reused to decompress downloads from different sources.
- jhardy54 6y agoBrotli! A few months ago I was looking for strings in random binaries and was very confused when I found that my Node.js binary came with tons of fragments of English and HTML. I looked through the Node.js source on GitHub and was horrified when I didn't see any of the text, so I compiled it from scratch and breathed a sigh of relief when my new binary included the text fragments. Turns out Brotli was included as a dependency, and it ships with a list of common fragments that are frequent enough that they justify hardcoding.
- seanwilson 6y ago> Turns out Brotli was included as a dependency, and it ships with a list of common fragments that are frequent enough that they justify hardcoding. How big? I know from coding word games that typical English word dictionaries only take up around 3MB example.
- Veedrac 6y agoNo it isn't. The encoding is conditional on all previously generated characters in the context window.
- rijoja 6y agoWhat would the size be of the equivalent dictionary to GPT-2?
- liuliu 6y agoThe training data is around 40GiB: https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf https://d4mucfpksywv.cloudfront.net/better-language-models/l... Consider the compression ratio for such text, and you need 2-word / 3-word to 1000-word dictionary, and at 1000-word length, it will be very sparse. I would guess an accelerated structure for such lookup would take around 60GiB. It would require quite a bit of engineering to get it right otherwise can easily blow-up pass that.
- CJefferson 6y agoJust to give a comparisson, this website can compress to about 15% size, the current state of the art compressing English text (for a large chunk of wikipedia) is about the same http://prize.hutter1.net/ http://prize.hutter1.net/ (15%). The hutter prize has the advantage it gets more input, but the disadvantage that you must include the uncompression program (GPT2 is huge, so you wouldn't want to include it).
- nullc 6y agoIt's closer to 11% with the large model. I assume it would be the hutter prize leader if the prizes' challenge were large enough to amortize the model.
- CJefferson 6y agoThe entire of wikipedia's English text is only about 15GB, and GPT-2 is 5GB -- so it couldn't "win". Also, other techniques might get better as size increases.
- xamuel 6y agoEven worse, the Hutter challenge is based on just a 1GB fragment of (one particular snapshot of) English Wikipedia. Further highlighting what has been said elsewhere in this thread, that as far as compression goes this is basically just a variation on compression-via-giant-dictionary
- nullc 6y agoThus the "if the prizes' challenge were large enough". :)
- moultano 6y agoI'd bet that a shallow transformer that was distilled on gpt2, possibly with quantized weights, would easily win. GPT2 isn't optimized for size at all, but there are tons of ways to do so.
- deepzn 6y agoBut, what's the Weissman's score?
- xdavidliu 6y agoTo me, one of the least realistic parts of that series was the reactions of other characters upon learning the Weissman score achieved by Richard Hendricks. Every single character, regardless of their background, upon learning of the score, immediately expressed some variant of "holy shit" or "that can't be possible!". Is there any real-life equivalent that would cause such a universal reaction to "hey, ZZZ achieved an X in Y score!"
- lostmsu 6y agoIQ or SAT tests maybe.
- can16358p 6y agoProbably lower than middle-out.
- josmala 6y agoAlso the compression algorithm seems to be too computationally intensive for poor server to be hammered by Hacker News crowd.
- BuildTheRobots 6y ago> The compression is achieved by using the probability of the next word computed by the GPT-2 language model released by OpenAI. Does this mean that as the model evolves (I assume it's not static) there could be a chance of decompressing a blob of text and having it say something different to the original?
- jerf 6y agoIt is static.
- sdenton4 6y agoYes. Neural compression requires a combination of a model and a compressed message. In the future, my guess is that (some) compression protocols may end up pretty static, and mainly consist of a simple message protocol and a way to check that you've got the correct version of the model for the messages you want to decompress.
- jkhdigital 6y agoThe trained model parameters are effectively the coding dictionary. Changing the parameters is like using Huffman compression but sending a different Huffman tree along with the compressed text—of course it will decompress to something different.
- MiroF 6y ago> I assume it's not static Why? It is static.
- BuildTheRobots 6y agoBecause I naively assumed the strength of an AI model would mean it would evolve to best match/understand your specific input (ala classical custom dictionaries or even just personalised models ala swiftkey) but I've obviously entirely misunderstood what's going on :\
- whimsicalism 6y ago
- tlack 6y agoI'm disappointed he isn't releasing the source for these or LibNC. We definitely need non-academic, non-Python machine learning implementations. Anyone know what's up with that?
- reubenmorais 6y agoTensorFlow and PyTorch fit the bill, their underlying implementations are C++/CUDA/hand-optimized kernels and the APIs are all reachable without Python. They're kind of monsters to deal with in terms of scale, speed of change, weird build systems in the case of TF, but the code is there.
- tlack 6y agoOh definitely true. And they have done a killer job of building out all the bells and whistles and making it all quite fast. But as someone interested in the guts, or understanding how to implement new types of systems, it can be quite overwhelming!
- MiroF 6y ago> I'm disappointed he isn't releasing the source for these or LibNC. Arithmetic coding with LM conditioned probability has been done before and it's not a particularly complex idea to implement, I don't think it is critical that the code be released. > We definitely need non-academic, non-Python machine learning implementations There are two things here: training and serving/inference. We already have non-Python implementations for the latter and I don't think we're in "definite" need of the former.
- TheRealPomax 6y agoAny reason this is based on GPT-2 instead of GPT-3? (Given that the world's been going nuts over 3, I'd imagine its probabilistic model is significantly better)
- OkGoDoIt 6y agoProbably because there’s no way to get access to or run GPT-3 unless you’re super well-connected and lucky, to be allowed to pay OpenAI for the privilege? GPT-3 is exciting in that it shows what’s possible if we push the transformer architecture farther, but it’s not really practical for much when it’s so walled off like it currently is
- jkhdigital 6y agoPreviously posted as https://news.ycombinator.com/item?id=23618465 https://news.ycombinator.com/item?id=23618465
- spiritplumber 6y agoI've done a bit of dictionary compression if anyone has a use for it. https://pastebin.com/CS6JrKQt https://pastebin.com/CS6JrKQt https://robots-everywhere.com/re_wiki/pmwiki.php?n=Main.Words https://robots-everywhere.com/re_wiki/pmwiki.php?n=Main.Word...
- spiritplumber 6y agoFor texts sent in English, it squishes to about 50%.
- MauranKilom 6y ago...which is not exactly great, considering that English text has about 1 bit of information per character (i.e. byte) and should allow compression down to about 12% of the original.