lm_polygraph.estimators.renyi_neg module
- class lm_polygraph.estimators.renyi_neg.RenyiNeg(verbose: bool = False, alpha: float = 0.5, temperature: float = 2)[source]
Bases:
EstimatorEstimates the sequence-level uncertainty of a language model following the method of “RenyiNeg” as provided in the paper https://arxiv.org/pdf/2212.09171.pdf. Works only with whitebox models (initialized using lm_polygraph.utils.model.WhiteboxModel).
This method calculates the generation Rényi divergence between probability distribution for each token and uniform distribution. Code adapted from https://github.com/icannos/Todd/blob/master/Todd/itscorers.py