Social

Twitter reveals some of its source code, including its recommendation algorithm

Comment

twitter logo in a cage
Image Credits: Bryce Durbin / Bryce Durbin / TechCrunch

As repeatedly promised by Twitter CEO Elon Musk, Twitter has opened a portion of its source code to public inspection, including the algorithm it uses to recommend tweets in users’ timelines.

On GitHub, Twitter published two repositories containing code for many parts that make the social network tick, including the mechanism Twitter uses to control the tweets users see on the For You timeline. In a blog post, Twitter characterized the move as a “first step to be[ing] more transparent” while at the same time “[preventing] risk” to Twitter itself and people on the platform.

On a Twitter Spaces session today, Musk clarified:

“Our initial release of the so-called algorithm is going to be quite embarrassing, and people are going to find a lot of mistakes, but we’re going to fix them very quickly,” Musk said. “Even if you don’t agree with something, at least you’ll know why it’s there, and that you’re not being secretly manipulated … The analog, here, that we’re aspiring to is the great example of Linux as an open source operating system … One can, in theory, discover many exploits for Linux. In reality, what happens is the community identifies and fixes those exploits.”

On that second point in the blog post about preventing risk, the open source releases don’t include the code that powers Twitter’s ad recommendations or the data used to train Twitter’s recommendation algorithm. Moreover, they include few instructions on how to inspect or actually use the code — reinforcing the idea that the releases are strictly developer-focused.

“[We excluded] any code that would compromise user safety and privacy or the ability to protect our platform from bad actors, including undermining our efforts at combating child sexual exploitation and manipulation,” Twitter wrote. It’s a bit of mixed messaging coming only weeks after Twitter fired much of its ethical AI and trust and safety staff, which was responsible for content moderation among other user security-related tasks. But the company nonetheless insists that it “[took] steps to ensure that user safety and privacy would be protected” with today’s code release.

Twitter
A diagram showing how Twitter’s recommendation pipeline works. Image Credits: Twitter

Twitter says it’s working on tools to manage code suggestions from the community and sync changes to its internal repository. Presumably, those will be made available at a future date — there’s no sign of them at the present.

“We’re going to look for suggestions, not just on bugs but also on how the algorithm should work,” Musk said on the Spaces session. “It’s going to be an evolving process. I wouldn’t expect it to be a nonstop upward movement… but we’re very open to what would improve the user experience.”

At first glance, the algorithm is fairly complex — but not necessarily surprising in any way from a technical standpoint. It’s made up of multiple models, including a model for detecting “not safe for work” or abusive content, determining the likelihood of a Twitter user interacting with another user and calculating a Twitter user’s “reputation.” (It’s unclear what “reputation” refers to, exactly; the high-level documentation isn’t clear on that.) Several neural networks are responsible for ranking the tweets and recommending accounts to follow, while a filtering component hides tweets to — forgive the jargon — “support legal compliance, improve product quality, increase user trust, protect revenue through the use of hard-filtering, visible product treatments and coarse-grained downranking.”

Twitter For You
Twitter’s For You timeline, powered by a recommendation algorithm. Image Credits: Twitter

In an engineering blog post, Twitter reveals more about the recommendation pipeline, which it claims runs approximately five billion times per day:

“We attempt to extract the best 1,500 tweets from a pool of hundreds of millions … Today, the For You timeline consists of 50% [tweets from people you don’t follow] and 50% [tweets from people you follow] on average, though this may vary from user to user,” Twitter wrote. “Ranking [tweets] is achieved with a ~48-million-parameter neural network that is continuously trained on tweet interactions to optimize for positive engagement (e.g. likes, retweets and replies).”

Twitter users don’t see the full 1,500 tweets, of course. They’re filtered according to content restrictions and other criteria and factors considered by the models, like if tweets have “negative feedback” and if they’re mainly from the same Twitter user, or from users who’ve been blocked or muted.

Gizmodo notes that one thing that doesn’t appear to have been made public is the list of VIPs that Twitter pushes to users. This week, Platformer reported that Twitter has a rotating list of noteworthy users, including YouTuber Mr. Beast and Daily Wire founder Ben Shapiro, that it uses to monitor changes to the recommendation algorithm by increasing the visibility of these “power users” seemingly at will.

There’s more evidence that the algorithm may treat tweets differently depending on the source. Researcher Jane Manchun Wong noted that Twitter’s algorithm specifically labels whether the tweet author is Elon Musk and has others labels indicating whether the author is a “power user” as well as whether they’re a Republican or Democrat.

During the Spaces session this afternoon, a Twitter engineer said that the labels were used only for metrics. But Musk — who said he wasn’t aware of the labels prior to today — said that they shouldn’t be there.

“It definitely shouldn’t be dividing people into Republicans and Democrats, that makes no sense,” Musk said.

The release of the source code comes after several controversies involving tweaks to Twitter’s recommendation algorithm in recent months. According to Platformer, in February, Musk called on Twitter’s engineers to reconfigure the algorithm so his tweets would be more widely viewed. (Twitter later walked back this change — at least somewhat.) In November, Twitter began showing users more tweets from people they don’t follow — a move the platform attempted prior to Musk’s acquisition but later reversed after a backlash from users.

More TechCrunch

If you’ve ever bought a sofa online, have you thought about the homes you can see in the background of the product shots? When it’s time to release a new…

Presti is using GenAI to replace costly furniture industry photo shoots

Google has joined investors backing Moving Tech, the parent firm of open-source ride-sharing app Namma Yatri in India that is eroding market share from Uber and Ola with its no-commission…

Google backs Indian open-source Uber rival

These messaging features, announced at WWDC 2024, will have a significant impact on how people communicate every day.

At last, Apple’s Messages app will support RCS and scheduling texts

