Slide 1

Slide 1 text

2018/12/09 Yuji Yamamoto (@y_yammt) EMNLP2018 ࿦จಡΈձ
 (@CyberAgent, Inc.)

Slide 2

Slide 2 text

ຊ೔঺հ͢Δ࿦จ • ͻͱ͜ͱͰݴ͏ͱʮಡΈඈ͹͠ɺಡΈฦ͕͠Ͱ͖ΔLSTMʯɻ • ಡΈඈ͹͠Ͱ(ಡΈͷ)ޮ཰ੑΛ࣮ݱ͠ɺ • ಡΈฦ͠Ͱམͱͨ͠৘ใΛऔΓ໭ͦ͏ͱ͢Δ • ࣮ݧͰLSTMͱൺֱͯ͠ΑΓߴ଎ͰΑΓΑ͘༧ଌͰ͖Δ͜ͱΛࣔͨ͠ɻ 2 New!

Slide 3

Slide 3 text

ൃදͷߏ੒ • લఏ: • ࿦จதͰऔΓѻ͍ͬͯΔλεΫ • ී௨ͷLSTM(Vanilla LSTM)ͰͷϞσϧԽ • ఏҊख๏: • χϡʔϥϧωοτϫʔΫͷߏ଄ • ύϥϝʔλߋ৽ͷ֓ཁ • ࣮ݧ: • ݁Ռ 3

Slide 4

Slide 4 text

औΓѻ͏λεΫ

Slide 5

Slide 5 text

࿦จதͰऔΓѻ͍ͬͯΔλεΫ • ςΩετΛೖྗͱ͠ɺ༩͑ΒΕͨީิͷத͔Βਖ਼͍͠΋ͷ Λબ୒͢Δɻ 1. ײ৘෼ੳ (ϙδωΨ൑ఆ) 2. χϡʔεهࣄ෼ྨ 3. ۭॴิॆ • ࣍ϖʔδʹ֤λεΫͷྫΛࣔ͠·͢ɻ • จॻͷҰ෦ΛಡΉ͚ͩͰ΋ճ౴Ͱ͖ͦ͏ͩͱ͍͏ײ֮Λ ͔ͭΜͰ͍͚ͨͩΕ͹ͱࢥ͍·͢ɻ 5 બ୒͢Δީิ͕ͲͷࣄྫͰ΋ಉ͡ (Ϋϥε෼ྨ) બ୒͢Δީิ͕ࣄྫ͝ͱʹมΘΔ

Slide 6

Slide 6 text

ײ৘෼ੳ (ϙδωΨ൑ఆ) • өըͷϨϏϡʔจΛݩʹPositive, NegativeΛ൑ఆ 6 Lars Von Triers Europa is an extremely good film. How's that? Von Trier has a very stylized way to tell a story, at least he did have with Europa. To me the whole film was like an experience even if I did see it on a small television screen. Even with all the tricks, in my opinion, this film is the most complete, REAL and moving piece of cinema then most of the films on the top 250 list. I also think it is perhaps the scariest, the most gothic and complete film around. All right there are other good ones too, but this one is my favorite. The final scene is one of the most harrowing scenes ever. (*) ϨϏϡʔจॻ͸ IMDB dataset ͷ 107_10.txt ΑΓҾ༻
 http://ai.stanford.edu/~amaas/data/sentiment/index.html Positive

Slide 7

Slide 7 text

χϡʔεهࣄ෼ྨ • χϡʔεهࣄΛݩʹτϐοΫ(ࠃࡍ, εϙʔπ, Ϗδωε, Պֶٕज़) Λ൑ఆ • ར༻͍ͯ͠Δσʔληοτ(AG Dataset)ͷΞϊςʔγϣϯͰ͸
 ෳ਺τϐοΫΛׂΓ౰ͯΔ͜ͱ͸͍ͯ͠ͳ͍ɻ
 (ͭ·Γଟϥϕϧ໰୊Ͱ͸ͳ͍) 7 Enterprise Security Adobe Patches Acrobat Vulnerabilities Adobe has issued a patch for Acrobat Reader to correct a vulnerability that could allow an atacker to take over a user #39;s system with an infected PDF file. Պֶٕज़ (*) χϡʔεهࣄ͸ mhjabreel/CharCNN ʹ͋Δσʔληοτ͔ΒҾ༻ https://github.com/mhjabreel/CharCNN

Slide 8

Slide 8 text

