Slide 1

Slide 1 text

NLU Architecture and
 ML Model Management in Clova Machine Learning Production Pitch #1 March 7th, 2019 Yuki Matoba (LINE Corporation) 1

Slide 2

Slide 2 text

ࣗݾ঺հ • Yuki Matoba (త৔ ༐थ) • LINE Clova VA։ൃνʔϜɹ • Clova NLU system • Rekcurd • GitHub: @yuki-mt 2

Slide 3

Slide 3 text

ࠓ೔࿩͢͜ͱ มߋΛૉૣ͘ϦϦʔε͢ΔͨΊͷɺ Clovaʹ͓͚ΔNLU (ࣗવݴޠཧղ) γεςϜͷΞʔΩςΫνϟ΍ ػցֶशϞσϧͷֶशɺධՁɺӡ༻ํ๏Λ঺հ 3

Slide 4

Slide 4 text

Agenda • Clova, NLUपลͷΞʔΩςΫνϟͷ؆୯ͳ঺հ • NLUγεςϜͷΞʔΩςΫνϟ • ػցֶशϞσϧͷӡ༻ํ๏ 4

Slide 5

Slide 5 text

Clovaͷ঺հ 5

Slide 6

Slide 6 text

NLUपลͷΞʔΩςΫνϟ ϢʔβʔͷԻ੠͕ཧղ͞ΕɺԠ౴Λฦ͢·ͰͷྲྀΕ 6

Slide 7

Slide 7 text

Clova user’s speech data Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ͸? 7

Slide 8

Slide 8 text

Clova user’s speech data Speech Recognition user’s 
 speech data Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ͸? ݱࡏͷ৽॓ͷఱؾ͸੖Ε (The weather of the present Shinjuku is sunny) 8

Slide 9

Slide 9 text

Clova user’s speech data Speech Recognition recognized
 text list user’s 
 speech data Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ͸? ݱࡏͷ৽॓ͷఱؾ͸੖Ε (The weather of the present Shinjuku is sunny) ࠓͷ৽॓ͷ ఱؾ͸? 9

Slide 10

Slide 10 text

Clova NLU / DM recognized
 text list user’s speech data Speech Recognition recognized
 text list user’s 
 speech data Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ͸? ݱࡏͷ৽॓ͷఱؾ͸੖Ε (The weather of the present Shinjuku is sunny) ࠓͷ৽॓ͷ ఱؾ͸? 10

Slide 11

Slide 11 text

Clova Key Value Domain Weather Intention Inform Main Goal General Place Shinjuku Time Present NLU Result NLU / DM recognized
 text list user’s speech data Speech Recognition recognized
 text list user’s 
 speech data Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ͸? ݱࡏͷ৽॓ͷఱؾ͸੖Ε (The weather of the present Shinjuku is sunny) ࠓͷ৽॓ͷ ఱؾ͸? 11

Slide 12

Slide 12 text

Clova Weather web API generated text NLU
 Result NLU Result ࠓͷ৽॓ͷ ఱؾ͸? NLU / DM recognized
 text list user’s speech data Speech Recognition recognized
 text list user’s 
 speech data Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ͸? ݱࡏͷ৽॓ͷఱؾ͸੖Ε Key Value Domain Weather Intention Inform Main Goal General Place Shinjuku Time Present 12

Slide 13

Slide 13 text

Clova Speech Synthesis generated text Weather web API generated text NLU
 Result Key Value Domain Weather Intention Inform Main Goal General Place Shinjuku Time Present NLU Result NLU / DM recognized
 text list user’s speech data Speech Recognition recognized
 text list user’s 
 speech data Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ͸? ݱࡏͷ৽॓ͷఱؾ͸੖Ε ࠓͷ৽॓ͷ ఱؾ͸? 13

Slide 14

Slide 14 text

Clova Speech Synthesis synthesized 
 speech data synthesized speech data Weather web API generated text NLU
 Result NLU Result NLU / DM recognized
 text list user’s speech data Speech Recognition recognized
 text list user’s 
 speech data Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ͸? generated text ࠓͷ৽॓ͷ ఱؾ͸? Key Value Domain Weather Intention Inform Main Goal General Place Shinjuku Time Present 14

