by hazrmard · 1w ago · 0 comments
Perplexity is the degree of surprise the model has in predicting the next token, over a sequence of tokens. At the worst case, perplexity is equal to the size of the vocabulary. At the best case, perplexity is 1.
So, given a sequence of tokens, "e = m c ^ 2", if the p(token | prev tokens) = 1 for every token, perplexity ends up being 1. If, however, it's a random predictor, the p(token | prev tokens) is 1/vocab for every token, and perplexity ends up being len(vocab).
The article plots log(perplexity) on the y-axis, which puts the best case at 0 (i.e. log 1).
Note the best case is not actually zero. If your model had zero log(perplexity) on "A random number from 1 to 10 is ___" it's not doing something useful. See the "Unknown floor" part of the original post.
In practice it is possible to get estimates for the floor assuming your current methodology, for example see Section 6.3 from Scaling Laws for Neural Language Models (2020)
Mathematically the best case is zero.
But you're pointing out that in the real world, setting aside the pure mathematical definition of the outcome, zero is unattainable because it's an illogical outcome.
Zero would be a sign of something fishy rather than improved intelligence. The article, I believe, referred to it as 'fully deterministic being impossible,' or invalid, or something along those lines.
Just clarifying because the parent's mathematical explanation was simple, accurate and clear. Just want to make sure readers are not confused when reading your response.
4th Paragraph
https://smalldocs.org/p/perplexity-explained-with-toast-Q0y3...
I linked to it as a stand alone comment as well: https://news.ycombinator.com/item?id=50601525#50603714
The primary way we measure progress on this key “intelligence substrate” has remained remarkably constant over the years—we have been tracking the perplexity of the models on a held-out dataset.2, 3 Perplexity measures how well a model predicts the next token on average; lower perplexity means better predictions.
This graph shows log(perplexity) it says. So perplexity starts at zero, then gets negative? I notice I am confused. Most plausible: you mean log-perplexity in best case is 1, for no perplexity, i.e. zero?
A helpful comparison: suppose you have a model that always outputs a uniform distribution over K possible tokens (assigning probability 1/K to each one), and that the next token is indeed one of those K options. This model has perplexity K. So, in some sense a perplexity of K is comparable to narrowing down the answer to one of K possibilities. This includes the special case of K=1, which is the best possible model.
Then
> So perplexity [in this graph] starts at [or near] zero, then gets negative?
was correct. Strange that some things are not inverted to be more handy.
Conversly pH/pOH using inverted, then positive numbers, since logs get negative.
(And pH rarly then gets negative, meaning "ten times" when it reaches -1, and that is usually not even taught in school, using 0 and 14 as limits for aqueous solutions there instead.)
pH 0 means something dissociates water at a rate of 10^-0 or 100% - every single molecule of acid converts an H2O to H3O+, so you don't really have that acid any more, you just have H3O+ and they all look the same. You can't measure acidity stronger than pH 0 in water because you're just measuring the maximum acidity of the water itself. For some reason the opposite thing happens for bases at 14.
Different solvents that disassociate can have different bounds, and we can extrapolate values outside of 0-14 by measuring different strong acids against each other in solvents that react with acids less. Like if one acid causes another to dissociate, that one is stronger.
None of the models get a negative perplexity. It's not possible to get a negative perplexity: that would mean you're doing better than predicting the next token with probability 1, which is impossible.
pretraining is where the raw intelligence comes from, emerging merely from predicting the next token as well as possible, hence perplexity is the measure of raw intelligence
what happens after, in post training is more about eliciting this intelligence, and making sure the model will do what we want
Let's say they get to loss = 0. How much of the dataset is incorrect, and how is new knowledge verified and folded in?
I don't understand how that's different from the old "word error rate".
I think "predicting" is a really bad term. It's not predicting anything. You don't get any lottery numbers out, it doesn't predict your future, and it's not predicting what word you were going to type.
It's "choosing" the best token to produce intelligible output. "Choosing" or "selecting" would be much better terms and wouldn't confuse people about what is actually happening.
It's probably too late though as it's become part of the jargon.
What exactly is the prediction? What future events tell it that it made an incorrect prediction and should have chosen another token?
Lottery numbers are a clear example of something you can attempt to predict and that you might get wrong. I would have thought that was obvious?
If you want a more specific term, it dicts not predicts. There is no pre.
The next token in the training data of course. During training, the model predicts a probablitiy distribution over the next token, compares it against the actual token, and updates its weights to minimize prediction error.
>Lottery numbers are a clear example of something you can attempt to predict and that you might get wrong. I would have thought that was obvious?
Yeah so? How are lottery numbers an example of something you can attempt to predict, but written text is not ? In fact, there is something lottery numbers can be expressed as...
The way an LLM generates text is by generating a probability distribution over the possible next tokens, and then you take a sample from the distribution and pick that as the concrete token to generate.