ۭॴิॆ • จॻ, ࣭໰, ճ౴ީิΛݩʹద੾ͳճ౴Λબ୒ 8 … 5 `` Thank you , " said Alice , `` it 's very interesting . 6 I never knew so much about a whiting before . " 7 `` I can tell you more than that , if you like , " said the Gryphon . 8 `` Do you know why it 's called a whiting ? " 9 `` I never thought about it , " said Alice . 10 `` Why ? “ 11 `` IT DOES THE BOOTS AND SHOES . ‘ 12 the Gryphon replied very solemnly . 13 Alice was thoroughly puzzled . … Query: `` Boots and shoes under the sea , " the XXXXX went on in a deep voice , `` are done with a whiting ". Candidates: Alice|BOOTS|Gryphon|SHOES|answer|fall|mouths|tone|way|whiting Gryphon (*) https://research.fb.com/downloads/babi/

Slide 9

Slide 9 text

ී௨ͷLSTM (Vanilla LSTM)
 ͰͷϞσϧԽ

Slide 10

Slide 10 text

LSTMΛ͓ܰ͘͞Β͍ 10 ht , ct = LSTM(xt , ht−1 , ct−1 ) xt ∈ ℝd×1 ht ∈ ℝh×1 ct ∈ ℝh×1 it = σ(Wii xt + bii + Whi ht−1 + bhi ) ft = σ(Wif xt + bif + Whf ht−1 + bhf ) gt = tanh(Wig xt + big + Whg ht−1 + bhg ) ot = σ(Wio xt + bio + Who ht−1 + bho ) ct = ft ∘ ct−1 + it ∘ gt ht = ot ∘ tanh(ct ) -45. xt ht−1 ct−1 ht ct torch.nn.LSTMCellͰॻ͔Ε͍ͯΔఆٛΛ WikipediaͷLSTMͷϖʔδʹ߹Θͤͯॻ͖௚ͨ͠ Wii ∈ ℝh×d, Wif ∈ ℝh×d, Wig ∈ ℝh×d, Wio ∈ ℝh×d bii ∈ ℝh×1, bif ∈ ℝh×1, big ∈ ℝh×1, bio ∈ ℝh×1 Whi ∈ ℝh×h, Whf ∈ ℝh×h, Whg ∈ ℝh×h, Who ∈ ℝh×h bhi ∈ ℝh×1, bhf ∈ ℝh×1, bhg ∈ ℝh×1, bho ∈ ℝh×1 t࣌఺ͷೖྗ t࣌఺ͷӅΕঢ়ଶ t࣌఺ͷηϧঢ়ଶ ୯७RNNϢχοτΛվྑͯ͠௕ظґଘΛֶशͰ͖ΔΑ͏ʹͨ͠΋ͷ

Slide 11

Slide 11 text

ී௨ͷLSTMͰͷϞσϧԽ (Ϋϥε෼ྨฤ) 11 Lars Von Triers Europa is an extremely good film. … The final scene is one of the most harrowing scenes ever. -45. h0 Lars -45. Von … -45. ever -45. . softmax(Wh0 ) W ∈ ℝ2×h Positive, Negative ͷ2Ϋϥε Positive ຤ඌͷӅΕঢ়ଶΛઢܗม׵ͯ͠SoftmaxΛ͔͚Ε͹Α͍ɻ

Slide 12

Slide 12 text

ී௨ͷLSTMͰͷϞσϧԽ (ۭॴิॆฤ) 12 … 7 `` I can tell you more than that , if you like , " said the Gryphon . 8 `` Do you know why it 's called a whiting ? " … Query: `` Boots and shoes under the sea , " the XXXXX went on in a deep voice , `` are done with a whiting ". Candidates: Alice|BOOTS|Gryphon|SHOES|answer|fall|mouths|tone|way|whiting Gryphon • จॻͱQueryΛ࿈݁ͨ͠΋ͷΛೖྗͱ͢Δɻ • ӅΕঢ়ଶΛ୯ޠຒΊࠐΈϕΫτϧͷۭؒʹઢܗม׵ͯ͠ɺ΋ͬͱ΋͍ۙީิΛ બ୒͢Δɻ -45. h0 … -45. -45. softmax(CWh0 ) ∈ ℝ10 C ∈ ℝ10×d 10ݸͷճ౴ީิͷ୯ޠຒΊࠐΈϕΫτϧΛฒ΂ͨ΋ͷ

Slide 13

Slide 13 text

ఏҊख๏ LSTM-Shuttle

