software architecture of ai-enabled systems - se4ai summer

23
Software Architecture of AI-enabled Systems SE4AI Summer Term 2020 02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 1

Upload: others

Post on 22-May-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Software Architecture of AI-enabled Systems - SE4AI Summer

Software Architecture of AI-enabled Systems

SE4AI Summer Term 2020

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 1

Page 2: Software Architecture of AI-enabled Systems - SE4AI Summer

Overview

1. Introduction

2. Challenges in AI-enabled applications

3. ML patterns

4. Distinguish Business Logic from ML Models

5. Microservice architectures for ML

6. Conclusion

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 2

Page 3: Software Architecture of AI-enabled Systems - SE4AI Summer

Introduction

What are the major challenges when designing AI-enabled applications

What are common pitfalls encountered during development

How can you approach these Problems with Software Engineering?

Example architectures

Conclusion

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 3

Page 4: Software Architecture of AI-enabled Systems - SE4AI Summer

Challenges in AI-enabled applicationsModel Deployment Location

In 2019 Openai first announced their new GPT-2 model for natural language generation [1]

Results are considered by many to be quite impressive (e.g. the unicorn example1)

Final model has a file size of over five gigabytes and requires special GPUs to be executed inseconds

1https://openai.com/blog/better-language-models#sample1

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 4

Page 5: Software Architecture of AI-enabled Systems - SE4AI Summer

Challenges in AI-enabled applicationsModel Deployment Location contd.

Reasons taken from “Building Intelligent Systems” [2]:

ML models can be big and computationally heavy to execute

execution and update latenciesoperation costs

intellectual property

Challenge

AI-enabled applications might need complicated deployment setups.

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 5

Page 6: Software Architecture of AI-enabled Systems - SE4AI Summer

Challenges in AI-enabled applicationsModel Telemetry

Figure 1: Twitter profile of the Tay Chatbot [3]

Microsoft released an intelligent chatbot@tayandyou in 2016

intended to learn from user interactions

bot started tweeting racist propagandahours after launch [4]

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 6

Page 7: Software Architecture of AI-enabled Systems - SE4AI Summer

Challenges in AI-enabled applicationsModel Telemetry contd.

AI-enabled applications need to be supervised

Complete feedback loop needs to be monitored (input and output)

Models can learn in production but this requires special care

Challenge

AI-enabled applications might need more/different supervision compared to traditional systems.

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 7

Page 8: Software Architecture of AI-enabled Systems - SE4AI Summer

Challenges in AI-enabled applicationsMultiple models

Figure 2: Google Maps NavigationFigure 3: Picasa Face Detection

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 8

Page 9: Software Architecture of AI-enabled Systems - SE4AI Summer

Challenges in AI-enabled applicationsMultiple models contd.

Different models might be necessary depending on the current usage context

Multiple models might be tested alongside each other

Challenge

AI-enabled applications might need to be able to switch between different models in production.

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 9

Page 10: Software Architecture of AI-enabled Systems - SE4AI Summer

Challenges in AI-enabled applicationsOther Challenges

Figure 4: CachingFigure 5: Organizational Issues

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 10

Page 11: Software Architecture of AI-enabled Systems - SE4AI Summer

ML patterns

Antipatterns [5]:

Glue Code

Pipeline Jungles

Dead Experimental Codepaths

Abstraction Debt

Common Smells

What about design and architecture patterns for ML?

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 11

Page 12: Software Architecture of AI-enabled Systems - SE4AI Summer

Figure 6: ML Pattern Map, Washizaki et al. [6]

Page 13: Software Architecture of AI-enabled Systems - SE4AI Summer

Distinguish Business Logic from ML Models

Figure 7: Distinguish Business Logic from ML Models, Yokoyama [7]

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 13

Page 14: Software Architecture of AI-enabled Systems - SE4AI Summer

Microservice architectures for ML

Figure 8: Siri and Alexa

Figure 9: ML microservice architecture, [8]

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 14

Page 15: Software Architecture of AI-enabled Systems - SE4AI Summer

Microservice architectures for MLUsage in Production

Rewe Digital uses microservices in production for their product recognition service [9]

Netflix started deploying jupyter notebooks in production [10]

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 15

Page 16: Software Architecture of AI-enabled Systems - SE4AI Summer

Microservice architectures for MLHow are the challenges addressed

Deployment Locations

