Inferring Logical Forms From Denotations Ice Pasupat and Percy - - PowerPoint PPT Presentation

inferring logical forms from denotations
SMART_READER_LITE
LIVE PREVIEW

Inferring Logical Forms From Denotations Ice Pasupat and Percy - - PowerPoint PPT Presentation

Inferring Logical Forms From Denotations Ice Pasupat and Percy Liang Stanford University ACL 2016 Monday, August 8, 2016 Semantic Parsing Utterance Where did the last 1st place finish occur? World Year Venue Position Time


slide-1
SLIDE 1

Ice Pasupat and Percy Liang Stanford University

ACL 2016 Monday, August 8, 2016

Inferring Logical Forms From Denotations

slide-2
SLIDE 2

Semantic Parsing

“Where did the last 1st place finish occur?”

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

2

from WikiTableQuestions dataset (Pasupat & Liang, 2015); simplified Utterance World

slide-3
SLIDE 3

Semantic Parsing

R[Venue].argmax(Position.1st, Index) “Where did the last 1st place finish occur?” Parse utterances into executable logical forms

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

3

slide-4
SLIDE 4

Semantic Parsing

R[Venue].argmax(Position.1st, Index) Parse utterances into executable logical forms

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

Denotation

4

“Where did the last 1st place finish occur?”

slide-5
SLIDE 5

Semantic Parsing

R[Venue].argmax(Position.1st, Index)

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

5

Parse utterances into executable logical forms “Where did the last 1st place finish occur?”

slide-6
SLIDE 6

Semantic Parsing

R[Venue].argmax(Position.1st, Index)

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

6

Parse utterances into executable logical forms “Where did the last 1st place finish occur?”

slide-7
SLIDE 7

Semantic Parsing

R[Venue].argmax(Position.1st, Index)

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

7

Parse utterances into executable logical forms “Where did the last 1st place finish occur?”

slide-8
SLIDE 8

Semantic Parsing

8

Setting: Learn a semantic parser from denotations

Training Data “Where did the last 1st place finish occur?”

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

Thailand

The logical form is latent!

slide-9
SLIDE 9

Space of Logical Forms

9

For each input utterance and world, we can set the space of logical forms that we want the semantic parser to consider

“Where did the last 1st place finish occur?”

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

logical forms

R[Venue].argmax(Position.1st, Index) ... ... ... ... ... ...

slide-10
SLIDE 10

▸ Restrict which predicates can appear

Restricting the Space of Logical Forms

10

“… Germany ...” Venue.Germany ▸ Only allow certain logical form compositions F(Values1) - F(Values2) → Values

Must have a parallel structure

“… German ...” Venue.Germany

(Pasupat & Liang, 2015)

slide-11
SLIDE 11

▸ Restrict which predicates can appear

Restricting the Space of Logical Forms

11

“… Germany ...” Venue.Germany ▸ Only allow certain logical form compositions + Easier to learn – Low coverage F(Values1) - F(Values2) → Values

Must have a parallel structure

“… German ...” Venue.Germany

(Pasupat & Liang, 2015)

slide-12
SLIDE 12

Expanding the Space of Logical Forms

12

▸ Less restriction on predicates “… Germany ...” Venue.Germany ▸ Very generic logical form composition

Anything goes!

“… German ...” Venue.Germany Set1 - Set2 → Set

(Details in the paper)

+ Higher coverage

slide-13
SLIDE 13

Expanding the Space of Logical Forms

13

+ Higher coverage – Two new challenges … ▸ Less restriction on predicates “… Germany ...” Venue.Germany ▸ Very generic logical form composition

Anything goes!

“… German ...” Venue.Germany Set1 - Set2 → Set

(Details in the paper)

slide-14
SLIDE 14

Space of Logical Forms

A semantic parser defines a distribution on logical forms

all logical forms

14

slide-15
SLIDE 15

Consistent Logical Forms

A logical form is consistent if it executes to the target denotation During training, a semantic parser learns to maximize the probability of consistent logical forms

all logical forms consistent

15

slide-16
SLIDE 16

Consistent Logical Forms

Challenge 1: Identifying this region of consistent logical forms during training = finding needles in a haystack

all logical forms consistent (actual size)

16

slide-17
SLIDE 17

Spurious Logical Forms

R[Venue].argmax(Position.1st, Index) “Where did the last 1st place finish occur?”

