Cs224n lecture 15 natural language generation (nlg)

Screenshot 2020-01-29 at 9.53.55 PM.png

Screenshot 2020-01-29 at 9.55.59 PM.png

Screenshot 2020-01-29 at 9.56.22 PM.png

Teacher Forcing

During training, we feed the gold (aka reference) target sentence into the decoder, regardless of what the decoder predicts. This training method is called Teacher Forcing.

Screenshot 2020-01-29 at 9.57.42 PM.png


** **

Decoding Algorithms

- Greedy Decoding

- Beam Search

What’s the effect of changing beam size k?

Screenshot 2020-01-30 at 3.31.12 PM.png

Sampling-based decoding

Sampling-based decoding is more efficient than beam search becasue there are no multiple hypotheses to track at each step.

Pure sampling

Top-n sampling

Softmax Temperature

Softmax temperature is not a decoding algo, its a method that can be used with any decoding algo to control diversity of output.

On timestep $t$, the LM computes a prob dist $P_t$ by applying the softmax function to a vector of scores $s \in R^{ V }$.

You can apply a temperature hyperparameter $\tau$ to the softmax

Raising the temperature $\tau$: The softmax probabilities becomes more uniform. Thus you get more diverse output. If you lower the temperature, things which are high prob become even more high prob. Note that $\tau < 1$ is permissable.

(“Mmemonic: If you raise the temp the distribution melts and smoothes, if you lower the temp, the distribution becomes cold and spiky”)

Summary of NLG Tasks and Neural Approaches

** **

Summarization

Task: Given input text x, write a summary y which is shorter and contains the main information of x.

Summarization can be single-document or multi-document.

WIthin single-document summarization, there are datasets with source documetns of different lengths and styles:

Sentence simplifcation is a different but related task: Rewrite the source text in a simpler (sometimes shorter) way.

Two main strategies for summarisation:

Pre-neural summarization:

Pre-neural summarization systems were mostly extractive. They typically had a pipeline as follows:

ROUGE: Main metric for summarization

Like BLEU, it’s based on n-gram overlap, but iwthout brevity penalty, and ROUGE is based on recall while BLEU is based on precision. (Precision is more important for machine translation, but recall is more important for summarization).

However (confusingly) often an F1 version of ROUGE is reported anyway.

ROUGE computation:

ROUGE scores are repoted separaly for each n-gram. The most commonly reported ROUGE scores are ROUGE-1, ROUGE-2, and ROUGE-L: longest common subsequence overlap.

Screenshot 2020-01-30 at 4.18.30 PM.png

Neural Approaches to Summarization

2015: Rush et al publish the first saeq2seq summarization paper. Single document abstractive sumamrization is a translation task! So standard seq2seq+attention NMT was used.

Other ideas

1. Make it easier to copy. But don’t copy too much!

Copying Mechanisms:

Seq2seq + attention systems are good at writing fluent output, but are bad at copying over details (like rare words) correctly.

Copy mechanisms use attention to enable a seq2seq system to easily copy words and phrases from the input to the output.

Several papers proposing copy mechanism variants:

Screenshot 2020-02-16 at 1.58.48 PM.png

Problems with copying mechanism: They copy too much, and so what should be an abstractive system collapses to a mostly extractive system.

Also: They’re bad at overall content selection, especially if the input document is long.

Bottom up Summarization

Recall: Pre-neural summarization had separate stages for content selection and text generation. In seq2seq attention summarization, these two stages are mixed together. On each step of the decoder, we do word-level content selection (attention). This is bad: no global content selection strategy. Bottom Up Summarization as a way to solve this.

Bottom Up Summarization:

Two stages:

Content selection stage: Use a neural sequence-tagging model to tag words as include or don’t-include

Bottom-up attention stage: The seq2seq+attention system can’t attend to words tagged* don’t-include *(apply a mask)

Bottom up Summarization is simple but effective!

Neural Summarization via Reinforcement Learning to directly maximize ROUGE-L

Interesting finding: Using RL instead of ML achieve higher ROUGE scores, but lower human judgement scores - “barely readable summaries”.

