SlideShare a Scribd company logo
1 of 28
Download to read offline
Collect requirements / Design / Analyze
Recommendation systems
01
1
Intro
This presentation does not contain sensitive implementation details.
The primary focus is on general system design.
No specific knowledge is required.
Duration is approximately 1 hour + questions.
Please write your questions in the chat and include the slide number (if
applicable).
Architecture diagrams are more specific to media services.
2
About
https://www.linkedin.com/in/anton-ermak
Rayman.k26@gmail.com
Training / Consulting
Anton Ermak
9 YOE in Software Development
System design starts here
Clarify the expected system behavior.
Refine the data volume for today and the future.
Don't hesitate to ask questions.
Consider non-technical requirements.
Link references and check assumptions.
Explain the general approach.
It's a vast discussion topic, so be mindful of your time.
3
4
General definitions
A service with users and items.
The goal is to provide the most relevant items for each user.
Examples include music/video services and e-commerce platforms.
Data collection includes implicit (behavioral) and/or explicit (rating) feedback.
5
Functional requirements
Provide a set of the most relevant items for a user.
Handle cold start and the sparsity problems.
Support multiple platforms.
Control recommendation diversity.
Ensure real-time updates of recommendation results.
Present the approach with a step-by-step process.
API:
- getRelevantItems(userProfile, count) -> [ItemId]
6
Non-functional requirements
Realtime response for concurrent recommendation invocations.
Scalable on millions users and items.
Monitoring and alerting.
Privacy and security.
Robustness.
Adaptability and customization.
A/B testing and Experimentation.
7
Initial assumptions
Long-tail distribution of items popularity.
Users categories: engaged and cold users.
Often items size >> users size.
Popularity
# of items
Popular items
8
A step-by-step plan
Top chart approach. Show the same most popular items to users (if applicable).
Personalize recommendations by incorporating popular items.
Apply content-based recommendations to include rare items.
Address the cold start problem.
Utilize a hybrid approach by combining multiple algorithms.
9
Side note: feature flags
Reduce risks
Improve flexibility
Enable experimentations
Essential building block for A/B tests
Self testing, colleagues, beta testers
Updated in runtime
Service layer /
Uploader
CDN
items meta db items blob
storage
users db
API Gateway
Initial service architecture
10
Feedback collection
It's essential to understand how users interact with items.
Usually, the pace of data collection is rapid.
Data includes implicit feedback (e.g., items listened to or viewed).
Data also includes explicit feedback (e.g., movie ratings or e-commerce item reviews).
Data is a primary source for most recommendation algorithms.
Consider implementing batching for data processing.
API: recordFeedback([(userId, itemId, feedback, ts)]) -> void
Service layer /
Uploader
CDN
API Gateway
Feedback
service
items meta db items blob
storage
users db
Service with feedback collection pipeline.
streaming
feedback db
Step 1.
11
Show most popular items
Create a background scheduled job to aggregate feedback for items.
Introduce a Recommender service and implement the API call.
This is a good first step for addressing the cold start problem.
The system might be further improved by employing user features (e.g., demographic
data).
Deploy the system and measure its performance through A/B testing.
Avoid feedback loop
Service layer /
Uploader
CDN
API Gateway
Feedback
service
items meta db items blob
storage
users db
Implement the first ETL job and setup a Recommender service
streaming
feedback db
Step 2.
Recommender
service
ETL jobs
recs db
Collaborative
filtering
12
Personalized recommendations
Deep learning
methods
Personalized
recommendations
Easy to implement
Low runtime overhead
Well-known
Allows side features
Provides flexibility
Might be hard to get right
Runtime overhead
13
Collaborative filtering example
5
4
4
5 2
–
–
–
– 3
5
4 3
1
–
5
Embeddings:
U_n*k - user matrix
V_m*k - items matrix
U(i) * V' = relevant items
for a user
14
Implement collaborative filtering
Having the feedback collection already in place we can analyze (user, item)
interactions in past history.
Given this pairs we want to compute embeddings for users and items.
Can be done using Matrix factorization.
Mostly works only for popular items and engaged users (remember the long tail chart).
Deploy and measure (A/B test).
Embeddings (same length "latent" vectors):
user_n = [0.12, 0.234, 0.34, ..., 0.893]
item_n = [0.843, 0.553, 0.123, ..., 0.23]
15
Collaborative filtering features
By using the embeddings it's possible to rank items for a given user.
Similarity measure (e.g. cosine) can be used to find similar items.
Often dataset is small to fit in memory.
Nightly updates work fine.
Many things to fine tune (algorithm, vector length). But possible to test offline.
Service layer /
Uploader
CDN
API Gateway
Feedback
service
items meta db items blob
storage
users db
Add a collaborative filtering job and serve results in runtime
streaming
feedback db
Step 3.
Recommender
service
ETL jobs
recs db
Load and serve
recommendations
from memory
Add collaborative
filtering job
16
Tackling long tail problem
Content-based algorithms are popular in this field.
It's possible to learn content features based on well-known collaborative filtering data.
For example, if a track sounds close to an another track their embeddings should be
similar.
We can produce embeddings based on content features even without users'
interaction.
Use a vector database to find a set of similar items for an item given.
Deploy and measure (A/B test).
Vector DB API: getSimilarItems(itemId, count) -> [ItemId]
Content-based idea (music example)
Track 1
Track 2
Embedding 1
17
Content-based approach
Add a vector db of embeddings.
Add a new pipeline to index new items.
In the runtime find similar items based on the latest users' feedback.
18
Hybrid recommender system
Depending on a situation it's possible to mix different algorithms in runtime.
Almost every item from the long tail might be considered. Might be risky, filters are
required.
Fallback strategy of cutting out some systems temporally.
19
Service layer /
Uploader
CDN
API Gateway
Feedback
service
data lake
Recommender
service
ETL jobs
Item content
embedder
items meta db items blob
storage
users db
Add content-based recommendations
streaming
Step 4.
recs db
uploading stream
items embeddings
Challenges
Many moving parts
Atomic updates
Data filtering
Business performance monitoring
ML-heavy problem
20
Wrap up
The approach scales well.
Can be accomplished by iterations.
It's crucial to continuously watch over the system.
Embeddings open endless customization options of a the recommendation engine.
21
Q&A session