Models can be wrapped in containers → can easily be scheduled e.g. by using kubernetes

Model Supervision

Inputs and Outputs can be closely monitoredReplaying of requests possible → have a "production" and a "learning" model

Multiple models

Routing of requests is made simpler since microservice interfaces are properly definedModels can easily be substituted or replaced

Capsuling machine learning models inside a microservice allows leveraging existing technology tocombat AI-specific challenges.

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 16

Page 17: Software Architecture of AI-enabled Systems - SE4AI Summer

Conclusion

AI-enabled applications will become more prevalent in the future

engineers might face new challenges and pitfalls when developing them

research is currently quite sparse in this particular area of software engineering

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 17

Page 18: Software Architecture of AI-enabled Systems - SE4AI Summer

Questions

Questions?

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 18

Page 19: Software Architecture of AI-enabled Systems - SE4AI Summer

Bibliography I

[1] Alec Radford et al. “Language models are unsupervised multitask learners”. In: OpenAI Blog1.8 (2019), p. 9.

[2] Geoff Hulten. “Building Intelligent Systems. A Guide to Machine Learning Engineering”. In:(2018).

[3] Microsoft. TayTweets Twitter Profile. URL: https://twitter.com/TayandYou (visitedon 05/30/2020).

[4] Elle Hunt. “Tay, Microsoft’s AI chatbot, gets a crash course in racism from Twitter”. In: TheGuardian 24.3 (2016), p. 2016.

[5] David Sculley et al. “Hidden technical debt in machine learning systems”. In: Advances inneural information processing systems. 2015, pp. 2503–2511.

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 22

Page 20: Software Architecture of AI-enabled Systems - SE4AI Summer

Bibliography II

[6] Hironori Washizaki et al. “Studying software engineering patterns for designing machinelearning systems”. In: 2019 10th International Workshop on Empirical Software Engineeringin Practice (IWESEP). IEEE. 2019, pp. 49–495.

[7] Haruki Yokoyama. “Machine learning system architectural pattern for improving operationalstability”. In: 2019 IEEE International Conference on Software Architecture Companion(ICSA-C). IEEE. 2019, pp. 267–274.

[8] Shivakumar Goniwada Rudrappa. Microservices Architecture in Artificial Intelligence. URL:https://medium.com/@shivakumar.goniwada/microservices-architecture-in-artificial-intelligence-60bac5b4485d (visited on05/30/2020).

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 23

Page 21: Software Architecture of AI-enabled Systems - SE4AI Summer

Bibliography III

[9] Rewe Digital. Unexplored territory: integrate AI into a microservice architecture. URL:https://mc.ai/integrate-ai-into-a-microservice-architecture/ (visitedon 05/30/2020).

[10] Michelle Ufford et al. Beyond Interactive: Notebook Innovation at Netflix. URL:https://netflixtechblog.com/notebook-innovation-591ee3221233 (visitedon 05/30/2020).

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 24

Page 22: Software Architecture of AI-enabled Systems - SE4AI Summer

Licences

"two girls illustrations" by "Clarisse Croset" (title slide) is licensed under the Unsplash licensehttps://unsplash.com/photos/-tikpxRBcsA"ia-siri" by portalgda is licensed under CC BY-NC-SA 2.0https://www.flickr.com/photos/135518748@N08/42075167191"Portrait of a lifeless Alexa." is licensed under Unsplash Licensehttps://unsplash.com/photos/k1osF_h2fzA"Database icon in the Tango style." (Figure 4) by "dracos" is licensed under CC BY-SA 3.0https://commons.wikimedia.org/wiki/File:Applications-database.svg"Team work, work colleagues, working together" (Figure 5) by "Annie Spratt" is licensed underthe Unsplash license https://unsplash.com/photos/QckxruozjRg"smartphone turned on inside vehicle" (Figure 2) by "Isaac Mehegan" is licensed under theUnsplash license https://unsplash.com/photos/7x5V13744KM"Face detection" by "Chris Wong" (Figure 3) is licensed under BY-NC-ND 2.0 2.0https://flic.kr/p/8VLr4A

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 25

Page 23: Software Architecture of AI-enabled Systems - SE4AI Summer

License

This work is licensed under a Creative Commons “Attribution-ShareAlike 4.0 International” license.

02.06.2020 | Computer Science Department | Reactive Programming Group | D. Ochs, H. Carrasco | 26