Slide 1

Slide 1 text

ML ENGINEERING : FON Kamolphan Liwprasert FROM MODEL TO PRODUCTION

Slide 2

Slide 2 text

แนะนําตัว Fon Kamolphan Liwprasert PhD Student at Chula MLOps Consultant at AIMET Google Developer Experts - Cloud Women Techmakers Ambassador

Slide 3

Slide 3 text

Agenda ▸ ทําความรู้จักกับ Machine Learning Engineering ▸ รูปแบบการนํา model ไปประยุกต์ใช้ ▸ ML in Production ▸ Tech Stack ที่น่าสนใจ ▸ แหล่งเรียนรู้ที่น่าสนใจเกี่ยวกับ MLE

Slide 4

Slide 4 text

ทําความรู้จักกับ Machine Learning Engineering

Slide 5

Slide 5 text

https://cloud.google.com/solutions/machine-learning/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning Hidden Technical Debt in Machine Learning Systems Elements for ML systems

Slide 6

Slide 6 text

นิยาม AI System แบบง่าย https://youtu.be/VfcY0edoSLU AI System = * Software Engineering DevOps Data Engineering Data Science ML/AI Research ML Engineering Software + Model + DATA

Slide 7

Slide 7 text

นิยาม AI System แบบง่าย https://youtu.be/VfcY0edoSLU AI System = * Software Engineering DevOps Data Engineering Data Science ML/AI Research ML Engineering Software

Slide 8

Slide 8 text

High-level of ML Systems 1. Data ▸ Data Engineering Pipelines ▸ Data Quality is a key 🔑 2. Model ▸ Machine Learning Pipelines ▸ Train, Evaluate, Test 󰙤 3. Software ▸ Model Serving & Predictions ▸ Deployment strategies & Infra 🐳☁

Slide 9

Slide 9 text

Machine Learning Engineers are technically proficient programmers who research, build, and design self-running software to automate predictive models. An ML Engineer builds artificial intelligence (AI) systems that leverage huge data sets to generate and develop algorithms capable of learning and eventually making predictions. - Brainstation.io ML Engineer Machine Learning Engineer คือ นักพัฒนาโปรแกรมที่วิจัย สราง และออกแบบ ซอฟตแวรที่สามารถรันโมเดลทำนายผลได และสรางระบบ AI โดยใชประโยชนจากขอมูลจำนวนมาก

Slide 10

Slide 10 text

หน้าที่ของ MLE Machine Learning Engineer

Slide 11

Slide 11 text

Machine Learning Engineer / Software Engineer Model training pipelines / tools work with DS / AI Automate the process of model training using pipelines and tools. (MLOps) Deploy ML model in production & monitoring Productionize the ML models including model versioning and optimization. Online prediction / API High performance model serving with low latency and high availability. Monitor the model prediction and performance for improvement. Integrate ML into application & monitoring

Slide 12

Slide 12 text

MLOps คืออะไร

Slide 13

Slide 13 text

Launching is easy, Operating is hard. ปญหาของ ML คือ ทํายังไงให จัดการดูแลระบบไดในระยะยาว ทําไมต้องมี MLOps CC0 images from pixabay.com

Slide 14

Slide 14 text

Process in Machine Learning Intro to Machine Learning in Production - Andrew Ng Deeplearning.ai

Slide 15

Slide 15 text

MLOps Continuous Training Continuous Monitoring CI/CD Concept drift Logging Canary Deployment A/B Testing Data-Centric AI vs Model-Centric AI Monitoring Healthcheck Testing Data Version Control Experiment Tracking Data Lineage Lifecycle Automation Data Quality Data Labeling Data Augmentation Train & Evaluate Model Versioning Model Serving & Deployment Optimization Error Reporting

Slide 16

Slide 16 text

MLOps Lifecycle https://services.google.com/fh/files/misc/practitioners_guide_to_mlops_whitepaper.pdf

Slide 17

Slide 17 text

MLOps = Continuous delivery and automation pipelines in machine learning MLOps: สร้าง automate pipeline ให้ ML System CI Continuous Integration CD Continuous Delivery CT Continuous Training CM Continuous Monitoring

Slide 18

Slide 18 text

DevOps vs MLOps ภาพจาก https://www.phdata.io/blog/mlops-vs-devops-whats-the-difference/ DevOps MLOps

Slide 19

Slide 19 text

1 2 3 4 Benefit of MLOps Automate process ชวยลด Technical Debt ในระยะยาว ได Pipeline ที่ดี ทำให data scientist ทำงานรวมกันไดงาย ชวยลดความเสี่ยง และขอผิด พลาด human error ปรับปรุง และ Maintain ได งาย สามารถ scale ได

Slide 20

Slide 20 text

ML System Business Requirements ML System Developers ML System Users ML System Deployment, monitoring, updating of logics Feature engineering ML algorithms Designing Machine Learning Systems -- Chip Huyen Evaluation Data Infrastructure MLOps: Continuous process Deployment, monitoring, updating of logics Data

Slide 21

Slide 21 text

Tools มากมายให้เลือกใช้ DVC (Data Version Control)

Slide 22

Slide 22 text

Start with essential things first

Slide 23

Slide 23 text

Project Boilerplate: CookieCutter https://cookiecutter-data-science.drivendata.org/

Slide 24

Slide 24 text

Microsoft’s Python Package Template https://github.com/microsoft/python-package-template

Slide 25