Slide 15

Slide 15 text

NLUγεςϜͷΞʔΩςΫνϟ γεςϜؒ, εςʔΫϗϧμʔؒΛૄ݁߹ʹ͢ΔͨΊͷߏ଄ 15

Slide 16

Slide 16 text

Clova Key Value Domain Weather Intention Inform Main Goal General Place Shinjuku Time Present NLU Result NLU / DM recognized
 text list ࠓͷ৽॓ͷ ఱؾ͸? 16 NLUγεςϜ͕͍ͯ͠Δ͜ͱ(͓͞Β͍) 1. ൃ࿩ͷจࣈྻΛड͚औΔ 2. ߏ଄Խ͞ΕͨσʔλΛฦ͢

Slide 17

Slide 17 text

NLUγεςϜͷ࢓༷มߋͷେม͞ Өڹൣғ΍ґଘؔ܎͕ෳࡶʹͳΓ΍͍͢ • ʮແݶύλʔϯͷൃ࿩ x ෳࡶͳcontextʯΛ ༷ʑͳDomainͰਖ਼͘͠෼୲͢Δඞཁ͕͋ΔͨΊ 17

Slide 18

Slide 18 text

NLUγεςϜͷ࢓༷มߋͷେม͞ • ྫ: ʮകӍ͕͍͔ͭڭ͑ͯʯͱ͍͏ൃ࿩Λweather domainͰ৽͘͠ ରԠ͍ͨ͠৔߹ɺ֬ೝ͢΂͖߲໨͸ • ৽͍͠ϞσϧͰʮകӍ͕͍͔ͭڭ͑ͯʯ͸৽͍͠࢓༷௨Γʹ൑ผͰ͖͍ͯΔ͔ • ʮകӍ͕͍͔ͭڭ͑ͯʯҎ֎ͷݴ͍ճ͠͸ͲΕ͚ͩΧόʔͰ͖͍ͯΔ͔ • Χόʔͨ͠ݴ͍ճ͠ʹผͷDomain, Intention, Main Goalͱ൑ఆ͢΂͖΋ͷ͸ೖ͍ͬͯ ͳ͍͔ • ͜ͷมߋ͸ผͷػೳʹӨڹΛ༩͑ͳ͍͔ • ଞͷػೳʹӨڹΛ༩͑Δ৔߹ɺͲͷcontextͷ࣌ʹͲͷൃ࿩ͰͲͷػೳ͕༏ઌ͞ΕΔͷ ͔ • … 18

Slide 19

Slide 19 text

NLUγεςϜͷ࢓༷มߋͷେม͞ • ྫ: ʮകӍ͕͍͔ͭڭ͑ͯʯͱ͍͏ൃ࿩Λweather domainͰ৽͘͠ ରԠ͍ͨ͠৔߹ɺ֬ೝ͢΂͖߲໨͸ • ৽͍͠ϞσϧͰʮകӍ͕͍͔ͭڭ͑ͯʯ͸৽͍͠࢓༷௨Γʹ൑ผͰ͖͍ͯΔ͔ • ʮകӍ͕͍͔ͭڭ͑ͯʯҎ֎ͷݴ͍ճ͠͸ͲΕ͚ͩΧόʔͰ͖͍ͯΔ͔ • Χόʔͨ͠ݴ͍ճ͠ʹผͷDomain, Intention, Main Goalͱ൑ఆ͢΂͖΋ͷ͸ೖ͍ͬͯ ͳ͍͔ • ͜ͷมߋ͸ผͷػೳʹӨڹΛ༩͑ͳ͍͔ • ଞͷػೳʹӨڹΛ༩͑Δ৔߹ɺͲͷcontextͷ࣌ʹͲͷൃ࿩ͰͲͷػೳ͕༏ઌ͞ΕΔͷ ͔ • … → ։ൃͷӨڹൣғ΍֬ೝࣄ߲͕ଟ͘ɺϦϦʔε·Ͱʹ͕͔͔࣌ؒΔ 19

