induwara.lk
induwara.lkAI · OpenAI API

Logit Bias Calculator (OpenAI)

Set a logit_bias from −100 to +100 on any token and watch OpenAI's next-token softmax renormalize in real time — ban a word, force a Yes/No answer, or gently nudge. No API key, no cost, runs in your browser.

By Induwara AshinsanaUpdated Jul 11, 2026
Logit bias visualizer
Reconciles to odds formula ✓
Input mode

Enter each token's base probability; they're normalized to sum to 1, then converted to logits internally.

Scenario preset

The classic four-way answer set with no bias yet — a clean baseline.

Candidate tokens4/8 tokens
Bias0
Bias0
Bias0
Bias0
Most likely token
Yes
50%
Effectively banned
0
tokens near 0%
Top-token share
50%
Contested

Before → after

Yes
50%
No
30%
Maybe
15%
Sure
5%

Token-by-token math

TokenBase probBiasAdj. logit× oddsAdj. probΔ
Yes50%0-0.69×1.0050%0.0 pp
No30%0-1.2×1.0030%0.0 pp
Maybe15%0-1.9×1.0015%0.0 pp
Sure5%0-3×1.005%0.0 pp

logit_bias is added to the logit, then softmax renormalizes. Range −100…+100. .

How it works

OpenAI's logit_bias parameter is a JSON map from token ID to a bias value in the range −100 to +100. That value is added to the token's logit — its raw, pre-softmax score — at every generation step, before sampling. The single most common mistake is to read the bias as a probability change; it is a logit change, and because probability is proportional to e^(logit), the effect is exponential.

  1. Get base logits. If you enter base probabilities p_i, the tool normalizes them to sum to 1 and sets z_i = ln(p_i). Softmax is invariant to an additive constant, so this reproduces your distribution exactly. In raw-logit mode you type z_i directly.
  2. Add the bias. z'_i = z_i + b_i, where b_i ∈ [−100, 100] is that token's logit_bias (0 if you leave it alone).
  3. Renormalize with softmax. p'_i = exp(z'_i) / Σ_j exp(z'_j). To keep exp in range even at ±100, the tool subtracts the maximum adjusted logit first (the log-sum-exp trick) — numerically identical, but no overflow or NaN.
  4. Interpret the result. Adding a bias bmultiplies a token's unnormalized weight by e^b. So b = −100 drives the weight to e⁻¹⁰⁰ ≈ 3.7×10⁻⁴⁴ (an effective ban, per OpenAI's help center), while the surviving tokens keep their relative proportions. b = +100 on one token drives its share to ≈100%.

Because exp(ln(p_i) + b_i) = p_i · e^{b_i}, the tool cross-checks itself two ways: the softmax path above, and an independent "odds" path that computes the weights as p_i · e^{b_i} and normalizes. The badge in the calculator confirms the two agree. Like the AI Temperature & Top-p Visualizer, this tool operates on an example distribution you supply — real per-model logits depend on the model and full context and can only be seen through an API call, which this tool never makes.

Worked examples

A · Nudge with +5 on “No”

Base: Yes 0.50, No 0.30, Maybe 0.15, Sure 0.05

  1. Weights p·e^b: Yes 0.50, No 0.30·e⁵ = 44.524, Maybe 0.15, Sure 0.05
  2. Sum = 45.224
  3. Adjusted: No 98.45%, Yes 1.11%, Maybe 0.33%, Sure 0.11%
  4. A +5 bias pushes “No” from 30% to ~98.5% — the exponential scale.

B · Ban with −100 on “Yes”

Base: Yes 0.50, No 0.30, Maybe 0.15, Sure 0.05

  1. weight(Yes) = 0.50·e⁻¹⁰⁰ ≈ 1.9×10⁻⁴⁴ ≈ 0
  2. Remaining weights {No 0.30, Maybe 0.15, Sure 0.05}, sum 0.50
  3. Renormalize: No 60%, Maybe 30%, Sure 10%, Yes ≈ 0%
  4. Confirms the documented ban + proportional redistribution.

C · Small +1 on “Maybe”

Base: Yes 0.50, No 0.30, Maybe 0.15, Sure 0.05

  1. weight(Maybe) = 0.15·e¹ = 0.407742
  2. Weights: Yes 0.50, No 0.30, Maybe 0.407742, Sure 0.05; sum 1.257742
  3. Adjusted: Yes 39.75%, No 23.85%, Maybe 32.42%, Sure 3.98%
  4. Odds ×e¹ = 2.718 lifts “Maybe” from 15% to ~32.4%.

Frequently asked questions

Sources & references

The logit_bias range and ban/force semantics were last cross-checked against the OpenAI API reference and help center on 2026-07-11. The softmax and e^bodds identity are standard; the worked examples above double as the tool's reconciliation fixtures (tolerance 1e-6).

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.