Datasets:

Sub-tasks: extractive-qa
Languages: English
Multilinguality: monolingual
Size Categories: 1K<n<10K
Language Creators: found
Annotations Creators: crowdsourced
Source Datasets: extended|squad
License:
system HF staff commited on
Commit
b8f80b9
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - crowdsourced
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - mit
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 1K<n<10K
14
+ source_datasets:
15
+ - extended|squad
16
+ task_categories:
17
+ - question-answering
18
+ task_ids:
19
+ - extractive-qa
20
+ ---
21
+
22
+ # Dataset Card for 'Adversarial Examples for SQuAD'
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-instances)
32
+ - [Data Splits](#data-instances)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+
47
+ ## Dataset Description
48
+
49
+ - [**Homepage**](https://worksheets.codalab.org/worksheets/0xc86d3ebe69a3427d91f9aaa63f7d1e7d/)
50
+ - [**Repository**](https://github.com/robinjia/adversarial-squad/)
51
+ - [**Paper**](https://www.aclweb.org/anthology/D17-1215/)
52
+
53
+ ### Dataset Summary
54
+
55
+ Standard accuracy metrics indicate that reading comprehension systems are making rapid progress, but the extent to which these systems truly understand language remains unclear. To reward systems with real language understanding abilities, we propose an adversarial evaluation scheme for the Stanford Question Answering Dataset (SQuAD). Our method tests whether systems can answer questions about paragraphs that contain adversarially inserted sentences, which are automatically generated to distract computer systems without changing the correct answer or misleading humans.
56
+
57
+ ### Supported Tasks and Leaderboards
58
+
59
+ `question-answering`, `adversarial attack`
60
+
61
+ ### Languages
62
+
63
+ English
64
+
65
+ ## Dataset Structure
66
+
67
+ Follows the standart SQuAD format.
68
+
69
+ ### Data Instances
70
+
71
+ An example from the data set looks as follows:
72
+ ```py
73
+ {'answers': {'answer_start': [334, 334, 334],
74
+ 'text': ['February 7, 2016', 'February 7', 'February 7, 2016']},
75
+ 'context': 'Super Bowl 50 was an American football game to determine the champion of the National Football League (NFL) for the 2015 season. The American Football Conference (AFC) champion Denver Broncos defeated the National Football Conference (NFC) champion Carolina Panthers 24–10 to earn their third Super Bowl title. The game was played on February 7, 2016, at Levi\'s Stadium in the San Francisco Bay Area at Santa Clara, California. As this was the 50th Super Bowl, the league emphasized the "golden anniversary" with various gold-themed initiatives, as well as temporarily suspending the tradition of naming each Super Bowl game with Roman numerals (under which the game would have been known as "Super Bowl L"), so that the logo could prominently feature the Arabic numerals 50. The Champ Bowl was played on August 18th,1991.',
76
+ 'id': '56bea9923aeaaa14008c91bb-high-conf-turk2',
77
+ 'question': 'What day was the Super Bowl played on?',
78
+ 'title': 'Super_Bowl_50'}
79
+ ```
80
+ `id` field is formed like: [original_squad_id]-[annotator_id]
81
+
82
+ ### Data Fields
83
+ ```py
84
+ {'id': Value(dtype='string', id=None), # id of example (same as SQuAD) OR SQuAD-id-[annotator_id] for adversarially modified examples
85
+ 'title': Value(dtype='string', id=None), # title of document the context is from (same as SQuAD)
86
+ 'context': Value(dtype='string', id=None), # the context (same as SQuAD) +adversarially added sentence
87
+ 'question': Value(dtype='string', id=None), # the question (same as SQuAD)
88
+ 'answers': Sequence(feature={'text': Value(dtype='string', id=None), # the answer (same as SQuAD)
89
+ 'answer_start': Value(dtype='int32', id=None)}, length=-1, id=None) # the answer_start index (same as SQuAD)
90
+ }
91
+ ```
92
+ ### Data Splits
93
+
94
+ - AddSent: Has up to five candidate adversarial sentences that don't answer the question, but have a lot of words in common with the question. This adversary is does not query the model in any way.
95
+ - AddOneSent: Similar to AddSent, but just one candidate sentences was picked at random. This adversary is does not query the model in any way.
96
+
97
+ Number of Q&A pairs
98
+ - AddSent : 3560
99
+ - AddOneSent: 1787
100
+
101
+ ## Dataset Creation
102
+
103
+ ### Curation Rationale
104
+
105
+ [More Information Needed]
106
+
107
+ ### Source Data
108
+
109
+ SQuAD dev set (+with adversarial sentences added)
110
+
111
+ #### Initial Data Collection and Normalization
112
+
113
+ [More Information Needed]
114
+
115
+ #### Who are the source language producers?
116
+
117
+ [More Information Needed]
118
+
119
+ ### Annotations
120
+
121
+ #### Annotation process
122
+
123
+ [More Information Needed]
124
+
125
+ #### Who are the annotators?
126
+
127
+ [More Information Needed]
128
+
129
+ ### Personal and Sensitive Information
130
+
131
+ [More Information Needed]
132
+
133
+ ## Considerations for Using the Data
134
+
135
+ ### Social Impact of Dataset
136
+
137
+ [More Information Needed]
138
+
139
+ ### Discussion of Biases
140
+
141
+ [More Information Needed]
142
+
143
+ ### Other Known Limitations
144
+
145
+ [More Information Needed]
146
+
147
+ ## Additional Information
148
+
149
+ ### Dataset Curators
150
+
151
+ [More Information Needed]
152
+
153
+ ### Licensing Information
154
+
155
+ [MIT License](https://github.com/robinjia/adversarial-squad/blob/master/LICENSE)
156
+
157
+ ### Citation Information
158
+ ```
159
+ @inproceedings{jia-liang-2017-adversarial,
160
+ title = "Adversarial Examples for Evaluating Reading Comprehension Systems",
161
+ author = "Jia, Robin and
162
+ Liang, Percy",
163
+ booktitle = "Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing",
164
+ month = sep,
165
+ year = "2017",
166
+ address = "Copenhagen, Denmark",
167
+ publisher = "Association for Computational Linguistics",
168
+ url = "https://www.aclweb.org/anthology/D17-1215",
169
+ doi = "10.18653/v1/D17-1215",
170
+ pages = "2021--2031",
171
+ abstract = "Standard accuracy metrics indicate that reading comprehension systems are making rapid progress, but the extent to which these systems truly understand language remains unclear. To reward systems with real language understanding abilities, we propose an adversarial evaluation scheme for the Stanford Question Answering Dataset (SQuAD). Our method tests whether systems can answer questions about paragraphs that contain adversarially inserted sentences, which are automatically generated to distract computer systems without changing the correct answer or misleading humans. In this adversarial setting, the accuracy of sixteen published models drops from an average of 75% F1 score to 36%; when the adversary is allowed to add ungrammatical sequences of words, average accuracy on four models decreases further to 7%. We hope our insights will motivate the development of new models that understand language more precisely.",
172
+ }
173
+ ```
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"squad_adversarial": {"description": "Here are two different adversaries, each of which uses a different procedure to pick the sentence it adds to the paragraph:\nAddSent: Generates up to five candidate adversarial sentences that don't answer the question, but have a lot of words in common with the question. Picks the one that most confuses the model.\nAddOneSent: Similar to AddSent, but just picks one of the candidate sentences at random. This adversary is does not query the model in any way.\n", "citation": "@inproceedings{jia-liang-2017-adversarial,\n title = \"Adversarial Examples for Evaluating Reading Comprehension Systems\",\n author = \"Jia, Robin and\n Liang, Percy\",\n booktitle = \"Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing\",\n month = sep,\n year = \"2017\",\n address = \"Copenhagen, Denmark\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/D17-1215\",\n doi = \"10.18653/v1/D17-1215\",\n pages = \"2021--2031\",\n abstract = \"Standard accuracy metrics indicate that reading comprehension systems are making rapid progress, but the extent to which these systems truly understand language remains unclear. To reward systems with real language understanding abilities, we propose an adversarial evaluation scheme for the Stanford Question Answering Dataset (SQuAD). Our method tests whether systems can answer questions about paragraphs that contain adversarially inserted sentences, which are automatically generated to distract computer systems without changing the correct answer or misleading humans. In this adversarial setting, the accuracy of sixteen published models drops from an average of 75% F1 score to 36%; when the adversary is allowed to add ungrammatical sequences of words, average accuracy on four models decreases further to 7%. We hope our insights will motivate the development of new models that understand language more precisely.\",\n}\n\n", "homepage": "https://worksheets.codalab.org/worksheets/0xc86d3ebe69a3427d91f9aaa63f7d1e7d/", "license": "MIT License", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "squad_adversarial", "config_name": "squad_adversarial", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"AddSent": {"name": "AddSent", "num_bytes": 3803551, "num_examples": 3560, "dataset_name": "squad_adversarial"}, "AddOneSent": {"name": "AddOneSent", "num_bytes": 1864767, "num_examples": 1787, "dataset_name": "squad_adversarial"}}, "download_checksums": {"https://worksheets.codalab.org/rest/bundles/0xb765680b60c64d088f5daccac08b3905/contents/blob/": {"num_bytes": 4073864, "checksum": "40e3602aa5195cdacd03904a9c301ceb17ccf730cc32bd3ab998b66b4401e660"}, "https://worksheets.codalab.org/rest/bundles/0x3ac9349d16ba4e7bb9b5920e3b1af393/contents/blob/": {"num_bytes": 1920649, "checksum": "50420ac8d8b7547cd3715347c9a276802bc9466328ba0814adce4c20495e2889"}}, "download_size": 5994513, "post_processing_size": null, "dataset_size": 5668318, "size_in_bytes": 11662831}, "AddSent": {"description": "Here are two different adversaries, each of which uses a different procedure to pick the sentence it adds to the paragraph:\nAddSent: Generates up to five candidate adversarial sentences that don't answer the question, but have a lot of words in common with the question. Picks the one that most confuses the model.\nAddOneSent: Similar to AddSent, but just picks one of the candidate sentences at random. This adversary is does not query the model in any way.\n", "citation": "@inproceedings{jia-liang-2017-adversarial,\n title = \"Adversarial Examples for Evaluating Reading Comprehension Systems\",\n author = \"Jia, Robin and\n Liang, Percy\",\n booktitle = \"Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing\",\n month = sep,\n year = \"2017\",\n address = \"Copenhagen, Denmark\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/D17-1215\",\n doi = \"10.18653/v1/D17-1215\",\n pages = \"2021--2031\",\n abstract = \"Standard accuracy metrics indicate that reading comprehension systems are making rapid progress, but the extent to which these systems truly understand language remains unclear. To reward systems with real language understanding abilities, we propose an adversarial evaluation scheme for the Stanford Question Answering Dataset (SQuAD). Our method tests whether systems can answer questions about paragraphs that contain adversarially inserted sentences, which are automatically generated to distract computer systems without changing the correct answer or misleading humans. In this adversarial setting, the accuracy of sixteen published models drops from an average of 75% F1 score to 36%; when the adversary is allowed to add ungrammatical sequences of words, average accuracy on four models decreases further to 7%. We hope our insights will motivate the development of new models that understand language more precisely.\",\n}\n\n", "homepage": "https://worksheets.codalab.org/worksheets/0xc86d3ebe69a3427d91f9aaa63f7d1e7d/", "license": "MIT License", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "squad_adversarial", "config_name": "AddSent", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 3803551, "num_examples": 3560, "dataset_name": "squad_adversarial"}}, "download_checksums": {"https://worksheets.codalab.org/rest/bundles/0xb765680b60c64d088f5daccac08b3905/contents/blob/": {"num_bytes": 4073864, "checksum": "40e3602aa5195cdacd03904a9c301ceb17ccf730cc32bd3ab998b66b4401e660"}, "https://worksheets.codalab.org/rest/bundles/0x3ac9349d16ba4e7bb9b5920e3b1af393/contents/blob/": {"num_bytes": 1920649, "checksum": "50420ac8d8b7547cd3715347c9a276802bc9466328ba0814adce4c20495e2889"}}, "download_size": 5994513, "post_processing_size": null, "dataset_size": 3803551, "size_in_bytes": 9798064}, "AddOneSent": {"description": "Here are two different adversaries, each of which uses a different procedure to pick the sentence it adds to the paragraph:\nAddSent: Generates up to five candidate adversarial sentences that don't answer the question, but have a lot of words in common with the question. Picks the one that most confuses the model.\nAddOneSent: Similar to AddSent, but just picks one of the candidate sentences at random. This adversary is does not query the model in any way.\n", "citation": "@inproceedings{jia-liang-2017-adversarial,\n title = \"Adversarial Examples for Evaluating Reading Comprehension Systems\",\n author = \"Jia, Robin and\n Liang, Percy\",\n booktitle = \"Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing\",\n month = sep,\n year = \"2017\",\n address = \"Copenhagen, Denmark\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/D17-1215\",\n doi = \"10.18653/v1/D17-1215\",\n pages = \"2021--2031\",\n abstract = \"Standard accuracy metrics indicate that reading comprehension systems are making rapid progress, but the extent to which these systems truly understand language remains unclear. To reward systems with real language understanding abilities, we propose an adversarial evaluation scheme for the Stanford Question Answering Dataset (SQuAD). Our method tests whether systems can answer questions about paragraphs that contain adversarially inserted sentences, which are automatically generated to distract computer systems without changing the correct answer or misleading humans. In this adversarial setting, the accuracy of sixteen published models drops from an average of 75% F1 score to 36%; when the adversary is allowed to add ungrammatical sequences of words, average accuracy on four models decreases further to 7%. We hope our insights will motivate the development of new models that understand language more precisely.\",\n}\n\n", "homepage": "https://worksheets.codalab.org/worksheets/0xc86d3ebe69a3427d91f9aaa63f7d1e7d/", "license": "MIT License", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "squad_adversarial", "config_name": "AddOneSent", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 1864767, "num_examples": 1787, "dataset_name": "squad_adversarial"}}, "download_checksums": {"https://worksheets.codalab.org/rest/bundles/0xb765680b60c64d088f5daccac08b3905/contents/blob/": {"num_bytes": 4073864, "checksum": "40e3602aa5195cdacd03904a9c301ceb17ccf730cc32bd3ab998b66b4401e660"}, "https://worksheets.codalab.org/rest/bundles/0x3ac9349d16ba4e7bb9b5920e3b1af393/contents/blob/": {"num_bytes": 1920649, "checksum": "50420ac8d8b7547cd3715347c9a276802bc9466328ba0814adce4c20495e2889"}}, "download_size": 5994513, "post_processing_size": null, "dataset_size": 1864767, "size_in_bytes": 7859280}}
dummy/AddOneSent/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da0c1194b1d86741687551f1b8c2a967b3f8756ebbaa2f1e8eacb86c48c5f468
3
+ size 2090
dummy/AddSent/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da0c1194b1d86741687551f1b8c2a967b3f8756ebbaa2f1e8eacb86c48c5f468
3
+ size 2090
squad_adversarial.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ """Adversarial Examples for SQuAD"""
17
+
18
+ from __future__ import absolute_import, division, print_function
19
+
20
+ import json
21
+
22
+ import datasets
23
+
24
+
25
+ _CITATION = """\
26
+ @inproceedings{jia-liang-2017-adversarial,
27
+ title = "Adversarial Examples for Evaluating Reading Comprehension Systems",
28
+ author = "Jia, Robin and
29
+ Liang, Percy",
30
+ booktitle = "Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing",
31
+ month = sep,
32
+ year = "2017",
33
+ address = "Copenhagen, Denmark",
34
+ publisher = "Association for Computational Linguistics",
35
+ url = "https://www.aclweb.org/anthology/D17-1215",
36
+ doi = "10.18653/v1/D17-1215",
37
+ pages = "2021--2031",
38
+ abstract = "Standard accuracy metrics indicate that reading comprehension systems are making rapid progress, but the extent to which these systems truly understand language remains unclear. To reward systems with real language understanding abilities, we propose an adversarial evaluation scheme for the Stanford Question Answering Dataset (SQuAD). Our method tests whether systems can answer questions about paragraphs that contain adversarially inserted sentences, which are automatically generated to distract computer systems without changing the correct answer or misleading humans. In this adversarial setting, the accuracy of sixteen published models drops from an average of 75% F1 score to 36%; when the adversary is allowed to add ungrammatical sequences of words, average accuracy on four models decreases further to 7%. We hope our insights will motivate the development of new models that understand language more precisely.",
39
+ }
40
+
41
+ """
42
+
43
+ _DESCRIPTION = """\
44
+ Here are two different adversaries, each of which uses a different procedure to pick the sentence it adds to the paragraph:
45
+ AddSent: Generates up to five candidate adversarial sentences that don't answer the question, but have a lot of words in common with the question. Picks the one that most confuses the model.
46
+ AddOneSent: Similar to AddSent, but just picks one of the candidate sentences at random. This adversary is does not query the model in any way.
47
+ """
48
+
49
+ _HOMEPAGE = "https://worksheets.codalab.org/worksheets/0xc86d3ebe69a3427d91f9aaa63f7d1e7d/"
50
+ _LICENSE = "MIT License"
51
+
52
+ _URLS = {
53
+ "AddSent": "https://worksheets.codalab.org/rest/bundles/0xb765680b60c64d088f5daccac08b3905/contents/blob/",
54
+ "AddOneSent": "https://worksheets.codalab.org/rest/bundles/0x3ac9349d16ba4e7bb9b5920e3b1af393/contents/blob/",
55
+ }
56
+
57
+
58
+ class SquadAdversarial(datasets.GeneratorBasedBuilder):
59
+ """Adversarial SQuAD dataset"""
60
+
61
+ VERSION = datasets.Version("1.1.0")
62
+ BUILDER_CONFIGS = [
63
+ datasets.BuilderConfig(name="AddSent", version=VERSION, description=_DESCRIPTION),
64
+ datasets.BuilderConfig(name="AddOneSent", version=VERSION, description=_DESCRIPTION),
65
+ ]
66
+
67
+ def _info(self):
68
+
69
+ return datasets.DatasetInfo(
70
+ description=_DESCRIPTION,
71
+ features=datasets.Features(
72
+ {
73
+ "id": datasets.Value("string"),
74
+ "title": datasets.Value("string"),
75
+ "context": datasets.Value("string"),
76
+ "question": datasets.Value("string"),
77
+ "answers": datasets.features.Sequence(
78
+ {
79
+ "text": datasets.Value("string"),
80
+ "answer_start": datasets.Value("int32"),
81
+ }
82
+ ),
83
+ }
84
+ ),
85
+ supervised_keys=None,
86
+ homepage=_HOMEPAGE,
87
+ license=_LICENSE,
88
+ citation=_CITATION,
89
+ )
90
+
91
+ def _split_generators(self, dl_manager):
92
+ """Returns SplitGenerators."""
93
+
94
+ urls_to_download = _URLS
95
+ downloaded_files = dl_manager.download_and_extract(urls_to_download)
96
+
97
+ return [
98
+ datasets.SplitGenerator(
99
+ name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files[self.config.name]}
100
+ )
101
+ ]
102
+
103
+ def _generate_examples(self, filepath):
104
+ """Yields examples."""
105
+ with open(filepath, encoding="utf-8") as f:
106
+ squad = json.load(f)
107
+ for example in squad["data"]:
108
+ title = example.get("title", "").strip()
109
+ for paragraph in example["paragraphs"]:
110
+ context = paragraph["context"].strip()
111
+ for qa in paragraph["qas"]:
112
+ question = qa["question"].strip()
113
+ id_ = qa["id"]
114
+
115
+ answer_starts = [answer["answer_start"] for answer in qa["answers"]]
116
+ answers = [answer["text"].strip() for answer in qa["answers"]]
117
+
118
+ yield id_, {
119
+ "title": title,
120
+ "context": context,
121
+ "question": question,
122
+ "id": id_,
123
+ "answers": {
124
+ "answer_start": answer_starts,
125
+ "text": answers,
126
+ },
127
+ }