dair-ai / dair-ai/Prompt-Engineering-Guide
Answer confidence of Generated Knowledge Prompting
- Dominant language
- MDX
- Stars
- 78.3k
- Forks
- 8.6k
- PR merge metrics
- No merged PRs in 30d
Description
Example of [Generated Knowledge Prompting](https://github.com/dair-ai/Prompt-Engineering-Guide/blob/main/guides/prompts-advanced-usage.md#generated-knowledge-prompting) in the guide of advanced usage of prompt, mentioned **confidence** of answer:
> Answer 1 (confidence very high):
>```
>No, the objective of golf is not to get a higher point total than others. Rather, the objective is to play a set of holes in the least number of strokes. The total number of strokes is used to determine the winner of the game, not the total number of points.
>```
>...
>Answer 2 (confidence is a lot lower):
>```
>Yes, part of golf is trying to get a higher point total than others. Each player tries to complete the course with the lowest score, which is calculated by adding up the total number of strokes taken on each hole. The player with the lowest score wins the game.
>```
How to calculate any answer's confidence ? I checked the paper by [Liu et al. 2022](https://arxiv.org/pdf/2110.08387.pdf), and the confidence's formula from the paper explained part of my question and meanwhile brought me more questions:
>```math
>p_I(a|q) = \frac{exp \, s_I(a|q)}{\sum_{a' \in A_q} exp \, s_I(a'|q) }
>```
>where
>```math
> \, s_I(a|q) = \sum_{i=1}^{|a|} log \, p(a_i|a_{ \textless i}, q),
>```
>and $$a_i$$ is the i-th token of choice a
I can understand that the denominator is kind of normalization factor and what really bothers me is the numerator.
To be more precise, I have two questions about it:
1. It said that _"a_i is the i-th token of choice a "_. What does "token" mean? Is it each word/phrase of the answer?
2. What is $$p(a_i|a_{ \textless i}, q)$$ trying to do?
Does it calculate the probability of the i-th token based on the presence of tokens before it? If so, how to calcaluate this probability?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.