17

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

slide-18
SLIDE 18

Spurious Logical Forms

Sometimes a consistent logical form is spurious: it gets the correct denotation for a wrong reason R[Venue].argmax(Position.1st, Time)

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

18

“Where did the last 1st place finish occur?”

slide-19
SLIDE 19

Spurious Logical Forms

Challenge 2: With the expanded space of logical forms, we get even more spurious logical forms!

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

R[Venue].R[Next].Year.avg(R[Year].Type.Row)

19

“Where did the last 1st place finish occur?”

slide-20
SLIDE 20

Spurious Logical Forms

Challenge 2: With the expanded space of logical forms, we get even more spurious logical forms! ▸ These spurious logical forms can hurt learning since they give misleading signals

20

all logical forms correct spurious

slide-21
SLIDE 21

Challenge 1: Enumerate Consistent LFs

Given a training example (an utterance, a world, and the target denotation), find all consistent logical forms

21

“Where did the last 1st place finish occur?”

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

Thailand all logical forms consistent

slide-22
SLIDE 22

Review: Beam Search

Idea: Compose logical forms of increasing sizes then keep the consistent final logical forms

22

(Set, 0) (Relation, 0) (Set, 1) (Set, 2)

...

slide-23
SLIDE 23

Review: Beam Search

A cell (c, s) contains logical forms with the same category c and “size” s

23

(Set, 0)

5th Germany

(Relation, 0)

Index Next Venue Position

(Set, 0) (Relation, 0) (Set, 1) (Set, 2)

...

[Similar to cell (c, i, j) in CYK algorithm for syntactic parsing]

slide-24
SLIDE 24

Review: Beam Search

Start from base predicates (size = 0)

For the sake of illustration, assume any cell / column can become a base predicate

24

(Set, 0) (Relation, 0) (Set, 1) (Set, 2)

(Set, 0)

5th Germany

... (Relation, 0)

Index Next Venue Position

slide-25
SLIDE 25

Review: Beam Search

Start from base predicates (size = 0) and compose partial logical forms of increasing sizes

25

(Set, 0)

5th Germany

(Relation, 0)

Index Next Venue Position

(Set, 1)

Position.5th

Relation.Set → Set

(Set, 0) (Relation, 0) (Set, 1) (Set, 2)

...

Venue.Germany

slide-26
SLIDE 26

Review: Beam Search

To control the search space, we prune cells to a fixed beam size

26

(Set, 2)

(Set, 0) (Relation, 0) (Set, 1) (Set, 2)

...

Next.Venue.Germany Next.Position.5th R[Venue].Position.5th count(Venue.Germany) R[Next].Position.5th R[Index].Venue.Germany R[Position].Position.5th count(Position.5th)

slide-27
SLIDE 27

Review: Beam Search

Finally, collect complete logical forms that execute to the target denotation

27

(Set, 5)

(Set, 6) R[Venue].argmax(Position.1st, Time) R[Year].argmin(Position.1st, Time) count(Venue.Germany) - count( … ) R[Venue].argmax(Position.1st, Index) (Set, 4) (Set, 5) (Map, 6)

R[Venue].Index.min(R[Year].Position.1st)

slide-28
SLIDE 28

Review: Beam Search

Only generates a partial list of logical forms → Misses many consistent logical forms

28

all logical forms consistent beam search

slide-29
SLIDE 29

Better Way to Control Search Space

Observation: Many logical forms execute to the same denotation

29

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

Venue.Germany Position.5th

all execute to {r1}

Index.1

slide-30
SLIDE 30

R[Time]. R[Time].

Better Way to Control Search Space

If we only care about denotations, these logical forms are interchangeable

30

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

R[Time]. Venue.Germany Position.5th

all execute to {46.62}

Index.1

slide-31
SLIDE 31

R[Time].

Better Way to Control Search Space

So if we collapse them into one “meta” logical form, the search space will be reduced

31

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

R[Time].

{r1} executes to {46.62}

slide-32
SLIDE 32

Better Way to Control Search Space

So if we collapse them into one “meta” logical form, the search space will be reduced a lot!

32

slide-33
SLIDE 33

Dynamic Programming on Denotations

Step 1: Build a parse chart leading to the target denotation

33

Step 2: Retrieve actual logical forms

Thailand

slide-34
SLIDE 34

