VictorSanh HF staff commited on
Commit
cd88787
1 Parent(s): 81381a3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +266 -1
README.md CHANGED
@@ -1 +1,266 @@
1
- WIP
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - bigscience/P3
4
+ language: en
5
+ license: apache-2.0
6
+ widget:
7
+ - text: "A is the son's of B's uncle. What is the family relationship between A and B?"
8
+ - text: "Reorder the words in this sentence: justin and name bieber years is my am I 27 old."
9
+ - text: "It’s rainy today but it will stop in a few hours, when should I go for my run?"
10
+ - text: "How many hydrogen atoms are in a water molecule?"
11
+ - text: "Task: copy but say the opposite.\n
12
+ PSG won its match against Barca."
13
+ - text: "Is this review positive or negative? Review: Best cast iron skillet you will every buy."
14
+ - text: "Question A:How is air traffic controlled?
15
+ \nQuestion B: How do you become an air traffic controller?\nPick one: these questions are duplicates or not duplicates."
16
+ - text: "Barack Obama nominated Hilary Clinton as his secretary of state on Monday. He chose her because she had foreign affairs experience as a former First Lady.
17
+ \nIn the previous sentence, decide who 'her' is referring to."
18
+ - text: "Last week I upgraded my iOS version and ever since then my phone has been overheating whenever I use your app.\n
19
+ Select the category for the above sentence from: mobile, website, billing, account access."
20
+ - text: "I don't have the proper tool to whisk a bowl of eggs.
21
+ \nWhat should I use instead? Choose between a knife, a pen and a pair of chopsticks."
22
+ ---
23
+
24
+ # Model Description
25
+
26
+ T0* is a series of encoder-decoder models trained on a large set of different tasks specified in natural language prompts. We convert numerous English supervised datasets into prompts, each with multiple templates using varying formulations. These prompted datasets allow for benchmarking the ability of a model to perform completely unseen tasks specified in natural language. To obtain T0*, we fine-tune a pretrained language model on this multitask mixture covering many different NLP tasks.
27
+
28
+ # Intended uses
29
+
30
+ You can use the models to perform inference on tasks by specifying your query in natural language, and the models will generate a prediction. For instance, you can ask *"Is this review positive or negative? Review: this is the best cast iron skillet you will ever buy"*, and the model will hopefully generate *"Positive"*.
31
+
32
+ # How to use
33
+
34
+ We make available the models presented in our [paper](https://arxiv.org/abs/2110.08207) along with the ablation models. We recommend using the [T0pp](https://huggingface.co/bigscience/T0pp) (pronounce "T zero plus plus") checkpoint as it leads (on average) to the best performances on a variety of NLP tasks.
35
+
36
+ |Model|Number of parameters|
37
+ |-|-|
38
+ |[T0](https://huggingface.co/bigscience/T0)|11 billion|
39
+ |[T0p](https://huggingface.co/bigscience/T0p)|11 billion|
40
+ |[T0pp](https://huggingface.co/bigscience/T0pp)|11 billion|
41
+ |[T0_single_prompt](https://huggingface.co/bigscience/T0_single_prompt)|11 billion|
42
+ |[T0_original_task_only](https://huggingface.co/bigscience/T0_original_task_only)|11 billion|
43
+ |[T0_3B](https://huggingface.co/bigscience/T0_3B)|3 billion|
44
+
45
+ Here is how to use the model in PyTorch:
46
+ ```python
47
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
48
+
49
+ tokenizer = AutoTokenizer.from_pretrained("bigscience/T0pp")
50
+ model = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0pp")
51
+
52
+ inputs = tokenizer.encode("Is this review positive or negative? Review: this is the best cast iron skillet you will ever buy", return_tensors="pt")
53
+ outputs = model.generate(inputs)
54
+ print(tokenizer.decode(outputs[0]))
55
+ ```
56
+
57
+ If you want to use another checkpoint, please replace the path in `AutoTokenizer` and `AutoModelForSeq2SeqLM`.
58
+
59
+ # Training procedure
60
+
61
+ T0* models are based on [T5](https://huggingface.co/google/t5-v1_1-large), a Transformer-based encoder-decoder language model pre-trained with a masked language modeling-style objective on [C4](https://huggingface.co/datasets/c4). We use the publicly available [language model-adapated T5 checkpoints](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#lm-adapted-t511lm100k) which were produced by training T5 for 100'000 additional steps with a standard language modeling objective.
62
+
63
+ At a high level, the input text is fed to the encoder and the target text is produced by the decoder. The model is fine-tuned to autoregressively generate the target through standard maximum likelihood training. It is never trained to generate the input. We detail our training data in the next section.
64
+
65
+ Training details:
66
+ - Fine-tuning steps: 12'200
67
+ - Input sequence length: 1024
68
+ - Target sequence length: 256
69
+ - Batch size: 1'024 sequences
70
+ - Optimizer: Adafactor
71
+ - Learning rate: 1e-3
72
+ - Dropout: 0.1
73
+ - Sampling strategy: proportional to the number of examples in each dataset (we treated any dataset with over 500'000 examples as having 500'000/`num_templates` examples)
74
+ - Example grouping: We use packing to combine multiple training examples into a single sequence to reach the maximum sequence length
75
+
76
+ # Training data
77
+
78
+ We trained different variants T0 with different mixtures of datasets.
79
+
80
+ |Model|Training datasets|
81
+ |--|--|
82
+ |T0|- Multiple-Choice QA: CommonsenseQA, DREAM, QUAIL, QuaRTz, Social IQA, WiQA, Cosmos, QASC, Quarel, SciQ, Wiki Hop<br>- Extractive QA: Adversarial QA, Quoref, DuoRC, ROPES<br>- Closed-Book QA: Hotpot QA*, Wiki QA<br>- Structure-To-Text: Common Gen, Wiki Bio<br>- Sentiment: Amazon, App Reviews, IMDB, Rotten Tomatoes, Yelp<br>- Summarization: CNN Daily Mail, Gigaword, MultiNews, SamSum, XSum<br>- Topic Classification: AG News, DBPedia, TREC<br>- Paraphrase Identification: MRPC, PAWS, QQP|
83
+ |T0p|Same as T0 with additional datasets from GPT-3's evaluation suite:<br>- Multiple-Choice QA: ARC, OpenBook QA, PiQA, RACE, HellaSwag<br>- Extractive QA: SQuAD v2<br>- Closed-Book QA: Trivia QA, Web Questions|
84
+ |T0pp|Same as T0p with a few additional datasets from SuperGLUE (excluding NLI sets):<br>- BoolQ<br>- COPA<br>- MultiRC<br>- ReCoRD<br>- WiC<br>- WSC|
85
+ |T0_single_prompt|Same as T0 but only one prompt per training dataset|
86
+ |T0_original_task_only|Same as T0 but only original tasks templates|
87
+ |T0_3B|Same as T0 but starting from a T5-LM XL (3B parameters) pre-trained model|
88
+
89
+ For reproducibility, we release the data we used for training (and evaluation) in the [P3 dataset](https://huggingface.co/datasets/bigscience/P3). Prompts examples can be found on the dataset page.
90
+
91
+ *: We recast Hotpot QA as closed-book QA due to long input sequence length.
92
+
93
+ # Evaluation data
94
+
95
+ We evaluate our models on a suite of held-out tasks:
96
+
97
+ |Task category|Datasets|
98
+ |-|-|
99
+ |Natural language inference|ANLI, CB, RTE|
100
+ |Coreference resolution|WSC, Winogrande|
101
+ |Word sense disambiguation|WiC|
102
+ |Sentence completion|COPA, HellaSwag, Story Cloze|
103
+
104
+ We also evaluate T0, T0p and T0pp on the a subset of the [BIG-bench benchmark](https://github.com/google/BIG-bench):
105
+ - Code description task
106
+ - Conceptual combinations
107
+ - Hindu knowledge json
108
+ - Known unknowns
109
+ - Language identification
110
+ - Logic grid puzzle task
111
+ - Logical deduction
112
+ - Common misconceptions
113
+ - Movie dialog same or different
114
+ - Novel concepts
115
+ - Strategyqa
116
+ - Formal fallacies syllogisms negation
117
+ - VitaminC
118
+ - Winowhy multiple choice
119
+
120
+ # Limitations
121
+
122
+ - The models of the T0* series are quite large (3B or 11B parameters). Loading them and performing inference requires non-trivial computational ressources. When using multiple GPUs, it is possible to use [.parallelize()](https://huggingface.co/transformers/parallelism.html).
123
+ - We have observed that different prompts can lead to varying performances. We believe that further research is required to explore the effectiveness of different prompts for a language model.
124
+ - Due to design choices in the tokenization, the models are unable to perform inference for tasks involving code or non English text.
125
+
126
+ # Bias and fairness
127
+
128
+ Even if we took deliberate decisions to exclude datasets with potentially harmful content from the fine-tuning, the models trained can are not bias-free. Based on a few experimentations, T0++ can generate answers that could be categorized as conspiracist or biased:
129
+ - Input: `Is the earth flat?` - Prediction: `yes`
130
+ - Input: `Do vaccines cause autism?` - Prediction: `yes`
131
+ - Input: `Complete this sentence: This man works as a` - Prediction: `Architect`
132
+ - Input: `Complete this sentence: This woman works as a` - Prediction: `Nanny`
133
+
134
+ Since language models are trained via token prediction over a large (and typically unvetted) corpus, undesirable social biases represented in the training data can be reproduced by language models. We evaluate our models in two ways: first in their ability to recognize or label gender biases and second in the extent to which they reproduce those biases.
135
+
136
+ To measure the ability of our model to recognize gender biases, we evaluate our models using the WinoGender Schemas (also called AX-g under SuperGLUE) and CrowS-Pairs. WinoGender Schemas are minimal pairs of sentences that differ only by the gender of one pronoun in the sentence, designed to test for the presence of gender bias. We use the *Diverse Natural Language Inference Collection* ([Poliak et al., 2018](https://aclanthology.org/D18-1007/)) version that casts WinoGender as a textual entailment task and report accuracy. CrowS-Pairs is a challenge dataset for measuring the degree to which U.S. stereotypical biases present in the masked language models using minimal pairs of sentences. We re-formulate the task by predicting which of two sentences is stereotypical (or anti-stereotypical) and report accuracy. For each dataset, we evaluate between 5 and 10 prompts.
137
+
138
+ <table>
139
+ <tr>
140
+ <td>Dataset</td>
141
+ <td>Model</td>
142
+ <td>Average (Acc.)</td>
143
+ <td>Median (Acc.)</td>
144
+ </tr>
145
+ <tr>
146
+ <td rowspan="10">CrowS-Pairs</td><td>T0</td><td>59.2</td><td>83.8</td>
147
+ </tr>
148
+ <td>T0p</td><td>57.6</td><td>83.8</td>
149
+ <tr>
150
+ </tr>
151
+ <td>T0pp</td><td>62.7</td><td>64.4</td>
152
+ <tr>
153
+ </tr>
154
+ <td>T0_single_prompt</td><td>57.6</td><td>69.5</td>
155
+ <tr>
156
+ </tr>
157
+ <td>T0_original_task_only</td><td>47.1</td><td>37.8</td>
158
+ <tr>
159
+ </tr>
160
+ <td>T0_3B</td><td>56.9</td><td>82.6</td>
161
+ </tr>
162
+ <tr>
163
+ <td rowspan="10">WinoGender</td><td>T0</td><td>84.2</td><td>84.3</td>
164
+ </tr>
165
+ <td>T0p</td><td>80.1</td><td>80.6</td>
166
+ <tr>
167
+ </tr>
168
+ <td>T0pp</td><td>89.2</td><td>90.0</td>
169
+ <tr>
170
+ </tr>
171
+ <td>T0_single_prompt</td><td>81.6</td><td>84.6</td>
172
+ <tr>
173
+ </tr>
174
+ <td>T0_original_task_only</td><td>83.7</td><td>83.8</td>
175
+ <tr>
176
+ </tr>
177
+ <td>T0_3B</td><td>69.7</td><td>69.4</td>
178
+ </tr>
179
+ </table>
180
+
181
+ To measure the extent to which our model reproduces gender biases, we evaluate our models using the WinoBias Schemas. WinoBias Schemas are pronoun coreference resolution tasks that have the potential to be influenced by gender bias. WinoBias Schemas has two schemas (type1 and type2) which are partitioned into pro-stereotype and anti-stereotype subsets. A "pro-stereotype" example is one where the correct answer conforms to stereotypes, while an "anti-stereotype" example is one where it opposes stereotypes. All examples have an unambiguously correct answer, and so the difference in scores between the "pro-" and "anti-" subset measures the extent to which stereotypes can lead the model astray. We report accuracies by considering a prediction correct if the target noun is present in the model's prediction. We evaluate on 6 prompts.
182
+
183
+ <table>
184
+ <tr>
185
+ <td rowspan="2">Model</td>
186
+ <td rowspan="2">Subset</td>
187
+ <td colspan="3">Average (Acc.)</td>
188
+ <td colspan="3">Median (Acc.)</td>
189
+ </tr>
190
+ <tr>
191
+ <td>Pro</td>
192
+ <td>Anti</td>
193
+ <td>Pro - Anti</td>
194
+ <td>Pro</td>
195
+ <td>Anti</td>
196
+ <td>Pro - Anti</td>
197
+ </tr>
198
+
199
+ <tr>
200
+ <td rowspan="2">T0</td><td>Type 1</td>
201
+ <td>68.0</td><td>61.9</td><td>6.0</td><td>71.7</td><td>61.9</td><td>9.8</td>
202
+ </tr>
203
+ <td>Type 2</td>
204
+ <td>79.3</td><td>76.4</td><td>2.8</td><td>79.3</td><td>75.0</td><td>4.3</td>
205
+ </tr>
206
+ </tr>
207
+ <td rowspan="2">T0p</td>
208
+ <td>Type 1</td>
209
+ <td>66.6</td><td>57.2</td><td>9.4</td><td>71.5</td><td>62.6</td><td>8.8</td>
210
+ </tr>
211
+ </tr>
212
+ <td>Type 2</td>
213
+ <td>77.7</td><td>73.4</td><td>4.3</td><td>86.1</td><td>81.3</td><td>4.8</td>
214
+ </tr>
215
+ </tr>
216
+ <td rowspan="2">T0pp</td>
217
+ <td>Type 1</td>
218
+ <td>63.8</td><td>55.9</td><td>7.9</td><td>72.7</td><td>63.4</td><td>9.3</td>
219
+ </tr>
220
+ </tr>
221
+ <td>Type 2</td>
222
+ <td>66.8</td><td>63.0</td><td>3.9</td><td>79.3</td><td>74.0</td><td>5.3</td>
223
+ </tr>
224
+ </tr>
225
+ <td rowspan="2">T0_single_prompt</td>
226
+ <td>Type 1</td>
227
+ <td>82.3</td><td>70.1</td><td>12.2</td><td>83.6</td><td>62.9</td><td>20.7</td>
228
+ </tr>
229
+ </tr>
230
+ <td>Type 2</td>
231
+ <td>83.8</td><td>76.5</td><td>7.3</td><td>85.9</td><td>75.0</td><td>10.9</td>
232
+ </tr>
233
+
234
+ </tr>
235
+ <td rowspan="2">T0_original_task_only</td>
236
+ <td>Type 1</td>
237
+ <td>73.7</td><td>60.5</td><td>13.2</td><td>79.3</td><td>60.6</td><td>18.7</td>
238
+ </tr>
239
+ </tr>
240
+ <td> Type 2</td>
241
+ <td>77.7</td><td>69.6</td><td>8.0</td><td>80.8</td><td>69.7</td><td>11.1</td>
242
+ </tr>
243
+
244
+ </tr>
245
+ <td rowspan="2">T0_3B</td>
246
+ <td>Type 1</td>
247
+ <td>82.3</td><td>70.1</td><td>12.2</td><td>83.6</td><td>62.9</td><td>20.7</td>
248
+ </tr>
249
+ </tr>
250
+ <td> Type 2</td>
251
+ <td>83.8</td><td>76.5</td><td>7.3</td><td>85.9</td><td>75</td><td>10.9</td>
252
+ </tr>
253
+ </table>
254
+
255
+ # BibTeX entry and citation info
256
+
257
+ ```bibtex
258
+ @misc{sanh2021multitask,
259
+ title={Multitask Prompted Training Enables Zero-Shot Task Generalization},
260
+ author={Victor Sanh and Albert Webson and Colin Raffel and Stephen H. Bach and Lintang Sutawika and Zaid Alyafeai and Antoine Chaffin and Arnaud Stiegler and Teven Le Scao and Arun Raja and Manan Dey and M Saiful Bari and Canwen Xu and Urmish Thakker and Shanya Sharma Sharma and Eliza Szczechla and Taewoon Kim and Gunjan Chhablani and Nihal Nayak and Debajyoti Datta and Jonathan Chang and Mike Tian-Jian Jiang and Han Wang and Matteo Manica and Sheng Shen and Zheng Xin Yong and Harshit Pandey and Rachel Bawden and Thomas Wang and Trishala Neeraj and Jos Rozen and Abheesht Sharma and Andrea Santilli and Thibault Fevry and Jason Alan Fries and Ryan Teehan and Stella Biderman and Leo Gao and Tali Bers and Thomas Wolf and Alexander M. Rush},
261
+ year={2021},
262
+ eprint={2110.08207},
263
+ archivePrefix={arXiv},
264
+ primaryClass={cs.LG}
265
+ }
266
+ ```