incerto.llm.TokenEntropy# class incerto.llm.TokenEntropy[source]# Bases: object Compute predictive entropy at each token position. Higher entropy indicates higher uncertainty in the model’s prediction for that token. This is the most common token-level uncertainty measure. __init__()# Methods __init__() compute(logits[, dim]) Compute entropy over token distribution. static compute(logits, dim=-1)[source]# Compute entropy over token distribution. Parameters: logits (Tensor) – Token logits of shape (…, vocab_size) dim (int) – Dimension to compute entropy over (default: -1) Return type: Tensor Returns: Entropy values of shape (…,)