💡GENIUS is a powerful conditional text generation model using sketches as input, which can fill in the missing contexts for a given sketch (key information consisting of textual spans, phrases, or words, concatenated by mask tokens). GENIUS is pre-trained on a large- scale textual corpus with a novel reconstruction from sketch objective using an extreme and selective masking strategy, enabling it to generate diverse and high-quality texts given sketches.
Example 1:
sketch: __ machine learning __ my research interest __ data science __
GENIUS: I am a Ph.D. student in machine learning, and my research interest is in data science. I am interested in understanding how humans and machines interact and how we can improve the quality of life for people around the world.
GENIUS can also be used as a general textual data augmentation tool for various NLP tasks (including sentiment analysis, topic classification, NER, and QA).
First, what is a sketch? As defined in our paper, a sketch is "key information consisting of textual spans, phrases, or words, concatenated by mask tokens". It's like a draft or framework when you begin to write an article. With GENIUS model, you can input some key elements you want to mention in your wrinting, then the GENIUS model can generate cohrent text based on your sketch.
The sketch which can be composed of:
keywords /key-phrases, like __NLP__AI__computer__science__
spans, like Conference on Empirical Methods__submission of research papers__
sentences, like I really like machine learning__I work at Google since last year__
or a mixup!
How to use the model
1. If you already have a sketch in mind, and want to get a paragraph based on it...
python
1from transformers import pipeline
2# 1. load the model with the huggingface `pipeline`3genius = pipeline("text2text-generation", model='beyond/genius-large', device=0)4# 2. provide a sketch (joint by <mask> tokens)5sketch ="<mask> Conference on Empirical Methods <mask> submission of research papers <mask> Deep Learning <mask>"6# 3. here we go!7generated_text = genius(sketch, num_beams=3, do_sample=True, max_length=200)[0]['generated_text']8print(generated_text)
Output:
'The Conference on Empirical Methods welcomes the submission of research papers. Abstracts should be in the form of a paper or presentation. Please submit abstracts to the following email address: eemml.stanford.edu. The conference will be held at Stanford University on April 1618, 2019. The theme of the conference is Deep Learning.'
If you have a lot of sketches, you can batch-up your sketches to a Huggingface Dataset object, which can be much faster.
TODO: we are also building a python package for more convenient use of GENIUS, which will be released in few weeks.
2. If you have an NLP dataset (e.g. classification) and want to do data augmentation to enlarge your dataset...
Data augmentation is an important application for natural language generation (NLG) models, which is also a valuable evaluation of whether the generated text can be used in real applications.
Setting: Low-resource setting, where only n={50,100,200,500,1000} labeled samples are available for training. The below results are the average of all training sizes.