-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add QA with wikipedia-dpr-100w-bm25 regression (#1926)
Added BM25 regression experiments that evaluate on the test set of multiple QA datasets, namely Natural Questions, TriviaQA, SQuAD, and WebQuestions using the wikipedia-dpr-100w corpus.
- Loading branch information
1 parent
72f85aa
commit 500e872
Showing
6 changed files
with
375 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# Anserini Regressions: QA with wikipedia-dpr-100w Corpus | ||
|
||
**Models**: BM25 | ||
|
||
This page documents QA regression experiments on the wikipedia-dpr-100w corpus, which is integrated into Anserini's regression testing framework. | ||
|
||
The exact configurations for these regressions are stored in [this YAML file](../src/main/resources/regression/wikipedia-dpr-100w-bm25.yaml). | ||
Note that this page is automatically generated from [this template](../src/main/resources/docgen/templates/wikipedia-dpr-100w-bm25.template) as part of Anserini's regression pipeline, so do not modify this page directly; modify the template instead. | ||
|
||
From one of our Waterloo servers (e.g., `orca`), the following command will perform the complete regression, end to end: | ||
|
||
```bash | ||
python src/main/python/run_regression.py --index --verify --search --convert --regression wikipedia-dpr-100w-bm25 | ||
``` | ||
|
||
## Indexing | ||
|
||
Typical indexing command: | ||
|
||
```bash | ||
target/appassembler/bin/IndexCollection \ | ||
-collection JsonCollection \ | ||
-input /path/to/wikipedia-dpr-100w \ | ||
-index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
-generator DefaultLuceneDocumentGenerator \ | ||
-threads 43 -storeRaw \ | ||
>& logs/log.wikipedia-dpr-100w & | ||
``` | ||
|
||
The directory `/path/to/wikipedia-dpr-100w/`should be a directory containing the wikipedia-dpr-100w passages collection retrieved from [here](https://dl.fbaipublicfiles.com/dpr/wikipedia_split/psgs_w100.tsv.gz). | ||
|
||
For additional details, see explanation of [common indexing options](common-indexing-options.md). | ||
|
||
## Retrieval | ||
|
||
Topics are stored in [`src/main/resources/topics-and-qrels/`](../src/main/resources/topics-and-qrels/). | ||
The regression experiments here evaluate on the test set of multiple QA datasets, namely Natural Questions, TriviaQA, SQuAD, and WebQuestions. | ||
|
||
After indexing has completed, you should be able to perform retrieval as follows: | ||
|
||
```bash | ||
target/appassembler/bin/SearchCollection \ | ||
-index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
-topics src/main/resources/topics-and-qrels/topics.dpr.nq.test.txt \ | ||
-topicreader DprNq \ | ||
-output runs/run.wikipedia-dpr-100w.bm25.topics.dpr.nq.test.txt \ | ||
-bm25 & | ||
target/appassembler/bin/SearchCollection \ | ||
-index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
-topics src/main/resources/topics-and-qrels/topics.dpr.trivia.test.txt \ | ||
-topicreader DprNq \ | ||
-output runs/run.wikipedia-dpr-100w.bm25.topics.dpr.trivia.test.txt \ | ||
-bm25 & | ||
target/appassembler/bin/SearchCollection \ | ||
-index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
-topics src/main/resources/topics-and-qrels/topics.dpr.squad.test.txt \ | ||
-topicreader DprJsonl \ | ||
-output runs/run.wikipedia-dpr-100w.bm25.topics.dpr.squad.test.txt \ | ||
-bm25 & | ||
target/appassembler/bin/SearchCollection \ | ||
-index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
-topics src/main/resources/topics-and-qrels/topics.dpr.wq.test.txt \ | ||
-topicreader DprJsonl \ | ||
-output runs/run.wikipedia-dpr-100w.bm25.topics.dpr.wq.test.txt \ | ||
-bm25 & | ||
target/appassembler/bin/SearchCollection \ | ||
-index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
-topics src/main/resources/topics-and-qrels/topics.nq.test.txt \ | ||
-topicreader DprNq \ | ||
-output runs/run.wikipedia-dpr-100w.bm25.topics.nq.test.txt \ | ||
-bm25 & | ||
``` | ||
|
||
The trec format will need to be converted to DPR's JSON format for evaluation: | ||
```bash | ||
python -m pyserini.eval.convert_trec_run_to_dpr_retrieval_run \ | ||
--index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
--topics dpr-nq-test \ | ||
--input runs/run.wikipedia-dpr-100w.bm25.topics.dpr.nq.test.txt \ | ||
--output runs/run.wikipedia-dpr-100w.bm25.topics.dpr.nq.test.txt.json \ | ||
& | ||
python -m pyserini.eval.convert_trec_run_to_dpr_retrieval_run \ | ||
--index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
--topics dpr-trivia-test \ | ||
--input runs/run.wikipedia-dpr-100w.bm25.topics.dpr.trivia.test.txt \ | ||
--output runs/run.wikipedia-dpr-100w.bm25.topics.dpr.trivia.test.txt.json \ | ||
& | ||
python -m pyserini.eval.convert_trec_run_to_dpr_retrieval_run \ | ||
--index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
--topics dpr-squad-test \ | ||
--input runs/run.wikipedia-dpr-100w.bm25.topics.dpr.squad.test.txt \ | ||
--output runs/run.wikipedia-dpr-100w.bm25.topics.dpr.squad.test.txt.json \ | ||
& | ||
python -m pyserini.eval.convert_trec_run_to_dpr_retrieval_run \ | ||
--index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
--topics dpr-wq-test \ | ||
--input runs/run.wikipedia-dpr-100w.bm25.topics.dpr.wq.test.txt \ | ||
--output runs/run.wikipedia-dpr-100w.bm25.topics.dpr.wq.test.txt.json \ | ||
& | ||
python -m pyserini.eval.convert_trec_run_to_dpr_retrieval_run \ | ||
--index indexes/lucene-index.wikipedia-dpr-100w/ \ | ||
--topics nq-test \ | ||
--input runs/run.wikipedia-dpr-100w.bm25.topics.nq.test.txt \ | ||
--output runs/run.wikipedia-dpr-100w.bm25.topics.nq.test.txt.json \ | ||
& | ||
``` | ||
|
||
Evaluation can be performed using scripts from pyserini: | ||
|
||
```bash | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 20 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.dpr.nq.test.txt.json | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 100 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.dpr.nq.test.txt.json | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 20 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.dpr.trivia.test.txt.json | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 100 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.dpr.trivia.test.txt.json | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 20 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.dpr.squad.test.txt.json | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 100 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.dpr.squad.test.txt.json | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 20 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.dpr.wq.test.txt.json | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 100 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.dpr.wq.test.txt.json | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 20 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.nq.test.txt.json | ||
python -m pyserini.eval.evaluate_dpr_retrieval --topk 100 --retrieval runs/run.wikipedia-dpr-100w.bm25.topics.nq.test.txt.json | ||
``` | ||
|
||
## Effectiveness | ||
|
||
With the above commands, you should be able to reproduce the following results: | ||
|
||
| **top_20_accuracy** | **BM25 (default parameters)**| | ||
|:-------------------------------------------------------------------------------------------------------------|-----------| | ||
| [DPR: Natural Questions Test](https://github.com/facebookresearch/DPR) | 0.6294 | | ||
| [DPR: TriviaQA Test](https://github.com/facebookresearch/DPR) | 0.7641 | | ||
| [DPR: SQuAD Test](https://github.com/facebookresearch/DPR) | 0.7109 | | ||
| [DPR: WebQuestions Test](https://github.com/facebookresearch/DPR) | 0.6240 | | ||
| [EfficientQA: Natural Questions Test](https://efficientqa.github.io/) | 0.6399 | | ||
| **top_100_accuracy** | **BM25 (default parameters)**| | ||
| [DPR: Natural Questions Test](https://github.com/facebookresearch/DPR) | 0.7825 | | ||
| [DPR: TriviaQA Test](https://github.com/facebookresearch/DPR) | 0.8315 | | ||
| [DPR: SQuAD Test](https://github.com/facebookresearch/DPR) | 0.8184 | | ||
| [DPR: WebQuestions Test](https://github.com/facebookresearch/DPR) | 0.7549 | | ||
| [EfficientQA: Natural Questions Test](https://efficientqa.github.io/) | 0.7922 | | ||
|
||
## Reproduction Log[*](reproducibility.md) | ||
|
||
To add to this reproduction log, modify [this template](../src/main/resources/docgen/templates/wikipedia-dpr-100w-bm25.template) and run `bin/build.sh` to rebuild the documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/resources/docgen/templates/wikipedia-dpr-100w-bm25.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Anserini Regressions: QA with wikipedia-dpr-100w Corpus | ||
|
||
**Models**: BM25 | ||
|
||
This page documents QA regression experiments on the wikipedia-dpr-100w corpus, which is integrated into Anserini's regression testing framework. | ||
|
||
The exact configurations for these regressions are stored in [this YAML file](${yaml}). | ||
Note that this page is automatically generated from [this template](${template}) as part of Anserini's regression pipeline, so do not modify this page directly; modify the template instead. | ||
|
||
From one of our Waterloo servers (e.g., `orca`), the following command will perform the complete regression, end to end: | ||
|
||
```bash | ||
python src/main/python/run_regression.py --index --verify --search --convert --regression ${test_name} | ||
``` | ||
|
||
## Indexing | ||
|
||
Typical indexing command: | ||
|
||
```bash | ||
${index_cmds} | ||
``` | ||
|
||
The directory `/path/to/${corpus}/`should be a directory containing the wikipedia-dpr-100w passages collection retrieved from [here](https://dl.fbaipublicfiles.com/dpr/wikipedia_split/psgs_w100.tsv.gz). | ||
|
||
For additional details, see explanation of [common indexing options](common-indexing-options.md). | ||
|
||
## Retrieval | ||
|
||
Topics are stored in [`src/main/resources/topics-and-qrels/`](../src/main/resources/topics-and-qrels/). | ||
The regression experiments here evaluate on the test set of multiple QA datasets, namely Natural Questions, TriviaQA, SQuAD, and WebQuestions. | ||
|
||
After indexing has completed, you should be able to perform retrieval as follows: | ||
|
||
```bash | ||
${ranking_cmds} | ||
``` | ||
|
||
The trec format will need to be converted to DPR's JSON format for evaluation: | ||
```bash | ||
${converting_cmds} | ||
``` | ||
|
||
Evaluation can be performed using scripts from pyserini: | ||
|
||
```bash | ||
${eval_cmds} | ||
``` | ||
|
||
## Effectiveness | ||
|
||
With the above commands, you should be able to reproduce the following results: | ||
|
||
${effectiveness} | ||
|
||
## Reproduction Log[*](reproducibility.md) | ||
|
||
To add to this reproduction log, modify [this template](${template}) and run `bin/build.sh` to rebuild the documentation. |
77 changes: 77 additions & 0 deletions
77
src/main/resources/regression/wikipedia-dpr-100w-bm25.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
corpus: wikipedia-dpr-100w | ||
corpus_path: /store/collections/wikipedia/wikipedia-dpr-100w | ||
|
||
index_path: indexes/lucene-index.wikipedia-dpr-100w/ | ||
collection_class: JsonCollection | ||
generator_class: DefaultLuceneDocumentGenerator | ||
index_threads: 43 | ||
index_options: -storeRaw | ||
index_stats: | ||
documents: 21015324 | ||
documents (non-empty): 21015324 | ||
total terms: 1512973270 | ||
|
||
conversions: | ||
- command: python -m pyserini.eval.convert_trec_run_to_dpr_retrieval_run | ||
params: | ||
in_file_ext: "" | ||
out_file_ext: .json | ||
|
||
metrics: | ||
- metric: top_20_accuracy | ||
command: python -m pyserini.eval.evaluate_dpr_retrieval | ||
params: --topk 20 --retrieval | ||
separator: " " | ||
parse_index: 1 | ||
metric_precision: 4 | ||
can_combine: false | ||
- metric: top_100_accuracy | ||
command: python -m pyserini.eval.evaluate_dpr_retrieval | ||
params: --topk 100 --retrieval | ||
separator: " " | ||
parse_index: 1 | ||
metric_precision: 4 | ||
can_combine: false | ||
|
||
topic_root: src/main/resources/topics-and-qrels/ | ||
qrels_root: | ||
topics: | ||
- name: "[DPR: Natural Questions Test](https://github.com/facebookresearch/DPR)" | ||
id: dpr-nq-test | ||
path: topics.dpr.nq.test.txt | ||
topic_reader: DprNq | ||
- name: "[DPR: TriviaQA Test](https://github.com/facebookresearch/DPR)" | ||
id: dpr-trivia-test | ||
path: topics.dpr.trivia.test.txt | ||
topic_reader: DprNq | ||
- name: "[DPR: SQuAD Test](https://github.com/facebookresearch/DPR)" | ||
id: dpr-squad-test | ||
path: topics.dpr.squad.test.txt | ||
topic_reader: DprJsonl | ||
- name: "[DPR: WebQuestions Test](https://github.com/facebookresearch/DPR)" | ||
id: dpr-wq-test | ||
path: topics.dpr.wq.test.txt | ||
topic_reader: DprJsonl | ||
- name: "[EfficientQA: Natural Questions Test](https://efficientqa.github.io/)" | ||
id: nq-test | ||
path: topics.nq.test.txt | ||
topic_reader: DprNq | ||
|
||
models: | ||
- name: bm25 | ||
display: BM25 (default parameters) | ||
params: -bm25 | ||
results: | ||
top_20_accuracy: | ||
- 0.6294 | ||
- 0.7641 | ||
- 0.7109 | ||
- 0.6240 | ||
- 0.6399 | ||
top_100_accuracy: | ||
- 0.7825 | ||
- 0.8315 | ||
- 0.8184 | ||
- 0.7549 | ||
- 0.7922 |
Oops, something went wrong.