← Questions

Design a cost-per-action bidding system for ads

0
AppleAI/ML designLast asked Mar 2026

An AI/ML design interview question asked in Apple's technical phone screen, last asked Mar 2026. It tests ads, bidding and conversion prediction.

Advertisers pay for actions such as app installs or purchases, not for clicks, and each sets a target cost per action (CPA) and a budget. Design the system that bids for them in every ad auction so they get as many actions as possible at or below their target, while the ad platform keeps its revenue and users see relevant ads.

Requirements

  • Functional: for each auction and each eligible campaign, predict the chance the impression leads to the advertiser's action, turn that into a bid, spend the budget evenly over the campaign's flight, and report the realized CPA.
  • Learn from conversions that arrive hours or days after the click, and from attribution data that may be partial.
  • Non-functional: the bid is computed within the auction's latency budget (a few milliseconds), the predictions are calibrated, and the system resists fraud and sparse data for new campaigns.

Clarifying questions

  • Which auction: second price or first price? Is it priced per impression or per click?
  • Which actions count, and over what attribution window?
  • How much conversion data do typical campaigns have, and how many are new?
  • Does the platform guarantee the target CPA or only aim for it?
  • What matters more for the business: advertiser CPA, platform revenue, or user experience?

What a strong answer covers

  • The bid: expected value of the impression, roughly target CPA × P(click) × P(action | click), adjusted by a pacing multiplier, and why calibration of both models matters more than ranking quality here.
  • The models: click and conversion prediction, the features, how to handle sparse campaigns (sharing across advertisers or apps, priors), and selection bias since conversions are only seen after clicks.
  • Delayed conversions: delay modeling or waiting windows so recent clicks aren't counted as non-converting; how attribution changes the labels.
  • Pacing and control: a feedback loop that adjusts the bid so realized CPA and spend track the targets, without oscillating.
  • Fraud and click-spam filtering before training and billing.
  • Evaluation: offline log loss and calibration, then online A/B tests with budget-split or campaign-level randomization, measuring CPA, delivery, platform revenue and advertiser retention.

Follow-ups

  • A campaign is far below its target CPA but cannot spend its budget. What do you change?
  • Privacy rules remove user-level conversion data. How do the models and the attribution adapt?
  • Advertisers optimize for value (revenue) instead of count of actions. How does the bid change?

Where it's asked

  • Apple · Technical phone screen · Last asked Mar 2026

What it tests

ads · bidding · conversion prediction

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing