incerto.llm.TokenConfidence#

class incerto.llm.TokenConfidence[source]#

Bases: object

Maximum softmax probability at each token position.

The probability assigned to the most likely token. Lower values indicate higher uncertainty.

__init__()#

Methods

__init__()

compute(logits[, dim])

Compute max softmax probability.

static compute(logits, dim=-1)[source]#

Compute max softmax probability.

Parameters:
  • logits (Tensor) – Token logits of shape (…, vocab_size)

  • dim (int) – Dimension to compute over (default: -1)

Return type:

Tensor

Returns:

Max probabilities of shape (…,)