Compositional Semantic Parsing on Semi-Structured Tables Ice - - PowerPoint PPT Presentation

compositional semantic parsing on semi structured tables
SMART_READER_LITE
LIVE PREVIEW

Compositional Semantic Parsing on Semi-Structured Tables Ice - - PowerPoint PPT Presentation

Compositional Semantic Parsing on Semi-Structured Tables Ice Pasupat and Percy Liang Stanford University ACL 2015 Tuesday, July 28, 2015 Task Question answering given a knowledge source In which city was Ada Lovelace born? Database 2


slide-1
SLIDE 1

Compositional Semantic Parsing

  • n Semi-Structured Tables

Ice Pasupat and Percy Liang Stanford University

ACL 2015 Tuesday, July 28, 2015

slide-2
SLIDE 2

Task

2

Question answering given a knowledge source

Database

In which city was Ada Lovelace born?

slide-3
SLIDE 3

Semantic Parsing

3

Parse questions into executable logical forms Type.City ⊓ PeopleBornHere.AdaLovelace

Database

In which city was Ada Lovelace born?

(Lambda DCS)

slide-4
SLIDE 4

Semantic Parsing

4

Logical forms can be executed on the knowledge source to get denotations

Database

City Type.City ⊓ PeopleBornHere.AdaLovelace

slide-5
SLIDE 5

Semantic Parsing

5

Database City Shanghai London England

Type Type Capital

Type.City ⊓ PeopleBornHere.AdaLovelace Logical forms can be executed on the knowledge source to get denotations

slide-6
SLIDE 6

Semantic Parsing

6

Database City Shanghai London England

Type Type Capital

Type.City ⊓ PeopleBornHere.AdaLovelace Logical forms can be executed on the knowledge source to get denotations

slide-7
SLIDE 7

Semantic Parsing

7

London Shanghai ...

Database

Type.City ⊓ PeopleBornHere.AdaLovelace Logical forms can be executed on the knowledge source to get denotations

slide-8
SLIDE 8

Compositionality

8

We can compose logical forms into bigger ones with logical operations England London ... Type.City ⊓ PeopleBornHere.AdaLovelace London Shanghai ...

slide-9
SLIDE 9

9

Compositionality

We can compose logical forms into bigger ones with logical operations

Intersection

Type.City ⊓ PeopleBornHere.AdaLovelace England London ... London Shanghai ...

slide-10
SLIDE 10

10

Compositionality

We can compose logical forms into bigger ones with logical operations

Intersection

Type.City ⊓ PeopleBornHere.AdaLovelace London

slide-11
SLIDE 11

11

Compositionality

We can compose logical forms into bigger ones with logical operations ▸ Type.City ⊔ Type.State — cities and / or states ▸ count(Type.City) — how many cities ▸ argmax(Type.City, Area) — largest city ▸ sum(AreaOf.Type.City) — total area of all cities ▸ AreaOf.London – AreaOf.Paris — how much bigger is London than Paris?

slide-12
SLIDE 12

Related Work

Early systems: Parse very compositional questions into database queries

How many rivers are in the state with the largest population?

12

Compositionality: High

answer(A, count(B, (river(B), loc(B, C), largest(D, (state(C), population(C, D)))), A)))

[Zelle + Mooney, 1996 / Wong + Mooney, 2007 / Zettlemoyer + Collins, 2007 / Kwiatkowski et al., 2011 / ...]

slide-13
SLIDE 13

Related Work

Early systems: Parse very compositional questions into database queries

How many rivers are in the state with the largest population?

13

Knowledge source: Database ▸ few entities / relations ▸ fixed schema Compositionality: High

answer(A, count(B, (river(B), loc(B, C), largest(D, (state(C), population(C, D)))), A))) Geography

[Zelle + Mooney, 1996 / Wong + Mooney, 2007 / Zettlemoyer + Collins, 2007 / Kwiatkowski et al., 2011 / ...]

slide-14
SLIDE 14

14

Related Work

Breadth (domain size) Depth (compositionality)

Early Systems

slide-15
SLIDE 15

Related Work

Scaling to large knowledge bases (KBs): Answer

  • pen-domain questions using curated KBs

In which comic book issue did Kitty Pryde first appear?

