402 comments

[ 2.8 ms ] story [ 277 ms ] thread
It's empty.
Did it get taken down already? I think open-sourcing the algo would materially change the value of the deal.
Taken down by whom? It was posted on the official github account of twitter.
Twitters main value is its user base (especially including most journalists, "stars", politicans, companies,...)

I would say the algo itself is worthless, but my estimate would be nowhere near even 1B$.

If open-sourcing the algo allows bots to game the system then it has value to the bot wranglers; if the feed becomes full of garbage that gradually destroys Twitter's value.
Any worth that "the algorithm" has is not in it's implementation (probably pretty standard ML prediction systems), but in the training data and weights. In isolation from the data and the rest of the code it is probably pretty useless as anything other than an example of real world ML use.
(comment deleted)
Is this supposed to be a joke? It's clearly an empty repo.

Either this is a mistake, or this is a really, really misguided attempt at a joke from Twitter.

It was created 20 minutes ago. Maybe a WIP?
For a company of Twitter's scale and resources, any public repos are supposed to go through legal to clear (this is how things work at every FAANG I've worked at).

So if it was a WIP, it'd be a private repo until it's ready to release publicly.

Well, all FAANG companies are public.
Many people have commented that it is empty. However what they do not realize is that there has never actually been an algorithm and that is why it is empty.
There's not an algorithm to order timelines?
(comment deleted)
Turns out, it's been RNG this entire time.
If that's the case, let it be client side RNG and not an RNG run server side, thanks.
If it’s a list of tweets ordered based on a kajillion ML data points that varies per user is it still an algorithm?

And does every user have their own algorithm?

And could it be made readable to a human?

Yes, irrelevant, and the code somewhere is readable.

Take an example like gravity: is there an algorithm for how gravity acts even though it varies per each molecule based on a kajillion other molecules? Of course there is.

Computer systems, even AI/ML-driven ones, aren't uncomprehended the way some areas of science that we haven't developed a strong understanding of are.

Systems comprised of (or generated by) comprehensible parts can be comprehended, we just often opt not to put in that work. There's a reason model interpretability is such a significant and increasingly-demanded area of expertise.

If I have your DNA can I recreate a perfect copy of you as you are now including your mind? It is after all the code you were made with.
The point is not to recreate it or explain it, or to have a way to say "tweet X will get rank Y" but to open source what there is. It doesn't matter if no single person can explain it, it'll still be open source and readable and the types of inputs will be known. But this doesn't look like a discussion on open source and more about politics at this point.

I for one haven't worked at FAANG and think it'll be super interesting to read this code, I can't believe software engineers are complaining about a potentially super complex bleeding edge codebase for timeline recommendations / ranking being open sourced. This is going to be great reading material if it ever gets published!

Nobody is trying to “recreate a perfect copy” of Twitter. Do you think that code which produces random numbers is also not an algorithm because it doesn’t recreate a perfect copy of a previous random number?
No you can't, you can only make a twin, but the mind is shaped by experience also and not just genetics. As is the body.
In that case, the definition of “the algorithm” is the training set.
> the definition of “the algorithm” is the training set

Or the trained model itself. There are people looking for intentional bias. But the insidiousness of the problem likely arises from unintentional bias. Letting researchers brute force the ranking models with hypotheticals could be a win win.

Is there any reason to not think that like most human-created systems it has a mixture of intentional and unintentional bias?
Twitter itself is probably the training set for twitter.
In that case, the algorithm is the labels.
There probably is not "an algorithm" on a site as large and complex as Twitter, no. There are probably dozens if not hundreds of algorithms spread throughout the codebase which affect the timeline for individual users, possibly even code entirely self-generated by ML systems.
In the end, it's still code that is being executed, which can be called "an algorithm". Algorithms are under no obligation to be simple or only include "one algorithm".
So then "open sourcing the algorithm" likely means opens sourcing the entire Twitter codebase?
At this point, what harm would that do to Twitter? The company's tech has been stagnant for years, and the only real features recently have been attempts to exploit Twitter's network effects to ape Clubhouse & Substack. (Seems successful for the former, kind of a failure for the latter.)
do we know? has any angy ex-twitter engineer revealed the secret sauce to the world?
Well sure there is "ORDER BY" something, and there are batch jobs to calculate this something from different variables. Maybe it is partially a ML black box, but I'm pretty sure they are not flying completely blind. There's got to be an internal Wiki or some PPTs where they list what goes into the mix. Number of likes, retweets. Attached media, hashtags, trending or not. Do they do sentiment analysis and use positivity as a factor? Do they do PageRank so that likes from important people have more weight? Are there manual debuffs for certain topics? Are certain posts removed or added in a second pass? These are all answerable questions in principle.
Maybe not. It could all be event-driven, distributed, and just pulling off various prioritized queues.
that's still an algorithm
We'll, it's ok if you feel that way given this is entirely subjective, but I disagree based on experience.

