weakly supervised semantic parsing with abstract examples › ... › p18-1168.presentation.pdf ·...

30
Weakly Supervised Semantic Parsing with Abstract Examples Omer Goldman, Veronica Latcinnik, Udi Naveh, Amir Globerson, Jonathan Berant Tel Aviv University ACL, July 2018

Upload: others

Post on 04-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Weakly Supervised Semantic Parsing with Abstract ExamplesOmer Goldman, Veronica Latcinnik, Udi Naveh, Amir Globerson, Jonathan Berant

Tel Aviv University

ACL, July 2018

Page 2: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Semantic Parsing

model

CapitalOf.argmax(Type.State ∩ LocatedIn.US,Population)

𝑊 h𝑎𝑡 𝑖𝑠 𝑡h𝑒 𝑐𝑎𝑝𝑖𝑡𝑎𝑙 𝑜𝑓 𝑡h𝑒 𝑙𝑎𝑟𝑔𝑒𝑠𝑡 𝑈𝑆 𝑠𝑡𝑎𝑡𝑒?

execution

Sacramento

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

KB:

1

Page 3: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Training with Full Supervision

! Training examples:

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

x: y: CapitalOf.argmax(Type.State ∩ LocatedIn.US,Population)E X P E N S I V E

$ € ¥

2

Page 4: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Training with Weak Supervision

! Training examples:

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

x: y: Sacramento

3

Page 5: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Problems with Weak Supervision

! Exponential search space

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

1

3+3*15

5+30

2-2

4+60/3

decoding

4

Page 6: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Problems with Weak Supervision

! Spurious programs (Pasupat and Liang, 2016; Guu et al., 2017)

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

32/4

20-16

4*2-4

50-1

3+85

decoding

4

Correct program: 2*2

Page 7: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

CNLVR (Suhr et al., 2017)

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions 6

Page 8: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Semantic Parsing

model

exist(filter(ALL_ITEMS,λx.IsBlue(x) ∩ IsSquare(x)))

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑏𝑙𝑢𝑒 𝑠𝑞𝑢𝑎𝑟𝑒

execution

True

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

KB:

Binary! 50% spurious

7

Page 9: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Insight

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑒𝑥𝑎𝑐𝑡𝑙𝑦 𝑜𝑛𝑒 𝑏𝑙𝑎𝑐𝑘 𝑐𝑖𝑟𝑐𝑙𝑒 𝑛𝑜𝑡 𝑡𝑜𝑢𝑐h𝑖𝑛𝑔 𝑡h𝑒 𝑒𝑑𝑔𝑒