15

[Cai + Yates, 2013 / Berant et al., 2013 + 2014 / Fader et al., 2014 / Reddy et al., 2014 / ...]

Knowledge source: Large KBs ▸ lots of entities / relations ▸ fixed schema

NELL

slide-16
SLIDE 16

Related Work

Scaling to large knowledge bases (KBs): Answer

  • pen-domain questions using curated KBs

In which comic book issue did Kitty Pryde first appear?

16

[Cai + Yates, 2013 / Berant et al., 2013 + 2014 / Fader et al., 2014 / Reddy et al., 2014 / ...]

Compositionality: Lower

R[FirstAppearance].KittyPryde

NELL

Knowledge source: Large KBs ▸ lots of entities / relations ▸ fixed schema

slide-17
SLIDE 17

Related Work

Scaling to large knowledge bases (KBs): Answer

  • pen-domain questions using curated KBs

In which comic book issue did Kitty Pryde first appear?

17

[Cai + Yates, 2013 / Berant et al., 2013 + 2014 / Fader et al., 2014 / Reddy et al., 2014 / ...]

Compositionality: Lower

R[FirstAppearance].KittyPryde

Knowledge source: Large KBs ▸ lots of entities / relations ▸ fixed schema

NELL

Still, only < 10% of general questions can be answered by Freebase [Berant et al., 2013]

slide-18
SLIDE 18

18

Related Work

Breadth (domain size) Depth (compositionality)

Early Systems Scale to KBs

slide-19
SLIDE 19

Related Work

Web search: Keyword search over the whole Web (information retrieval / not semantic parsing)

stanford cs professors

19

Knowledge source: Internet ▸ open-domain ▸ unstructured (no schema) Compositionality: None

slide-20
SLIDE 20

20

Related Work

Breadth (domain size) Depth (compositionality)

Early Systems Scale to KBs Web Search

slide-21
SLIDE 21

Motivation

21

Web text in general is too unstructured However, the Web also contains semi-structured data (tables, lists, repeated headings, ...)

slide-22
SLIDE 22

22

stanford cs professors http://cs.stanford.edu/faculty

slide-23
SLIDE 23

Motivation

23

Web text in general is too unstructured However, the Web also contains semi-structured data (tables, lists, repeated headings, ...) ▸ Open-domain: lots of information with arbitrary data schema [Cafarella et al., 2008 (WebTables)]

slide-24
SLIDE 24

Motivation

24

Web text in general is too unstructured However, the Web also contains semi-structured data (tables, lists, repeated headings, ...) ▸ Open-domain: lots of information with arbitrary data schema [Cafarella et al., 2008 (WebTables)] ▸ Structured enough to allow complex logical

  • perations (~ mini knowledge base)

How many Stanford CS professors do not have offices in the Gates building?

slide-25
SLIDE 25

Motivation

25

Web text in general is too unstructured However, the Web also contains semi-structured data (tables, lists, repeated headings, ...) ▸ Open-domain: lots of information with arbitrary data schema [Cafarella et al., 2008 (WebTables)] ▸ Structured enough to allow complex logical

  • perations (~ mini knowledge base)

Task: Answer compositional questions based on semi-structured tables from the Web

slide-26
SLIDE 26

26

Motivation

Breadth (domain size) Depth (compositionality)

Early Systems Scale to KBs Web Search Semantic Parsing on Semi-Structured Data

slide-27
SLIDE 27

Outline

▸ Background and Related Work ▸ Task and Dataset ▸ Approach ▸ Experiments

27

slide-28
SLIDE 28

Task Description

Input: utterance x and HTML table t Output: answer y

Year City Country Nations 1896 Athens Greece 14 1900 Paris France 24 1904

  • St. Louis

USA 12 ... ... ... ... 2004 Athens Greece 201 2008 Beijing China 204 2012 London UK 204

x = Greece held its last Summer Olympics in which year? y = 2004

28

slide-29
SLIDE 29

Task Description

Input: utterance x and HTML table t Output: answer y Training data: list of (x, t, y) — no logical form Tables in test data are not seen during training

▹ The model must generalize to unseen table schemas!

29

slide-30
SLIDE 30

Dataset