I disagree b/c: That's a system. An algorithm is designed, a system will emerge from pieces. An algorithm can be defined, a system's behavior has to be characterized post-hoc. You can characterize a system, but only as a black/gray box. An algorithm has invariants and stateful steps, a system has nearly infinite state and nearly zero meaningful invariants.

The trouble is, there could be literally millions of ORDER BY queries. Hell, each user could be given a fine-tuned cnn…
The aggregate of a set of systems that maps inputs and state to outputs and state updates is...

still a system that maps inputs and state to outputs and outputs and state updates.

A collection of algorithms is just a bigger algorithm.

  ORDER BY timestamp DESC;
no self respecting PM would ever allow something so trite and simple. this was obviously copy&pasted from stackoverflow. something like this would never web scale, so obviously they need somethign written from scratch preferably in Go/Rust/Node/anythingButSQL
just birds poking random tweets
Turns out they never actually scaled their mailbox pattern. As a result, what you see is what they delivered before timeout.
If there is a total set of data, and a subset of it is produced for users, there is an algorithm. `SELECT TOP` is an algorithm. A ML model with a trillion parameters is an algorithm.

There is no "no algorithm."

You're not wrong. But would it be useful to define better what we mean with algorithm then? Like: we mean "non-obvious algorithm"?
You and I might be technical enough people to suss out little details, but I suspect the average person probably also wants to know whether or not something like Twitter testing a feature flag (Yes, really!) is affecting their timeline.

If it affects results in the slightest, I think that's what people are asking about.

Yeah, if the new senior dev screwed up a deployment and now football fans in Dallas are suddenly getting fewer posts about the most recent athlete scandal all because a regional deployment was the only thing doing relevance record keeping, then yes, that's a part of "the algorithm."

(comment deleted)
This is most likely the correct answer. I doubt there is a single piece of code or algorithm that controls all of twitter. From my limited perspective it's just a catch phrase to simplify what is likely tens of thousands of lines of code.
Well, that's an algorithm. If you have to draw a diagram showing how edge cache nodes affect a user's results based on whether or not they signed in from New York or Phoenix, or if the downtime of a cluster affects the relevance rankings of tweets for a photography enthusiast, then guess what...

That's an algorithm.

This shouldn't be downvoted. Any black box with inputs and outputs is a function over discrete data, otherwise known as an algorithm.
> a function over discrete data, otherwise known as an algorithm

'A function over discrete data' is a far broader concept / far larger set than 'an algorithm'.

I don't disagree, I might even argue that twitter is comprised of many algorithms. We can argue all software is algorithms, or we can just call it software.
That just moves the terminology around and doesn't answer people's questions. Everyone would simply start asking, "what software or lines of code directly affect my timeline?"

The "timeline algorithm" is a perfectly normal way to describe what people ask about.

Yes it's an algorithm, but as software engineers we shouldn't pander to people who actually think there is a small flow chart dictating what happens in your search results. It's idiotic or dishonest.
I mean I'm sure Google has somewhere a UML chart of the entire process of ordering results. Your insistence otherwise is disingenuous at best, either that or you've never actually worked on any sort of major software, at least with any level of reliability/dependability.
Sure they have a chart but it's not "if !idpol -> make woke instead".

The level of discourse I'm trying to convey like what we saw in the Zuck/Pichai hearings in Congress. No understanding of the domain at all.

You or I know how software actually works, your average politician or man on the street does not.

> I mean I'm sure Google has somewhere a UML chart of the entire process of ordering results.

No, there isn't.

I think it is unfortunate that "the algorithm" has become the popularized phrase for the thing, though. Yes, clearly an algorithm which evaluates the entire state of the universe and uses that as an input is still an algorithm. But it is also clearly not what people are looking for.

I'm pretty sure people expect to be able look at The Algorithm and find the part that is trying to destroy <whatever their hobby-horse is>. I bet whatever we see will lean more toward "big dumb pile of A/B tests."