More Related Content

What's hot

Kepler's Laws of Planetary Motion
Kepler's Laws of Planetary MotionKepler's Laws of Planetary Motion
Kepler's Laws of Planetary Motiondwinter1
 
"Force and motion" is a power point for the 9th grade Physics students at the...
"Force and motion" is a power point for the 9th grade Physics students at the..."Force and motion" is a power point for the 9th grade Physics students at the...
"Force and motion" is a power point for the 9th grade Physics students at the...Physics Amal Sweis
 
Why the philippines is prone to typhoons
Why the philippines is prone to typhoonsWhy the philippines is prone to typhoons
Why the philippines is prone to typhoonsDaisy Rose Biejo
 
Philippine Geothermal Industry: Current Status and Perspectives
Philippine Geothermal Industry: Current Status and Perspectives�Philippine Geothermal Industry: Current Status and Perspectives�
Philippine Geothermal Industry: Current Status and PerspectivesFernando Penarroyo
 
Big Bang Theory origins2.ppt
Big Bang Theory origins2.pptBig Bang Theory origins2.ppt
Big Bang Theory origins2.pptJanmejayaJena3
 
Earthquakes and faults (Grade 8 Lesson)
Earthquakes and faults (Grade 8 Lesson) Earthquakes and faults (Grade 8 Lesson)
Earthquakes and faults (Grade 8 Lesson) Riya Duran
 

What's hot (12)

Understanding typhoons
Understanding typhoonsUnderstanding typhoons
Understanding typhoons
 
Comets
CometsComets
Comets
 
Kepler's Laws of Planetary Motion
Kepler's Laws of Planetary MotionKepler's Laws of Planetary Motion
Kepler's Laws of Planetary Motion
 
"Force and motion" is a power point for the 9th grade Physics students at the...
"Force and motion" is a power point for the 9th grade Physics students at the..."Force and motion" is a power point for the 9th grade Physics students at the...
"Force and motion" is a power point for the 9th grade Physics students at the...
 
heat and temperature
heat and temperatureheat and temperature
heat and temperature
 
Meiosis grade 8
Meiosis grade 8Meiosis grade 8
Meiosis grade 8
 
