BETA
This is a BETA experience. You may opt-out by clicking here

More From Forbes

Edit Story

Your Social Media News Feed And The Algorithms That Drive It

Following
This article is more than 6 years old.

How do news feed algorithms work? originally appeared on Quora: the place to gain and share knowledge, empowering people to learn from others and better understand the world.

Answer by Abhinav Sharma, Product Designer at Quora, on Quora:

How do news feed algorithms work? Strap in, this will get into all sorts of detail, but I hope you leave you with a comprehensive overview because these algorithms are really important to the internet but I’ve found very little writing on how they actually work.

I’m going to work through Facebook as an example but but most work the same way. I didn’t work on newsfeed so I’m not divulging any internal knowledge, but the functioning of these systems is shared a lot within industry.

Facebook wants you to keep coming back and to become a daily utility in your life. To keep you engaged, they need to offer you interesting content to read. This content has to come largely from a pool of posts, photos, etc. created by your friends and pages you like. Let’s call them all stories to simplify. The pool of stories you’re eligible at all to see are your candidate stories. Facebook has candidate selection principles around what’s considered a candidate, for example the story has to come from or be liked by someone in your friend or follow graph, and to maintain freshness there is a time window from which stories are considered.

When someone creates a post, a reference to that story is pushed to an index/candidate stream. When a friend logs in, newsfeed iterates over all their friends’ indexes to extract stories that might be interesting to them and then proceeds to ranking them. For those of you interested in infrastructure, there’s some discussion here, but I’ll move on. Also, note that people with a search background will often call everything pre-ranking the retrieval phase.

Ranking is the bread and butter of these products. In order to keep you engaged, one needs engaging stories, which are chiefly determined by signals such as your likelihood to click, like, comment or share them. These signals are also called actions, and they can be explicit (e.g. liking) or implicit (time spent on a page before returning to feed).

The core idea with newsfeeds is to use ML on past behavior to predict action probabilities in order to determine the most engaging stories and put them on top.

With some ML familiarlity, you can frame this as an optimization problem where the objective function (also called loss function, value function) to be maximized is how accurately you’re predicting actions, based on features like past clickthrough rate on an author, language features, content type, etc. There are usually thousands to tens of thousands of features, and this is where the bulk of the engineering work happens and product intuition is encoded.

Recap, we extract stories in real time from candidate streams and rank them by some action prediction score based on many many features. Often, the objective function is composed of multiple action predictions, e.g. aP(like) +bP(share) - cP(report).

Hopefully, you’re beginning to see the limitations of action prediction and the emergence of clickbait as a problem. Now, one can make the naïve argument that maximizing click => maximizing impressions => maximizing advertising dollars, and this is how the industry has more or less operated for a while.

But burnout is real and the most money is in high intent advertising (travel, wedding, etc.) and not just any clicks so companies are trying to find ways to optimize long-term metrics over short term metrics. The problem with long term metrics is that they’re too nebulous and sparse to perform effective machine learning on, e.g. a satisfaction survey or a qualitative feedback report, or worse, a user dropping off your product for good.

So, we approximate long-term engagement with short term leading indicators (and often just intuition from knowledge of human behavior), and encode them into ranking using strategic boosts (e.g. a multiplier on the predicted click score for stories posted by friends) or constraints (e.g. always show a friend’s major life event story on top). We can also encode this into the value function, for example by putting extra weight on stories rated well by manual raters or vice-versa.

Often you have to rank stories in a feed that are different content types, e.g. videos and text. For example, a video objective function can be time spent watching but this’ll always be different and often be more than text, so we can either calibrate the model score by artificially normalizing the distributions of the scores for each story type, or rely on fixed composition/templates, where for a user it’s determined that the optimal pattern to show stories is for example (text, video, photo, photo), etc.

And that’s how the sausage is made. It’s important to note that modern day systems don’t simply rank by things like coefficient or edgerank but use those things as features. It’s also important to note that this is just the tip of the iceberg and there are lots of fascinating details that vary heavily by company that takes one of these systems from being adequate to making great user experiences.

This question originally appeared on Quora - the place to gain and share knowledge, empowering people to learn from others and better understand the world. You can follow Quora on Twitter, Facebook, and Google+. More questions: