Evaluating LLMs: loss, logprob scoring, benchmarks
Score a multiple-choice question either by comparing answer log-probabilities or by generating an answer. Explain what benchmarks like MMLU measure and their pitfalls: contamination, prompt format and saturation.
Builds on: Loss per token and perplexity, Deduplication, memorization and contamination
What the animation says
Loss isn't a grade
Held-out loss tells you how well a model predicts text. It doesn't tell you whether it can answer a chemistry question. And loss can't even be compared across tokenizers. So we use a benchmark: a fixed set of questions with an answer key, scored as accuracy. But the model never says 'B'. It only gives probabilities for the next token. Turning those into 'answered B, correct' is the whole trick.
Two ways to extract an answer
Way one: logprob scoring. Feed the question, then each candidate answer, and ask how probable the model finds that answer's tokens. Pick the most probable. Nothing is generated, so the format can never be wrong. Score the full answer text, or list lettered options and score just the letter after 'Answer'. Way two: generation. The model writes a reply, a pattern pulls out the answer, and it's compared to the key. Here the model replies: 'Probably the second one.' The pattern finds no letter. How is this graded?
The logprob score
Counted wrong. Logprob scoring avoids that problem. Here's its score. For each answer token, take its log probability given the question and earlier answer tokens. Add them up. Each term is zero or below, so every extra token can only lower the sum. What purrs? Answer A, 'dog': one token, minus two. Answer B, 'a house cat': three tokens, minus one point two, minus zero point nine, minus zero point three. With the sum, which answer wins?
Sum vs mean
The sum picks 'dog': minus two beats minus two point four. Wrong, and only because B has more tokens. The fix: length-normalize. Divide each sum by the answer's token count. Dividing by characters instead also takes the tokenizer out of the picture. Here are both divisions. Tap the answer the mean picks.
The method is part of the score
The mean picks the cat: minus zero point eight against minus two. But normalizing can also err, by favouring a long wrong answer. Letter scoring is a third way: list both options and compare the probability of 'A' versus 'B' after 'Answer'. Three valid methods, possibly three different picks. So a score only means something together with its method.
Reading an MMLU score
MMLU: about fourteen thousand four-option questions in fifty-seven subjects, from school to professional level. Chance is twenty-five percent. Contamination: the questions are public, so a model may have trained on them. Prompt format: wording, the number of solved examples, and letter versus text scoring have moved one model by over ten points. Saturation: top models pass ninety percent, and a few percent of keys are wrong, so the last gaps mean little. Two models, two setups. Tap why this gap may say nothing.
Two ways to extract an answer
The logprob score of an answer
Sum vs mean flips the answer
Reading an MMLU score
What to remember
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.
Bytewise
All courses