EntityQuestions icon indicating copy to clipboard operation
EntityQuestions copied to clipboard

BM25 text extraction

Open karlstratos opened this issue 4 years ago • 5 comments

The code for text extraction in BM25 seems to incorrectly include the title portion, because hit.raw actually has the string form of the dictionary. The correct extraction code is

json.loads(hit.raw)['contents'][len(title):].strip()

This bug results in a slightly higher recall for BM25 (because answer strings can now be found in the title part included in text). It's a slight but consistent (false) improvement. Please consider updating the results in the paper if this is a legitimate bug. I've created a PR.

karlstratos avatar Dec 16 '21 18:12 karlstratos

Hello,

Thanks so much for checking out our paper and bringing this up! I just finished re-running this locally on my end and indeed it looks like the format of hit.raw is now a dictionary instead of the contents string. Thanks again for bringing this to our attention! I'll go ahead and merge in your PR with the bug fix.

Fortunately, when we originally ran and reported our analysis, hit.raw just contained the concatenated "[title] [text]" string. I re-ran BM25 using the bug-fixed code on all of the relation test sets and confirmed that the numbers we reported are equal to the BM25 numbers I observed.

Thanks again and let me know if there's anything else I can clarify!

cdsciavolino avatar Dec 20 '21 04:12 cdsciavolino

Thanks for looking into this! Just to make sure, could you confirm that you also get the reported 64.5 with BM25 on the NQ test set after this fix? I'll try again, but it seems I tend to get a bit lower number (specifically, 62.7).

karlstratos avatar Dec 22 '21 01:12 karlstratos

I hope you had a wonderful holidays! Just wanted to post an update and say that we haven't forgotten about this.

When I re-ran BM25 on the DPR repo's NQ test set, I indeed get the same 62.7% accuracy you mentioned.

I downloaded our original results used for our reported numbers. There are a couple discrepancies between the questions in our original results and the questions in the re-downloaded file. In the re-downloaded DPR version, the test questions have some artifacts of tokenization (e.g "do n't" instead of "don't"). I'm not sure what caused this (maybe a versioning issue? We downloaded from the DPR repo in mid-2020).

Re-computing the string match for our retrieval results from our reported numbers (--answer_match=string in utils/accuracy.py), we get 63.4%. This is closer, but still slightly different than the numbers we reported in our paper.

Using the same flag with our original DPR-NQ results, it also looks like there's also a small discrepancy (79.8% vs our reported 80.1% on NQ-test and 24.7% vs. our reported 25.4% on P19-test). We're investigating the exact cause of the issue and will post here when we figure it out. We'll also update the numbers in our paper if there are any inconsistencies in our evaluation.

Thanks again for bringing this up!

cdsciavolino avatar Jan 06 '22 23:01 cdsciavolino

Following up with our investigation, I wrote a new has_answer_fn that explicitly includes the title + the text, concatenated with a space. We downloaded our original results and concluded the following:

  • Our BM25 results, which used our has_answer field, did not correctly include the title in the paragraph. Using the new function, BM25 received a small, but relevant bump in retrieval accuracy, around ~0.8%
  • Our DPR results, which used DPR's original has_answer field, did include the title in the passage. Using the function, DPR received nearly the same results, with very minor differences (typically less than 0.2% on a dataset)

Unfortunately, we weren't able to find DPR results for all the tables (specifically, DPR results for table 3 in our paper and our DPR-multi results), and I no longer have the compute resources to re-compute our dense results; however, based on the comparisons to all other DPR results we did have, we don't believe the difference is significant. Additionally, I also want to note that we don't believe the updates have changed any of our final conclusions, specifically around DPR's retrieval biases.

In response, we did the following:

  • Added the new --answer_match string_title option, which will do the "{title} {text}" concatenation, to the GitHub repo
  • Updated our paper results to use the new BM25 results (text + title has_answer fn) and the original DPR results (which uses DPR's has_answer fn). Both should consistently use the "{title} {text}" concatenation as the answer corpus.

Thanks again for bringing this up!

cdsciavolino avatar Feb 24 '22 13:02 cdsciavolino

I see, thanks a lot for addressing this issue! I agree the issue/update doesn't change your conclusions.

karlstratos avatar Mar 04 '22 03:03 karlstratos