Dynamic Programming on Denotations

Step 1: Build a parse chart to the target denotation ▸ Group logical forms based on denotations ▸ Each cell becomes (category, size, denotation)

34

(Set, 1)

Position.5th count(Type.Row) Venue.Germany

(Set, 1)

slide-35
SLIDE 35

Dynamic Programming on Denotations

Step 1: Build a parse chart to the target denotation ▸ Group logical forms based on denotations ▸ Each cell becomes (category, size, denotation)

35

count(Type.Row)

(Set, 1, {3})

(Set, 1, {r1}) (Set, 1, {3})

(Set, 1, {r1})

Position.5th Venue.Germany

slide-36
SLIDE 36

Dynamic Programming on Denotations

Step 1: Build a parse chart to the target denotation ▸ Since we only care about denotations, we can collapse logical forms in each cell

36

{3}

(Set, 1, {3})

(Set, 1, {r1}) (Set, 1, {3})

{r1}

(Set, 1, {r1})

slide-37
SLIDE 37

Dynamic Programming on Denotations

37

(Set, 1, {r1}) (Relation, 0, Time) (Set, 2, {46.62})

Time

(Relation, 0, Time)

{46.62}

(Set, 2, {46.62})

{r1}

(Set, 1, {r1})

Step 1: Build a parse chart to the target denotation ▸ Since we only care about denotations, we can collapse logical forms in each cell

slide-38
SLIDE 38

Dynamic Programming on Denotations

(___, ___, {Thailand})

38

slide-39
SLIDE 39

Dynamic Programming on Denotations

39

Remove paths that do not lead to the target denotation Reduced from ≈ 153,000 cells to ≈ 2,000 cells (99% reduction!)

(___, ___, {Thailand})

slide-40
SLIDE 40

Dynamic Programming on Denotations

40

Step 2: To get the actual logical forms, uncollapse the “meta” logical forms by following the backpointers

slide-41
SLIDE 41

Dynamic Programming on Denotations

41

all logical forms = DPD consistent

We have eliminated a lot of cells, so it is possible to exhaustively enumerate logical forms along the remaining paths up to a certain logical form size

(in most cases)

slide-42
SLIDE 42

Dynamic Programming on Denotations

Experiment: For each of 300 examples: ▸ Annotate the example with a gold logical form (consistent and correct) ▸ Test whether the algorithm can generate the gold logical form

42

consistent beam search gold consistent DPD gold

slide-43
SLIDE 43

Dynamic Programming on Denotations

43

Uninitialized beam search Dynamic programming

  • n denotations
slide-44
SLIDE 44

Dynamic Programming on Denotations

Uninitialized beam search Initialized beam search Dynamic programming

  • n denotations

44

slide-45
SLIDE 45

Challenge 1: Enumerate Consistent LFs

Given a training example (an utterance, a world, and the target denotation), find all consistent logical forms

45

“Where did the last 1st place finish occur?”

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

Thailand all logical forms consistent

slide-46
SLIDE 46

Challenge 2: Prune Spurious LFs

Given the set of consistent logical forms (Task 1), prune out spurious logical forms

46

“Where did the last 1st place finish occur?”

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13

Thailand all logical forms correct spurious

slide-47
SLIDE 47

Challenge 2: Prune Spurious LFs

Given the set of consistent logical forms (Task 1), prune out spurious logical forms

Year Venue Position Time 2003 Finland 1st 47.12 2005 Germany 5th 46.62 2007 Thailand 1st 53.13 R[Venue].argmax(Position.1st, Index) R[Venue].argmax(Position.1st, Time) “Where did the last 1st place finish occur?”

47

Thailand Thailand

slide-48
SLIDE 48

Fictitious Worlds

Intuition: Correct logical forms should give a correct denotation when the world slightly changes

Year Venue Position Time 2003 Thailand 1st 53.13 2005 Finland 1st 47.12 2007 Germany 5th 46.62 Finland Thailand

Keep sorted columns sorted Resample cells in other columns

48

“Where did the last 1st place finish occur?” R[Venue].argmax(Position.1st, Index) R[Venue].argmax(Position.1st, Time)

slide-49
SLIDE 49

Fictitious Worlds

Generate fictitious worlds and execute the logical forms on them

w z1 Thailand z2 Thailand z3 Thailand z4 Thailand z5 Thailand