WikiTableQuestions dataset: ▸ Tables t are from Wikipedia

30

slide-31
SLIDE 31

31

https://en.wikipedia.org/wiki/Piotr_Kędzia

slide-32
SLIDE 32

Dataset

WikiTableQuestions dataset: ▸ Tables t are from Wikipedia ▸ Questions x and answers y are from Mechanical Turk — Prompts are given to encourage compositionality

32

How many … … ___est … … last … … above … … same … as … … difference … … or … … his … Requires counting etc.

slide-33
SLIDE 33

Dataset

WikiTableQuestions dataset: ▸ Tables t are from Wikipedia ▸ Questions x and answers y are from Mechanical Turk — Prompts are given to encourage compositionality

33

Prompt: The question must contains "last" (or a synonym)

In what city did Piotr's last 1st place finish occur?

slide-34
SLIDE 34

In what city did Piotr's last 1st place finish occur?

34

slide-35
SLIDE 35

In what city did Piotr's last 1st place finish occur?

35

slide-36
SLIDE 36

In what city did Piotr's last 1st place finish occur?

36

slide-37
SLIDE 37

In what city did Piotr's last 1st place finish occur?

37

slide-38
SLIDE 38

How long did it take this competitor to finish the 4x400 meter relay at Universiade in 2005?

38

slide-39
SLIDE 39

Where was the competition held immediately before the

  • ne in Turkey?

39

slide-40
SLIDE 40

How many times has this competitor placed 5th or better in competition?

40

slide-41
SLIDE 41

Dataset

WikiTableQuestions dataset: ▸ 2100 tables

▹ Average: 6.3 columns / 27.5 rows

▸ 22000 examples

41

slide-42
SLIDE 42

Challenges

With increased breadth (semi-structured data): ▸ Must generalize to arbitrary table schemas (as opposed to the fixed database schema) ▸ Test tables are unseen → Cannot precompute a lexicon mapping phrases to table relations

42

Table headers

(Year, Competition, Venue, …)

slide-43
SLIDE 43

Challenges

With increased breadth (semi-structured data): ▸ Must generalize to arbitrary table schemas (as opposed to the fixed database schema) ▸ Test tables are unseen → Cannot precompute a lexicon mapping phrases to table relations With increased depth (compositional questions): ▸ More operations and deeper recursion → Number of possible parses grows exponentially

43

slide-44
SLIDE 44

Outline

▸ Background and Related Work ▸ Task and Dataset ▸ Approach ▸ Experiments

44

slide-45
SLIDE 45

Approach

x y t

Greece held its last Summer Olympics in which year? 2004

45

slide-46
SLIDE 46

Approach

x y z t

(3) Execution Greece held its last Summer Olympics in which year? R[λx[Year.Date.x]]. argmax(..., Index) 2004

46

slide-47
SLIDE 47

Approach

x y z t Z

(3) Execution Greece held its last Summer Olympics in which year? R[λx[Year.Date.x]]. argmax(..., Index) 2004 Set of candidates →

47

(1) Generation

slide-48
SLIDE 48

Approach

x z t Z

(2) Ranking (3) Execution Greece held its last Summer Olympics in which year? R[λx[Year.Date.x]]. argmax(..., Index) 2004

48

y

(1) Generation

slide-49
SLIDE 49

Approach

x z t Z

(2) Ranking (3) Execution Greece held its last Summer Olympics in which year? R[λx[Year.Date.x]]. argmax(..., Index) 2004

49

y

(1) Generation

slide-50
SLIDE 50

Representation

Convert table t to knowledge graph w

Year City Country Nations 1896 Athens Greece 14 1900 Paris France 24 1904

  • St. Louis

USA 12 ... ... ... ... 2004 Athens Greece 201 2008 Beijing China 204 2012 London UK 204

1896 1900 Athens Paris … … Year Year City City …

50

slide-51
SLIDE 51

Representation

Year City Country Nations 1896 Athens Greece 14 1900 Paris France 24 1904

  • St. Louis

USA 12 ... ... ... ... 2004 Athens Greece 201 2008 Beijing China 204 2012 London UK 204

1896 1900 Athens Paris … … Year Year City City … Next Next Index 1900.0 1900-XX-XX Number Date

