Is it possible to open source the Twitter algorithm?



Elon Musk, who

is accelerating the move towards the acquisition of Twitter, recommends makingTwitter open source to make it a fairer place. Software developer Travis Fisher also said he was wondering, 'Is it possible to open source Twitter's algorithms?' And is analyzing the elements needed to achieve this.

Open Sourcing Twitter's Algorithm Part 1: How Twitter Works
https://transitivebullsh.it/oss-twitter-algorithm-part-1

Elon Musk said in TED Talks on April 14, 2022 that he was planning to acquire Twitter 'to make Twitter a place for free speech.' In the event, Musk argued, 'By open sourcing Twitter's algorithms, we should minimize content crackdown intervention.'

In the past, Mr. Musk has conducted a questionnaire on Twitter asking 'Should Twitter algorithms be open sourced?' In addition, more than 1 million people answered this questionnaire, and 'Yes' accounted for more than 80%.




Musk isn't the only one interested in making Twitter open source. Twitter founder Jack Dorsey also tweeted that 'the choice of algorithms to use (or not use) on Twitter should be open to everyone.'




The problem with making Twitter open source is that mechanism. Twitter uses two algorithm feeds on its timeline: 'Top Tweet Priority (Home)' and 'Latest Tweet (Latest)'. 'Latest Tweets' is just a chronological list of the latest tweets posted by the accounts you follow, which has been adopted by default until Twitter adopted a new algorithm feed in 2016 . .. Another 'top tweet priority' is to arrange tweets on the timeline based on the tweets of the other party that the user frequently interacts with from the accounts that are followed on Twitter and the tweets that the user is involved in.



At the time of writing the article, Twitter's default algorithm feed is 'top tweet priority,' and 'most Twitter users use this algorithm feed,' Fisher said.

Next, Fisher cites 'understanding the core features of Twitter' as an important part of understanding Twitter's complex system. That's where Twitter's public API v2 , first released in 2020, is important. According to this, the two core functions of Twitter are the short ' Tweet ' posted by the user and the user account ' User '. Twitter has various functions, but ' Mentions ', ' Quote Tweet ', ' Bookmarks ', ' Hidden Replies ', etc. are just related components. In addition, functions such as ' Space ', ' List ', ' Media ', ' Poll ', and ' Place ' also exist as different resource models. Therefore, Mr. Fisher says, 'Since it is not essential to know the mechanism of Twitter, I will ignore other than the core function.'

Social network services like Twitter form a very large network. The node in the network called Twitter is 'users and tweets', and the edge is 'reactions (interactions) such as replies, retweets, and likes to tweets'.



'Most of Twitter's core business is a huge database built by this user-tweet interaction,' Fisher claims. This database keeps all records of users logging in, viewing tweets, viewing another user's profile, tweeting, replying, and so on.

Twitter's 'Top Tweet Priority' algorithm feed utilizes

a personalized recommender system that predicts 'which tweets and which users are most likely to interact with.' There are two important points in this recommendation system.

1: Basic data used to educate machine learning models (information obtained from Twitter's large-scale proprietary network described above, that is, data stored in an internal database)
2: Ranking algorithm for judging relevance

Twitter's ranking algorithm includes 'characteristics of the tweet itself' (the latestness of the tweet, the presence or absence of media, interaction), 'relationship with the tweeter' (past communication, strength of connection between accounts, etc.), and 'user'. Weigh each action that takes place on Twitter, taking into account 'about yourself' (such as tweets you've been involved in in the past and how often you use Twitter).



The ' pseudo code that greatly simplifies Twitter's algorithm feed' created by Mr. Fisher based on these elements is as follows.
[code] export abstract class TwitterAlgorithmicFeed {
/ **
* Pseudo-code for understanding how Twitter's algorithmic feed works.
* / /
async getAlgorithmicTimelineForUser (user: User): Promise {
const rawTimeline = await this.getRawTimelineForUser (user)
const relevantTweets = await this.getPotentiallyRelevantTweetsForUser (user)

const mergedTimeline = await this.mergeTimelinesForUserBasedOnRelevancy (
user,
rawTimeline,
relevantTweets
)

return this.injectAdsForUserIntoTimeline (user, mergedTimeline)
}

/ **
* Returns a reverse-chronological stream of tweets from users directly
* Followed by a given user.
* / /
abstract getRawTimelineForUser (user: User): Promise

/ **
* Returns a stream of tweets ordered by relevancy for a given user at a
* given time.
*
* This will only consider tweets from users the given user is not already
* following.
* / /
abstract getPotentiallyRelevantTweetsForUser (user: User): Promise

/ **
* Returns a stream of tweets ordered by relevancy to a given user, taking
* into account both their raw timeline of latest tweets and a subset of
* the network graph timeline containing potentially relevant tweets.
* / /
abstract mergeTimelinesForUserBasedOnRelevancy (
user: User,
rawTimeline: Timeline,
relevantTweets: Timeline
): Promise

/ **
* Returns a stream of tweets which injects ads into the timeline for a
* given user.
* / /
abstract injectAdsForUserIntoTimeline (
user: User,
timeline: Timeline
): Promise
} [/ code]

This pseudo code is also published on GitHub.

twitter-feed-algorithm/algorithmic-feed.ts at master · transitive-bullshit / twitter-feed-algorithm · GitHub
https://github.com/transitive-bullshit/twitter-feed-algorithm/blob/master/src/algorithmic-feed.ts



in Web Service, Posted by logu_ii