Machine learning at Coframe, San Francisco

Jonathan Gu

I build the machine learning that decides what you see next.

Recommendations, search and grids for online stores. At home, I answer to two small children.

Unwritten Stars, the arcade machine

Work at Coframe

Résumé & elsewhere

Your shelf, live

The capsule recommender
  1. 01Recommen­dation rails
  2. 02Search
  3. 03Feeds & grids

Until you press something, these are my picks. After that, they are yours.

Writing

Ask the page

Turn on JavaScript and these toys do real things.

The shelf

Your shelf

This is a real recommender, and it is running in your browser as you read this. Everything on the page belongs somewhere among five topics. When you open or play something, the shelf revises its opinion of you, scores everything again and reorders itself, keeping one place for something you have shown no interest in, on the theory that you may not know yet. It learns only from what you choose to open. Nothing is stored, nothing is sent anywhere, and it forgets you when you close the tab.

Fig. 01The capsule recommenderTurn the crank for your top pick. Open it, and the queue re-sorts.
Hand-inked drawing of a capsule machine holding one capsule for each of the twelve things on this page, queued on a spiral track

The same idea, at two sizes

StepOn this pageAt Coframe
What gets rankedTwelve drawingsLive product catalogs
What it learns fromThe drawings you open and playReal shopper behavior, from the first visit
The modelA Dirichlet over five topicsLearned embeddings and rankers
How it stays freshUpdates after every openUpdates after the next product view and retrains on schedule
Where it runsYour browser, in a fraction of a millisecondA production ML API, fast enough to add no visible wait
How we know it worksYou watch it moveEvery model ships as an A/B test against what was already there

Coframe uses AI to improve and personalize online stores. My part is the machine learning that decides what each shopper sees: which products appear beside the one they are looking at, the order of a category page, what search returns and what to suggest to someone hesitating over a cart. I am building it so that a client can ask for something in a sentence and have a working, tested model behind it within hours. Each model checks its data before it trains, retrains every day and replaces the live one only when a fair comparison says it is no worse. The final judge is revenue, measured against whatever the store used before, which has the advantage of being difficult to argue with. The machines below run small versions of the real ideas, and their buttons work.

Fig. 02

Recommendation rails

“You may also like,” done properly.

Hand-inked drawing of a toy train whose cars carry products in ranked order, wired to a signal box marked MODEL

Every store has a row that says “You may also like.” Ours form a view of the shopper on the first visit and revise it after the next product they look at. A substitute and a complement are different questions, so each gets its own model, and what a shopper has already viewed is something the model weighs rather than a rule it obeys.

Fig. 03

What the shopper meant, rather than what they typed.

Search results reordered by what the shopper meant rather than the exact words typed, learned from how people search and what they then buy.

Fig. 04

Feeds & grids

The same category, in a different order for each visitor.

Hand-inked drawing of a three by three cubby shelf of product cards beside a taste meter

Collection pages and homepages, put in a different order for each visitor. One product view is enough for the grid to reconsider.

Fig. 05

The ML factory

Where a day of clicks becomes tomorrow’s model.

Hand-inked drawing of a little factory line: a glass tube of shopper events, a hopper, a grinder, an oven and a press that stamps the model

Events, features, training, evaluation, publishing and serving, in one place. A model learns the goal of the experiment it serves, which is usually revenue per visit. A client’s request becomes a working model within hours, and the model retrains every day.

Fig. 06

Head to head

The shoppers decide which model stays.

Hand-inked drawing of two little shops, A for the old way and B for the new model, with a splitter sending shoppers to each and scoreboards on the roofs

Every model goes live as an experiment against whatever was on the page before, including established vendors in their own slots. A new model replaces the old one only when it is at least as good, and a gain that sits inside the noise does not count. It must also beat the best simple rule, which is more humbling than you might expect.

Fig. 07

The experiment engine

Each test, won or lost, suggests the next one.

Hand-inked figure: the experiment engine, where every finished test feeds the next ideas

Every test, won or lost, teaches an engine that proposes the next ideas for every client. Agents build the ideas, and people decide which of them deserve a store’s visitors.

Under the models

Underneath the models are the platform they run on and the method by which all of it gets built.

Fig. 08

The switchboard

A client’s request becomes a record rather than a project.

Hand-inked drawing of a switchboard: use-case cards slot into a registry, a shadow lamp, a gate light and a flip lever wire a storefront to the new platform

Each client’s request becomes a record that says what to show, what to learn from and how success will be judged, with custom code only where the record cannot say it. A short check proves that the data exists before any training is paid for. Clients are walled off from one another. A new model answers quietly beside the old one before anyone sees it, and the way back is written down before the switch.

