Views
No views yet

Flan-PaLM 540B achieves state-of-the-art performance on several benchmarks, such as 75.2% on five-shot MMLU. We also publicly release Flan-T5 checkpoints,1 which achieve strong few-shot performance even compared to much larger models, such as PaLM 62B. Overall, instruction finetuning is a general method for improving the performance and usability of pretrained language models.
transformers:1
2from transformers import T5Tokenizer, T5ForConditionalGeneration
3
4tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
5model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl")
6
7input_text = "translate English to German: How old are you?"
8input_ids = tokenizer(input_text, return_tensors="pt").input_ids
9
10outputs = model.generate(input_ids)
11print(tokenizer.decode(outputs[0]))1# pip install accelerate
2from transformers import T5Tokenizer, T5ForConditionalGeneration
3
4tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
5model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto")
6
7input_text = "translate English to German: How old are you?"
8input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
9
10outputs = model.generate(input_ids)
11print(tokenizer.decode(outputs[0]))1# pip install accelerate
2import torch
3from transformers import T5Tokenizer, T5ForConditionalGeneration
4
5tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
6model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", torch_dtype=torch.float16)
7
8input_text = "translate English to German: How old are you?"
9input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
10
11outputs = model.generate(input_ids)
12print(tokenizer.decode(outputs[0]))1# pip install bitsandbytes accelerate
2from transformers import T5Tokenizer, T5ForConditionalGeneration
3
4tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xxl")
5model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xxl", device_map="auto", load_in_8bit=True)
6
7input_text = "translate English to German: How old are you?"
8input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")
9
10outputs = model.generate(input_ids)
11print(tokenizer.decode(outputs[0]))The primary use is research on language models, including: research on zero-shot NLP tasks and in-context few-shot learning NLP tasks, such as reasoning, and question answering; advancing fairness and safety research, and understanding limitations of current large language models
Language models, including Flan-T5, can potentially be used for language generation in a harmful way, according to Rae et al. (2021). Flan-T5 should not be used directly in any application, without a prior assessment of safety and fairness concerns specific to the application.
Flan-T5 is fine-tuned on a large corpus of text data that was not filtered for explicit content or assessed for existing biases. As a result the model itself is potentially vulnerable to generating equivalently inappropriate content or replicating inherent biases in the underlying data.
Flan-T5 has not been tested in real world applications.
Flan-T5 should not be applied for any unacceptable use cases, e.g., generation of abusive speech.

These models are based on pretrained T5 (Raffel et al., 2020) and fine-tuned with instructions for better zero-shot and few-shot performance. There is one fine-tuned Flan model per T5 model size.

1@misc{https://doi.org/10.48550/arxiv.2210.11416,
2 doi = {10.48550/ARXIV.2210.11416},
3
4 url = {https://arxiv.org/abs/2210.11416},
5
6 author = {Chung, Hyung Won and Hou, Le and Longpre, Shayne and Zoph, Barret and Tay, Yi and Fedus, William and Li, Eric and Wang, Xuezhi and Dehghani, Mostafa and Brahma, Siddhartha and Webson, Albert and Gu, Shixiang Shane and Dai, Zhuyun and Suzgun, Mirac and Chen, Xinyun and Chowdhery, Aakanksha and Narang, Sharan and Mishra, Gaurav and Yu, Adams and Zhao, Vincent and Huang, Yanping and Dai, Andrew and Yu, Hongkun and Petrov, Slav and Chi, Ed H. and Dean, Jeff and Devlin, Jacob and Roberts, Adam and Zhou, Denny and Le, Quoc V. and Wei, Jason},
7
8 keywords = {Machine Learning (cs.LG), Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
9
10 title = {Scaling Instruction-Finetuned Language Models},
11
12 publisher = {arXiv},
13
14 year = {2022},
15
16 copyright = {Creative Commons Attribution 4.0 International}
17}