iOS 18 will be available in the fall as a free software update.

Here are all the devices compatible with iOS 18

The tests indicate there are loopholes in TikTok’s ability to apply its parental controls and policies effectively in a situation where the teen user originally lied about their age, as…

TikTok glitch allows Shop to appear to users under 18, despite adults-only policy

Lhoopa has raised $80 million to address the lack of affordable housing in Southeast Asian markets, starting with the Philippines.

Lhoopa raises $80M to spur more affordable housing in the Philippines

Former President Donald Trump picked Ohio Senator J.D. Vance as his running mate on Monday, as he runs to reclaim the office he lost to President Joe Biden in 2020.…

Trump’s VP candidate JD Vance has long ties to Silicon Valley, and was a VC himself

Hello and welcome back to TechCrunch Space. Is it just me, or is the news cycle only accelerating this summer?!

TechCrunch Space: Space cowboys

Apple Intelligence features are not available in the developer beta, which is out now.

Without Apple Intelligence, iOS 18 beta feels like a TV show that’s waiting for the finale

Apple released the public betas for its next generation of software on the iPhone, Mac, iPad and Apple Watch on Monday. You can now test out iOS 18 and many…

Apple’s public betas for iOS 18 are here to test out

One major dissenter threatens to upend Fisker’s apparent best chance at offloading its unsold EVs, a deal that would keep the startup’s bankruptcy proceeding alive and pave the way for…

Fisker has one major objector to its Ocean SUV fire sale

Payments giant Stripe has delayed going public for so long that its major investor Sequoia Capital is getting creative to offer returns to its limited partners. The venture firm emailed…

Major Stripe investor Sequoia confirms $70B valuation, offers its investors a payday

Alphabet, Google’s parent company, is in advanced talks to acquire Wiz for $23 billion, a person close to the company told TechCrunch. The deal discussions were previously reported by The…

Google’s Kurian approached Wiz, $23B deal could take a week to land, source says

Name That Bird determines individual members of a species by identifying distinguishing characteristics that most humans would be hard-pressed to spot.

Bird Buddy’s new AI feature lets people name and identify individual birds

YouTube Music is introducing two new ways to boost song discovery on its platform. YouTube announced on Monday that it’s experimenting with an AI-generated conversational radio feature, and rolling out…

YouTube Music is testing an AI-generated radio feature and adding a song recognition tool

Tesla had internally planned to build the dedicated robotaxi and the $25,000 car, often referred to as the Model 2, on the same platform.

Elon Musk confirms Tesla ‘robotaxi’ event delayed due to design change

What this means for the space industry is that theory has become reality: The possibility of designing a habitation within a lunar tunnel is a reasonable proposition.

Moon cave! Discovery could redirect lunar colony and startup plays

Get ready for a prime week of savings at TechCrunch Disrupt 2024 with the launch of Disrupt Deal Days! From now to July 19 at 11:59 p.m. PT, we’re going…

Disrupt Deal Days are here: Prime savings for TechCrunch Disrupt 2024!

Deezer is the latest music streaming app to introduce an AI playlist feature. The company announced on Monday that a select number of paid users will be able to create…

Deezer chases Spotify and Amazon Music with its own AI playlist generator

Real-time payments are becoming commonplace for individuals and businesses, but not yet for cross-border transactions. That’s what Caliza is hoping to change, starting with Latin America. Founded in 2021 by…

Caliza lands $8.5 million to bring real-time money transfers to Latin America using USDC

Adaptive is a platform that provides tools designed to simplify payments and accounting for general construction contractors.

Adaptive builds automation tools to speed up construction payments

When VanMoof declared bankruptcy last year, it left around 5,000 customers who had preordered e-bikes in the lurch. Now VanMoof is up and running under new management, and the company’s…

How VanMoof’s new owners plan to win over its old customers

Mitti Labs aims to transform rice farming in India and other South Asian markets by reducing methane emissions by 50% and water consumption by 30%.

Mitti Labs aims to make rice farming less harmful to the climate, starting in India

This is a guide on how to check whether someone compromised your online accounts.

How to tell if your online accounts have been hacked

There is a general consensus today that generative AI is going to transform business in a profound way, and companies and individuals who don’t get on board will be quickly…

The AI financial results paradox

Google’s parent company Alphabet might be on the verge of making its biggest acquisition ever. The Wall Street Journal reports that Alphabet is in advanced talks to acquire Wiz for…

Google reportedly in talks to acquire cloud security company Wiz for $23B

Featured Article

Hank Green reckons with the power — and the powerlessness — of the creator

Hank Green has had a while to think about how social media has changed us. He started making YouTube videos in 2007 with his brother, novelist John Green, at a time when the first iPhone was in development, Myspace was still relevant and Instagram didn’t exist. Seventeen years later, posting…

Hank Green reckons with the power — and the powerlessness — of the creator

Here is a timeline of Synapse’s troubles and the ongoing impact it is having on banking consumers. 

Synapse’s collapse has frozen nearly $160M from fintech users — here’s how it happened

Featured Article

Helixx wants to bring fast-food economics and Netflix pricing to EVs

When Helixx co-founder and CEO Steve Pegg looks at Daisy — the startup’s 3D-printed prototype delivery van — he sees a second chance. And he’s pulling inspiration from McDonald’s to get there.  The prototype, which made its global debut this week at the Goodwood Festival of Speed, is an interesting proof…

Helixx wants to bring fast-food economics and Netflix pricing to EVs

Featured Article

India clings to cheap feature phones as brands struggle to tap new smartphone buyers

India is struggling to get new smartphone buyers, as millions of Indians don’t go for an upgrade and continue to be on feature phones.

India clings to cheap feature phones as brands struggle to tap new smartphone buyers