Slide 20

Slide 20 text

NLUγεςϜͷ(Ұ෦ͷ)ΞʔΩςΫνϟ Domain Detector weather rule-based NLU Global Pattern NLU other domain rule-based NLU1 : ॲཧͷॱ൪ weather ML-based NLU other domain ML-based NLU1 other domain rule-based NLU2 other domain ML-based NLU2 weather domain-specific NLU 20

Slide 21

Slide 21 text

NLUγεςϜͷ(Ұ෦ͷ)ΞʔΩςΫνϟ Domain Detector weather rule-based NLU Global Pattern NLU other domain rule-based NLU1 weather ML-based NLU other domain ML-based NLU1 other domain rule-based NLU2 other domain ML-based NLU2 Global Pattern NLU • ࠷΋༏ઌ౓͕ߴ͍
 → ଞͷίϯϙʔωϯτͷӨڹड͚ͳ͍ • ओʹϏδωε্ॏཁͳυϝΠϯΛ
 ϧʔϧϕʔεͰਖ਼֬ʹ࣮૷ 21

Slide 22

Slide 22 text

NLUγεςϜͷ(Ұ෦ͷ)ΞʔΩςΫνϟ Domain Detector weather rule-based NLU Global Pattern NLU other domain rule-based NLU1 weather ML-based NLU other domain ML-based NLU1 other domain rule-based NLU2 other domain ML-based NLU2 Domain Detector • υϝΠϯ෼ྨ͕੹຿ • ൑ఆͨ͠υϝΠϯʹରԠ͢Δ
 domain-specific NLUʹॲཧΛ౉͢ • ଟΫϥε෼ྨʹͷΈूத͢Ε͹ྑ͍ 22

Slide 23

Slide 23 text

NLUγεςϜͷ(Ұ෦ͷ)ΞʔΩςΫνϟ Domain Detector weather rule-based NLU Global Pattern NLU other domain rule-based NLU1 weather ML-based NLU other domain ML-based NLU1 other domain rule-based NLU2 other domain ML-based NLU2 domain-specific NLU (DSNLU) • 1ͭͷυϝΠϯͷΈ୲౰ • DomainҎ֎ͷɺNLUͰऔಘ͢΂͖ ৘ใΛऔಘ͢Δͷ͕੹຿ • ଞͷDomainʹӨڹ͕ͳ͍ͷͰ
 มߋ͕༰қ 23

Slide 24

Slide 24 text

NLUγεςϜͷ(Ұ෦ͷ)ΞʔΩςΫνϟ Domain Detector weather rule-based NLU Global Pattern NLU other domain rule-based NLU1 weather ML-based NLU other domain ML-based NLU1 other domain rule-based NLU2 other domain ML-based NLU2 domain-specific rule-based NLU • ࡉ͔͍࢓༷΁ͷରԠΛߦ͏ • ϧʔϧϕʔεͳͷͰਖ਼֬ʹ
 ࢓༷௨Γʹ࣮૷͢Δ͜ͱ͕Մೳ 24

Slide 25

Slide 25 text

NLUγεςϜͷ(Ұ෦ͷ)ΞʔΩςΫνϟ Domain Detector weather rule-based NLU Global Pattern NLU other domain rule-based NLU1 weather ML-based NLU other domain ML-based NLU1 other domain rule-based NLU2 other domain ML-based NLU2 domain-specific ML-based NLU • rule-based NLUͰर͑ͳ͔ͬͨ
 ൃ࿩ʹରԠ • rule-based΄Ͳਖ਼֬Ͱ͸ͳ͍΋ͷͷ
 ޿ൣғͷൃ࿩ΛΧόʔͰ͖Δ 25

Slide 26

Slide 26 text

NLU ΞʔΩςΫνϟͷ·ͱΊ • NLUγεςϜΛ੹຿, Domain͝ͱʹ෼͚Δ͜ͱͰ • ෳࡶͳґଘؔ܎Λܰݮ • Domain಺ͷ࢓༷มߋʹૉૣ͘ରԠ͢Δ͜ͱ͕Մೳʹ • Rule-based, ML-basedͷ྆ํ࢖͏͜ͱͰ • ඍௐ੔ΛՄೳʹͭͭ͠ɺ޿ൣғͷൃ࿩ΛΧόʔ 26

