Jonathan Gu

I’m a machine learning engineer at Coframe with a PhD in economics from UCLA.

Jonathan with his wife and their two kids on vacation, all four smiling

I build the backend and the models that decide what each visitor sees on a client’s site, including search and recommendations, and I run the A/B tests that measure whether they help.

What I do at Coframe

I’m working on making the whole machine learning stack something we can spin up for a client in hours. Someone tells us what they want, we build it, and they can try it on their own site.

Search and recommendations are a big part of that, but the requests get much more specific once you start talking to people. A lighting store wants to show similar chandeliers below the one a shopper is looking at. A retailer wants to help people choose a size. Someone selling cooking classes wants to suggest the next class a visitor might enjoy. Each needs different data and different logic, and I want us to be able to build all of them without starting over each time.

That’s what we’re building at Coframe. Our agents already make changes to websites. My part is the backend behind them. A shopper’s page calls it for search results, recommendations, the order of a collection page or a pick of content, and it answers with products, prices and stock.

I built it for One Kings Lane, Legendairy, RealTruck, DUER, iFIT, NordicTrack, Sur La Table, La Belle Perfumes and Magid.

  • Search drop-down
  • Search results
  • Collection page ranking
  • Product page recommendations
  • Cart cross-sell
  • Home page carousel
  • Offers and content
  • Size recommendation
  • Vehicle picker
Parts of a store’s site the backend answers for today.

I wrote about how this works for a shopper in Personalization on Demand.

The goal

The goal is three hours from a client’s request to a serving model. Our best recent internal drill took 9.5 hours.

Today my bar is eight hours for any request that needs the backend, and no request should take more than a day. On November 26, 2026 the median over the last eight requests was 12.4 hours, and one request had been waiting for more than a week, so I’m not there yet.

I track five goals, and each has one measure.

  1. 1Our version beats the store’s own in live tests. The measure is how many more buyers our versions bring than the store’s own.
  2. 2Every shopper gets a right answer in time. The measure is the share of a day’s calls that were late, empty, hidden, failed or priced unlike the store.
  3. 3Every model beats the model it replaces. The measure is how many do, on revenue from held-out shoppers.
  4. 4A client’s request is live within hours. The measure is the hours from the request to live.
  5. 5Each dollar spent on building and testing brings more buyers. The measure is dollars per extra buyer.

A test runs what we built against the store’s own version on real shoppers. I read each test as the chance that our version beats the store’s.

How the backend works

The backend is split into units, one for each API of each client. One Kings Lane search is one unit. Each unit is checked, published and rolled back by itself, so a change to one client’s search doesn’t wait in line behind anyone else’s. 85 of 88 APIs run this way.

A unit starts from one of five templates, or from its own Rust code where no template fits. The templates are search, collection page, item recommendations, home page and content. The unit’s record says what it serves, its features, its model and its training recipe. When something is fixed, the fix goes into the template, and every unit of that kind gets it.

  1. 1RequestA client tells us what they want.
  2. 2RecordAn agent writes the unit’s record: what it serves, its features, its model and its training recipe.
  3. 3TrainThe recipe has to work on a small sample within ten minutes. Then Vertex AI trains the model.
  4. 4EvaluateThe model is scored on held-out shoppers against a simple baseline and the model it replaces.
  5. 5ServeThe Rust engine answers from a table computed ahead, with the live price and stock.
Fig. 1. Steps from a client’s request to a live answer.

A unit can use gradient-boosted trees, a two-tower network, a cross-encoder or a sequence model. We also give each model a simple baseline to beat. For recommendations, that might be best sellers or products people often view together. If a simple rule works better, I want to know that before we put the model in front of shoppers. On November 26, 45 of 62 new models scored above the model they replaced on revenue from held-out shoppers, and 17 did not.

Serving is a Rust engine on Cloudflare Workers. Most answers are computed ahead and saved, so a call is a lookup and a sort. Each product card takes the live price and stock when it is served. Lookups have deadlines, so the store shows its own ordering if our answer is late. If a price we would show doesn’t match the store’s, we hide our part of the page.

A new build of a unit runs next to the live one on copies of real calls. It takes a growing share of visitors, and it rolls back by itself when timeouts or empty answers rise.

109 ms
Median time to answer a call
76%
Calls answered from a saved answer
85 of 88
APIs that run as units
77%
Code in Rust
Readings from November 26, 2026.

On November 26 the backend answered 339,362 calls from shoppers’ pages in 24 hours. 76.3% of them got a saved answer, up from 26.3% a week earlier. The median time to answer was 109 ms. One call in ten took 457 ms or longer. My target for the slowest tenth is 300 ms, and I haven’t met it.

Most of the code is Rust now. On October 20 the main branch had 3,673 Python files. On November 26 it had 712, and Rust was about 77% of the code. The old Python recommendation service is deleted. The rule is that each change deletes the path it replaces.

How I work

A small team and a lot of agents are building this. The agents write code, run training, and review each other’s work. We set the goals, check the results, and decide what goes live.

I work by writing orders to the agents in plain words. From October 22 to November 26, 2026 I gave 1,846 orders, about 51 a day, and the record of that work shows no code that I wrote by hand. The agents run on 43 seats: 20 Claude, 20 Codex and 3 others.

  1. 1OrderI write what I want in plain words.
  2. 2AdvisorOne agent writes down my words and names the one case that has to pass in production.
  3. 3Command centerOne agent gives the work to an owner.
  4. 4OwnerOne agent does the work end to end. It writes, tests, merges, releases and watches production.
  5. 5RerunA tool with no model in it reruns the owner’s check. The work is done only when that rerun passes.
Fig. 2. How an order moves through the agents.

The rerun exists because an agent saying it was done was often wrong. From October 29 to November 7, 122 claims of done came with a check that could be run, and 93 of those checks failed when rerun. A check counts only after it has failed on a bad change and passed on a good one.

Agents also collide. In the week to November 26, 164 files were each changed by ten or more pull requests, and 1,182 of the 1,656 merged pull requests touched one of them. A shared file has no owner, so nobody splits it. I’m having those files split so that each piece has one owner.

Five rules hold whatever the order says. Nobody launches a test without the approval of the person named for it. Only the command center changes a test that is live. No client’s data crosses to another client. No key or password is printed. Code lands only through the merge queue, after tests and a security review.

Before Coframe

Instacart2020 to 2026

At Instacart I built automated bidding for ads from scratch, with reinforcement learning and contextual bandits, across roughly 70% of Sponsored Products spend (about $700M a year). It replaced manual product-keyword bids with weekly-budget bidding.

I also built the first version of growth targeting, which ranks users by the extra effect a treatment is expected to have on them. I measured how much coupons and marketing add over what would have happened without them, and I built the models that predict whether an item is in stock at a store.

Microsoft Research New England2013 to 2014

Before that I studied search auctions with Susan Athey at Microsoft Research.

UCLA2014 to 2020

PhD in economics.

Writing

Last Star

Last Star is a game I made for a phone. My family is in it, and they carry a fallen star home across five seas. You walk my son Everest with one finger, and he hits the monsters by himself. The animals that join walk with him.

Play Last Star
  • The title of Last Star over a sandy island with a ferry at its dock
  • A page of the story: at night a dark hand in the sky carries Mom and Dad away while stars fall into the sea
  • Everest and a ladybug keep the star from crabs that walk up the beach
  • A pick of one card in three: Swing, Ladybug or Beetle