r/MachineLearning • • Mar 31 '23

News [News] Twitter algorithm now open source

News just released via this Tweet.

Source code here: https://github.com/twitter/the-algorithm

I just listened to Elon Musk and Twitter Engineering talk about it on this Twitter space.

719 Upvotes

151 comments sorted by

View all comments

641

u/ZestyData ML Engineer Mar 31 '23

Putting aside the political undertones behind many peoples' desire to publish "the algorithm", this is a phenomenal piece of educational content for ML professionals.

Here we have a world-class complex recommendation & ranking system laid bare for all to read into, and develop upon. This is a veritable gold mine of an an educational resource.

311

u/Educational-Net303 Mar 31 '23

Yeah, like Elon or not, the push for open source is always going to be beneficial to the community. Ironic how twitter is more open than ____AI.

91

u/Erosis Mar 31 '23

Twitter is already established as a brand to near saturation and Elon has more money than god. It's the perfect combo for ML philanthropy. Now waiting for that Tesla vision algorithm...

45

u/NotARedditUser3 Apr 01 '23

God has no money, why do you think he's always begging for more?

→ More replies (4)
→ More replies (8)
→ More replies (5)

25

u/grumpyp2 Mar 31 '23

Where to start with, it’s such a huge project 😳

72

u/LetMeGuessYourAlts Mar 31 '23

Readme.md

Sorry, had to πŸ€“

22

u/Internationalizard Mar 31 '23

I checked the commit history but it has only one commit. So this is a pretty straight forward place to start: https://github.com/twitter/the-algorithm/commit/7f90d0ca342b928b479b512ec51ac2c3821f5922

14

u/lordofbitterdrinks Mar 31 '23

So how do we know this is the repo used by Twitter and not some stripped down version of it

54

u/ZestyData ML Engineer Mar 31 '23

This quite obviously isn't the repo used by twitter.

It is a pretty large and well put together documentation epic & consolidation of multiple microservices.

Whether the content is 100% reflective of whats deployed is completely unclear. But its not "fake" that's for sure, its genuinely too many man-years of work to not be in-essence real.

→ More replies (1)

10

u/MjrK Mar 31 '23

We don't and likely we won't know.

Unless perhaps someone internal checks and leaks important missing details that later on...

But for now, it does seem robust enough to be reflective of what they have probably been using up to some recent - but that's still just speculation

5

u/tinkr_ Apr 01 '23

It is a stripped down version, Elon said it himself. It supposedly contains the vast majority of the relevant code and has been modified slightly so as to be runnable by others, but you're just going to have to take his word on that.

5

u/zdss Apr 01 '23

Does it have the special code that boosts Elon Musk's tweets in it?

8

u/czerilla Apr 01 '23

Not to my knowledge. There is a line that seems to be tracking Elon's tweets in particular. But that is only invoked by code generating metrics, so presumably it is to filter for Elon's tweets in their dashboard for evaluating statistics.
See: https://github.com/twitter/the-algorithm/issues/236#issuecomment-1492700916

→ More replies (4)

13

u/f10101 Mar 31 '23

It will take time, but I'd imagine it should be possible to derive a method of determining this by observation.

Algorithms like this will have fingerprints.

→ More replies (1)

38

u/pier4r Mar 31 '23

world-class complex recommendation & ranking system

https://twitter.com/amasad/status/1641879976529248256?s=20

I mean surely it is great but my recommendations weren't exactly stellar in those years.

32

u/Ulfgardleo Mar 31 '23

this aprt is not used for recommendations though. this is for analytics and internal testing and ensuring that different groups (+elon) don't get disadvantaged.

17

u/f10101 Mar 31 '23

I wonder did they add that flag before or after the day when they accidentally made people see only Elon's tweets on their timeline: https://www.theverge.com/2023/2/13/23598514/twitter-algorithm-elon-musk-tweets

7

u/starstruckmon Apr 01 '23

I guessing that's exactly when they added it to see what went wrong.

3

u/Franc000 Apr 01 '23

Wow, and those groups are really USA centered. Are those groups also used in AB testing in other countries, where we do not have just 2 parties of Republicans and Democrats, and some unspecified power users? That seems like a pretty bad way to go at things, unless I am missing something.

→ More replies (4)
→ More replies (5)

8

u/ZestyData ML Engineer Mar 31 '23

Idk man as a fairly well seasoned MLE I find their general architecture and scale of their combined models to be fascinating in-and-of itself.

Twitter sucks ass - but this is a beautiful piece of ML Engineering.

→ More replies (1)

9

u/light24bulbs Apr 01 '23

It's genuinely so interesting. I didn't realize just how neural-network based all of this would be, i thought it would be mostly simpler.

8

u/like_a_tensor Apr 01 '23 edited Apr 01 '23

Aren't only the ranker and TwHIN neural network-based? The rest looks like good ol logistic regression, personalized PageRank, random walks, and matrix factorization.

Considering how much GNN research is coming from Bronstein, who works at Twitter, and the general graph ML community, I'm surprised that there aren't more neural networks in the algorithm assuming I'm reading the code correctly.

25

u/LoaderD Mar 31 '23

Here we have a world-class complex recommendation

...You know this is twitter's recommender system right? All the tweets I interact with are ML related from very 'left' people like Jeremy Howard.

My recommender system could legit be:

if interested_in_finance_or_ML:
     recommend_alt_right_hate_speech_accounts()
     recommend_crypto_scam_ads()

28

u/Educational-Net303 Mar 31 '23

Get rid of the if statement and you just recreated Twitter's recommendation algorithm

→ More replies (2)
→ More replies (6)
→ More replies (3)