incerto.llm.PredictiveEntropy#

class incerto.llm.PredictiveEntropy[source]#

Bases: object

Predictive entropy across multiple sampled sequences.

Average the probability distributions from multiple samples and compute entropy. Higher values indicate disagreement.

__init__()#

Methods

__init__()

compute(logit_samples)

Compute predictive entropy from multiple samples.

static compute(logit_samples)[source]#

Compute predictive entropy from multiple samples.

Parameters:

logit_samples (List[Tensor]) – List of logit tensors, each of shape (seq_len, vocab_size) or (vocab_size,)

Return type:

Tensor

Returns:

Predictive entropy (scalar or per-position)