Taming popularity bias in recommender systems with logit adjustment
My recommender kept recommending the same blockbusters to everyone. Here is how I got it to recommend niche movies that actually match a user’s taste.
Say you have a WW2 movie fan whose watch history is Saving Private Ryan, Enemy at the Gates, Stalingrad, and The Great Escape. What should a recommender show them next?
Below are the recommendations for that user from two versions of my two-tower model. Both use the exact same architecture and code. The only difference is that the model on the right was trained with a popularity correction (explained below) and the one on the left wasn’t.

The left side (before) is pretty bad for a WW2 fan: Braveheart, Gladiator, The Lord of the Rings (twice), and The Godfather Part II. Six of the ten aren’t even war movies. They are just super popular (Braveheart alone has 75,514 ratings).
The right side (after) is actually war movies: The Devil’s Brigade, Cross of Iron, Tora! Tora! Tora!, Battle of Britain. Most of them only have a few hundred ratings, which is a lot closer to what a WW2 movie fan is actually looking for. The median recommendation went from 35,547 ratings down to 1,083 (roughly 33× less mainstream), and the recommendations stay on-genre too.
This wasn’t just a WW2 thing either. I saw the same kind of before/after across every test profile I tried, and I put six more examples in the Appendix (high-fantasy, crime, courtroom, vintage sci-fi, giallo horror, and screwball comedy). For the courtroom fan, the ‘before’ list was basically just the IMDb Top 10.
Popularity bias
This is called ‘popularity bias’, and it’s a feedback loop:
- Popular movies get shown more, so they get more clicks.
- You train on those clicks, so the model learns that popular = good.
- The model shows popular movies even more, and you’re right back at step 1.
If you don’t do anything about it, a ‘personalized’ recommender slowly turns into a Most Popular list. Everyone gets shown the same blockbusters, and the rest of the catalog (the ‘long tail’) barely ever shows up.
The fix: logit adjustment
The fix I used comes from a 2020 paper, “Long-Tail Learning via Logit Adjustment” (Menon et al.). The idea is pretty simple: during training, you add a bonus to every movie’s score based on how popular it is (including the negatives).
# during training only: add each movie's log-popularity to its score
scores = user · movie_embeddings + α · log(1 + rating_count)
Since the bonus is only used during training, all you have to do is retrain the model. Nothing changes at serving time, which also makes it very easy to A/B test online.
There is just one knob to tune: α. At α=0 you get the blockbuster list from above, and if you set it too high the recommendations get way too obscure. I ended up going with α=0.5, which fixes the popularity drift while still letting movies like Saving Private Ryan show up.
Why a popularity bonus reduces popularity bias
This sounds backwards at first, so it’s worth walking through why it works. The model trains with a full softmax: each training example scores the true next movie against every movie in the catalog, and the α · log(popularity) bonus gets added to all of them. That means popular movies are always sitting among the negatives with a head start, so the only way for the model to push the loss down is to score the true movie high enough to beat them. Over millions of examples, the model learns scores that represent relevance after accounting for popularity. A movie only gets a high score if you’d like it more than its popularity alone would predict. Then at serving time you drop the bonus and rank on those raw scores, so a niche movie that actually fits you can finally beat a blockbuster.
If you want the math: at the optimum, each raw score converges to log P(movie | you) − α · log(popularity), which is your relevance with the popularity base rate factored out. Again, the bonus is ONLY used in training. At serving time you rank on the raw score, which already has that popularity discount baked in. The paper also proves this is Fisher-consistent, so it’s not just a hack.
Why not fix it after the model?
Most teams try to handle popularity bias after the model runs, using things like demotion multipliers, caps on how many blockbusters can appear on a page, or a separate diversity re-ranker. The issue is those are mostly hacks that tend to break as the catalog changes, and they add another stage you have to maintain at serving time. Logit adjustment is one line in the loss function, has real theory behind it (the Fisher-consistent result above), and is easy to tune. If your team thinks the debiasing is too aggressive, you just change α in the next training run.
It also isn’t specific to two-tower models. Because the adjustment happens inside the softmax, it works for any model trained with cross-entropy over candidate items (including ranking models).
Results
To make sure this wasn’t just a couple of lucky test profiles, I ran both models over 60,000 held-out recommendation contexts from 3,000 real users and measured how popular their recommendations were:
| Before (α=0) | After (α=0.5) | ||
|---|---|---|---|
| Median recommendation popularity | 26,830 ratings | 13,200 | ↓ 51% |
| Catalog coverage (distinct movies ever shown) | 4,485 (48%) | 7,899 (84%) | +3,414 movies |
| Exposure inequality (Gini) | 0.907 | 0.776 | more equal |
| Long-tail share of recommendations | 0.2% | 4.3% | ~20× |
The median recommendation is half as popular, and catalog coverage jumped from 48% to 84%. That’s 3,414 more movies the model recommended to at least one test user.
The cost

