The Policy Layer
In one line: the ranker scores items one at a time, and several things you care about are properties of the whole slate, so something after the ranker has to own them.
Why a stage after ranking exists at all
Take the top ten by score and you get ten items that are individually excellent and collectively terrible: five near-duplicates, all from one creator, all on the same topic, three of which the user watched last week.
None of that is visible to the ranker. It scored each item independently, and by that measure it did its job perfectly. Diversity is not a property of an item — it is a property of a set — and a pointwise scorer cannot represent it.
Diversity, done properly
The naive fix — take the top item, then skip anything too similar — is greedy and it works surprisingly well. It also has no notion of how much quality it is giving up for how much variety.
The principled version is a determinantal point process. A DPP defines a probability over subsets that is proportional to the determinant of a kernel matrix built from item quality and pairwise similarity. Determinant is volume, and volume is large when the vectors are both long — high quality — and spread out — dissimilar. So sampling a high-probability subset naturally selects sets that are good and varied, with a single parameter trading between the two.
Wilhelm and colleagues published the production version of this for YouTube in 2018, which makes it a citable example rather than a theoretical one.
The practical argument for a DPP over greedy deduplication is that the trade-off becomes a parameter you can tune and A/B test, rather than a threshold somebody picked.
What else lives here
Diversity is one of several things that belong after ranking. The others share a property: they are constraints, not preferences, and a loss function is the wrong place for a constraint.
| Concern | Why it is not in the model |
|---|---|
| Diversity | A property of the set, not the item |
| Dedup and cooldown | Depends on this user's recent history, not on item quality |
| Freshness boost | A distribution goal about the catalogue |
| Eligibility and safety | Hard rules — an ineligible item must never appear, at any score |
| Creator exposure floor | About distribution across items, not about any slate |
| Contractual placement | A commitment, not a prediction |
The eligibility row is the clearest case. If an item is geo-restricted, age-gated or removed, no score should be able to surface it. Expressing that as a large negative weight in a loss is strictly worse than a filter: it is approximate, it is invisible when it fails, and it competes with other terms.
Position matters here too
The policy layer decides the final order, and the top slot is worth several times the third. So the slate assembly is not just "which ten" but "in what order", and the two interact: a diverse set arranged badly reads as incoherent.
A common pattern is to anchor the first slot on the highest-scoring item — the user should see the best thing immediately — and diversify from position two onward. That preserves the strongest single impression while still varying the slate.
Where it goes wrong
Too many rules. Every incident adds one. After two years there are forty, they interact, and nobody can predict the output. Rules need owners and expiry dates like everything else.
Rules that should be features. "Boost videos under ten minutes" is a rule someone added because short videos performed better. That is a pattern the model could learn, and as a rule it is frozen — it does not adapt when the pattern changes, and it applies to users for whom it was never true.
The dividing line: if it is a prediction, it belongs in the model. If it is a constraint or a commitment, it belongs in policy. "Short videos do better" is a prediction. "Never show this in this country" is a constraint.
Diversity applied to the wrong axis. Diversifying by creator when the user follows three creators deliberately, or by topic on a surface where the user came for one topic. Diversity is contextual, and on a strong-intent surface it is a cost with no benefit.
The latency cost
The policy layer is usually cheap, with one exception. A DPP over a hundred candidates involves determinant computations that can dominate a two-millisecond budget if implemented naively. The standard mitigation is to apply it to a shortlist — diversify the top twenty rather than the full hundred — which captures nearly all the benefit for a fraction of the cost.
Worth mentioning if asked about the budget, because it is the one place in this design where a principled method has a real cost and a simple approximation is genuinely close.
Key takeaway
The ranker scores items independently, so anything that is a property of the slate needs a stage after it. Diversity is the main one, and a DPP turns the quality-versus-variety trade into a tunable parameter rather than a hard-coded threshold. Everything else here is a constraint rather than a prediction — and the test is exactly that: predictions belong in the model where they adapt, constraints belong in policy where they can be verified.
Next: why the offline number and the A/B result disagree.