Slide 25 text

Good App? Follow 12 Factor Apps! https://12factor.net/

Slide 26

Slide 26 text

Level of MLOps

Slide 27

Slide 27 text

MLOps level 0: Manual process https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning

Slide 28

Slide 28 text

MLOps level 1: ML Pipeline https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning

Slide 29

Slide 29 text

https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning MLOps level 2: CI/CD Pipeline

Slide 30

Slide 30 text

ผลลัพธ์ในแต่ละขั้นตอนของ MLOps https://cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning

Slide 31

Slide 31 text

“Model Card” ตัวอยาง Model Card Model Metadata: เก็บข้อมูลของ Model https://services.google.com/fh/files/misc/practitioners_guide_to_mlops_whitepaper.pdf

Slide 32

Slide 32 text

Production: รูปแบบการนํา model ไปประยุกต์ใช้

Slide 33

Slide 33 text

Deep RL ML models Classification / Regression รูปแบบของ Model Computer Vision Object Detection / Image Classification / Face Recognition NLP Translation / Sentiment Analysis / Chatbot / LLM ตัวอยาง RL Robotics / Simulation Controlling problems (Large Language Model) Deep Learning

Slide 34

Slide 34 text

เอา model ไปใช้อย่างไรได้บ้าง https://www.newsletter.swirlai.com/p/sai-03-machine-learning-deployment Batch Prediction ไมตอง real time Streaming มีขอมูลเขามาตลอด เวลา near-real time API Online prediction ในลักษณะ request/response Edge computing ประมวลผลที่ device ปลายทาง a.k.a Deployment

Slide 35

Slide 35 text

1. Batch prediction: ทํางานแบบ batch @aurimas_gr https://www.newsletter.swirlai.com/p/sai-03-machine-learning-deployment

Slide 36

Slide 36 text

2. Streaming: ทํางานตามลําดับใน queue @aurimas_gr https://www.newsletter.swirlai.com/p/sai-03-machine-learning-deployment

Slide 37

Slide 37 text

3. API: Online prediction - model serving @aurimas_gr https://www.newsletter.swirlai.com/p/sai-03-machine-learning-deployment

Slide 38

Slide 38 text

4. Edge computing: ใช้ device ปลายทาง @aurimas_gr https://www.newsletter.swirlai.com/p/sai-03-machine-learning-deployment Edge devices

Slide 39

Slide 39 text

Recap: ML Deployment https://www.newsletter.swirlai.com/p/sai-03-machine-learning-deployment Batch Prediction ไมตอง real time Streaming มีขอมูลเขามาตลอด เวลา near-real time API Online prediction ในลักษณะ request/response Edge computing ประมวลผลที่ device ปลายทาง

Slide 40

Slide 40 text

ML in Production

Slide 41

Slide 41 text

Batch Production Centralized Decentralized On-device “Edge” Edge computing Web Mobile Embedded On-Cloud / On-Premise Direct Model serving Streaming API Edge

Slide 42

Slide 42 text

ตัวอยาง Model Serving Centralized: Model Serving https://ubuntu.com/blog/guide-to-ml-model-serving https://www.anyscale.com/blog/serving-ml-models-in-production-common-patterns

Slide 43

Slide 43 text

Edge: Web ML & MediaPipe ❤

Slide 44

Slide 44 text

Example: MediaPipe https://mediapipe-studio.webapps.google.com/

Slide 45

Slide 45 text

For beginner: เริ่มต้นอย่างไร ?

Slide 46

Slide 46 text

ML Engineering = Software Engineering + ML Git: Version Control Docker Kubernetes CI/CD Programming!

Slide 47

Slide 47 text

Things to consider 🎯 การออกแบบระบบ ขึ้นอยูกับ use case และความตองการ ควรพิจารณาอยางถี่ถวน กอนตัดสินใจใช tool ที่เหมาะสม ⚒ 🎯 Pricing 💲: บาง tool มีคาใชจายคอนขางสูง 💸 ตองดูความคุมคาระยะยาว 🎯 Over-engineering : Perfect is the enemy of good xkcd by Randall Munroe. Automation takes a life of its own.

Slide 48

Slide 48 text

https://cloud.google.com/solutions/machine-learning/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning Hidden Technical Debt in Machine Learning Systems Elements for ML systems

Slide 49

Slide 49 text

Rule of Machine Learning Martin Zinkevich https://developers.google.com/machine-learning/guides/rules-of-ml

Slide 50

Slide 50 text

To make great products: do machine learning like the great engineer you are, not like the great machine learning expert you aren’t. Martin Zinkevich https://developers.google.com/machine-learning/guides/rules-of-ml

Slide 51

Slide 51 text

Resource

Slide 52

Slide 52 text

Made With ML https://madewithml.com/

Slide 53

Slide 53 text

AI Engineering Club https://ai-engineering.club/

Slide 54

Slide 54 text

MLOps Zoomcamp https://github.com/DataTalksClub/mlops-zoomcamp

Slide 55

Slide 55 text

Chip Huyen อาจารยวิชา Machine Learning Systems Design มหาวิทยาลัย Stanford (https://stanford-cs329s.github.io/) และผูเขียนหนังสือ Blog: Chip Huyen https://huyenchip.com/blog/

Slide 56

Slide 56 text

Books

Slide 57

Slide 57 text

Q & A

Slide 58

Slide 58 text

Thank You :) FON Kamolphan Liwprasert