Slide 27

Slide 27 text

ػցֶशϞσϧͷֶश, ഑৴, ӡ༻ Airflow, RekcurdΛ༻ֶ͍ͯश, ഑৴, ӡ༻աఔΛࣗಈԽ 27

Slide 28

Slide 28 text

ػցֶशϞσϧͷ؅ཧͷେ·͔ͳεςοϓ 28 σʔλूܭ σʔλͷϑΥʔϚοτ ֶश ഑৴ ධՁ ӡ༻

Slide 29

Slide 29 text

ػցֶशϞσϧͷ؅ཧͷࡉ͔͍εςοϓ • format data • train a new model • evaluate the model • share the result to members • Implement API to use model • estimate machine resource • set machine resource • Implement client side • deploy to development environment • set endpoint for dev API • confirm it works expectedly • deploy to staging environment • set endpoint for staging API • QA • minor fix • fix some training data • train a new model • deploy a fixed model to staging environment • set endpoint for staging API • deploy to production environment • blue-green deployment • set endpoint for production API • AB Test • monitoring • trouble shooting • rollback • … 29

Slide 30

Slide 30 text

ػցֶशϞσϧͷ؅ཧͷࣗಈԽ • ֶशաఔͷࣗಈԽ → Airflow • Ϟσϧͷ഑৴ͱධՁͷࣗಈԽ → Rekcurd from Airflow • σϓϩΠޙͷϞσϧͷӡ༻ → Rekcurd 30

Slide 31

Slide 31 text

What is Rekcurd ػցֶशϞδϡʔϧͷ഑৴, ؅ཧ, ӡ༻Λ؆୯ʹ͢ΔOSS https://github.com/rekcurd • ഑৴Λ؆୯ʹ → Rekcurd • ؅ཧͱӡ༻Λ؆୯ʹ → Rekcurd Dashboard (x Kubernetes) • طଘγεςϜ΁ͷ౷߹Λ؆୯ʹ → Rekcurd Client 31

Slide 32

Slide 32 text

Rekcurd pipͰinstallͯ͠rekcurdίϚϯυͰςϯϓϨʔτ࡞੒ޙɺ ҎԼͷؔ਺Λ࣮૷ • Ϟσϧͷϩʔυ • ਪ࿦ • ϞσϧͷੑೳධՁ ͋ͱ͸Dashboard͔ΒͷGUIૢ࡞Ͱ Kubernetes্ʹ͜ͷίʔυΛσϓϩΠ 32

Slide 33

Slide 33 text

Rekcurd Ϟσϧͷϩʔυ ਪ࿦ ϞσϧͷੑೳධՁ 33

Slide 34

Slide 34 text

Rekcurd Dashboard • RekcurdαʔϏεΛҰݩ؅ཧ • Ϟσϧͷόʔδϣχϯάɺ੾Γସ͑΋GUI͔Βͷૢ࡞ͰՄೳ • ։ൃ؀ڥ, ຊ൪؀ڥͷ੾Γ෼͚΋Մೳ 34

Slide 35

Slide 35 text

Why Rekcurd • ػցֶशϞδϡʔϧΛ؅ཧ͢ΔͨΊͷAPI͕͋Γ
 Airflow͔Βૢ࡞͢ΔPlugin͕͋Δ https://github.com/rekcurd/airflow-plugin → AirflowͷWorkflow಺ͰػցֶशϞσϧͷૢ࡞͕Մೳ • σϓϩΠɺϞσϧ੾Γସ͑ɺ࡟আͳͲ͕GUI͔Βߦ͑Δ. • σϓϩΠ͢Ε͹ҎԼͷػೳ͕ࣗಈͰ෇༩͞ΕΔ • readable endpoint • load balancer • auto scaling • ... 35

Slide 36

Slide 36 text

