incerto.llm.SelfConsistency#
- class incerto.llm.SelfConsistency[source]#
Bases:
objectSelf-consistency via majority voting across samples.
Generate N samples and measure agreement. Higher agreement indicates lower uncertainty. Proposed by Wang et al. (2023).
- Reference:
Wang et al., “Self-Consistency Improves Chain of Thought Reasoning” ICLR 2023.
- __init__()#
Methods
- static compute(responses, normalize_fn=None)[source]#
Compute self-consistency from multiple responses.
- Parameters:
- Returns:
agreement_rate: Fraction agreeing with majority
entropy: Entropy over response distribution
top_response: Most common response
num_unique: Number of unique responses
- Return type:
Dictionary with