Fig. 09

The command center

The agents build it, and people decide.

Hand-inked drawing of a control room: a plan board of ordered work, lanes, robot builders at benches, an advisor, a two-lens checker, a merge gate and a locked live storefront

I build all of this with a company of AI agents. One plans the work, another audits the plan, and builders take the rows. A grader from a different family of models checks what they produce, on the reasonable theory that nobody should mark their own homework. A piece of work is finished when a script prints PASS, not when an agent says so, and the person who owns a launch decides when it launches.

One loop

  1. Shopper events
  2. Features & embeddings
  3. Candidates
  4. Ranking
  5. Serving
  6. Experiment
  7. Retrain

The same loop runs for every client, every day. Shopper events become features, the features become candidates and rankings, the rankings are served, an experiment says whether they helped, and the answer goes into the next model. A page counts as live only when a new visitor actually sees the model’s choices on it.

Side A

Three songs for my family, played over our own photographs.

Everest in the late afternoon sun, the first picture of the Side A film
  1. 1Bus Stop ConfettiFor Everest & Maggie. Sung in Mandarin, with English under each line.4:11
  2. 2Three Hearts Inside a Stolen ShipFor Tina, Everest & Maggie5:05
  3. 3One More ThingFor Everest, sung by Dad4:38

The songs were made with Suno, and the photographs come from our family album.

Fig. 11The Unwritten Stars cabinetDrop a coin and press start, and the game will load.
Hand-inked drawing of a bartop arcade cabinet for Unwritten Stars, with a stack of coins beside it

Now playing

Unwritten Stars

Follow the stolen ship home.

An action game in four acts, each as long as its song, from “Three Hearts Inside a Stolen Ship” to the lullaby 门前大桥下 on the river home. Run an unwritten road while the Blight eats it behind you; your weapons fire by themselves, and every level is a choice that branches and evolves. With Gentle on, Wren pulls you up whenever you fall, so anyone can reach home.

It plays with a keyboard, a touchscreen or a gamepad, with the sound on, and each act lasts about five minutes.

Game night

Priced In

Trivia for people who don’t know the answer.

A trivia game for friends who think they know things. Everyone locks in a guess, the guesses become an odds board, and you bet on whoever you think is closest without going over. Play at a live table now, or start a room and text the link so everyone plays on their own phone, with voice chat and AI guessers who explain their terrible reasoning in the group chat.

Play Priced In

High expectations and a great deal of warmth

Let kids meet hard things and find out they can learn them, with someone close by.

Most of what I believe about learning, I believe more since becoming a father.

Jonathan with his wife and their two kids on vacation, all four smiling
The four of us, briefly facing the same direction.
Everest and Maggie riding together in a green grocery cart in front of a wall of fruit
Saturday groceries, with two passengers who do not help.
Everest in a tie-dye shirt, standing in the late afternoon sun
Everest, in the last of the afternoon sun.
Maggie with two little pigtails, sitting by a bright window with flowers behind her
Maggie by the window, considering her options.
Jonathan’s son and daughter laughing together at the kitchen table
A birthday, which her brother has taken charge of.
Jonathan on a shaded walkway with Maggie in a baby carrier, Tina and Everest on a bench behind them
Out for a walk, all four of us.
Everest at the table, gluing green paper triangles onto pink paper
Everest, applying glue with great seriousness.
Maggie grinning on the rug in a green-trimmed bib
Maggie, who finds most things funny.
Everest outside in a blue fleece, holding a long branch in one hand and a toy truck in the other
He found the best stick, and brought a truck in case.
Maggie sitting on the rug in a knitted sweater, holding a blue stacking ring
Rings, in order, eventually.

None of this is ranked. Some things you don’t optimize.

“I do it”

The best sound in parenting is “help me” turning into “I do it.” A balance bike gets there faster than any lecture.

Little boat, fat boat

On the walk home along the water, every boat must be assigned a role in the family. The little boat is Maggie. The fat boat, I am told, is Daddy.

Anything with wheels

Monster trucks, fire trucks, trains and cranes are all examined from as close as an adult will allow, and for as long as one will wait.

Five books at bedtime

Five books, every night, because five is currently the largest reasonable number in the universe. So far, the books are winning.

Two languages

Our home runs in Mandarin and English. The songs we sang to our kids, they now sing back to us.

Saturday pancakes

He mixes the batter with great seriousness. His little sister supervises and handles the cheese.

A walk home from preschool can take three hours. Every boat, fire truck and unusual machine requires investigation.

Work and home turn out to run on the same method. You watch closely, try something, keep what works and change your mind when the evidence says so. Children do this without being asked. Models have to be taught, and so, now and then, do I.