Why the philippines is prone to typhoons
Why the philippines is prone to typhoonsWhy the philippines is prone to typhoons
Why the philippines is prone to typhoons
 
Philippine Geothermal Industry: Current Status and Perspectives
Philippine Geothermal Industry: Current Status and Perspectives�Philippine Geothermal Industry: Current Status and Perspectives�
Philippine Geothermal Industry: Current Status and Perspectives
 
SCIENCE 8
SCIENCE 8SCIENCE 8
SCIENCE 8
 
Big Bang Theory origins2.ppt
Big Bang Theory origins2.pptBig Bang Theory origins2.ppt
Big Bang Theory origins2.ppt
 
Earthquakes and faults (Grade 8 Lesson)
Earthquakes and faults (Grade 8 Lesson) Earthquakes and faults (Grade 8 Lesson)
Earthquakes and faults (Grade 8 Lesson)
 
Tracking the path of a tropical cyclone
Tracking the path of a tropical cycloneTracking the path of a tropical cyclone
Tracking the path of a tropical cyclone
 

Similar to Recommendation systems

FAST PHRASE SEARCH FOR ENCRYPTED CLOUD STORAGE.pptx
FAST PHRASE SEARCH FOR ENCRYPTED CLOUD STORAGE.pptxFAST PHRASE SEARCH FOR ENCRYPTED CLOUD STORAGE.pptx
FAST PHRASE SEARCH FOR ENCRYPTED CLOUD STORAGE.pptxgattamanenitejeswar
 
System analysis and design
System analysis and designSystem analysis and design
System analysis and designRobinsonObura
 
Building Bridges: Merging RPA Processes, UiPath Apps, and Data Service to bu...
Building Bridges:  Merging RPA Processes, UiPath Apps, and Data Service to bu...Building Bridges:  Merging RPA Processes, UiPath Apps, and Data Service to bu...
Building Bridges: Merging RPA Processes, UiPath Apps, and Data Service to bu...DianaGray10
 
Usability awareness brown bag
Usability awareness brown bagUsability awareness brown bag
Usability awareness brown bagLawrenceNajjar
 
Top tableau questions and answers in 2019
Top tableau questions and answers in 2019Top tableau questions and answers in 2019
Top tableau questions and answers in 2019minatibiswal1
 
Database performance management
Database performance managementDatabase performance management
Database performance managementscottaver
 
Innovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsInnovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsSteve Speicher
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docxfantabulous2024
 
Discussion Explore and Discuss a Research StudyReview the Probl.docx
Discussion Explore and Discuss a Research StudyReview the Probl.docxDiscussion Explore and Discuss a Research StudyReview the Probl.docx
Discussion Explore and Discuss a Research StudyReview the Probl.docxmadlynplamondon
 
Michigan Information Retrieval Enthusiasts Group Meetup - August 19, 2010
Michigan Information Retrieval Enthusiasts Group Meetup - August 19, 2010Michigan Information Retrieval Enthusiasts Group Meetup - August 19, 2010
Michigan Information Retrieval Enthusiasts Group Meetup - August 19, 2010ivan provalov
 
Data and Business Team Collaboration
Data and Business Team CollaborationData and Business Team Collaboration
Data and Business Team CollaborationApple
 
Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...
Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...
Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...Databricks
 
Recommender Systems from A to Z – Real-Time Deployment
Recommender Systems from A to Z – Real-Time DeploymentRecommender Systems from A to Z – Real-Time Deployment
Recommender Systems from A to Z – Real-Time DeploymentCrossing Minds
 
Research Article
Research ArticleResearch Article
Research Articlesparwaiz
 
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...Nati Shalom
 
Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014Sandro Mancuso
 

Similar to Recommendation systems (20)

Web engineering
Web engineeringWeb engineering
Web engineering
 
FAST PHRASE SEARCH FOR ENCRYPTED CLOUD STORAGE.pptx
FAST PHRASE SEARCH FOR ENCRYPTED CLOUD STORAGE.pptxFAST PHRASE SEARCH FOR ENCRYPTED CLOUD STORAGE.pptx
FAST PHRASE SEARCH FOR ENCRYPTED CLOUD STORAGE.pptx
 
System analysis and design
System analysis and designSystem analysis and design
System analysis and design
 
