Books Deep-Read · ML System Design Interview · Chapter 6

Video Recommendation: you think the hard part is guessing right — it's not having the time

Machine Learning System Design Interview · Ch 6 · Ali Aminian & Alex Xu · 2023

中文 →

What is this chapter about?

You open a video site and the home page hands you about twenty videos. You probably imagine a machine that knows you well, picking your twenty favourites out of everything it has. This chapter says the real problem is different: the hard part isn't picking well, it's that there is nowhere near enough time to pick at all.

An analogy first

Imagine a city with a billion restaurants. You are hungry, standing at your door, and you need to be told where to eat before you can blink.

"Try all billion, then rank them" was never on the table — not because the tasting is inaccurate, but because there simply isn't time. So the real method splits into two passes: first something very fast and a bit crude narrows a billion down to a few hundred plausible ones, then something slow and fussy ranks those few hundred properly. Almost every design in this chapter grows out of that arithmetic.

Why the old world was hard

Before you can split the work, you have to answer a simpler question: what makes the system think you'd like something? There were two old answers, each with its own way of dying.

So real systems run both: the second one does the discovering, the first one covers what the second can't reach.

How it manages to be fast enough

The trick is doing the work ahead of time. The system precomputes, for every video, a short string of coordinates — roughly, where it sits on a huge map of interests. It computes one for you too: which part of that map you usually hang around in. When you arrive, it does one thing: find the points on the map near you — the way you'd find nearby restaurants on a map instead of measuring the distance to every restaurant in town.

That pass only tries not to miss anything, and leaves about a thousand. Only then does the slow, fussy model rank them properly. Finally there's a review pass: this one isn't licensed in your country, this one is stale, these two are the same clip, all twenty are from the same creator — all removed here.

How to think about it

The thing worth remembering is that each layer chases something different. The first chases "don't drop anything" — what it drops, no amount of later precision can recover. The second chases "get the order right". The third handles the rules you can't teach a model: licensing, freshness, no duplicates, don't be monotonous. Collapsing all three into one layer is the classic beginner's mistake.

What it costs

The system can only learn from things it has already shown you — anything it never showed you, it will never find out whether you'd have liked, so it keeps recommending an ever-tighter version of who it thought you were yesterday.

One line to remember

A recommender's shape isn't set by "how do we get smarter", it's set by an arithmetic of time: a billion candidates against a budget shorter than a blink forces the three passes — coarse filter, fine ranking, final review. And its deepest flaw comes from that same shape: it can only learn from what it has already shown.

Want the mechanisms, the notation and the diagrams? → Switch to the deep read