https://smalldocs.org/p/perplexity-explained-with-toast-Q0y3...
I liked to it as a stand alone comment as well: https://news.ycombinator.com/item?id=50601525#50603714
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?
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.
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.
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)
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.
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.
During inference, the same learned distribution is used to generate text. Prediction and generation are not mutually exclusive and in fact, the latter relies on the former.
If you didn't know this much, why argue a term is incorrectly used ?
>During training, the model predicts a probablitiy distribution over the next token,
But when the model is taken out of a training context, we might not want to say it is "predicting" the next token as this misleads on the mechanisms involved. It's like the dispute between frequentists and bayesians in probability. If you think of a probability as a frequency analysis, then the probability of a one-off is undefined. We have a more generic term that avoids this dispute, namely credence. What the parent is saying is perhaps we should use the more generic term "generate" in contexts divorced from a ground truth in which to compare the prediction.
>How are lottery numbers an example of something you can attempt to predict, but written text is not
There's a ground truth to what the lottery number will be, whereas in general there is no ground truth to what token comes after some prefix sequence.
Since everything computers do is binary, there is also a ground truth to what a digital "thing"'s next atom will be
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.
Let's say they get to loss = 0. How much of the dataset is incorrect, and how is new knowledge verified and folded in?
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
Perplexity is the degree of surprise the model has in predicting the next token, given 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).