Calculators
Sequence Perplexity Calculator
Calculate sequence perplexity and mean token surprisal from observed-token probabilities, privately in your browser.
Enter the probability assigned to each observed token, in sequence order, separated by spaces, commas or semicolons. Use 1–10000 values from 0 to 1 and at most 200000 characters. Probabilities are not normalized. Calculation runs locally in your browser.
How sequence perplexity works
Sequence perplexity is exp(−Σ ln(pᵢ) / N), where pᵢ is the probability the model assigned to the token actually observed at position i, conditional on its context. Enter one probability per observed token, not a vocabulary distribution. The inputs are not normalized and need not sum to one. For 0.5, 0.25, 0.125, perplexity is 4, mean negative log probability is ln(4) nats/token, and mean surprisal is 2 bits/token. All-one probabilities give perplexity 1; any exact zero gives infinite perplexity. Smaller values indicate higher assigned probability to this sequence. Compare models only on the same evaluation data, tokenization, and scoring convention; this is not a general measure of output quality. Each token has equal weight. Enter 1–10000 probabilities from 0 to 1 using spaces, commas or semicolons, up to 200000 characters. Scientific notation is accepted; commas separate values rather than thousands. Logarithms and compensated averaging avoid multiplying tiny probabilities. Nonzero probabilities that underflow browser numbers are rejected. If exponentiation exceeds the numeric range, log perplexity remains available. Results use up to 12 significant digits. Processing stays in your browser.
Frequently Asked Questions
Everything you need to know about this tool, how it works, and privacy.
What probabilities should I enter?
Enter the probability assigned to each token actually observed, conditional on its context. Do not enter all vocabulary probabilities for one position.
Are probabilities normalized?
No. Each value belongs to a different token position. Their sum need not be one.
What is an example?
Probabilities 0.5, 0.25 and 0.125 give perplexity 4 and mean surprisal 2 bits per token.
What happens with a zero probability?
An exact zero for an observed token gives infinite perplexity. Tiny nonzero inputs that underflow browser numbers are rejected.
Can I compare different tokenizers?
Per-token perplexity depends on tokenization. Compare scores only with matching evaluation data, tokenization and scoring conventions.
Does the calculator upload my data?
No. All calculations run locally in your browser.