Twitter is mostly an infrastructure operation imho, someone school me. It’s a scale-based problem space, how do you get all these tweets out in real time at minimum, and at best, how do you do some level of topic bucketing on top of it.
Right but "the algorithm" is inextricably tied in with scaling. "the algorithm" is designed to handle updates at scale and the model probably has different parts updating to different events on different cadences.
Yes there is an algorithm. It may not be concise, it may not be found in one place, and nobody alive may be able to explain it to you, but the existence of timelines that are ordered certainly implies the existence of 'the algorithm' that is used to order timelines.

I mean even if timelines were totally random, or based on some external facts, there is an algorithm that is being used to order them.

This isn't just an academic distinction. Claiming 'there is no algorithm' because the algorithm is intentionally or unintentionally obfuscated or complicated has implications if that claim of 'no algorithm' is accepted. If my algorithm for approving mortgage applications is explicitly racist, I can just spread it's functionality across myriad services owned by lots of teams, make it almost impossible to figure out how it works, and then avoid any responsibility by saying 'there is no algorithm to decide loan approvals'? That would be bullshit!

You don't think recent news of the EU compelling social media companies to disclose their algorithms has anything to do with this?
No, the repository is a joke (IME). Regarding the EU, the details haven’t even been nailed down yet, and the timeline is that it will only become a requirement in 2024 I believe. The goal also isn’t to publish “the algorithm”, but to give researchers and civil society representatives access to the training data and information about the most important factors controlling the algorithm, so they can make assessments on the basis of that. It is not about open-sourcing code.
They don't necessarily have to publish code to the repo though, they could just as well publish papers that document their algorithm.
This would be some pretty funny semantics... but, however it works, message is the same: Transparency for how these work

- Search results

- Comment Order

- Timeline Order

- Trends

- Human vs code

Personalization in general. Big gigantic “why” when it happens to you

As far as I'm concerned, the algorithm is and can only ever be an implementation detail. If the leadership of Twitter changes overnight, it'd be highly likely the types of content that gets recommended will subtly/not-so-subtly change... because the algorithm has been changed.

It's an interchangeable function, it would only be publicized if it's clear to leadership that it wouldn't affect their revenue if people started trying to game towards the published algorithm.

(comment deleted)
This, personally I was thinking in light of the new upcomming sale, the current Twitter staff might decide to 'open source' some algorithm. Which would be an effective method of protest against a sale like that.

But there definitely is a relationship algo that could be considered theirs, like all social medias inflating the bubbles users all feel.

There's clearly an (probably shifting daily) algorithm. I'm not sure what the statement the site is trying to make. Even a random number generator that selects tweets at random for your feed is an algorithm.
Here’s the play: interpret “the algorithm” in a stupid way, and then claim it doesn’t exist, and then make a joke about it on company repo.

You know what? This does demonstrate the internal problems inside Twitter and shows the need for shakeup.

I don't get it ¯\_(ツ)_/¯
Makes me wonder how Twitter employees internally are handling the news. If they are celebrating or commiserating?
Twitter Locks Down Product Changes After Agreeing to Musk Bid - https://finance.yahoo.com/news/twitter-locks-down-product-ch...
Looks like a wise move to keep potential destructive protests at bay.
Yep. I imagine Twitter has a employee base with a very strong activist streak. I'm sure some of them wouldn't mind martyring themselves to make a virtuous statement.
> Twitter imposed the temporary ban to keep employees who may be miffed about the deal from “going rogue,” according to one of the people.

What could a rogue employee do?

There was a case in 2017 of a Twitter employee who deleted Donald Trump’s account for 11 minutes.

In 2020 hackers who gained access to Twitter admin tools that were - at the time - apparently accessible to thousands of employees were able to use that access to compromise multiple verified (blue check) Twitter accounts including Jeff Bezos, Barack Obama and Bill Gates. They used it to promote a lame Bitcoin scam.

In the aftermath of that things were supposedly tightened up a little but don’t doubt a Twitter employee could do some damage.

Once upon a time they could perform all sorts of admin-level actions. One of my friends was there back in the day and said you could literally delete someone's account or use the built-in impersonation to see someone else's DMs. Another thing they could do back then was leak PII of specific accounts. I think it was the Saudis who paid someone to get someone's name. A friend of mine was part of the FBI team that caught one of those spies.
look up confidential user information for the saudi government?
(comment deleted)
Thanks! Good to know.

I was actually wondering some people may want to remove traces of what they have been doing.

I wish someday we can see the internal communications lead to the Hunter Biden laptop story ban.