There is a tradeoff here. Because held-out viewings skew heavily toward popular movies (which is the whole reason popularity bias exists in the first place), pushing popular movies down means some of those held-out movies get ranked a bit lower. Here are both models scored on the same ~100,000 held-out viewings:
| Overall ranking accuracy | α=0 | α=0.5 | |
|---|---|---|---|
| MRR | 0.120 | 0.115 | −4.3% |
| Recall@10 | 0.230 | 0.220 | −4.4% |
| NDCG@10 | 0.135 | 0.129 | −4.1% |
So overall accuracy drops by about 4%. If you split that by how popular the held-out movie was, you can see where the drop comes from:
| MRR, split by how popular the held-out movie was | α=0 | α=0.5 | |
|---|---|---|---|
| Popular head (>1,000 ratings) | 0.124 | 0.119 | −4.7% |
| Long tail (≤1,000 ratings) | 0.0031 | 0.0152 | +390% |
All of the drop is on the popular head, meaning the blockbusters the model already gets right and that people don’t really need a recommender to find. Meanwhile, accuracy on the long tail goes up 5–12× (tail Recall@10 jumps from 0.2% to 3%). That’s still a small number since long-tail movies are hard to predict, but it’s a big improvement over basically zero, and the long tail is where a recommender actually helps you find something new.
So the tradeoff is giving up about 4% accuracy on movies everyone already knows in exchange for making the rest of the catalog actually show up.
What about people who like popular movies?
One fair question about that −4.7% drop is what happens to users who actually do just want mainstream movies, or who mostly watch recent, popular releases in a genre. Does setting α=0.5 push them into obscure movies they don’t want?
I checked both models on those exact kinds of users, and it doesn’t.
First, I tried a pure blockbuster fan who only liked huge crowd-pleasers (Avatar, Titanic, Jurassic Park, The Dark Knight, Inception, The Matrix, and so on, every one with over 27k ratings). The α=0.5 model recommends Spider-Man, Batman Begins, Iron Man, The Incredibles, Minority Report, and Harry Potter, which are all still blockbusters. The median recommendation only moves from 42,700 to 38,700 ratings. So if someone genuinely only watches mainstream hits, the model still gives them mainstream hits.

Second, I tried a modern sci-fi fan: Inception, Interstellar, Ex Machina, Arrival, District 9, Moon. This user watches 2010s sci-fi, not 1950s sci-fi, and this is the kind of case you might worry α would break by pushing them toward Forbidden Planet and 2001, but it didn’t. α=0.5 cuts the median recommendation by 2.3× (15,100 down to 6,500 ratings), while every pick stays modern sci-fi: Oblivion, Prometheus, Sunshine, Primer, Coherence, Predestination, all from 2004–2014. It just found less popular modern sci-fi movies.

This is the main reason I like doing this in the loss instead of slapping a blunt popularity filter on top at serving time. The model only discounts popularity relative to how well a movie matches the user’s history, so if blockbusters really are the best match, they still win. I checked a bunch of other profiles too (modern superhero, Pixar-era animation, action, crime-thriller, post-2000 horror) and saw the same thing: each one stayed in recent, on-genre movies.
Takeaway
Usually improving a recommender means a bigger model or more features. Here, adding one term to the loss function:
- halved the popularity of recommendations
- nearly doubled catalog coverage
- made the long tail 5–12× more findable
- cost ~4% accuracy on the popular head and zero added latency
Appendix: More examples
High-fantasy fan:

Courtroom-drama fan:

Organized-crime fan:

1950s creature-feature fan:

Argento-Fulci giallo cultist:

1930s screwball-comedy fan:

This is a personal project, not affiliated with my employer. All views are my own.