Building Bridges: Merging RPA Processes, UiPath Apps, and Data Service to bu...
Building Bridges:  Merging RPA Processes, UiPath Apps, and Data Service to bu...Building Bridges:  Merging RPA Processes, UiPath Apps, and Data Service to bu...
Building Bridges: Merging RPA Processes, UiPath Apps, and Data Service to bu...
 
Lec1
Lec1Lec1
Lec1
 
Lec1
Lec1Lec1
Lec1
 
Usability awareness brown bag
Usability awareness brown bagUsability awareness brown bag
Usability awareness brown bag
 
Top tableau questions and answers in 2019
Top tableau questions and answers in 2019Top tableau questions and answers in 2019
Top tableau questions and answers in 2019
 
Database performance management
Database performance managementDatabase performance management
Database performance management
 
Innovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC IntegrationsInnovate2011 Keys to Building OSLC Integrations
Innovate2011 Keys to Building OSLC Integrations
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docx
 
Discussion Explore and Discuss a Research StudyReview the Probl.docx
Discussion Explore and Discuss a Research StudyReview the Probl.docxDiscussion Explore and Discuss a Research StudyReview the Probl.docx
Discussion Explore and Discuss a Research StudyReview the Probl.docx
 
Michigan Information Retrieval Enthusiasts Group Meetup - August 19, 2010
Michigan Information Retrieval Enthusiasts Group Meetup - August 19, 2010Michigan Information Retrieval Enthusiasts Group Meetup - August 19, 2010
Michigan Information Retrieval Enthusiasts Group Meetup - August 19, 2010
 
Data and Business Team Collaboration
Data and Business Team CollaborationData and Business Team Collaboration
Data and Business Team Collaboration
 
Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...
Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...
Solving Data Discovery Challenges at Lyft with Amundsen, an Open-source Metad...
 
Recommender Systems from A to Z – Real-Time Deployment
Recommender Systems from A to Z – Real-Time DeploymentRecommender Systems from A to Z – Real-Time Deployment
Recommender Systems from A to Z – Real-Time Deployment
 
HowOthersDoCA_Plex
HowOthersDoCA_PlexHowOthersDoCA_Plex
HowOthersDoCA_Plex
 
Research Article
Research ArticleResearch Article
Research Article
 
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
Designing a Scalable Twitter - Patterns for Designing Scalable Real-Time Web ...
 
Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014Crafted Design - LJC World Tour Mash Up 2014
Crafted Design - LJC World Tour Mash Up 2014
 

