learning compositional semantics
play

Learning Compositional Semantics CS224U: Natural Language - PowerPoint PPT Presentation

Learning Compositional Semantics CS224U: Natural Language Understanding Feb. 9, 2012 Percy Liang Google/Stanford Review Last time: Mapping sentences to logical forms (FOL or lambda calculus) Alaska borders no states. x. state ( x )


  1. Dependency-Based Compositional Semantics (DCS) What is the most populous city in California? 10

  2. Dependency-Based Compositional Semantics (DCS) What is the most populous city in California? city 1 1 1 1 population loc 2 c 1 argmax CA 10

  3. How to interpret the logical form? What is the most populous city in California? city 1 1 1 1 population loc 2 c 1 argmax CA 11

  4. How to interpret the logical form? What is the most populous city in California? city 1 1 1 1 population loc 2 c 1 argmax CA Los Angeles 11

  5. How to interpret the logical form? What is the most populous city in California? city 1 1 1 1 population loc 2 c 1 argmax CA World/Database Los Angeles 11

  6. World/Database city state San Francisco Alabama Chicago Alaska Boston Arizona · · · · · · loc border Mount Shasta California Washington Oregon San Francisco California Washington Idaho Boston Massachusetts Oregon Washington · · · · · · · · · · · · · · · · · · 12

  7. Basic DCS Trees DCS tree Database city 1 1 loc 2 1 CA 13

  8. Basic DCS Trees DCS tree Constraints Database city 1 1 loc 2 1 CA A DCS tree encodes a constraint satisfaction problem (CSP) 13

  9. Basic DCS Trees DCS tree Constraints Database city city c ∈ city San Francisco 1 Chicago Boston 1 · · · loc 2 1 CA A DCS tree encodes a constraint satisfaction problem (CSP) 13

  10. Basic DCS Trees DCS tree Constraints Database city c ∈ city city San Francisco 1 Chicago Boston 1 · · · ℓ ∈ loc loc 2 loc Mount Shasta California 1 San Francisco California CA Boston Massachusetts · · · · · · A DCS tree encodes a constraint satisfaction problem (CSP) 13

  11. Basic DCS Trees DCS tree Constraints Database city c ∈ city city San Francisco 1 Chicago Boston 1 · · · ℓ ∈ loc loc 2 loc Mount Shasta California 1 San Francisco California s ∈ CA CA Boston Massachusetts · · · · · · CA California A DCS tree encodes a constraint satisfaction problem (CSP) 13

  12. Basic DCS Trees DCS tree Constraints Database city c ∈ city city San Francisco 1 Chicago c 1 = ℓ 1 Boston 1 · · · ℓ ∈ loc loc 2 loc Mount Shasta California 1 San Francisco California s ∈ CA CA Boston Massachusetts · · · · · · CA California A DCS tree encodes a constraint satisfaction problem (CSP) 13

  13. Basic DCS Trees DCS tree Constraints Database city c ∈ city city San Francisco 1 Chicago c 1 = ℓ 1 Boston 1 · · · ℓ ∈ loc loc 2 loc ℓ 2 = s 1 Mount Shasta California 1 San Francisco California s ∈ CA CA Boston Massachusetts · · · · · · CA California A DCS tree encodes a constraint satisfaction problem (CSP) 13

  14. Basic DCS Trees DCS tree Constraints Database city c ∈ city city San Francisco 1 Chicago c 1 = ℓ 1 Boston 1 · · · ℓ ∈ loc loc 2 loc ℓ 2 = s 1 Mount Shasta California 1 San Francisco California s ∈ CA CA Boston Massachusetts · · · · · · CA California A DCS tree encodes a constraint satisfaction problem (CSP) 13

  15. Basic DCS Trees DCS tree Constraints Database city c ∈ city city San Francisco 1 Chicago c 1 = ℓ 1 Boston 1 · · · ℓ ∈ loc loc 2 loc ℓ 2 = s 1 Mount Shasta California 1 San Francisco California s ∈ CA CA Boston Massachusetts · · · · · · CA California A DCS tree encodes a constraint satisfaction problem (CSP) 13

  16. Basic DCS Trees DCS tree Constraints Database city c ∈ city city San Francisco 1 Chicago c 1 = ℓ 1 Boston 1 · · · ℓ ∈ loc loc 2 loc ℓ 2 = s 1 Mount Shasta California 1 San Francisco California s ∈ CA CA Boston Massachusetts · · · · · · CA California A DCS tree encodes a constraint satisfaction problem (CSP) 13

  17. Basic DCS Trees DCS tree Constraints Database city c ∈ city city San Francisco 1 Chicago c 1 = ℓ 1 Boston 1 · · · ℓ ∈ loc loc 2 loc ℓ 2 = s 1 Mount Shasta California 1 San Francisco California s ∈ CA CA Boston Massachusetts · · · · · · CA California A DCS tree encodes a constraint satisfaction problem (CSP) Computation : dynamic programming ⇒ time = O ( # nodes ) 13

  18. Properties of DCS Trees city 1 1 1 2 loc traverse 2 1 1 1 state river 1 1 1 1 1 1 border major traverse 2 2 1 1 CA AZ 14

  19. Properties of DCS Trees city 1 1 1 2 loc traverse 2 1 1 1 state river 1 1 1 1 1 1 border major traverse 2 2 1 1 CA AZ Trees 14

  20. Properties of DCS Trees city 1 1 1 2 loc traverse 2 1 1 1 state river 1 1 1 1 1 1 border major traverse 2 2 1 1 CA AZ Linguistics Trees syntactic locality 14

  21. Properties of DCS Trees city 1 1 1 2 loc traverse 2 1 1 1 state river 1 1 1 1 1 1 border major traverse 2 2 1 1 CA AZ Linguistics Trees Computation syntactic locality efficient interpretation 14

  22. Divergence between Syntactic and Semantic Scope most populous city in California 15

  23. Divergence between Syntactic and Semantic Scope most populous city in California Syntax city populous in most California 15

  24. Divergence between Syntactic and Semantic Scope most populous city in California Syntax Semantics city argmax ( λx. city ( x ) ∧ loc ( x, CA ) , λx. population ( x )) populous in most California 15

  25. Divergence between Syntactic and Semantic Scope most populous city in California Syntax Semantics city argmax ( λx. city ( x ) ∧ loc ( x, CA ) , λx. population ( x )) populous in most California 15

  26. Divergence between Syntactic and Semantic Scope most populous city in California Syntax Semantics city argmax ( λx. city ( x ) ∧ loc ( x, CA ) , λx. population ( x )) populous in most California Problem: syntactic scope is lower than semantic scope 15

  27. Divergence between Syntactic and Semantic Scope most populous city in California Syntax Semantics city argmax ( λx. city ( x ) ∧ loc ( x, CA ) , λx. population ( x )) populous in most California Problem: syntactic scope is lower than semantic scope If DCS trees look like syntax, how do we get correct semantics? 15

  28. Solution: Mark-Execute most populous city in California Superlatives ∗∗ x 1 x 1 city 1 1 1 1 population loc 2 c 1 argmax CA 16

  29. Solution: Mark-Execute most populous city in California Superlatives ∗∗ x 1 x 1 city 1 1 1 1 population loc Mark at syntactic scope 2 c 1 argmax CA 16

  30. Solution: Mark-Execute most populous city in California Superlatives ∗∗ Execute at semantic scope x 1 x 1 city 1 1 1 1 population loc Mark at syntactic scope 2 c 1 argmax CA 16

  31. Solution: Mark-Execute Alaska borders no states. Negation ∗∗ Execute at semantic scope x 1 x 1 border 1 2 1 1 AK state Mark at syntactic scope q no 16

  32. Solution: Mark-Execute Some river traverses every city. Quantification (narrow) ∗∗ Execute at semantic scope x 12 x 12 traverse 1 2 1 1 river city Mark at syntactic scope q q some every 16

  33. Solution: Mark-Execute Some river traverses every city. Quantification (wide) ∗∗ Execute at semantic scope x 21 x 21 traverse 1 2 1 1 river city Mark at syntactic scope q q some every 16

  34. Solution: Mark-Execute Some river traverses every city. Quantification (wide) ∗∗ Execute at semantic scope x 21 x 21 traverse 1 2 1 1 river city Mark at syntactic scope q q some every Analogy: Montague’s quantifying in, Carpenter’s scoping constructor 16

  35. From Sentences to DCS Trees Lexicon (very simple/crude) no ⇒ no state ⇒ state 17

  36. From Sentences to DCS Trees Lexicon (very simple/crude) no no ⇒ state ⇒ state Grammar (very simple/crude) a b i i a b a b ⇒ ⇒ j j b a 17

  37. From Sentences to DCS Trees Lexicon (very simple/crude) no no ⇒ state ⇒ state Grammar (very simple/crude) a b i i j j a b a b c c ⇒ ⇒ k k l l b a 17

  38. Words to Predicates (Lexical Semantics) What is the most populous city in CA ? 18

  39. Words to Predicates (Lexical Semantics) CA What is the most populous city in CA ? Lexical Triggers: 1. String match CA ⇒ CA 18

  40. Words to Predicates (Lexical Semantics) argmax CA What is the most populous city in CA ? Lexical Triggers: 1. String match CA ⇒ CA 2. Function words (20 words) most ⇒ argmax 18

  41. Words to Predicates (Lexical Semantics) city city state state river river argmax population population CA What is the most populous city in CA ? Lexical Triggers: 1. String match CA ⇒ CA 2. Function words (20 words) most ⇒ argmax 3. Nouns/adjectives city ⇒ city state river population 18

  42. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] i j most populous city in California 19

  43. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] i k j most populous city in California 19

  44. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] C i,k C k,j i k j most populous city in California 19

  45. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] population city 1 c 1 argmax loc 2 1 CA C i,k C k,j i k j most populous city in California 19

  46. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] city 1 1 1 1 population loc 2 population city c 1 1 c argmax CA 1 argmax loc 2 1 CA C i,k C k,j i k j most populous city in California 19

  47. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] city 1 1 2 1 population loc 2 population city c 1 1 c argmax CA 1 argmax loc 2 1 CA C i,k C k,j i k j most populous city in California 19

  48. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] city 1 1 1 1 loc loc 2 2 population city 1 1 1 c population CA 1 argmax loc c 2 argmax 1 CA C i,k C k,j i k j most populous city in California 19

  49. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] city 1 1 2 1 loc loc 1 2 population city 1 1 1 c population CA 1 argmax loc c 2 argmax 1 CA C i,k C k,j i k j most populous city in California 19

  50. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] city 1 1 2 1 border loc 1 2 population city 1 1 1 c population CA 1 argmax loc c 2 argmax 1 CA C i,k C k,j i k j most populous city in California 19

  51. Predicates to DCS Trees (Compositional Semantics) C i,j = set of DCS trees for span [ i, j ] population 1 c 1 argmax city 1 population city 1 1 c loc 1 2 argmax loc 1 2 CA 1 CA C i,k C k,j i k j most populous city in California 19

  52. Comparison CCG DCS 20

  53. Comparison CCG DCS Logical form lambda calculus formulae DCS trees λx. city ( x ) ∧ loc ( x, CA ) 1 1 2 1 CA city loc 20

  54. Comparison CCG DCS Logical form lambda calculus formulae DCS trees λx. city ( x ) ∧ loc ( x, CA ) 1 1 2 1 CA city loc Lexicon categories + lambda calculus predicates major n / n : λf.λx.f ( x ) ∧ major ( x ) major 20

  55. Comparison CCG DCS Logical form lambda calculus formulae DCS trees λx. city ( x ) ∧ loc ( x, CA ) 1 1 2 1 CA city loc Lexicon categories + lambda calculus predicates major n / n : λf.λx.f ( x ) ∧ major ( x ) major Grammar combinator rules ≅ dependency parsing Y/X : a X : b Y : a ( b ) ⇒ i j a b 20

  56. Comparison CCG DCS Logical form lambda calculus formulae DCS trees λx. city ( x ) ∧ loc ( x, CA ) 1 1 2 1 CA city loc Lexicon categories + lambda calculus predicates major n / n : λf.λx.f ( x ) ∧ major ( x ) major Grammar combinator rules ≅ dependency parsing Y/X : a X : b Y : a ( b ) ⇒ i j a b Nature tighter control simple/permissive 20

  57. Comparison CCG DCS Logical form lambda calculus formulae DCS trees λx. city ( x ) ∧ loc ( x, CA ) 1 1 2 1 CA city loc Lexicon categories + lambda calculus predicates major n / n : λf.λx.f ( x ) ∧ major ( x ) major Grammar combinator rules ≅ dependency parsing Y/X : a X : b Y : a ( b ) ⇒ i j a b Nature tighter control simple/permissive Origin linguistics NLP 20

  58. Outline city 1 1 1 2 loc traverse 2 1 1 1 Representation state river 1 1 1 1 1 1 border major traverse 2 2 1 1 CA AZ x Learning z θ w y Experiments 21

  59. Supervision Detailed Supervision What is the largest city in California? argmax ( { c : city ( c ) ∧ loc ( c, CA ) } , population ) 22

  60. Supervision Detailed Supervision What is the largest city in California? expert argmax ( { c : city ( c ) ∧ loc ( c, CA ) } , population ) 22

  61. Supervision Detailed Supervision What is the largest city in California? - doesn’t scale up expert argmax ( { c : city ( c ) ∧ loc ( c, CA ) } , population ) 22

  62. Supervision Detailed Supervision What is the largest city in California? - doesn’t scale up expert argmax ( { c : city ( c ) ∧ loc ( c, CA ) } , population ) Natural Supervision What is the largest city in California? Los Angeles 22

  63. Supervision Detailed Supervision What is the largest city in California? - doesn’t scale up expert argmax ( { c : city ( c ) ∧ loc ( c, CA ) } , population ) Natural Supervision What is the largest city in California? non-expert Los Angeles 22

  64. Supervision Detailed Supervision What is the largest city in California? - doesn’t scale up expert argmax ( { c : city ( c ) ∧ loc ( c, CA ) } , population ) Natural Supervision What is the largest city in California? - scales up non-expert Los Angeles 22

  65. Supervision Detailed Supervision What is the largest city in California? - doesn’t scale up expert - representation-dependent argmax ( { c : city ( c ) ∧ loc ( c, CA ) } , population ) Natural Supervision What is the largest city in California? - scales up non-expert Los Angeles 22

Recommend


More recommend