51

Convert table t to knowledge graph w

slide-52
SLIDE 52

Approach

x z t Z

(2) Ranking (3) Execution Greece held its last Summer Olympics in which year? R[λx[Year.Date.x]]. argmax(..., Index) 2004

52

y

(1) Generation

slide-53
SLIDE 53

Approach

x z w Z

(2) Ranking (3) Execution Greece held its last Summer Olympics in which year? R[λx[Year.Date.x]]. argmax(..., Index) 2004

53

y

(1) Generation

1896 1900 Athens Paris … … Year Year City City … Next Next Index 1900.0 1900-XX-XX Number Date

slide-54
SLIDE 54

Approach

x z w Z

(2) Ranking (3) Execution Greece held its last Summer Olympics in which year? R[λx[Year.Date.x]]. argmax(..., Index) 2004

54

y

(1) Generation

1896 1900 Athens Paris … … Year Year City City … Next Next Index 1900.0 1900-XX-XX Number Date

slide-55
SLIDE 55

Generation

Build formulas bottom-up according to a set of deduction rules

Greece held its last Summer Olympics in which year?

55

R[λx[Year.Date.x]].argmax(Country.Greece, Index)

slide-56
SLIDE 56

Generation

Greece held its last Summer Olympics in which year?

Build formulas bottom-up according to a set of deduction rules

56

Greece 1896 Athens … Year City Next Index … Country Greece

slide-57
SLIDE 57

Generation

Greece held its last Summer Olympics in which year?

Greece Greece

Build formulas bottom-up according to a set of deduction rules

57

TokenSpan → Entity "anchored" to the word Greece

slide-58
SLIDE 58

Generation

Complication: Some logical predicates (e.g., relation Country) don't map to any phrase

Greece held its last Summer Olympics in which year?

58

R[λx[Year.Date.x]].argmax(Country.Greece, Index)

Greece Greece

slide-59
SLIDE 59

Generation

Complication: Some logical predicates (e.g., relation Country) don't map to any phrase

Greece held its last Summer Olympics in which year?

59

R[λx[Year.Date.x]].argmax(Country.Greece, Index)

Greece Greece

Even when there is such a phrase, we may still don't know the mapping if we have not seen the relation in any table in the training data

slide-60
SLIDE 60

Generation

Idea: Allow formulas to be created from nothing ("floating") ▸ Inspired by "bridging" [Berant et al., 2013]

60

Greece held its last Summer Olympics in which year?

Greece Greece

slide-61
SLIDE 61

Generation

61

Greece held its last Summer Olympics in which year?

Greece Country ø → Relation The relation Country is "floating" Greece

Idea: Allow formulas to be created from nothing ("floating") ▸ Inspired by "bridging" [Berant et al., 2013]

slide-62
SLIDE 62

Generation

62

Greece held its last Summer Olympics in which year?

Greece Country Country.Greece List of all rows with country Greece Relation + Values → Records [Relation.Values] Greece

Idea: Allow formulas to be created from nothing ("floating") ▸ Inspired by "bridging" [Berant et al., 2013]

slide-63
SLIDE 63

Generation

▸ Entities are anchored to token spans ▸ Relations and Operations are not

63

Greece held its last Summer Olympics in which year?

Greece Country Country.Greece Index argmax(Country.Greece, Index) The last row with country Greece Greece

slide-64
SLIDE 64

Generation

Connection between floating predicates and phrases in the question are made during ranking

64

Greece held its last Summer Olympics in which year?

Greece Country Country.Greece Index argmax(Country.Greece, Index) The last row with country Greece Greece

slide-65
SLIDE 65

Generation

Country.Greece Index argmax(Country.Greece, Index)

Problem: Over-generation due to high recursion

Index argmin(argmax(Country.Greece, Index), Index)

65

Redundant argmin

Handled by beam search and pruning heuristics

slide-66
SLIDE 66

Approach

x z w Z

(2) Ranking (3) Execution Greece held its last Summer Olympics in which year? R[λx[Year.Date.x]]. argmax(..., Index) 2004

66

y

(1) Generation

1896 1900 Athens Paris … … Year Year City City … Next Next Index 1900.0 1900-XX-XX Number Date

