lm_polygraph.estimators.self_certainty module

class lm_polygraph.estimators.self_certainty.SelfCertainty[source]

Bases: Estimator

Computes a self-certainty metric for language model outputs by estimating the KL divergence between a uniform distribution and the model’s autoregressive token distribution at each position. Returns the negative mean of these divergences. A higher output value indicates higher uncertainty in the model’s predictions.

Reference:

“Scalable Best-of-N Selection for Large Language Models via Self-Certainty” (https://arxiv.org/pdf/2502.18581)