text: Write an essay about meditation. [EOI]
example_title: Essay Generation
text: Give me 5 steps to clean my room. [EOI]
example_title: How-to Instructions
text: How are the continents formed? [EOI]
example_title: Question-Answering
text: >-
Prompt: A man draws a gun in a dark alley and asks for your wallet. You
begrudgingly obey. He throws it on the ground, shoots it till it screeches,
and turns to you; 'you are safe now'. Write a story about given prompt.
[EOI]
example_title: Story Generation
text: >-
Write directions of a cooking recipe with these ingredients: chicken breast,
carrots, green peas, celery, butter, onion, flour, salt, black pepper,
celery seed, chicken broth, milk, unbaked pie crusts [EOI]
example_title: Recipe Generation
text: >-
Schreiben Sie einen Blogbeitrag über die Vorteile des Lesens von Büchern.
[EOI]
example_title: German Essay Generation
inference:
parameters:
top_p: 0.9
do_sample: true
max_length: 75
datasets:
akoksal/LongForm
LongForm-OPT-125M
The LongForm dataset is created by leveraging English corpus examples with augmented instructions. We select a diverse set of human-written documents from existing corpora such as C4 and Wikipedia and generate instructions for the given documents via LLMs. Then, we extend these examples with structured corpora examples such as Stack Exchange and WikiHow and task examples such as question answering, email writing, grammar error correction, story/poem generation, and text summarization.
For LongForm OPT and LLaMA models: Use [EOI] to indicate the end of instruction.
How to Load
python
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3model = AutoModelForCausalLM.from_pretrained("akoksal/LongForm-OPT-125M")4tokenizer = AutoTokenizer.from_pretrained("akoksal/LongForm-OPT-125M")56instruction ="Write an essay about meditation. [EOI]"7torch.manual_seed(42)8input_ids = tokenizer(instruction, return_tensors="pt").input_ids
9target_ids = model.generate(input_ids, do_sample=True, max_new_tokens=50, top_p=0.9)10tokenizer.decode(target_ids[0])11# Output:12# > Write an essay about meditation. [EOI]Meditation, or 'Maraise', is13# a method that is used to meditate in the Tibetan and Malay Buddhist14# religions. It is a combination of meditation with Tibetan prayer.15# Meditation is an art in itself. Meditation is a form of practice
Evaluation
We provide in-depth evaluation of LongForm models and baselines in the paper. We present the METEOR scores of models in out-of-domain datasets. In all tasks, Recipe Generation (RGen), long-form question answering (ELI5), short story generation (WritingPrompts/WP), LongForm models outperform prior instruction-tuned models.
‡: We can just release the difference between LongForm-LLaMA-7B and pretrained LLaMA-7B publicly due to restrictions of LLaMA models.
Limitations
The LongForm dataset and models mainly focus on long text generation and have limitations regarding structured prediction tasks in NLP. Additionally, we observe that LongForm models may present hallucination problems similar to those found in LLMs.
License
The LongForm project is subject to a MIT License with custom limitations for restrictions imposed by OpenAI (for the instruction generation part), as well as the license of language models (OPT, LLaMA, and T5). The WikiHow subset of LongForm-C is subject to the license proposed by WikiHow.
Citation
@misc{koksal2023longform,
title={LongForm: Effective Instruction Tuning with Reverse Instructions},
author={Abdullatif Köksal and Timo Schick and Anna Korhonen and Hinrich Schütze},
year={2023},
eprint={2304.08460},
archivePrefix={arXiv},
primaryClass={cs.CL}
}