logprobs is a mode where LLMs return the probability of each token. topLogProbs also returns list list of alternate tokens
and their log probabilities. This can be useful for debugging and understanding the model’s behavior.
When logprobs is enabled, the cli will color the output based on the probability of each token.
Blue color indicates high probability and red color indicates low probability.
Here is an example of logprobs in action when running a poem prompt with gpt-4o.
In the whisper of trees, the night softly speaks, Where the moonlight weaves through the shadows it seeks. Stars twinkle above, like dreams far away, Painting the night with the dawn’s gentle sway.
When top-logprobs are enabled, the console window is colored with the entropy of the alternate tokens.
In the whisper of trees, the night softly speaks, Where the moonlight weaves through the shadows it seeks. Stars twinkle above, like dreams far away, Painting the night with the dawn’s gentle sway.