Sentence representations and question answering (YerevaNN)

33
Sentence Representations Michael Manukyan and Hrayr Harutyunyan YerevaNN

Transcript of Sentence representations and question answering (YerevaNN)

Page 1: Sentence representations and question answering (YerevaNN)

Sentence

RepresentationsMichael Manukyan and Hrayr Harutyunyan

YerevaNN

Page 2: Sentence representations and question answering (YerevaNN)

Where it is used?

• Machine Translation

• Text classification

• Text clustering

• Machine Comprehension

Page 3: Sentence representations and question answering (YerevaNN)

Unsupervised solutions

• Bag of Words (multiset of words)

• Based on Word Embeddings (word2vec, GloVe):

• sum of word vectors

• weighted sum

• positional encoding

• max-pooling

• Recurrent Neural Networks (RNN)

Page 4: Sentence representations and question answering (YerevaNN)

Sum of the word vectors

Page 5: Sentence representations and question answering (YerevaNN)

* color shades indicate weights

Weighted sum of the word vectors

Page 6: Sentence representations and question answering (YerevaNN)

* color shades indicate weights

Positional encoding (Sukhbaatar et al. 2015)

Page 7: Sentence representations and question answering (YerevaNN)

* color shades indicate values

Max-pooling

Page 8: Sentence representations and question answering (YerevaNN)

here is the sentence representation

RNN: encoder-decoder(J. Li et al., 2015)

Page 9: Sentence representations and question answering (YerevaNN)

Supervised

(task dependent) solutions

Page 10: Sentence representations and question answering (YerevaNN)

Recursive NN

learnable parameters

here is the

sentence

representation

Page 11: Sentence representations and question answering (YerevaNN)

Convolutional NN

learnable parameters

here is the

sentence

representation

Page 12: Sentence representations and question answering (YerevaNN)

Machine Comprehension:

Question Answering

Page 13: Sentence representations and question answering (YerevaNN)

• Set of triples (𝑃, 𝑄, 𝐴)

• 𝑃 - passage (the text that computer should

read and comprehend)

• 𝑄 - question asked on that passage

• 𝐴 - answer for the question

Datasets

Page 14: Sentence representations and question answering (YerevaNN)

Facebook bAbI

• Passage:

1. Mary moved to the bathroom.

2. John went to the hallway.

• Question: Where is Mary?

• Answer: bathroom

20 tasks, 10k examples per task

Page 15: Sentence representations and question answering (YerevaNN)

CNN/Daily Mail

10M examples

Page 16: Sentence representations and question answering (YerevaNN)

Children’s Book Test

700k examples

Page 17: Sentence representations and question answering (YerevaNN)

MCTestJames the Turtle was always getting in trouble. Sometimes he'd reach into the

freezer and empty out all the food. Other times he'd sled on the deck and get a splinter.

His aunt Jane tried as hard as she could to keep him out of trouble, but he was sneaky

and got into lots of trouble behind her back.

One day, James thought he would go into town and see what kind of trouble he could

get into. He went to the grocery store and pulled all the pudding off the shelves and ate

two jars. Then he walked to the fast food restaurant and ordered 15 bags of fries. He

didn't pay, and instead headed home.

His aunt was waiting for him in his room. She told James that she loved him, but he

would have to start acting like a well-behaved turtle.After about a month, and after

getting into lots of trouble, James finally made up his mind to be a better turtle.

What is the name of the trouble making turtle?

A) Fries

B) Pudding

C) James

D) Jane 600 examples

Page 18: Sentence representations and question answering (YerevaNN)

SQuAD

• The Stanford Question Answering Dataset

• questions a set of Wikipedia articles

• the answer to every question is a segment of

text, or span, from the corresponding reading

passage

• 100,000+ question-answer pairs on 500+ articles

Page 20: Sentence representations and question answering (YerevaNN)

SQuAD scoring

• Exact match

• the percentage of predictions that exactly

match one of the ground truth answers

• F1 score

• F1 score over common word tokens between

the predicted answer and the ground truth

Page 21: Sentence representations and question answering (YerevaNN)

SQuAD Leaderboard

Page 22: Sentence representations and question answering (YerevaNN)

Best published model for SQuAD so far:

Match-LSTM with Answer-Pointer

(Boundary)

Singapore Management University

(Wang & Jiang '16)

Page 23: Sentence representations and question answering (YerevaNN)

Model

• LSTM-preprocessing

• Match-LSTM

• Answer module

Page 24: Sentence representations and question answering (YerevaNN)

LSTM Preprocessing

• incorporate contextual information into the

representation of each token in the passage and

the question

Page 25: Sentence representations and question answering (YerevaNN)

Match-LSTM

• It has been used to predict whether the premise

entails the hypothesis

• In this model the question is considered as premise

and the passage as hypothesis

• For each word we get one vector which contains its

word vector and the question representation that

depends on that word

• Bidirectional LSTM is applied on those vectors to

encode the sequence

Page 26: Sentence representations and question answering (YerevaNN)

Answer Module

• Vocabulary is huge and answer is always

present in the passage (it’s a substring of it)

• Models

• Sequence: predict each word one by one and

guess where to stop

• Boundary: predict two indices indicating the

beginning and the end of the answer

Page 27: Sentence representations and question answering (YerevaNN)
Page 28: Sentence representations and question answering (YerevaNN)
Page 29: Sentence representations and question answering (YerevaNN)

Results

Page 30: Sentence representations and question answering (YerevaNN)

Results

Page 31: Sentence representations and question answering (YerevaNN)

Results

Page 32: Sentence representations and question answering (YerevaNN)

Attention

Page 33: Sentence representations and question answering (YerevaNN)

Thanks