What is Airflow • Workflow؅ཧOSSπʔϧ • DAG (༗޲ඇ८ճάϥϑ) ͱݺ͹ΕΔάϥϑͰWorkflowΛఆٛ • DAGͷఆٛ͸PythonίʔυͰߦ͏ • GUIͰDAGͷՄࢹԽ, ࣮ߦ, ࣮ߦͷεέδϡʔϦϯά͕Մೳ • GUI͔ΒPythonίʔυ΍ϩά΋֬ೝͰ͖Δ 36

Slide 37

Slide 37 text

Why Airflow • طଘͷֶशͷͨΊͷεΫϦϓτ͕Python΍bashͩͬͨͷͰ AirflowͰWorkflowΛ࡞Γ΍͔ͬͨ͢ • PythonίʔυͰͷΈWorkflow͕ఆٛͰ͖ΔͷͰ
 όʔδϣϯ؅ཧָ͕ • ϩά΍࣮ߦঢ়گΛGUIͰ֬ೝͰ͖Δͷָ͕ • ಋೖ͕؆୯ 37

Slide 38

Slide 38 text

Example DAG 38 ֶश → ϞσϧΛRekcurd DashboardʹΞοϓϩʔυ → sandbox؀ڥͰ࢖͏ → (ฒྻͰ)ධՁ༻σʔλͷΞοϓϩʔυ → ϞσϧͷੑೳධՁ → ݁ՌΛग़ྗ → if ੑೳ͕ྑ͍: development؀ڥͰ࢖͏ (ಈ࡞֬ೝͷεςοϓʹਐΉͨΊ) → else: ϞσϧΛRekcurd Dashboard͔Β࡟আ

Slide 39

Slide 39 text

Video

Slide 40

Slide 40 text

ػցֶशϞσϧͷ؅ཧͷࡉ͔͍εςοϓ • format data • train a new model • evaluate the model • share the result to members • Implement API to use model • estimate machine resource • set machine resource • Implement client side • deploy to development environment • set endpoint for dev API • confirm it works expectedly • deploy to staging environment • set endpoint for staging API • QA • minor fix • fix some training data • train a new model • deploy a fixed model to staging environment • set endpoint for staging API • deploy to production environment • blue-green deployment • set endpoint for production API • AB Test • monitoring • trouble shooting • rollback • … 40

Slide 41

Slide 41 text

ػցֶशϞσϧͷ؅ཧͷࡉ͔͍εςοϓ • format data • train a new model • evaluate the model • share the result to members • Implement API to use model • estimate machine resource • set machine resource • Implement client side • deploy to development environment • set endpoint for dev API • confirm it works expectedly • deploy to staging environment • set endpoint for staging API • QA • minor fix • fix some training data • train a new model • deploy a fixed model to staging environment • set endpoint for staging API • deploy to production environment • blue-green deployment • set endpoint for production API • AB Test • monitoring • trouble shooting • rollback • … 41 ɹɹɹɹ: AirflowͱRekcurdͰ ࣗಈԽ, ؆қԽ Ͱ͖ͨ෦෼

Slide 42

Slide 42 text

ػցֶशϞσϧͷ؅ཧํ๏ͷ·ͱΊ • ػցֶशϞσϧͷֶशʹAirflowΛಋೖ • ϞσϧͷֶशΛ΄΅ࣗಈԽ • ֶशաఔ, ϩάͷՄࢹԽ • Airflow͔ΒRekcurdʹΞΫηε͢Δ͜ͱͰϞσϧͷ഑৴ΛࣗಈԽ • Ϟσϧ࡞੒ → Ξοϓϩʔυ&഑৴ΛϊϯετοϓͰ࣮ߦ • ϞσϧͷੑೳධՁ΋࣮ߦ • ػցֶशϞσϧͷӡ༻ʹRekcurdΛಋೖ • Ϟσϧͷ੾Γସ͑ͳͲͷ؅ཧΛGUI͔Βߦ͑Δ • k8s্ͰػցֶशͷαʔϏε͕HAߏ੒Ͱӡ༻͞ΕΔ 42