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

Harmful Content Detection: the image is fine, the caption is fine, together they aren't

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

中文 →

What is this chapter about?

You scroll past hundreds of posts a day and almost never run into gore, slurs or scams. That isn't because nobody posts them. It's because every piece of content passes through an invisible checkpoint before it reaches you. This chapter is about how that checkpoint is built.

Start with something odd

There's a kind of content where every piece, taken apart, is spotless. A photo of a skunk — harmless. A line that reads "love the way you smell today" — harmless. Put them together and send them at a person, and it's an insult.

The malice isn't in the picture or in the words. It's in the join. So a checkpoint built as "let the picture inspector look, then the text inspector look, and wave it through if both say fine" is structurally blind to this. Half the design in this chapter exists because of that fact.

Why the old world struggled

Three old approaches, all of them short.

The core mechanism

Three moves.

How to think about it

The thing that matters isn't how clever the model is. It's where those two dividing lines get drawn. Draw them loose and people get hurt; draw them tight and people speaking normally get their posts pulled for nothing. There is no "correct" spot — and different categories belong in different spots: missing one self-harm post and wrongly deleting one rudely-worded one are not the same order of cost.

What it costs

Handing the least certain band to people ties a fixed-capacity tail to the system: loosen the threshold and the queue explodes, so the content that most needs a human ends up waiting hours.

Remember one thing

The hard part of harmful content detection isn't "recognising bad things". It's two other things: information has to be merged early, because malice often lives only in the combination; and the model scores, it does not rule — you leave the least certain band to humans and accept that their capacity is the ceiling of the whole system.

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