Share
Embed
NLU Architecture and ML Model Management in Clova
2019/3/7 Machine Learning Production Pitch #1
Yuki Matoba
LINE Developers
March 07, 2019
Transcript
42 slides
-
NLU Architecture and ML Model Management in Clova Machine Learning
Production Pitch #1 March 7th, 2019 Yuki Matoba (LINE Corporation) 1 -
ࣗݾհ • Yuki Matoba (త ༐थ) • LINE Clova VA։ൃνʔϜɹ
• Clova NLU system • Rekcurd • GitHub: @yuki-mt 2 -
Clova user’s speech data Speech Recognition user’s speech data
Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ? ݱࡏͷ৽॓ͷఱؾΕ (The weather of the present Shinjuku is sunny) 8 -
Clova user’s speech data Speech Recognition recognized text list user’s
speech data Ͷ͑ Clova, ࠓͷ৽॓ͷఱؾ? ݱࡏͷ৽॓ͷఱؾΕ (The weather of the present Shinjuku is sunny) ࠓͷ৽॓ͷ ఱؾ? 9 -
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 -
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 -
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 -
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 -
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 -
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. ߏԽ͞ΕͨσʔλΛฦ͢ -
NLUγεςϜͷ༷มߋͷେม͞ • ྫ: ʮകӍ͕͍͔ͭڭ͑ͯʯͱ͍͏ൃΛweather domainͰ৽͘͠ ରԠ͍ͨ͠߹ɺ֬ೝ͖߲͢ • ৽͍͠ϞσϧͰʮകӍ͕͍͔ͭڭ͑ͯʯ৽͍༷͠௨ΓʹผͰ͖͍ͯΔ͔ • ʮകӍ͕͍͔ͭڭ͑ͯʯҎ֎ͷݴ͍ճ͠ͲΕ͚ͩΧόʔͰ͖͍ͯΔ͔
• Χόʔͨ͠ݴ͍ճ͠ʹผͷDomain, Intention, Main Goalͱఆ͖͢ͷೖ͍ͬͯ ͳ͍͔ • ͜ͷมߋผͷػೳʹӨڹΛ༩͑ͳ͍͔ • ଞͷػೳʹӨڹΛ༩͑Δ߹ɺͲͷcontextͷ࣌ʹͲͷൃͰͲͷػೳ͕༏ઌ͞ΕΔͷ ͔ • … 18 -
NLUγεςϜͷ༷มߋͷେม͞ • ྫ: ʮകӍ͕͍͔ͭڭ͑ͯʯͱ͍͏ൃΛweather domainͰ৽͘͠ ରԠ͍ͨ͠߹ɺ֬ೝ͖߲͢ • ৽͍͠ϞσϧͰʮകӍ͕͍͔ͭڭ͑ͯʯ৽͍༷͠௨ΓʹผͰ͖͍ͯΔ͔ • ʮകӍ͕͍͔ͭڭ͑ͯʯҎ֎ͷݴ͍ճ͠ͲΕ͚ͩΧόʔͰ͖͍ͯΔ͔
• Χόʔͨ͠ݴ͍ճ͠ʹผͷDomain, Intention, Main Goalͱఆ͖͢ͷೖ͍ͬͯ ͳ͍͔ • ͜ͷมߋผͷػೳʹӨڹΛ༩͑ͳ͍͔ • ଞͷػೳʹӨڹΛ༩͑Δ߹ɺͲͷcontextͷ࣌ʹͲͷൃͰͲͷػೳ͕༏ઌ͞ΕΔͷ ͔ • … → ։ൃͷӨڹൣғ֬ೝࣄ߲͕ଟ͘ɺϦϦʔε·Ͱʹ͕͔͔࣌ؒΔ 19 -
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 -
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 -
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 -
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 -
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 -
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 -
NLU ΞʔΩςΫνϟͷ·ͱΊ • NLUγεςϜΛ, Domain͝ͱʹ͚Δ͜ͱͰ • ෳࡶͳґଘؔΛܰݮ • Domainͷ༷มߋʹૉૣ͘ରԠ͢Δ͜ͱ͕Մೳʹ •
Rule-based, ML-basedͷ྆ํ͏͜ͱͰ • ඍௐΛՄೳʹͭͭ͠ɺൣғͷൃΛΧόʔ 26 -
ػցֶशϞσϧͷཧͷࡉ͔͍εςοϓ • 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 -
ػցֶशϞσϧͷཧͷࣗಈԽ • ֶशաఔͷࣗಈԽ → Airflow • Ϟσϧͷ৴ͱධՁͷࣗಈԽ → Rekcurd from
Airflow • σϓϩΠޙͷϞσϧͷӡ༻ → Rekcurd 30 -
What is Rekcurd ػցֶशϞδϡʔϧͷ৴, ཧ, ӡ༻Λ؆୯ʹ͢ΔOSS https://github.com/rekcurd • ৴Λ؆୯ʹ →
Rekcurd • ཧͱӡ༻Λ؆୯ʹ → Rekcurd Dashboard (x Kubernetes) • طଘγεςϜͷ౷߹Λ؆୯ʹ → Rekcurd Client 31 -
Rekcurd pipͰinstallͯ͠rekcurdίϚϯυͰςϯϓϨʔτ࡞ޙɺ ҎԼͷؔΛ࣮ • Ϟσϧͷϩʔυ • ਪ • ϞσϧͷੑೳධՁ ͋ͱDashboard͔ΒͷGUIૢ࡞Ͱ
Kubernetes্ʹ͜ͷίʔυΛσϓϩΠ 32 -
Why Rekcurd • ػցֶशϞδϡʔϧΛཧ͢ΔͨΊͷAPI͕͋Γ Airflow͔Βૢ࡞͢ΔPlugin͕͋Δ https://github.com/rekcurd/airflow-plugin → AirflowͷWorkflowͰػցֶशϞσϧͷૢ࡞͕Մೳ • σϓϩΠɺϞσϧΓସ͑ɺআͳͲ͕GUI͔Βߦ͑Δ.
• σϓϩΠ͢ΕҎԼͷػೳ͕ࣗಈͰ༩͞ΕΔ • readable endpoint • load balancer • auto scaling • ... 35 -
What is Airflow • WorkflowཧOSSπʔϧ • DAG (༗ඇ८ճάϥϑ) ͱݺΕΔάϥϑͰWorkflowΛఆٛ •
DAGͷఆٛPythonίʔυͰߦ͏ • GUIͰDAGͷՄࢹԽ, ࣮ߦ, ࣮ߦͷεέδϡʔϦϯά͕Մೳ • GUI͔ΒPythonίʔυϩά֬ೝͰ͖Δ 36 -
Example DAG 38 ֶश → ϞσϧΛRekcurd DashboardʹΞοϓϩʔυ → sandboxڥͰ͏ →
(ฒྻͰ)ධՁ༻σʔλͷΞοϓϩʔυ → ϞσϧͷੑೳධՁ → ݁ՌΛग़ྗ → if ੑೳ͕ྑ͍: developmentڥͰ͏ (ಈ࡞֬ೝͷεςοϓʹਐΉͨΊ) → else: ϞσϧΛRekcurd Dashboard͔Βআ -
ػցֶशϞσϧͷཧͷࡉ͔͍εςοϓ • 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 -
ػցֶशϞσϧͷཧͷࡉ͔͍εςοϓ • 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Ͱ ࣗಈԽ, ؆қԽ Ͱ͖ͨ෦ -
ػցֶशϞσϧͷཧํ๏ͷ·ͱΊ • ػցֶशϞσϧͷֶशʹAirflowΛಋೖ • ϞσϧͷֶशΛ΄΅ࣗಈԽ • ֶशաఔ, ϩάͷՄࢹԽ • Airflow͔ΒRekcurdʹΞΫηε͢Δ͜ͱͰϞσϧͷ৴ΛࣗಈԽ
• Ϟσϧ࡞ → Ξοϓϩʔυ&৴ΛϊϯετοϓͰ࣮ߦ • ϞσϧͷੑೳධՁ࣮ߦ • ػցֶशϞσϧͷӡ༻ʹRekcurdΛಋೖ • ϞσϧͷΓସ͑ͳͲͷཧΛGUI͔Βߦ͑Δ • k8s্ͰػցֶशͷαʔϏε͕HAߏͰӡ༻͞ΕΔ 42