Are there precedents of this? This looks like there is not much trust internally. I doubt this was the first Elon’s decision
The level of trust is to be expected from a company like this imo. We're in an information war all around us. Spies, saboteurs, etc, are all part of a war, and we just witnessed a coup of leadership.
Well you’re reading about it here so clearly there are employees who aren’t above breaking the rules a bit ;)
Wonder if their RSU grants have a clause that converts them to cash in the event of a takeover.

And having been in a company that was taken over, it's a mixture of emotions - is my job safe, will this be the same culture I joined for etc. etc.

>"Wonder if their RSU grants have a clause that converts them to cash in the event of a takeover"

This is interesting question since RSUs are a big part of total comp but how are unvested RSUs dealt with when the stock is retired? Are those put on a future cash comp schedule? And if so at what conversion rate?

The last place I worked had an explicit clause in the RSU agreement that essentially said "if we get bought the price per share for unvested stock will be given to you as cash".
I'm curious was the complete cash out immediate or did it assume the same schedule as the vesting? I'm guessing if the cash out is immediate the company would then run the risk that those people might exit?
I believe it was immediate, but I don't have the grant document anymore to check.
There are probably some secret celebration.
I am sure there is a small set of Vocal employee's blasting internal communications with the end of the world messages, a majority of employee's just wanting to keep working and get their salary, and a different small set of employees hoping Elon purges the first set of employee's making the work place better.
I am sure those with in the money options are happy
It was all in your head ;)
Seems weird to start as a non-private repo until there's some content. Also bit of an unusual name. Can't tell if this is internal trolling or the future
They probably have their own internal Git hosting service. Pushing to the public Github repo could be done at a later point, but the Git repo hasn't actually been created yet here, just the project on Github.
The Twitter board has unanimously approved Musk's purchase, pending approval by stockholders, and Musk has stated that once he owns the company they will open source the "algorithms" for transparency.

So not a troll, but yes it is odd to put up an empty repo, and announce the repo before there is anything in it.

Seems like a perfect troll/joke, especially given everything.
Trolling your new boss is a sure way to get your ass fired.

EDIT: in case you're not aware, Musk has stated that one of the first things he'll be doing after taking Twitter private is to open source its algorithm.

Firing someone for making an innocent joke doesn’t seem very “free speech absolutist”!
Creating a repository on the official account of your employer is not an innocent joke. Media will pick up on it expecting content and when it doesn’t show up/gets removed, you’ll have a whole bunch of loser journalists writing news stories bashing Elon.

In fact, any action that appears to have been made on behalf of a company is not and will never be considered an innocent joke. I’m sure you’ve heard everyone disclosing something they say or write is “their own opinion and not of their employer’s”. Now please show me that kind if disclosure for this repo and then maybe it can be considered a joke.

If you think doing this kind if thing is OK regardless of context, then you’re in for a world of surprises when shit goes south for you.

This seems to be a practical joke by a Twitter engineer as opposed to an actual release.
Or a commit is being prepared? It's only 20 minutes old.
It just seems unlikely that the algorithm would be open-sourced right after a deal for Twitter is agreed upon (but before it actually goes through). I've never seen a buyout of this scale done by an individual, but I imagine the SEC and several other parties will need to be involved.

At the minimum, I would make a private Github repo first, add all relevant commits, and then make it public once there's actually content.

Sure it's fast but it seems the deal is done. A practical joke by an employee seems more unlikely than an official release.

The engineer from the OSS team at Twitter linked to it and said "watch this space"

https://twitter.com/willnorris/status/1518694675909013504

Sure I guess it could be that engineer gearing up for a joke, but I think it's more likely that it's a real release.

It seems more like a symbolic gesture.
Could you take it any other way? I mean obviously you could, because most here appear to be taking 'the-algorithm' very seriously .. but, seriously? It's funny. No joke.
There is something vaguely threatening about this.
Will Norris who works on OSS at Twitter posted this[0]: "watch this space https://github.com/twitter/the-algorithm"

[0]: https://twitter.com/willnorris/status/1518694675909013504

Oh hey - I didn't know he'd left Google. He was a big part of open source there too.
did the repo ever exist or was he joking, or teasing?
I just checked and its gone. But when it did exist it was just an empty repo no README even.
Does it remind anyone of Po and the Dragon scroll from Kung Fu Panda?
if ($has_blue_checkmark) show_post_to($everyone);
Perhaps Twitter will be the new Mozilla if it decides to open-source 'everything' then.

Maybe that is where it is going.