49

slide-50
SLIDE 50

Fictitious Worlds

Generate fictitious worlds and execute the logical forms on them

w w1 z1 Thailand z2 Thailand z3 Thailand z4 Thailand z5 Thailand

50

slide-51
SLIDE 51

Fictitious Worlds

Generate fictitious worlds and execute the logical forms on them

w w1 z1 Thailand Finland z2 Thailand Thailand z3 Thailand Finland z4 Thailand Finland z5 Thailand Germany

51

slide-52
SLIDE 52

w w1 z1 Thailand Finland z2 Thailand Thailand z3 Thailand Finland z4 Thailand Finland z5 Thailand Germany

Human

Thailand Finland

Fictitious Worlds

We can ask humans to answer the question based

  • n the fictitious worlds

52

slide-53
SLIDE 53

w w1 z1 Thailand Finland z2 Thailand Thailand z3 Thailand Finland z4 Thailand Finland z5 Thailand Germany

Human

Thailand Finland

Fictitious Worlds

We can ask humans to answer the question based

  • n the fictitious worlds

53

slide-54
SLIDE 54

w w1 w2 z1 Thailand Finland Germany z2 Thailand Thailand Germany z3 Thailand Finland Thailand z4 Thailand Finland Germany z5 Thailand Germany Finland

Human

Thailand Finland Germany

Fictitious Worlds

We can ask humans to answer the question based

  • n the fictitious worlds

54

slide-55
SLIDE 55

w w1 w2 z1 Thailand Finland Germany z2 Thailand Thailand Germany z3 Thailand Finland Thailand z4 Thailand Finland Germany z5 Thailand Germany Finland

Human

Thailand Finland Germany

Fictitious Worlds

We can ask humans to answer the question based

  • n the fictitious worlds

55

slide-56
SLIDE 56

Fictitious Worlds

▸ Similar to test cases for programs ▸ In practice:

▹ Generate 30 fictitious worlds ▹ Choose a subset of 5 worlds that maximizes the expected information gained from the workers' answers (Details in the paper) ▹ Ask crowd workers to answer the question based on the chosen worlds

56

slide-57
SLIDE 57

Fictitious Worlds

Results with “Ideal Worker” (emulate a human by executing the gold logical form) ▸ Ruled out 98.3% of spurious logical forms

57

correct spurious

98.3%

slide-58
SLIDE 58

Fictitious Worlds

Results with Actual Workers (Mechanical Turk) ▸ Pruned correct LFs in 20% of examples, many of which are due to semantic confusions

58

Name Birth Death Beethoven 1756 1750 Mozart 1770 1827 Bach 1685 1791

correct spurious

slide-59
SLIDE 59

Fictitious Worlds

Results with Actual Workers (Mechanical Turk) ▸ Pruned correct LFs in 20% of examples, many of which are due to semantic confusions ▸ For other examples, could prune out 92.1% of spurious logical forms

59

correct spurious

92.1%

Name Birth Death Beethoven 1770 1750 Mozart 1756 1827 Bach 1685 1791

slide-60
SLIDE 60

Summary

60

Learning from ... Logical Forms Denotations Size of Logical Form Space

Expensive to annotate!

slide-61
SLIDE 61

Summary

61

Logical Forms Denotations

Low coverage

Size of Logical Form Space Learning from ...

slide-62
SLIDE 62

Summary

Two techniques to handle larger logical form spaces

Dynamic programming on denotations: Use intermediate denotations to control search space

62

R[Time]. R[Time]. R[Time]. Venue.Germany Position.5th Index.1 R[Time]. {r1}

slide-63
SLIDE 63

Summary

Two techniques to handle larger logical form spaces

Dynamic programming on denotations: Use intermediate denotations to control search space

Year Venue Position Time 2003 Thailand 1st 53.13 2005 Finland 1st 47.12 2007 Germany 5th 46.62

Fictitious worlds: Use denotations on mutated worlds to detect spurious logical forms

argmax on Index argmax on Time Finland Thailand

63

R[Time]. R[Time]. R[Time]. Venue.Germany Position.5th Index.1 R[Time]. {r1}

slide-64
SLIDE 64

Code, data, and reproducible results:

http://tinyurl.com/acl2016-inferring

WikiTableQuestions Dataset:

http://tinyurl.com/wikitablequestions

Thank you!

64