Top Banner
NLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh [email protected]
40

NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

May 28, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

NLU: Semantic parsingAdam Lopez

slide credits: Chris Dyer, Nathan Schneider March 30, 2018

School of Informatics University of Edinburgh

[email protected]

Page 2: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Recall: meaning representations

Sam likes Caseylikes(Sam, Casey)

Anna’s dog Mr. PeanutButter misses hermisses(MrPB, Anna) ∧ dog(MrPB)

Kim likes everyone∀x.likes(x, Kim)

Page 3: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Recall: meaning representations

• Meaning representations are verifiable, unambiguous, canonical.

• Predicate-argument structure is a good match for FOL, as well as structures with argument-like elements (e.g. NPs)

• Determiners, quantifiers (e.g. “everyone”, “anyone”), and negation can be expressed in first order logic.

Page 4: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Representing the meaning of arbitrary NL is hard

• Much of natural language is unverifiable, ambiguous, non-canonical.

• What is the finite set of predicates? • When do two words map to the same predicate? • When are homonyms mapped to different

predicates? • Can we decompose lexical meanings into a finite

set of predicates (possibly composed)? • What is the finite set of constants?

Page 5: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Easier: representing a closed domain

What states border Texas?λx. state(x) ∧ borders(x,texas)

argmax(λx. state(x) ∧ λx.size(x))What is the largest state?

Example: GEOQUERY dataset

Semantic parsing is the problem of returning a logical form for an input natural language sentence.

Page 6: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Pairs of NL sentences with structured MR can be collected…

Example: IFTTT dataset (Quirk et al. 2015)

Page 7: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

WikiTableQuestions

Page 8: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

…similar information powers Google’s knowledge graph

Page 9: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Viewing MR as a string, semantic parsing is just conditional language modeling

p(y1, ..., y|y| | x1, ..., x|x|)

Model using standard sequence models…

Page 10: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Viewing MR as a string, semantic parsing is just conditional language modeling

p(y1, ..., y|y| | x1, ..., x|x|)

Model using standard sequence models…

…with one additional element

Page 11: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Ich möchte ein Bier

x1 x2 x3 x4

Page 12: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Ich möchte ein Bier

x1 x2 x3 x4

�!h 1

�!h 2

�!h 3

�!h 4

Page 13: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Ich möchte ein Bier

x1 x2 x3 x4

�!h 1

�!h 2

�!h 3

�!h 4

�h 1

�h 2

�h 3

�h 4

Page 14: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Ich möchte ein Bier

x1 x2 x3 x4

�!h 1

�!h 2

�!h 3

�!h 4

�h 1

�h 2

�h 3

�h 4

fi = [ �h i;�!h i]

Page 15: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Ich möchte ein Bier

x1 x2 x3 x4

�!h 1

�!h 2

�!h 3

�!h 4

�h 1

�h 2

�h 3

�h 4

fi = [ �h i;�!h i]

Page 16: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Ich möchte ein Bier

x1 x2 x3 x4

�!h 1

�!h 2

�!h 3

�!h 4

�h 1

�h 2

�h 3

�h 4

fi = [ �h i;�!h i]

Page 17: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Ich möchte ein Bier

x1 x2 x3 x4

�!h 1

�!h 2

�!h 3

�!h 4

�h 1

�h 2

�h 3

�h 4

fi = [ �h i;�!h i]

Page 18: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Ich möchte ein Bier

x1 x2 x3 x4

�!h 1

�!h 2

�!h 3

�!h 4

�h 1

�h 2

�h 3

�h 4

Ich mochte ein Bier

F 2 R2n⇥|f |

fi = [ �h i;�!h i]

Page 19: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

0

Ich mochte ein Bier

Page 20: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

0

Ich mochte ein Bier

z }| {Attention history:

a>1

a>2

a>3

a>4

a>5

Page 21: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

0

Ich mochte ein Bier

z }| {Attention history:

a>1

a>2

a>3

a>4

a>5

Page 22: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

I'd

0

Ich mochte ein Bier

z }| {Attention history:

a>1

a>2

a>3

a>4

a>5

Page 23: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

I'd

I'd →

like

0

Ich mochte ein Bier

z }| {Attention history:

a>1

a>2

a>3

a>4

a>5

Page 24: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

I'd

I'd →

like

like

a

0

Ich mochte ein Bier

z }| {Attention history:

a>1

a>2

a>3

a>4

a>5

Page 25: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

I'd

I'd →

like

like

a

a

beer

0

Ich mochte ein Bier

z }| {Attention history:

a>1

a>2

a>3

a>4

a>5

Page 26: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

I'd

I'd →

like

like

a

a

beer

beer

stopSTOP

0

Ich mochte ein Bier

z }| {Attention history:

a>1

a>2

a>3

a>4

a>5

Page 27: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

English-French

English-German

I confess that I speak neither French nor German. Sorry!

Page 28: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Since logical forms are tree-like, can use treeLSTM decoder

Page 29: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Model learns to “translate” words into predicates they invoke

Page 30: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

7

• The edges (ARG0 and ARG1) are relations

• Each node in the graph has a variable!

• They are labeled with concepts!

• d / dog means “d is an instance of dog”

!“The dog is eating a bone” (e / eat-01 :ARG0 (d / dog) :ARG1 (b / bone))

PENMAN notation

e/eat-01

d/dog

b/bone

A

R

G

0

A

R

G

1

Abstract meaning representation (AMR)

Page 31: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

9

• What if something is referenced multiple times?

• Notice how dog has two incoming roles now.

• To do this in PENMAN format, repeat the variable. We call this a reentrancy.

(want-01 :ARG0 (d / dog) :ARG1 (e / eat-01 :ARG0 d! :ARG1 (b / bone)))

Reentrancy

e/eat-01

w/want-01

d/dog

b/bone

A

R

G

0

A

R

G

1

A

R

G

0

A

R

G

1

“The dog wants to eat the bone”

Abstract meaning representation (AMR)

Page 32: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Coreference

Bob wants Anna to give him a job.

Q: who does him refer to?

Page 33: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Coreference

Bob wants Anna to give him a job.

Q: who does him refer to?

Charles just graduated, and now

Page 34: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Metonymy

Westminster decided to distribute funds throughout England, Wales, Northern Island, and Scotland

Page 35: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Metonymy

Westminster decided to distribute funds throughout England, Wales, Northern Island, and Scotland

decided(Westminster, …)

Page 36: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Metonymy

Westminster decided to distribute funds throughout England, Wales, Northern Island, and Scotland

decided(Westminster, …)

decided(Parliament, …) ✔

Page 37: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

ImplicatureThat cake looks

delicious

Page 38: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Implicature

What Rogelio was really thinking: I would like a piece of that cake.

That cake looks delicious

Page 39: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Even more phenomena…

• Abbreviations (e.g. National Health Service=NHS) • Nicknames (JLaw=Jennifer Lawrence) • Metaphor (crime is a virus infecting the city) • Time expressions and change of state • Many others

Page 40: NLU semantic parsing - The University of EdinburghNLU: Semantic parsing Adam Lopez slide credits: Chris Dyer, Nathan Schneider March 30, 2018 School of Informatics University of Edinburgh

Summary• In many cases, meaning representation can be captured in first-

order logic. • But wide-coverage meaning representation is hard; closed

domains are easier, and can sometimes be harvested automatically.

• This leads to a proliferation of domain-specific MRs. • Trainable alternative to compositional approaches: encoder-

decoder neural models. • The encoder and decoder can be mixed and matched: RNN,

top-down tree RNN, etc. • Works well on small, closed domains if we have training data, but

there are many unsolved phenomena/ problems in semantics.