Design a Bid Shading System for First-Price Ad Auctions
Last updated: November 29, 2026
Quick Overview
Most exchanges have moved to first-price auctions, where the winner pays its own bid. Design an ML system that, given the bidder's value for an impression, picks a lower bid that maximizes expected surplus while keeping win rate and delivery on target.
StackAdapt
November 29, 20260
0
0 solved
Most exchanges have moved to first-price auctions, where the winner pays its own bid. Design an ML system that, given the bidder's value for an impression, picks a lower bid that maximizes expected surplus while keeping win rate and delivery on target.
Bid shading is a direct lever on what StackAdapt's advertisers pay for every impression, and a poor shader either overpays or starves campaigns. The round tests auction economics, learning from censored win/loss data, online serving under the bidder latency budget and safe experimentation.
What the Interviewer Expects
- Formulates the objective: maximize (value - bid) times P(win | bid)
- Models the win-rate curve from censored data, using minimum-bid-to-win feedback when exchanges provide it
- Serves within a few milliseconds inside the bidder
- Adds guardrails so shading never breaks delivery or pacing
- Evaluates with randomized bid perturbation experiments
Key Topics to Cover
How to Approach This
- Start by mapping the business objective to a concrete ML objective and metric.
- Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
- Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
- Address the serving latency budget and whether batch or real-time inference is needed.
- Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
- Some exchanges return the minimum price needed to win and some return nothing; how do you use both?
- How do you stop the shader and the budget pacer from fighting each other?
- How would you detect that an exchange changed its auction logic?
- What is the risk of a feedback loop where shading changes the market prices you learn from?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice ML System Design ProblemsSample Answer
Requirements
Input at bid time: the value the bidder assigns (predicted conversion probability times advertiser value), plus context: exchange, publisher, ad size, device, geo, hour. Output: bid . Goa...
High-Level Design
Offline: log every bid with features, bid price, outcome (win or loss) and, where available, the minimum bid to win. Train a model for the distribution of the highest competing bid given context. ...