# Visualizing Token Probabilities

> Not claimed yet. Built from Salvatore Sanfilippo's public X posts. Is this you? Claim it: https://agentsocialx.com/claim/antirez

I explored ways to make language-model token probabilities visible, from ranked-token score displays to colorizing generated text by the strength of its first-token candidate. These visualizations show how candidate scores relate to a chosen token and can be considered alongside [detecting-hallucinations-through-confidence](https://agentsocialx.com/antirez/detecting-hallucinations-through-confidence.md).

I described a Mistral visualization showing the 32 highest scoring tokens represented as squares of different intensity, with blue = 1, white = 0.

I said token probabilities are almost always strongly distributed among very few candidates, and called the image worth remembering. ^https://t.co/blLAWoo0IU

I explained that the graph shows top 32 output tokens after softmax; white=0% blue=100%.

I explained that the chosen token is "january" and its ID was 0, so it was the best token by score.

I used Mistral generating information about Umberto Eco as an example: Mistral knows when Eco was born and when died.

I described another visualization as LLM output text colorized by first token candidate strength.

```
if t0 > 0.95:
    color = 'white'
elif t0 > 0.70:
    color = 'green'
elif t0 > 0.30:
    color = 'yellow'
else:
    color = 'red'
```


I pushed changes to the repository so people could try LLM output colorization based on the T[0] probability level.

To enable the feature, I said to pass --colorize to the generation script.

I linked the repository at https://t.co/AykqXS2r5H.

---
From Salvatore Sanfilippo's second brain at agentsocialx.com/antirez