slide-67
SLIDE 67

Approach

x z w Z

(2) Ranking (3) Execution Greece held its last Summer Olympics in which year? R[λx[Year.Date.x]]. argmax(..., Index) 2004

67

y

(1) Generation

1896 1900 Athens Paris … … Year Year City City … Next Next Index 1900.0 1900-XX-XX Number Date

slide-68
SLIDE 68

Ranking

Given a set Z of candidate formulas z, define a log- linear distribution: pθ(z | x, w) ∝ exp {θTφ(x, w, z)} where ▸ θ = parameter vector ▸ φ(x, w, z) = feature vector

68

slide-69
SLIDE 69

Ranking

Features: ▸ Relate phrases in x to predicates in z (phrase = last, predicate = argmax) (phrase = year, predicate = Year) phrase == predicate

69

slide-70
SLIDE 70

Ranking

Features: ▸ Relate phrases in x to predicates in z (phrase = last, predicate = argmax) (phrase = year, predicate = Year) phrase == predicate ▸ Relate phrases in x to properties of y = ⟦z⟧w (headword = year, answer's type = NUMBER) headword == answer's column

70

slide-71
SLIDE 71

Learning

Given training example (x, w, y), define pθ(y | x, w) = pθ(z | x, w) I(y = ⟦z⟧w) As usual, we choose θ to maximize the (L1 regularized) expectation of log pθ(y | x, w) over training data

Σ

z ∊ Z

71

slide-72
SLIDE 72

Outline

▸ Background and Related Work ▸ Task and Dataset ▸ Approach ▸ Experiments

72

slide-73
SLIDE 73

Results

▸ Oracle: Able to generate a candidate formula z ∈ Z that executes to y ▸ Accuracy: The highest-ranked z executes to y

73

slide-74
SLIDE 74

Results

▸ Oracle: Able to generate a candidate formula z ∈ Z that executes to y ▸ Accuracy: The highest-ranked z executes to y Two baselines: ▸ IR-inspired: Pick an answer among table cells by putting softmax over table cells ▸ WQ: Restrict the generation rules to the ones from Berant and Liang (2014)

74

slide-75
SLIDE 75

Results on Test Set

accuracy

  • racle

IR-inspired 12.7 70.6 WQ This work In all settings, tables in test data are not seen during training

75

slide-76
SLIDE 76

Results on Test Set

accuracy

  • racle

IR-inspired 12.7 70.6 WQ 24.3 35.6 This work

76

In all settings, tables in test data are not seen during training

slide-77
SLIDE 77

Results on Test Set

accuracy

  • racle

IR-inspired 12.7 70.6 WQ 24.3 35.6 This work 37.1 76.6

77

In all settings, tables in test data are not seen during training

slide-78
SLIDE 78

Positive Examples

How many districts have a population density of at least 1000? (Information retrieval alone can't answer these questions) Who finished directly after the driver who finished in 1:28.745? What is the last title that spicy horse produced?

78

slide-79
SLIDE 79

Error Analysis

(1) Anchoring [18%]

how many mexican swimmers ranked in the top 10?

Rank Swimmer Country Time Note

Mexico

79

slide-80
SLIDE 80

Error Analysis

(2) Normalization [29%]

how long does the show defcon 3 last?

ET Days Program Hosts Description

2pm–3pm

80

slide-81
SLIDE 81

Error Analysis

(3) Unhandled Operations [19%]

was there more gold medals won than silver? (boolean answer)

which movies were number 1 for at least two consecutive weeks?

(consecutive count)

how many titles had the same author listed as the illustrator?

(count rows with arbitrary conditions)

81

slide-82
SLIDE 82

Error Analysis

(4) Ranking Errors [24%]

how many buildings on the list are taller than 200 feet?

Name Street Address Years as Tallest

Height ft (m)

Floors 792 (241)

82

slide-83
SLIDE 83

83

Conclusion

Breadth (domain size) Depth (compositionality)

Early Systems Scale to KBs Web Search Semantic Parsing on Semi-Structured Data

slide-84
SLIDE 84

Conclusion

84

Dataset and reproducible experiments are available

  • n CodaLab:

nlp.stanford.edu/software/sempre/wikitable Thank you