What are logprobs?
When a large model picks its next token, it actually holds a candidate list in its head — every possible next word has a probability. Logprobs are the log-scale version of that distribution. In short, they're the raw record of how confident the model is.Why take the log?
Raw probabilities underflowGenerating a sentence means multiplying lots of tiny probabilities, and they shrink until a computer can't represent them. Taking logs turns multiplication into addition, which is far more stable.
Logs are easier to read
Logprobs are usually negative: closer to 0 means more confident, more negative means less. One glance tells you which word the model is sure about and which it's guessing.
What are they good for?
Measuring uncertaintyPerplexity is computed from logprobs — a key signal for whether a model is about to hallucinate.
Calibration and sampling
Temperature and top-p sampling all sit on top of this probability distribution; many sampling strategies tweak it directly.
Practical engineering
Detecting hallucinations, scoring multiple-choice confidence, and judging whether an answer is trustworthy often start from logprobs.
How do you get them?
Many APIs expose a logprobs parameter — turn it on and you get back the log probability of every generated token, ready for downstream decisions. It's the window that shows you the model's hidden hand.Bottom line: logprobs are the markings on the model's internal scale — they tell you how sure it is about each word.
Comments