ML at Twitter: A Deep Dive into Twitter’s Timeline
Cibele Montez Halasz, Twitter Cortex Satanjeev “Bano” Banerjee, Twitter Timelines Quality O’Reilly AI Conference
ML at Twitter: A Deep Dive into Twitters Timeline Cibele Montez - - PowerPoint PPT Presentation
Twitter Cortex Twitter Timelines Quality ML at Twitter: A Deep Dive into Twitters Timeline Cibele Montez Halasz, Twitter Cortex Satanjeev Bano Banerjee, Twitter Timelines Quality OReilly AI Conference April 2019 Agenda 1 ML at
ML at Twitter: A Deep Dive into Twitter’s Timeline
Cibele Montez Halasz, Twitter Cortex Satanjeev “Bano” Banerjee, Twitter Timelines Quality O’Reilly AI Conference
1 2 3 4 5 6 ML at Twitter Timelines Product Modeling and Serving Pipeline Model Timelines on Tensorflow Lessons Learned and Conclusions
AgendaML at Twitter
Personalized Search
ML at TwitterRecommendations
ML at TwitterHealth
ML at TwitterAds
ML at TwitterCortex
8Timelines Product
Tweets shown to users when they log in and ask for Tweets in the Home section of the app
Similar to Facebook News Feed, Instagram Home, etc.Twitter “Timeline”
Timelines Product‘Reverse Chron’ Timeline
1m 5m 9m 13m 29m1 minute old 9 minutes old 29 minutes old 5 minutes old 13 minutes old
Timelines ProductProblems of Reverse Chron
Goal of Timelines Product
Show each user the Tweets they are most likely to be interested in
Timelines Product 13User interests —> User engagement
Timelines ProductEngagement == Likes / replies / retweets / ... Timelines Product’s Goal: Show users Tweets that they are more likely to engage with
Relevance Ranked Timeline
1m 5m 9m 13m 29m29 minutes old 13 minutes old 9 minutes old 5 minutes old 1 minutes old
Timelines ProductML problem: Given a Tweet and a user, predict the user’s probability of engaging with that Tweet
Timelines ProductModeling and Serving Pipeline
Modeling Engagements
Modeling and Serving PipelineModeling Engagements
Modeling and Serving PipelineModeling Engagements
Modeling and Serving PipelineModeling Engagements
Modeling and Serving PipelineModeling Engagements
Modeling and Serving PipelineModeling Engagements
Modeling and Serving PipelineModeling Engagements
Modeling and Serving Pipeline➔ Currently we combine the models with learned weights score = x × P(like) + y × P(retweet) + z × P(reply) + … ➔ Additional score adjustments ◆ Photo penalty ◆ Author diversity penalty ◆ Producer-side value boost ➔ Lots of experiments to tune these parameters
Combining Separate Engagement Scores per Tweet
38 Modeling and Serving PipelinePredictive Features for Timelines Ranking
➔ Tweet features
#
➔ User’s network features ➔ User historical features ➔ Request features ➔ Text features
Modeling and Serving PipelineModel
Timelines Model
1
Percentile Discretizer2 3
Sparse Layer Dense MLP4
Isotonic CalibrationTimelines Model: Percentile Discretization
Raw feature values Discretized feature values 42Timelines Model
Percentile Discretizer1 2 3
Sparse Layer Dense MLP4
Isotonic CalibrationTimelines Model: Sparse Linear Layer
44Timelines Model
Percentile Discretizer1 2 3
Sparse Layer Dense MLP4
Isotonic CalibrationTimelines Model
The ModelTimelines Model
Percentile Discretizer1 2
Sparse Layer Dense MLP4
Probability Calibration3
examples (Tweets that were shown to the user, but the user did not like, reply, retweet, etc).
○ Heavily downsample negative examples ○ Train without example weights ○ Then apply probability calibration in the end
The ModelTimelines Model: Skewed Dataset
48Sparse Linear Layer: Probability Calibration Sparse Linear Layer: Probability Calibration
Goal: Bring predicted CTR back in line with data CTR
49Sparse Linear Layer: Probability Calibration
0.8, 0.5, 0.6, 0.7, 0.8 1, 2 , 1, 2, 3 1, 0 , 1, 1, 1 predictions weights labels MLP (multilayer perceptron) 50Sparse Linear Layer: Probability Calibration
0.8, 0.5, 0.6, 0.7, 0.8 1, 2 , 1, 2, 3 1, 0 , 1, 1, 1 predictions weights labels MLP (multilayer perceptron) 0.5, 0.6, 0.7, 0.8, 0.8 2 , 1, 2, 3, 1 0 , 1, 1, 1, 1 sorted predictions sorted weights sorted labels 51Sparse Linear Layer: Probability Calibration
0.8, 0.5, 0.6, 0.7, 0.8 1, 2 , 1, 2, 3 1, 0 , 1, 1, 1 predictions weights labels MLP (multilayer perceptron) 0.5, 0.6, 0.7, 0.8, 0.8 2 , 1, 2, 3, 1 0 , 1, 1, 1, 1 sorted predictions sorted weights sorted labels 52Sparse Linear Layer: Probability Calibration
0.8, 0.5, 0.6, 0.7, 0.8 1, 2 , 1, 2, 3 1, 0 , 1, 1, 1 predictions weights labels MLP (multilayer perceptron) 0.5, 0.6, 0.7, 0.8, 0.8 2 , 1, 2, 3, 1 0 , 1, 1, 1, 1 binning sorted predictions sorted weights sorted labels 53Sparse Linear Layer: Probability Calibration
0.8, 0.5, 0.6, 0.7, 0.8 1, 2 , 1, 2, 3 1, 0 , 1, 1, 1 predictions weights labels MLP (multilayer perceptron) 0.5, 0.6, 0.7, 0.8, 0.8 2 , 1, 2, 3, 1 0 , 1, 1, 1, 1 sorted predictions sorted weights sorted labels binning Compute average prediction per bin 54Sparse Linear Layer: Probability Calibration: Closer Look
Source: Scikit-learn 55 The ModelTimelines on Tensorflow
Timelines Model and Tensorflow Hub
MLP (multilayer perceptron) Probability Calibration 57Tensorflow: Profiler
58Tensorflow: Tensorflow Model Analysis
59Tensorflow: Tensorboard
60Lessons Learned, Conclusions, Next Steps
➔ Unifying teams under a single unified platform ➔ ML Automation is crucial for productionizing models ➔ Visualization tools are really helpful for ML practitioners
Lessons Learned: Platform
Lessons Learned / Conclusion / Next Steps➔ Choice of what to optimize for: ◆ Engagement? Time on app? Active days? ➔ Feedback loop – training on previously served data ➔ Automated and frequent model refreshes ➔ Speed of development: Feature engineering, new modeling techniques
Lessons Learned: Product
Lessons Learned / Conclusion / Next Steps➔ Goal of Timelines Product: Show users with most relevant Tweets ➔ Huge scale ◆ Infrastructure constraints ◆ Modeling Decisions ◆ Tensorflow offerings used by Timelines
Lessons Learned / Conclusion / Next StepsConclusion
64➔ Continuous Learning ➔ Model integration: automated model evaluation ➔ More model exploration for Timelines Quality in Tensorflow
Next Steps
65 Lessons Learned / Conclusion / Next StepsThank you! Questions?
Twitter Cortex Twitter Timelines QualityIf you are interested in learning more about Twitter Cortex and Twitter Timelines Quality, please DM us on Twitter: @cibelemh @satanjeev
66