However, a combined objective which is a mix of old fashioned langage model (optimizing for perplexity), and optimizing directly for ROUGE gets better human judgement scores than just the old fashioned langauge model alone.

Dialogue Systems

Task-oriented Dialogue

Social Dialogue

Pre-DL, the difficulty of open-ended freeform NLG, pre-neural dialgoue systems usually used predefined templates.

As in summarization research, since 2015 there have been many papers applying seq2seq to dialogue.

Esp:

A Neural Conversational Model, Vinyals et al 2015,

Neural Responding Machine for Short-Text Conversation, Shang et al 2015.

It quickly became apparent that a naive application of standard seq2seq attention had pervasive deficienceies for chitchat dialogue

Irrelevant Response problem

Problem: seq2seq often generates response that’s unrelated to user’s utterance, wither becasie it’s generic (“I don’t know), or because changing the subject to somethign unrelated.

One solution: Optimize for **Maximum Mutual Information (MMI) **between input S and response T:

If T is high likelihood anyways it will get penalised, as follows:

Genericness / boring response problem

Easy test-time fixes:

Repitition Problem: Simple Soution:

Storytelling Most neural storytelling work uses some kind of prompt

Generating Stories about Images, Skip-Thought Vectors Question: How to get around lack of parallel data? Answer: Use a common sentence-encoding space.

Generating a story from a writing prompt

In 2018, Fan et al released a new story generation dataset colelcted from Reddit’s WritingPrompts subreddit.** Hierarchical Neural Story Generation**, 2018.

Each story has an associated brief writing prompt.(1)

They made a very impressive, very beefed up seq2seq convolutional prompt to story model:

Model fusion:

Impressive:

Related to prompt, diverse, stylistically dramatic.

However:

Automatic Evaluation Metrics for NLG

Word-overlap based metrics: BLEU, ROUGE, METEOR, F1 etc are not ideal for translation, even worse for summarization, and even worse for dialogue, which is more open-ended than summarizaiton.

Word voerlap metrics are not a good fit for dialogue. Very little correlation between BLUE and human score.

Perplexity tells you how strong your langauge model is, but doesn’t tell you anything about generation (if your decoding algo is bad, perplexity is unaffected).

Word embedding based metrics to capture the similarity of the word embeddings - unfortuantely, does not correlate well with human jusgements for open-ended tasks liek dialogiue.

Generally, we define more focused automatic metrics to capture particular aspects of generated text:

Though these don’t measure overall quality, they can help us track some important qualities that we care about.

Human Evaluation

Human jusgements are regarded as the gold standard, but are slow and expensive. But also,

Humans are inconsistent, can be illogical, lost concentration, misinterpret your question, etc

Screenshot 2020-02-16 at 2.45.03 PM.png

Screenshot 2020-02-16 at 2.46.39 PM.png

Thoughts on NLG Research, Current Trends, and the Future

Exciting current trends:

NLG is still one of the wildest parts remaining in NLP research!

Neural NLG community is rapidly maturing. A lof of open-ended workshops and competitions:

NeuralGan workshop

Storytelling workshop

Alexa challenge

ConvAI2 NeuIPS challenge.

These are particularly useful to organize the community, increase reproducability, standardize evaluation etc. However biggest roadblock is still standardizing evaluation.

8 Things I’ve learned working in NLG

1. The more open-ended the task, the harder everyting becomes.

2. Aiming for a specific improvemetns can be more manageable than aiming to improve overall generation quality

3. If you’re using a LM for NLG: improving the LM (perplexity) will improve generation quality, but it is not the only way to improve generation quality

4. You should look at your output, a lot.

5. You’ll need several automatic metrics, even if its imperefct.

6. If you do human eval, make the questions as focused as possible.

7. Reproducability is a huge problem in NLP+Deep learning and a huger problem in NLG. Appeal to publicly release all generated output along with paper.

8. Very frustrating and very funny.

Appendix 1:

Screenshot 2020-02-16 at 2.32.17 PM.png

-