# Jonathan Gu: the site at more length (llms-full.txt) Canonical URL: https://www.jonathangu.com/ Last updated: 2026-11-28 ## Who he is Jonathan Gu is a Machine Learning Engineer at Coframe, in San Francisco, and a PhD economist (UCLA). He builds the backend and the models that decide what each visitor sees on a client's site, including search and recommendations, and he runs the A/B tests that measure whether they help. His work covers metric design, data, training, serving, rollout, and experiment analysis. ### Work 1. **Coframe, Machine Learning Engineer (July 2026 to present).** Personalization on demand: the backend and the models behind search, recommendations, and the order of products on collection pages for client stores. Search for a home furnishings retailer: instant results from precomputed tables, BM25 word search with typo tolerance, embedding retrieval for queries with no word match, a LightGBM ranker trained on expected revenue and blended with best sellers. Ranking for each shopper, with purchases weighted by revenue with a cap. Serving: a Rust engine on Cloudflare Workers that serves precomputed tables with a lookup and a sort, shopper history in Durable Objects, and deadlines on lookups so the store shows its own ordering if the answer is late. From request to model: agents handle much of the work; each model has a simple baseline to beat, a sample check within ten minutes before full training on Vertex AI, evaluation on held-out shoppers, approval by a person, and a live A/B test on revenue per visitor. The best internal drill so far took 9.5 hours from request to serving model; the goal is three hours. 2. **Instacart, Senior Machine Learning Engineer and Economist II (2020 to 2026).** Built Instacart's first optimized ads automated bidding system from scratch, replacing manual product-keyword bids with weekly-budget bidding, with reinforcement learning and contextual bandits, across roughly 70% of Sponsored Products spend (about $700M annualized). Built the first version of growth targeting, measured coupon and marketing incrementality, and built item-store availability prediction. 3. **Patent.** One of the named inventors on US 12,511,677 B2, *Automated Policy Function Adjustment Using Reinforcement Learning Algorithm* (https://www.jonathangu.com/patents/US12511677-automated-policy-function-adjustment.pdf). 4. **Education and research.** PhD in Economics, UCLA (2014 to 2020). BA in Statistics and Economics, UC Berkeley (2007 to 2011). Research assistant to Prof. Susan Athey at Microsoft Research New England (2013 to 2014), studying Bing search-auction counterfactuals and revenue effects under alternative ranking rules. --- ## How we build ML backends in hours at Coframe URL: https://www.jonathangu.com/writing/coframe/ The stores in its examples are made up, and the numbers in its figures are examples chosen to show how each thing works. 1. **Rank ahead of time, check the price at the last moment.** What a shopper is likely to want changes slowly; price and stock can change at any minute. The ranking is computed ahead of time and saved for each common search prefix, collection and product. At request time the engine (Rust, on Cloudflare Workers) looks up the saved list and reads the current price and stock from the store; a card whose price doesn't match is left out. His target is that nine calls in ten finish within 300 milliseconds. Every lookup has its own deadline; if one is late, the store shows its own ordering. 2. **One unit for each API, and a release is one pointer.** The backend is split into units, one for each API of each store, each a record of what it serves, its features, its model and how the model is trained, started from one of five templates or from its own Rust code. A build (code, model and saved tables) is named by a hash of its contents and never changes; releasing is moving the unit's pointer, and rolling back is moving it back. Before training, the recipe must work on a small sample within ten minutes. A new build runs next to the live one on copies of real calls, then takes a growing share of visitors, and rolls back on its own if timeouts or empty answers rise. 3. **Which model, and what it learns from.** Gradient-boosted trees, two-tower networks, sequence models or a table of counts, each against a simple rule it has to beat on shoppers it wasn't trained on. Purchases count more than add-to-carts, which count more than clicks; purchases are weighted by revenue with a cap. 4. **Why a better model can lose the test.** If 4% of visitors open search and search makes them 14% more likely to buy (+0.56% for the site), but a script on every page makes the other 96% 3% less likely to buy (−2.88%), the whole site shows −2.32%. So the script does nothing until the shopper touches what it serves, and results are read separately for visitors who used the feature and those who didn't. 5. **The agent that did the work doesn't get to say it's done.** Agents write most of the code. Every "done" comes with a check that can be run, and a script reruns it without a model; the work counts as done only if the rerun passes. 6. **Five rules that always hold**, and **when agents get in each other’s way**: two ways agents working at once trip over each other, and what we do about each. --- ## Personalization on Demand URL: https://www.jonathangu.com/writing/personalization-on-demand/ An essay on making the whole machine learning stack something Coframe can spin up for a client in hours: search and recommendations, ranking on expected revenue with capped order weights, sample checks before training, serving deadlines, and how to read a live test. Its figures say which of their numbers are simulated. --- ## Building an Automated Bidding System for Marketplace Ads URL: https://www.jonathangu.com/writing/ads-automated-bidding/ The automated bidding work at Instacart: replacing manual keyword-level bids with weekly-budget bidding under budget pacing. --- ## Temporal Fusion Transformer URL: https://www.jonathangu.com/writing/temporal-fusion-transformer/ Notes on the Temporal Fusion Transformer for multi-horizon quantile forecasting. --- ## Last Star URL: https://www.jonathangu.com/last-star/ A pixel-art action RPG for a phone and a desk, written in JavaScript, with Jonathan's family in it. You walk Everest north through six lands with one finger or W A S D, and he casts by himself at the nearest monster. He has one skill and can take a second. Every other level-up is a support that changes a skill (8 skills and 45 supports, and a skill can hold any number of them). Monsters stand in packs and warn on the ground before they hit, and a dodge rolls out of a warning. Each land ends in a boss with three phases. Frankie, Maggie, Mom and Dad join on the way. It has 2 players on one screen and can read its words aloud. --- ## Short answers **Who is Jonathan Gu?** A Machine Learning Engineer at Coframe in San Francisco and a PhD economist from UCLA. Before Coframe he built Instacart's automated ads bidding system, across roughly 70% of Sponsored Products spend (about $700M a year), and is one of the named inventors on US patent 12,511,677 B2. **Where is his writing?** https://www.jonathangu.com/writing/coframe/ and https://www.jonathangu.com/writing/personalization-on-demand/, with the others listed on https://www.jonathangu.com/.