! Equal(1,(filter(ALL_ITEMS,λx.IsBlack(x) ∩ IsCircle(x) ∩ ¬IsTouchingWall(x)))

! GreaterEqual(3,(filter(ALL_ITEMS,λx.IsBlue(x) ∩ IsTriangle(x) ∩ ¬IsTouchingWall(x)))

! GreaterEqual(1,(filter(ALL_ITEMS,λx.IsBlue(x) ∩ IsTriangle(x) ∩ ¬IsTouchingWall(x)))

! LessEqual(3,(filter(ALL_ITEMS,λx.IsYellow(x) ∩ IsRectangle(x) ∩ ¬IsTouchingWall(x)))

! Equal(1,(filter(ALL_ITEMS,λx.IsBlack(x) ∩ IsCircle(x) ∩ ¬IsTouchingWall(x)))

8

Page 10: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Contributions

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝐶 − 𝐶𝑂𝐿𝑂𝑅 𝐶 − 𝑆𝐻𝐴𝑃𝐸exist(filter(ALL_ITEMS,λx.IsC-COLOR(x)⋀IsC-SHAPE(x)))

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑦𝑒𝑙𝑙𝑜𝑤 𝑐𝑖𝑟𝑐𝑙𝑒exist(filter(ALL_ITEMS,λx.IsYellow(x)⋀IsCircle(x)))

Data augmentation helps search

Abstract cache tackles spuriousness

CNLVR improvement: 67.8 ! 82.5

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions 9

Page 11: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Semantic Parsing

11

Page 12: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Logical Program

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

x: z: exist(filter(ALL_BOXES,λx.ge(3,count(filter(x,λy.IsBlue(y))))))

Constant Set(Set(Item)) Function

Set() ! Int

Function Set() ! Bool

Variable Set(Item)

Variable Item

Function Set() BoolFunc() ! Set()

12

Page 13: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Model

! Training maximizes log-likelihood of correct programs

! + discriminative re-ranker

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

“There is a yellow triangle”

Exist(Filter(ALL_ITEMS,λx.IsYellow(x)))

Exist(Filter(ALL_ITEMS,λx.And(IsYellow(x), IsTriangle(x))))

GraeterEqual(1,count(Filter(ALL_ITEMS,λx.And(IsYellow(x),IsTriangle(x))))) Encoder – Decoder

Beam search

13

Page 14: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Abstract Examples

14

Page 15: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Abstraction

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑏𝑙𝑢𝑒 𝑠𝑞𝑢𝑎𝑟𝑒𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑦𝑒𝑙𝑙𝑜𝑤 𝑐𝑖𝑟𝑐𝑙𝑒

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝐶 − 𝐶𝑂𝐿𝑂𝑅 𝐶 − 𝑆𝐻𝐴𝑃𝐸

exist(filter(ALL_ITEMS,λx.IsC-COLOR(x)⋀IsC-SHAPE(x)))

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

exist(filter(ALL_ITEMS,λx.IsYellow(x)⋀IsCircle(x))) exist(filter(ALL_ITEMS,λx.IsBlue(x)⋀IsRectangle(x)))

15

Page 16: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Analysis

! ~150 abstract sentences cover 50% of CNLVR.

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

• There is………… • One of the……. • There are…….. • Exactly two….. • There is………… • In two of………. • There is……….. • There are…….. • There is……….. • One square….. • There is……….. • One of the……. • There are…….. • There is…….... • Two towers….. • There are…….. • There is……….. • One circle……. • There is……….. • Last one………..

abstraction

• There is…………… • There are………… • C-Num of…….…… • There is........... • One tower……….. • There are…………. • C-Num C-Shape… • There is……………. • C-Num towers….. • Another last………

3163 CNLVR sentences

~1300 abstract sentences

16

Page 17: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Abstraction

!Data augmentation

!Abstract cache

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions 17

Page 18: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Data Augmentation

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑦𝑒𝑙𝑙𝑜𝑤 𝑐𝑖𝑟𝑐𝑙𝑒

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝐶 − 𝐶𝑂𝐿𝑂𝑅 𝐶 − 𝑆𝐻𝐴𝑃𝐸exist(filter(ALL_ITEMS,λx.IsC-COLOR(x)⋀IsC-SHAPE(x)))

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑏𝑙𝑢𝑒 𝑟𝑒𝑐𝑡𝑎𝑛𝑔𝑙𝑒exist(filter(ALL_ITEMS,λx.IsBlue(x)⋀IsSquare(x)))

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑦𝑒𝑙𝑙𝑜𝑤 𝑡𝑟𝑖𝑎𝑛𝑔𝑙𝑒exist(filter(ALL_ITEMS,λx.IsYellow(x)⋀IsTriangle(x)))

𝑇h𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑏𝑙𝑎𝑐𝑘 𝑐𝑖𝑟𝑐𝑙𝑒exist(filter(ALL_ITEMS,λx.IsBlack(x)⋀IsCircle(x)))

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions 18

Page 19: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Training Procedure

~100 Abstract examples

~6000 Instantiated examples Supervised model

3163 CNLVR training examples Weakly-supervised model

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

Generation

Supervised training

Weakly supervised training

initialization

(abs. sent., abs. prog.)

(sentence, program)

(sentence, answer)

19

Page 20: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Abstract Cache

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions 20

Page 21: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Reward Tying

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

50% spurious

21

Page 22: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

:False

:False

6.25% spurious

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

Reward Tying

22

Page 23: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Results

23

Page 24: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Models

! Majority label (True)

! Max Entropy classifier on extracted features

! Supervised trained model (+Re-ranker)

! Weakly supervised trained model (+Re-ranker)

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

Baselines (Suhr et al., 2017)

24

Page 25: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Results - Public test set

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

Majority MaxEnt Sup. Sup.+Rerank W.Sup. W.Sup.+Rerank

6560.1

51.8

38.3

8481.776.6

66.967.7

56.2

Test-P Accuracy Test-P Consistency

25

Page 26: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Ablations

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

No dataaugmentation

Abstract weaklysupervised parser

26

Page 27: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Ablations

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions

-Abstraction -Data augment. -Beam cache W.Sup.+Rerank

67.4

56.1

41.2

7.1

85.7

77.271.4

58.2

Dev AccuracyDev Consistency

Cache addition

Data augmentation addition

27

Page 28: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Conclusions

28

Page 29: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Conclusions

! Similar ideas in: Dong and Lapata (2018) and Zhang et al. (2017)

! Automation would be useful

! Introduction ! Semantic parser ! Abstract examples ! Results ! Conclusions 29

Closed domains

Weak supervision

AbstractionBetter

training

Facilitate information sharing

Page 30: Weakly Supervised Semantic Parsing with Abstract Examples › ... › P18-1168.Presentation.pdf · Semantic parser ! Abstract examples ! Results ! Conclusions “There is a yellow

Thank you

https://github.com/udiNaveh/nlvr_tau_nlp_final_proj