Slide 14

Slide 14 text

ԿΛ͢Δ΋ͷ͔? • ͻͱ͜ͱͰݴ͏ͱʮಡΈඈ͹͠ɺಡΈฦ͕͠Ͱ͖ΔLSTMʯɻ • ಡΈඈ͹͠Ͱ(ಡΈͷ)ޮ཰ੑΛ࣮ݱ͠ɺ • ಡΈฦ͠Ͱམͱͨ͠৘ใΛऔΓ໭ͦ͏ͱ͢Δ • LSTMͷӅΕঢ়ଶΛར༻ͯ͠ɺͲΕ͚ͩτʔΫϯ(=୯ޠ or จࣈ or จ)Λ
 ಡΈඈ͹͢(or ಡΈฦ͢)͔ΛܾΊΔɻ 14 -45. xt ht−1 ct−1 ht ct softmax(Ws ht ) ͜ͷΑ͏ͳsoftmaxΛ༻ҙ͢Ε͹ಡΈඈ͹͠ɺ ಡΈฦ͠ͷࢦࣔΛग़͢͜ͱ͕Ͱ͖Δɻ
 (Ws ͷߦྻαΠζ͸ޙͰࣔ͢)

Slide 15

Slide 15 text

ه߸ͷఆٛ • N: ಡΈඈ͹͠/ಡΈฦ͠ΛԿճڐ͔͢ • R: ಡΈඈ͹͠/ಡΈฦ͢͠ΔલʹԿτʔΫϯ(ॱํ޲ʹ)ಡΈࠐΉ͔ • K: ࠷େԿτʔΫϯඈ͹͔͢ • ޙΖʹKτʔΫϯɺલKτʔΫϯͣΒ͢͜ͱ͕Ͱ͖Δɻ • ͞ΒʹɺͣΒ͞ͳ͍ͱ͍͏બ୒ࢶ΋ೖΕΔ(ಡΈࠐΈऴྃΛද͢)ͱɺ2K+1௨Γ
 ͷಡΈඈ͹͠ɺಡΈฦ͠ࢦ͕ࣔ͋Γ͑Δɻ 15 -45. xt ht−1 ct−1 ht ct softmax(Ws ht ) Ws ∈ ℝ(2K+1)×h

Slide 16

Slide 16 text

ಡΈฦ͠ʹ͍ͭͯͷิ଍ • N: ಡΈඈ͹͠/ಡΈฦ͠ΛԿճڐ͔͢ • R: ಡΈඈ͹͠/ಡΈฦ͢͠ΔલʹԿτʔΫϯ(ॱํ޲ʹ)ಡΈࠐΉ͔ • K: ࠷େԿτʔΫϯඈ͹͔͢ 16 R=2, K = 10ͷ৔߹ (ਤ͸࿦จ Figure 1͔ΒҾ༻) • softmaxͰಘΒΕͨಡΈฦ͠ͷτʔΫϯ਺ + R ͨ͠τʔΫϯ਺Λ໭͢
 (Լਤͷ -3 ͷ෦෼Λࢀর) • ಉ͡ͱ͜ΖΛԿ౓΋ಡ·ͤͳ͍Α͏ʹ͢ΔͨΊ? • ઌ಄ΑΓલʹ໭͞ͳ͍ͱ͍͚ͳ͍৔߹͸Ͳ͏͢ΔͷͩΖ͏?
 ઌ಄͔Β࢝ΊΔ͜ͱʹ͢Δͷ͔ͳ?

Slide 17

Slide 17 text

τʔΫϯಡΈࠐΈͷऴྃ৚݅ • N: ಡΈඈ͹͠/ಡΈฦ͠ΛԿճڐ͔͢ • R: ಡΈඈ͹͠/ಡΈฦ͢͠ΔલʹԿτʔΫϯ(ॱํ޲ʹ)ಡΈࠐΉ͔ • K: ࠷େԿτʔΫϯඈ͹͔͢ 17 • ҎԼͷͲΕ͔ɻ • softmaxͰ0ͱग़ྗ͞Εͨɻ • ಡΈඈ͹͠/ಡΈฦ͠ճ਺͕NΛ௒͑ͨɻ • ࠷ޙͷτʔΫϯʹ౸ୡͨ͠ɻ • ౸ୡ͔ͯ͠ΒಡΈฦ͢ͱ͍͏͜ͱ͸ͳ͍ɻ

Slide 18

Slide 18 text