Kind of unrealistic but I hope Twitter now open-sources not only the algorithm but also the Rails monolith itself. Would be kind of interesting to see how everything is done
The rails monolith is long gone.
That gives even more reason to open-source it, right? If Twitter isn't using that codebase anymore.
(comment deleted)
I know the algorithm i use, it ends with ORDER BY date DESC.
Same here, and it blows my mind that we're in such a minority.
Is that actually possible on Twitter? (I have an account but don't use it.) I do believe them that when a user follows several 100+ other users, it would probably be impossible to read every tweet chronologically.
Impossible to read, maybe. Impossible to display, definitely not.
Sort by recent is an available setting. Whether you can keep up with the volume is up to how many people you choose to follow.
i always use chronological, atm following very few people, but in the past following too many to keep up w/.

even when following too many to read everything, i preferred chrono because it would yield a coherent slice of what was happening. an unbiased sample.

twitter is basically a medium for conversation.

imagine there's a large party. would you rather listen to an out-of-order "most important" set parts of the conversation, or just a slice of conversation from a particular time?

well, actually, both can be interesting, but generally the slice is more coherent. :-)

Assuming we're talking about the timeline "latest" mode (rather than "top"), IIRC in the past the used to do the home timeline processing on the read paths, but have long since opted to optimize for read latency, thus the heavy lifting is performed during the insertion, so in broad strokes, when someone post a tweet, the three main things that happen are:

1. Insertion of tweet to tweets table.

2. Insertion of that tweet-id to the home timelines of all that user's followers.

3. Insertion of that tweet-id to the user-timeline of that user.

On the read-path, if I'm not mistaken, the only join that happen is between the requested timeline and the tweets table (which is replicated across cluster of machines but not partitioned, or at least I remember reading that was the case not many years ago)

I use lists by subject matter, including a list of personal contacts.

I then use tweet deck which shows a column of tweets per list.

As these are separated by subject and are chronological, it makes it far easier to follow.

Nice for some things. Absolute death for discovery in a lot of cases though. Either trim your follows down dramatically, or miss some incredible stuff...
there is nothing to discover anymore. everyone is retweeting the same stories. and the best bet at discovering is via soomeone you follow
(comment deleted)
This is what YouTube's Subscriptions tab does and I hate it. Rarely uploading quality creators are hidden in a sea of daily uploads from channels which focus on regular uploads rather than quality.

I think there is a place for a smarter algorithm than "ORDER BY date DESC", but one that is not designed to manipulate users into addiction.

Yeah it s not good for youtube because youtube doesnt have retweets, so people subscribe to everything they like. On twitter you can subscribe to a few people and they ll still retweet most of the stuff that the algorithm would give u
Can someone explain this to me? All I can see from this link is an empty GitHub repository. Not sure what I'm missing here.
It's just a declaration of intent at this point.
There are elements of their algo that I think should be openly defined, and perhaps there should be some regulatory branch that reports to Congress that has full access. However, obfuscation is often necessary to countering bad actors.
On the other hand, wouldn't open sourcing the algorithm help accelerate the identification of possible exploits?
"algorithm" here isn't some fancy, hard to debug code. It is the business logic of weighting tweets and how recommendations are made.

There is great opportunity to abuse this by Twitter, yes. There is also a lot of money to be made. But in defense of some of that being secret, is the fact that any publicly known ruleset (with no hidden exceptions) _will_ be exploited by bad actors. Imagine if search engines told spam sites exactly why their site dropped in page rankings.

>perhaps there should be some regulatory branch that reports to Congress

I think only if you offer twitter users the level of first amendment protection they'd expect with a government body. Otherwise reporting to congress would be an a bold faced circumvention the first amendment. Twitter is a privately held company with no need to report to congress.

So nobody is being shadowbanned or suppressed?
Last I heard, Twitter has internal tooling that allows moderators to shadowban or suppress.
Surely you guys don’t think that twitters sorting algorithm is already factored out into its own repo. Of course it’s empty.

That doesn’t mean it’s a joke, I see it as a show of goodwill — that there are a handful of people inside Twitter that are excited for transparency and for a revenue model that isn’t entirely based on ads, that are excited to get to work on this right away.

(comment deleted)
(comment deleted)
(comment deleted)
Imagine having something like this for Google's and YouTube's algorithms; $100bn+ SEO industry would go bankrupt or at least they would pivot to some sort of advising but there wouldn't be the mayhem that we have today.
Scientific knowledge is written down and freely available but I still don’t understand most of it. I think a public algorithm would increase SEO business if anything because it would get more effective once the bullshit was debunked.
Results would also become an absolute cesspool. Say what you want about how they are now, but if the people gaming it could see the exact rules, it would become completely useless.