Recently uploaded

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Recently uploaded (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

Recommendation systems

  • 1. Collect requirements / Design / Analyze Recommendation systems 01
  • 2. 1 Intro This presentation does not contain sensitive implementation details. The primary focus is on general system design. No specific knowledge is required. Duration is approximately 1 hour + questions. Please write your questions in the chat and include the slide number (if applicable). Architecture diagrams are more specific to media services.
  • 4. System design starts here Clarify the expected system behavior. Refine the data volume for today and the future. Don't hesitate to ask questions. Consider non-technical requirements. Link references and check assumptions. Explain the general approach. It's a vast discussion topic, so be mindful of your time. 3
  • 5. 4 General definitions A service with users and items. The goal is to provide the most relevant items for each user. Examples include music/video services and e-commerce platforms. Data collection includes implicit (behavioral) and/or explicit (rating) feedback.
  • 6. 5 Functional requirements Provide a set of the most relevant items for a user. Handle cold start and the sparsity problems. Support multiple platforms. Control recommendation diversity. Ensure real-time updates of recommendation results. Present the approach with a step-by-step process. API: - getRelevantItems(userProfile, count) -> [ItemId]
  • 7. 6 Non-functional requirements Realtime response for concurrent recommendation invocations. Scalable on millions users and items. Monitoring and alerting. Privacy and security. Robustness. Adaptability and customization. A/B testing and Experimentation.
  • 8. 7 Initial assumptions Long-tail distribution of items popularity. Users categories: engaged and cold users. Often items size >> users size. Popularity # of items Popular items
  • 9. 8 A step-by-step plan Top chart approach. Show the same most popular items to users (if applicable). Personalize recommendations by incorporating popular items. Apply content-based recommendations to include rare items. Address the cold start problem. Utilize a hybrid approach by combining multiple algorithms.
  • 10. 9 Side note: feature flags Reduce risks Improve flexibility Enable experimentations Essential building block for A/B tests Self testing, colleagues, beta testers Updated in runtime
  • 11. Service layer / Uploader CDN items meta db items blob storage users db API Gateway Initial service architecture
  • 12. 10 Feedback collection It's essential to understand how users interact with items. Usually, the pace of data collection is rapid. Data includes implicit feedback (e.g., items listened to or viewed). Data also includes explicit feedback (e.g., movie ratings or e-commerce item reviews). Data is a primary source for most recommendation algorithms. Consider implementing batching for data processing. API: recordFeedback([(userId, itemId, feedback, ts)]) -> void
  • 13. Service layer / Uploader CDN API Gateway Feedback service items meta db items blob storage users db Service with feedback collection pipeline. streaming feedback db Step 1.
  • 14. 11 Show most popular items Create a background scheduled job to aggregate feedback for items. Introduce a Recommender service and implement the API call. This is a good first step for addressing the cold start problem. The system might be further improved by employing user features (e.g., demographic data). Deploy the system and measure its performance through A/B testing. Avoid feedback loop
  • 15. Service layer / Uploader CDN API Gateway Feedback service items meta db items blob storage users db Implement the first ETL job and setup a Recommender service streaming feedback db Step 2. Recommender service ETL jobs recs db
  • 16. Collaborative filtering 12 Personalized recommendations Deep learning methods Personalized recommendations Easy to implement Low runtime overhead Well-known Allows side features Provides flexibility Might be hard to get right Runtime overhead
  • 17. 13 Collaborative filtering example 5 4 4 5 2 – – – – 3 5 4 3 1 – 5 Embeddings: U_n*k - user matrix V_m*k - items matrix U(i) * V' = relevant items for a user
  • 18. 14 Implement collaborative filtering Having the feedback collection already in place we can analyze (user, item) interactions in past history. Given this pairs we want to compute embeddings for users and items. Can be done using Matrix factorization. Mostly works only for popular items and engaged users (remember the long tail chart). Deploy and measure (A/B test). Embeddings (same length "latent" vectors): user_n = [0.12, 0.234, 0.34, ..., 0.893] item_n = [0.843, 0.553, 0.123, ..., 0.23]
  • 19. 15 Collaborative filtering features By using the embeddings it's possible to rank items for a given user. Similarity measure (e.g. cosine) can be used to find similar items. Often dataset is small to fit in memory. Nightly updates work fine. Many things to fine tune (algorithm, vector length). But possible to test offline.
  • 20. Service layer / Uploader CDN API Gateway Feedback service items meta db items blob storage users db Add a collaborative filtering job and serve results in runtime streaming feedback db Step 3. Recommender service ETL jobs recs db Load and serve recommendations from memory Add collaborative filtering job
  • 21. 16 Tackling long tail problem Content-based algorithms are popular in this field. It's possible to learn content features based on well-known collaborative filtering data. For example, if a track sounds close to an another track their embeddings should be similar. We can produce embeddings based on content features even without users' interaction. Use a vector database to find a set of similar items for an item given. Deploy and measure (A/B test). Vector DB API: getSimilarItems(itemId, count) -> [ItemId]
  • 22. Content-based idea (music example) Track 1 Track 2 Embedding 1 17
  • 23. Content-based approach Add a vector db of embeddings. Add a new pipeline to index new items. In the runtime find similar items based on the latest users' feedback. 18
  • 24. Hybrid recommender system Depending on a situation it's possible to mix different algorithms in runtime. Almost every item from the long tail might be considered. Might be risky, filters are required. Fallback strategy of cutting out some systems temporally. 19
  • 25. Service layer / Uploader CDN API Gateway Feedback service data lake Recommender service ETL jobs Item content embedder items meta db items blob storage users db Add content-based recommendations streaming Step 4. recs db uploading stream items embeddings
  • 26. Challenges Many moving parts Atomic updates Data filtering Business performance monitoring ML-heavy problem 20
  • 27. Wrap up The approach scales well. Can be accomplished by iterations. It's crucial to continuously watch over the system. Embeddings open endless customization options of a the recommendation engine. 21