ύϥϝʔλֶशͷཁ఺ (1/2) • Ϟσϧ͔Β௚઀ޯ഑Λܭࢉ͢Δ͜ͱͰύϥϝʔλߋ৽Ͱ͖Δ΋ͷ ͱͰ͖ͳ͍΋ͷ͕͋Δ • Ͱ͖Δ΋ͷ (θR ) → ී௨ͷLSTM(Vanilla LSTM)ͷϞσϧԽͰग़ ͯདྷͨύϥϝʔλ܈ • Ͱ͖ͳ͍΋ͷ (θU ) → ಡΈඈ͹͠/ಡΈฦ͠ͷࢦࣔΛग़ͨ͢Ίͷ ύϥϝʔλ (ࢀরͰ͖Δਖ਼ղ͕ͳ͍ͨΊ) 18 -45. xt ht−1 ct−1 ht ct softmax( Ws ht ) θR θU

Slide 19

Slide 19 text

ύϥϝʔλֶशͷཁ఺ (2/2) • Ϟσϧ͔Β௚઀ޯ഑Λܭࢉ͢Δ͜ͱͰύϥϝʔλߋ৽Ͱ͖Δ΋ ͷͱͰ͖ͳ͍΋ͷ͕͋Δ • Ͱ͖ͳ͍΋ͷ (θU ) → ಡΈඈ͹͠/ಡΈฦ͠ͷࢦࣔΛग़ͨ͢Ί ͷύϥϝʔλ • ͨͩ͠ɺͳΔ΂͘औΓѻ͏λεΫͷਖ਼ղ͕ଟ͘ͳΔΑ͏ʹ θU ΛܾΊ͍ͨ → ڧԽֶश • ࿦จதͰ͸REINFORCEΞϧΰϦζϜΛద༻ͯ͠ɺ
 ۙࣅతʹ θU ͷޯ഑ΛٻΊ͍ͯΔɻ 19

Slide 20

Slide 20 text

࣮ݧ

Slide 21

Slide 21 text

λεΫͱσʔληοτ 21 ۭॴิॆ

Slide 22

Slide 22 text

ൺֱख๏ 22

Slide 23

Slide 23 text

ײ৘෼ੳ(ϙδωΨ൑ఆ)ͷ࣮ݧ݁Ռ - IMDB 23 • LSTM-ShuttleͰN(ಡΈඈ͹͠/ಡΈฦ͠ΛԿճڐ͔͢)Λগͳ͘͢ΔͱɺͰ͖Δ͚ͩશମ ΛಡΈ௨ͦ͏͢Δ܏޲͕͋ΔͷͰBackward Ratio͕Լ͕Δɻ • ͱ͸͍͑ɺಡΈ໭͠΋ͨ͘͞Μ͍ͯ͠ΔͷͰɺਐΜͰޡΓΛਖ਼ͦ͏ͱ͍ͯ͠Δɻ

Slide 24

Slide 24 text

ײ৘෼ੳ(ϙδωΨ൑ఆ)ͷ࣮ݧ݁Ռ - Rotten Tomatoes 24 • LSTM-ShuttleͰ͸ɺ
 ઌ಄ → ࠷ޙͷ΄͏ → ਅΜதʹ໭Δ ͷॱͰಡ΋͏ͱ͢ΔͷͰ
 Backward ratio͕ߴ͘ͳͬͨɻ

Slide 25

Slide 25 text

χϡʔεهࣄ෼ྨͷ࣮ݧ݁Ռ 25

Slide 26

Slide 26 text

ۭॴิॆͷ࣮ݧ݁Ռ 26

Slide 27

Slide 27 text

ۭॴิॆͷࣄྫ 27

Slide 28

Slide 28 text

ײ૝

Slide 29

Slide 29 text

ײ૝ • ಡΈ໭͠ΛࣗવͳܗͰ࣮ݱͰ͖͍ͯΔͱ͜Ζ͕໘ന͍ɻ • ͨͩϞσϧ͸طଘख๏ͷLSTM-Jumpͱ΄΅มΘͬͯ ͳ͍ͱ͜Ζ͕ͪΐͬͱऐ͍͠ɻ • ಡΈඈ͹͠/ಡΈฦ͕࣮͠ݱͰ͖͔ͨΒͦ͜Ͱ͖Δλε Ϋ͕Ͱ͖ͳ͍΋ͷ͔? • ਓؒͷޡಡΛ໛฿͢ΔλεΫΈ͍ͨͳ?? 29