coarse to fine decoding for neural semantic parsing
play

Coarse-to-Fine Decoding for Neural Semantic Parsing July 16, 2018 - PowerPoint PPT Presentation

Coarse-to-Fine Decoding for Neural Semantic Parsing July 16, 2018 Li Dong and Mirella Lapata Semantic Parsing Mapping natural language to structured representations Human-friendly -> Computer-friendly all flights from dallas before 10am


  1. Coarse-to-Fine Decoding for Neural Semantic Parsing July 16, 2018 Li Dong and Mirella Lapata

  2. Semantic Parsing Mapping natural language to structured representations Human-friendly -> Computer-friendly all flights from dallas before 10am Semantic Parser (lambda $0 e (and (flight $0) (from $0 dallas:ci) (< (departure_time $0) 1000:ti))) Example from ATIS (Kwiatkowski et al., 2011) 2 / 27

  3. Neural Semantic Parsing Sequence decoder (Jia and Liang, 2016; Dong and Lapata, 2016; Ling et al., 2016 ; Iyer et al., 2017) Syntactically-constrained decoder (Dong and Lapata, 2016; Xiao et al., 2016; Alvarez-Melis and Jaakkola, 2017; Yin and Neubig, 2017; Cheng et al., 2017; Krishnamurthy et al., 2017; Rabinovich et al., 2017; Xu et al., 2017) Attention Layer answer(J,(compa what microsoft jobs LSTM LSTM ny(J,'microsoft'),j do not require a ob(J),not((req_de bscs? g(J,'bscs'))))) Input Structured Encoder Decoder Utterance Representation 3 / 27

  4. This Work all flights from dallas before 10am Meaning Sketch (lambda#2 (and flight@1 from@2 (< departure time@1 ? ) ) ) & Low-level Details (e.g., arguments and variable names) (lambda $0 e (and (flight $0) (from $0 dallas:ci) (< (departure_time $0) 1000:ti))) 4 / 27

  5. Meaning Sketch Python code example if length of bits is lesser than integer 3 or second element of bits is not equal to string ’as’ , if len ( NAME ) < NUMBER or NAME [ NUMBER ] != STRING : if len(bits) < 3 or bits[1] != ’as’ : SQL example What record company did conductor Mikhail Snitko record for after 1996? WHERE > AND = SELECT Record Company WHERE ( Year of Recording > 1996 ) AND ( Conductor = Mikhail Snitko ) 5 / 27

  6. Meaning Sketch Disentangle high-level from low-level semantics Model meaning at different levels of granularity More compact meaning representation Length: 21.1 → 9.2 (on ATIS) Explicit sharing coarse structure For examples that have the same basic meaning Provide global context to fine meaning decoder Know what the basic meaning of input looks like 6 / 27

  7. Method 7 / 27

  8. Method 8 / 27

  9. Method 9 / 27

  10. Method Sketch constrains the decoding output Example 1: one augment is missing flight@1 (flight ) Example 2: type information NUMBER (a numeric token) 10 / 27

  11. Training and Inference 𝑦 : input, 𝑏 : sketch, 𝑧 : meaning representation Training: maximize the log likelihood Fine Meaning Coarse Meaning Decoder Decoder Inference: greedy search 11 / 27

  12. Semantic Parsing Tasks Natural language to logical form (Geo/ATIS) what is the population of the state with the largest area? (argmax $0 (and (mountain:t $0) (loc:t $0 alaska:s)) (elevation:i $0)) Natural language to source code (Django) if length of bits is lesser than integer 3 or second element of bits is not equal to string ’as’ , if len (bits) < 3 or bits[1] != ’as’: Natural language to SQL (WikiSQL) Pianist Conductor Record Company Year of Recording Format What record company did conductor Mikhail Snitko record for after 1996? SELECT Record Company WHERE ( Year of Recording > 1996 ) AND ( Conductor = Mikhail Snitko ) (Zettlemoyer and Collins, 2005; Kwiatkowski et al., 2011; Oda et al., 2015; Zhong et al., 2017) 12 / 27

  13. Natural Language to Logical Form “#” Variable information “@” “?” (e.g., lambda, Arguments of Partial argument count, and predicate or information argmax) operator (lambda#2 (and flight@1 from@2 (< departure time@1 ? ) ) ) (lambda $0 e (and (flight $0) (from $0 dallas:ci) (< (departure_time $0) 1000:ti))) 13 / 27

  14. Natural Language to Source Code Substitute tokens with their token types Except Delimiters (e.g., “[”, and “:”) Operators (e.g., “+”, and “*”) Built- in keywords (e.g., “True”, and “while”) if NAME [ : NUMBER ] . NAME ( ) == STRING : if s [ : 4 ] . lower ( ) == ’http’: https://docs.python.org/3/library/tokenize.html 14 / 27

  15. Natural Language to SQL WikiSQL (Zhong et al., 2017) SELECT agg_operator agg_column WHERE (cond_column cond_operator cond_value) AND ... SELECT Record Company WHERE ( Year of Recording > 1996 ) AND ( Conductor = Mikhail Snitko ) WHERE > AND = 15 / 27

  16. Natural Language to SQL Decoding is table-aware How many presidents are graduated from A? President College SELECT COUNT ( President ) WHERE ( College = A ) College Number of Presidents SELECT Number of Presidents WHERE ( College = A ) 16 / 27

  17. ǁ ǁ ǁ ǁ Natural Language to SQL Table-aware input encoder LSTM units Vectors Attention 𝑓 1 𝑓 2 𝑓 3 𝑓 4 𝒇 𝒇 𝒇 𝒇 𝒅 1 𝒅 2 𝒅 3 𝒅 4 Question-to-Table Attention 𝒅 1 𝒅 2 𝒇 1 𝒇 2 𝒇 3 𝒇 4 𝑦 1 𝑦 2 𝑦 3 𝑦 4 || college || number of presidents || Input Question Column 1 Column 2 17 / 27

  18. ǁ Natural Language to SQL SELECT agg_operator agg_column SELECT clause WHERE (cond_column cond_operator cond_value) AND ... Softmax agg_operator ∈ {empty, COUNT , 𝑓 MIN , MAX , SUM , AVG } Classifier Question Column Vector agg_column Pointer 𝒅 1 𝒅 2 college || number of presidents || Column 1 Column 2 18 / 27

  19. ǁ Natural Language to SQL SELECT agg_operator agg_column WHERE Clause WHERE (cond_column cond_operator cond_value) AND ... What record company did conductor Record Year of Pianist Conductor Format Company Recording Mikhail Snitko record for after 1996 ? Sketch 𝑓 WHERE > AND = Classification 19 / 27

  20. ǁ ǁ ǁ Natural Language to SQL SELECT agg_operator agg_column WHERE Clause WHERE (cond_column cond_operator cond_value) AND ... What record company did conductor Record Year of Pianist Conductor Format Company Recording Mikhail Snitko record for after 1996 ? cond_col cond … AND Pointer Pointer Sketch-Guided 𝒊 1 𝒊 2 𝒊 3 𝒊 4 … WHERE Decoding 𝒅 4 𝑓 𝑚 𝑓 𝑠 Sketch 𝒘 1 𝒘 2 Encoding Sketch 𝑓 WHERE > AND = Classification 20 / 27

  21. ǁ ǁ ǁ Natural Language to SQL SELECT agg_operator agg_column WHERE Clause WHERE (cond_column cond_operator cond_value) AND ... What record company did conductor Record Year of Pianist Conductor Format Company Recording Mikhail Snitko record for after 1996 ? Point to a table column cond_col cond … AND Point to a Pointer Pointer text span Sketch-Guided 𝒊 1 𝒊 2 𝒊 3 𝒊 4 … WHERE Decoding 𝒅 4 𝑓 𝑚 𝑓 𝑠 Sketch 𝒘 1 𝒘 2 Encoding Sketch 𝑓 WHERE > AND = Classification 21 / 27

  22. Experimental Results NL->Code (Django) 74.1 75 71.6 69.5 70 Accuracy 65 62.3 60 55 50 (Ling et al., 2016) (Yin and Neubig, OneStage (w/o Coarse2Fine 2017) sketch) 22 / 27

  23. Experimental Results NL->Logical Form 88.2 89 87.7 87.1 87.1 87 85.9 85.3 85 84.6 84.6 84.2 85 Accuracy 83 81 79 77 75 Geo ATIS Seq2Seq Seq2Tree ASN OneStage Coarse2Fine Baseline: (Dong and Lapata, 2016; Rabinovich et al., 2017) 23 / 27

  24. Experimental Results NL->SQL (WikiSQL) 80 78.5 75.9 75 Execution Accuracy 70 68 65 59.4 60 55 53.3 50 45 Aug Pointer (Zhong et al., (Xu et al., 2017) OneStage (w/o Coarse2Fine Network (Zhong 2017) sketch) et al., 2017) 24 / 27

  25. Sketch Accuracy 95.9 95.4 95 89.3 90 88 Sketch Accuracy 85.9 85.4 85 80 77.4 73.2 75 70 65 Geo ATIS Django WikiSQL OneStage Coarse2Fine 25 / 27

  26. Oracle Meaning Sketch 95.1 93.9 95 88.2 90 87.7 85 Accuracy 83 79.6 78.5 80 74.1 75 70 65 Geo ATIS Django WikiSQL Coarse2Fine + Oracle Sketch 26 / 27

  27. Future Work Alternative ways of defining meaning sketches Different levels of granularity Weakly supervised setting Meaning sketch reduces search space Partial annotation Only annotate meaning sketches for some examples 27 / 27

  28. Thanks! Q&A Code Available: http://homepages.inf.ed.ac.uk/s1478528

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend