Book Deep-Read · Generative AI System Design Interview · Chapter 10

Personalized Headshots: a Face Is the One Condition You Cannot Write Into a Prompt

Generative AI System Design Interview · Ch 10 · Ali Aminian, Hao Sheng & Alex Xu · 2024

中文 →

What is this chapter about?

You upload a dozen phone selfies, pick a "professional headshot" style, wait a few minutes, and get back dozens of studio-lit portraits in a suit — with your face still being your face. This chapter is about how that pipeline is built.

A strange thing first

Last chapter's model was already very good at drawing. Tell it "a professional headshot of a woman in her thirties" and it produces something fast and beautiful — but it is a stranger. Add details: monolid eyes, a high nose bridge, a mole on the left cheek… by the twentieth adjective it is still somebody else.

Think about it and you already know why: could you describe your mother in words well enough that a stranger could pick her out of a crowd? The words simply do not exist. What makes a face recognizable lives in millimetre-scale geometry, and adjectives are a very blunt instrument.

So stop describing — show it instead

If it can't be said, teach it differently: put a handful of your photos in front of the model, let it take a short class, and give you a brand-new name that means only you. Afterwards you say "draw that name standing on a snowy mountain" and it knows who to draw.

There are two ways to run that class. One is to let it relearn everything: the memory sticks best, but every single user then needs their own full copy of the retrained "brain", several gigabytes each — and it easily overdoes it, getting so absorbed in you that afterwards everyone it draws looks like you.

The other is what nearly every product picks: leave the original skills completely untouched and pin a tiny badge beside them. A few dozen megabytes, clipped on when you want a picture and taken off afterwards — so one brain can serve thousands of people in turn.

An easy trap

Overdo the class and what it learned is not "your face" but those dozen photos memorized whole. Ask for you on a snowy mountain and you get the same white study wall as before, just with a more accurate face.

So "does it look like me" cannot be read alone — while it climbs, "does it do what I asked" is falling. What you want is where the two cross. It is also why a dozen photos from different places and different angles beat forty taken in front of the same wall.

And this chapter carries something extra

Earlier chapters generated fictional people; this one generates a real person. So a whole set of things the earlier chapters never needed has to be built into the flow: confirming on upload that the face really is yours, blocking what shouldn't be produced, leaving a traceable mark on the image, and — when someone deletes their account — destroying that badge along with the photos, because it amounts to a standing ability to recreate that person.

The cost is concrete too: every user needs their own training run, a per-head compute bill none of the earlier chapters had.

Remember this one line

Identity is the one condition you cannot talk your way into, so it has to be taught with samples; the winning way to teach is not "relearn everything" but "pin on a few-dozen-megabyte badge", because that lets one brain be shared by everyone and lets the memory be deleted cleanly; and "does it look like me" must always be read alongside "does it do what I asked", or you end up with a model that only recites its training photos.

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