Minimum Token Probability#
min_probability
Minimum Token Probability (MTP) uses the minimum among token probabilities for a given response as a confidence score.
Definition#
Minimum token probability is defined as:
where \(t\) iterates over all tokens in response \(y_i\) and \(p_t\) denotes the token probability.
Key Properties:
Identifies the “weakest link” - the least confident token in the response
Robust to long responses with mostly high-confidence tokens
Score range: \([0, 1]\)
How It Works#
Generate a response with logprobs enabled
Extract the probability for each token in the response
Return the minimum probability across all tokens
This scorer is particularly useful for detecting responses where the model is uncertain about specific parts, even if most of the response is generated with high confidence.
Parameters#
When using WhiteBoxUQ, specify "min_probability" in the scorers list.
Example#
from uqlm import WhiteBoxUQ
# Initialize with min_probability scorer
wbuq = WhiteBoxUQ(
llm=llm,
scorers=["min_probability"]
)
# Generate responses and compute scores
results = await wbuq.generate_and_score(prompts=prompts)
# Access the min_probability scores
print(results.to_df()["min_probability"])
References#
Manakul, P., et al. (2023). SelfCheckGPT: Zero-Resource Black-Box Hallucination Detection for Generative Large Language Models. arXiv.
See Also#
WhiteBoxUQ- Main class for white-box uncertainty quantificationLength-Normalized Sequence Probability - Geometric mean of token probabilities
Sequence Probability - Joint probability of all tokens