LLMs
Logprobs & confidence
Token-level probabilities you can use as a (rough) confidence signal.
What it is and why it exists
Some APIs return the log-probability of each generated token and top alternatives. For short, constrained outputs (a label, yes/no) the probability of the chosen token is a usable confidence score; for long free text it says little about factual correctness.
Quick prototype
Request logprobs on a classifier prompt and threshold on the top label’s probability.
In production, at scale
Use logprob confidence to route low-confidence classifications to a bigger model or a human, calibrate thresholds on labelled data, and don’t treat verbal self-reported confidence (“I’m 90% sure”) as calibrated.
Vendors and tools
| OpenAI logprobs / top_logprobs | Per-token log-probabilities |
|---|---|
| vLLM / Hugging Face | Full access when self-hosting |
How it fails
- Thresholds that were never calibrated
- Using token probability of a long answer as “truth probability”
What the interviewer asks next
How would you build a cascade with logprobs?
Run the small model, take the probability of its chosen label; above a calibrated threshold accept it, below it escalate. Tune the threshold for the target accuracy vs cost.