Intuition about the Reader score #3277
-
Hi, in our case, the score is often around 0.005 and I would like to understand what that means. So I found out the the Reader puts out vectors with logits for each token of the input document, predicting if that token is the start or end of the answer. The best and valid ones are then summed and put through the expit function in these lines of code Resources: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, @FabianHertwig just to confirm I believe the score is for the Reader is separately calculated and is provided at this line the in results haystack/haystack/nodes/reader/farm.py Line 1159 in e2e6887 I also noticed that you are referencing an older version of Haystack in this link "in these lines of code" Could you let me know what version of Haystack that you are using? Also the discussion here #193 is a little old and out of date. The answer score is no longer the raw logit by default, but instead, the confidence score that is explained in the blog post you linked. The code for calculating the confidence score is a bit buried but can be found here haystack/haystack/modeling/model/prediction_head.py Lines 524 to 525 in e2e6887 and here haystack/haystack/modeling/model/prediction_head.py Lines 537 to 541 in e2e6887 The basic idea is that the confidence score is a softmax applied on all of the raw logits produced by the model when predicting all potential answers for a single Haystack Document. As mentioned in the blog post a low reader confidence score can still occur (even if the answer is correct) when the data being fed to the model strongly differs from the training data. In this scenario, this means that the raw logits for all possible answers for one Haystack Document are closely grouped together instead of being further spaced apart. This doesn't mean that the model still cannot produce very good results, it just means that the model does not confidently identify the top answer as being much more correct than the other answers. I hope this helps! Please let me know if you have any questions. |
Beta Was this translation helpful? Give feedback.
-
Hello @sjrl, So I propose to include a better and deeper explanation in the documentation... Sorry I'm a little rude, I really appreciate your efforts to make Haystack better every day. 🤗 |
Beta Was this translation helpful? Give feedback.
Hi, @FabianHertwig just to confirm I believe the score is for the Reader is separately calculated and is provided at this line the in results
haystack/haystack/nodes/reader/farm.py
Line 1159 in e2e6887
I also noticed that you are referencing an older version of Haystack in this link "in these lines of code" Could you let me know what version of Haystack that you are using?
Also the discussion here #193 is a little old and out of date. The answer score is no longer the raw logit by default, but instead, the confidence score that is explained in the blog post you linked.
The code for calculating the confid…