A set of APIs to power Personalized For You feeds or Channel Feeds.

The For You feeds have a latency of around 1.3 seconds and channel feed have a latency of sub second.

Creating Feeds

Here is how our Feed endpoints generates relevant casts to populate the trending feed (for you/channel) for your application.

Here along with explaining some assumption that we have used to generate a very well curated feed we have also explained our all the ways the API will have configurations to customize the experience for the feed based on your (developers') own judgement.

Step 1: Getting all the casts

As of the first step in creating a feed, we take in all casts ever created on the Farcaster network for the last 5 days.

To understand the full extent of the what kind of data we deal with - its around 600,000+ new casts as of April 2024. When fetching these casts we also take into consideration all the actions on each of those casts like - Likes, Recasts, Replies.

At the end of this step we get a list of all casts with all engagement data in the past 5 days.

Step 2: Generating relevant Graphs to power feeds

In For You feeds, we create a personalized graph and rank a users neighbors. For the current For You API endpoints we default it to k=1 i.e. only map the graph for first degree neighbors. But there is an option to configure it to upto 5.

The wider the graph (higher k value) the higher is the latency.

In Channel feeds, we create a graph by ranking all the users in that channel based on their interactions. These graphs are generated based on engagement, learn more about it here. At the end of this step we have a ranked list of users with a score based on their incoming engagement in a channel.

Step 3: Filtering all casts

We now have two lists, first includes all the casts and the second includes the ranked network graph. Next, we iterate through each of the casts from the first list and apply a score to it. This score is a multiplier assigned to each cast based on the networks interaction with the cast.

Example on how this step works for For You Feed:

Lets say Michelle who is a second degree neighbor to You, and has a personalized ranking score of 0.5. And there is a cast that Michelle interacted with (liked + recasted) then we give the cast a score of (0.5*1)+(0.5*5) giving the cast a score of 3 and we also square this so it becomes 9.

Now if Adam who is also in your graph has also interacted with the same cast then it gets added to the score 9 on that cast that was generated by Michelle interaction. Hence giving the cast a better score and making it rank higher on the feed.

We us sumofsquares i.e. square the scores and add it to amplify good casts, but this too can be controlled by changing it to rootmeansquare or sum based on the developers choice of amplification.

There are two main things to note here on this step

  1. We remove casts that don't have any score applied to it, removing all casts the relevant network hasn't interacted with.

  2. All casts that aren't parent casts are also removed. (i.e. we remove all replies from this) Making the feed only be populated by Parent casts.

This was done based on the feedback we got from the community and can/should be configurable by developers.

What we get at the end of this step is a score assigned to each cast based on the relevant networks interest in that cast.

Step 4: Sorting and Time based filtering

Now that we have all the casts and corresponding scores attached to them we bucket the casts based on 1 hour time slots and in that bucket we sort them based on the score we generated in the previous step.

What this leaves you with is a list of casts that is first sorted based on recency and then sorted based on relevancy to provide your users with the best feed possible.

And this is how the feeds are generated.

Last updated


Copyright 2024