Building an Automated Bidding System for Marketplace Ads

How I built an automated bidding system that replaced manual product-keyword bids. Advertisers give a budget and an objective, and the system sets the bids.

Summary

I built the first automated bidding system for a large retail marketplace ads business. Before it, advertisers set a bid by hand for every product and keyword. With it, they give a budget and an objective, and the system sets the bids.

The idea comes from economics. If an advertiser is spending well, the return on the next dollar should be about the same everywhere in the campaign. The system estimates the return on each product and keyword, chooses how aggressively each advertiser should bid, simulates what would happen, and publishes the bids.

The Problem

Before automated bidding, a campaign could contain many products and many keywords, and the advertiser had to choose a bid for each one. The right bid depends on conversion rates, basket behavior, competition in the auction, attribution lag, the budget, and demand that keeps changing.

That caused three problems.

Work for Advertisers

Advertisers mostly wanted to state a goal, like growing sales or hitting a return threshold. Manual bidding made them solve an optimization problem instead.

Wasted Spend

Some parts of a campaign were underbid while others took spend at lower expected returns. The platform had better aggregate data than any single advertiser, but manual bids could not use it.

Limits on the Product

New objectives and new inventory needed a control layer. Manual bids did not extend to several objectives, automated pacing, or campaigns managed by a model.

The Product Interface

The main design choice was to change what the advertiser controls. They give a budget and an objective, and the platform chooses the bids.

That is easier for the advertiser. It also makes the platform responsible for spending the budget where it is likely to produce the objective, without delivery that hurts return, trust, or the user experience.

The Main Idea

If an advertiser can move spend between opportunities, a good allocation should not leave large gaps in return. If one product or query is expected to return much more than another, the campaign should spend more there until the gap closes.

The return measure was ROAS: revenue attributed to ads divided by ad spend. The implementation had to handle attribution, delayed conversions, sparse and noisy data, and competition in the auction. The rule itself is short:

Allocate spend so expected marginal ROAS is balanced across eligible opportunities, while respecting budget, pacing, relevance, and marketplace constraints.

That gives two problems. The first is estimation: predict the expected return for many product and keyword opportunities. The second is control: choose the target return for each advertiser that spends the right amount without going below the return they need.

System Architecture

The first version had to work inside the existing ads stack, run on batch data, and produce bids reliably. I built it as separate stages that could each be inspected, instead of one model.

1

Collect Signals

Join impressions, clicks, conversions, spend, attributed sales, product metadata, campaign setup, query context, and budget state.

2

Estimate Return

Estimate expected sales or return for each eligible product and keyword, with smoothing for sparse and delayed outcomes.

3

Solve Policy

Find the target return or control setting each advertiser needs to spend efficiently against the objective.

4

Simulate Delivery

Simulate the bids to estimate spend, pacing, auction eligibility, return, and constraint violations before publishing.

5

Generate Bids

Publish bids to ad serving, monitor delivery, and feed the outcomes into the next cycle.

The first production version ran as batch jobs, with the large joins and the simulations done in the data warehouse, close to the data. It had to generate bids reliably every day, with budget and pacing safeguards, intermediate tables for debugging, and a way to roll back when a model or the data got worse.

The Algorithm

The first version was a control loop around the auction. It decided how aggressively each advertiser should bid and turned that into a bid for each opportunity.

1. Estimate opportunity value

For each eligible opportunity (a product, keyword, campaign, and serving context), the system estimated the expected attributed value. Many product and keyword pairs had little data, so the estimate combined their own history with broader priors. It had to be stable enough to set tomorrow's bids, so it smoothed noisy observations and handled conversion delay.

2. Translate value into a bid

The bid comes from the expected value and the advertiser's target return. Higher expected value means a higher bid, and a stricter return target means a lower one.

candidate_bid = expected_value / target_return_threshold

The real system also had floors, caps, auction constraints, eligibility rules, and pacing adjustments. The formula still made each bid explainable.

3. Solve for the advertiser-level control setting

The target return was different for each advertiser, because each had a different catalog, budget, competition, and objective. The system searched for the setting where simulated spend and simulated return were both acceptable. If it was too conservative, the campaign underdelivered. If it was too aggressive, the campaign could miss the advertiser's return target.

4. Simulate before publishing

A bid that looks reasonable alone can spend too much, deliver too little, or concentrate in one place once it competes in the auction. So the system simulated candidate policies before publishing bids. When a campaign underdelivered, the simulation also let us tell apart weak inventory, conservative settings, auction competition, budget limits, and noisy return estimates.

5. Close the loop

After the bids were live, the system observed spend, attributed sales, budget use, pacing, and return, and used them in the next cycle. It had to correct allocation mistakes without changing so quickly that advertisers could not trust it.

Measurement

We could not evaluate the system by comparing manual campaigns with automated ones. Advertisers choose different strategies for different campaigns, so the two groups are not comparable, and a comparison of observed ROAS would include selection bias.

The measurement was experimental. It asked whether the automated policy did better against the advertiser's stated objective under comparable conditions. The metrics were:

  • Return quality: whether realized return stayed above the advertiser's target often enough to keep their trust.
  • Budget utilization: whether the system could spend the intended budget when there was enough good inventory.
  • Sales or objective lift: whether the campaign produced more of the stated outcome.
  • Pacing stability: whether spend was spread out instead of running out early or missing opportunities.
  • Marketplace health: whether ad delivery stayed compatible with relevance, conversion, and user experience.

In one sentence, the controller tried to spend as much of the budget as was useful, subject to the advertiser's return constraint and marketplace quality constraints.

What Made It Hard

Noisy Labels

Conversions are delayed, attributed through imperfect rules, and affected by what the user already intended to buy.

Auction Feedback

Bids affect whether an ad is shown, which affects what data we see. The system learns from data that earlier policies generated.

Budget Constraints

Campaigns are limited by budgets, pacing rules, and available inventory, so underdelivery can come from the policy, from supply, or from competition.

Sparse Data

The finer the bid granularity, the less data each cell has. The estimates had to be fine enough to act on and stable enough to trust.

Advertiser Behavior

Advertisers respond to what the platform offers. Automated bidding changes what a bid means, so the product had to be understandable.

Safeguards

Ads revenue is not the only objective. The system also had to respect relevance, marketplace quality, and longer-term trust.