22 Basic Pacing
A campaign has a budget and a goal, and it wants both met: spend the daily budget, spread across the day, at or better than the target CPI or ROAS. Those two pull against each other. Bidding higher spends more and wins more installs, but at a higher cost per install. Bidding lower meets the target easily and leaves budget unspent. Pacing is the system that sets this balance, continuously, for every campaign.
The crawl DSP paced with throttling: it bid on a fraction of each campaign’s eligible requests, adjusted every few minutes to follow a spend curve. That spreads spend, but it can’t trade price against volume, and it drops requests at random rather than dropping the least valuable ones. And in many legacy DSPs, the real pacing system is manual: account managers raise overbids when a campaign underspends, as we saw in Chapter 4.
In this chapter, we will replace throttling and manual levers with a controller on the pacing multiplier \(\gamma\). We cover why pacing matters, why we pace by modifying bids rather than dropping requests, and how a PI controller with a forecast from the win model sets \(\gamma\). We then pace under CPI and ROAS goals, replace manual overbids, handle new campaigns and weekly budgets, and monitor pacing.
Why Pacing Matters
Without pacing, campaigns fail in three ways:
- Underspend. The campaign bids too low to win enough impressions, and ends the day with budget left. The advertiser wanted that spend, and moves it to another channel.
- Overspend. The campaign wins too much, too fast, and hits its daily cap. Budgets are caps, so it doesn’t overspend in total, but everything after the cap is lost reach.
- Spending too early. Even a campaign that spends exactly its budget can spend it badly: all of it in the first hours of the day, on whatever traffic arrives then, in whichever time zones are awake.
Pacing problems are also model problems. A campaign that spends its whole budget at 3:00 in the morning trains the models on one slice of traffic, and an advertiser who sees erratic delivery adds manual levers that make the data worse.
Throttling vs. Bid Modification
There are two ways to slow a campaign down. Throttling skips a share of eligible requests. Bid modification scales the campaign’s value by a multiplier \(\gamma\) before shading, so it bids lower everywhere.
Bid modification is better, for a reason that comes straight from the auction. When \(\gamma\) falls, the campaign bids less on every request, and it loses first where its bids were marginal: the impressions where competition was close to its value, which are the ones with the least surplus. It keeps winning where it had a large margin. Throttling, in contrast, drops requests at random, so it gives up valuable and marginal impressions in equal measure. For the same spend, a campaign paced by bid modification gets more value.
Bid modification also works upward. When a campaign is behind, \(\gamma\) above 1 raises its bids, so it wins more of the impressions it was narrowly losing. Throttling can only stop skipping requests, and once it bids on all of them, it has nothing left.
The cost is that bid modification needs the win model. Without it, a change in \(\gamma\) has an unknown effect on spend, which is why crawl throttled. Throttling stays as a backstop: when a campaign is far ahead even at the lowest \(\gamma\) allowed, it skips requests.
PI Controllers and Feedforward from a Replay Forecast
The pacing controller is a second fast-adapting layer, alongside the calibration multiplier from Chapter 21. The models retrain on a schedule, and the controller reacts within minutes.
Every few minutes, the controller compares the campaign’s actual spend with its plan, and adjusts \(\gamma\). A proportional-integral (PI) controller does this with two terms: one proportional to the current error, and one to the error accumulated over time. Because spend responds to \(\gamma\) multiplicatively, the controller works in log space:
\[e_t = \ln\frac{\text{planned spend}_t}{\text{actual spend}_t}, \qquad \ln \gamma_{t+1} = \ln \gamma_0 + K_p\, e_t + K_i \sum_{\tau \le t} e_\tau\]
where \(e_t\) is the error over the last interval, \(\gamma_0\) is the starting value, and \(K_p\) and \(K_i\) are the gains. Spend is measured over a short window, such as the last 15 minutes, against the plan for the same window. The plan is shaped like the campaign’s eligible traffic over the day, as with throttling.
Two things make the controller stable:
- The gain from spend elasticity. As we’ll see in the next section, the win model predicts how much spend changes when \(\gamma\) changes. With that elasticity \(\varepsilon\), a proportional gain of about \(1/\varepsilon\) corrects most of an error in one step without overshooting. The integral gain is much smaller, and removes persistent offsets.
- A feedforward starting point. Rather than starting each day at \(\gamma_0 = 1\) and waiting for the controller to find its way, start from a forecast: replay a recent day of the campaign’s eligible requests through the pricing path at different values of \(\gamma\), and pick the one whose forecast spend matches the budget. The controller then only has to correct the forecast’s error.
Bound \(\gamma\), for example between 0.3 and 2, and bound how much it can change per step. A controller that pushes \(\gamma\) to 10 to make up for a broken campaign is a runaway bid with extra steps.
The reference DSP’s controller runs every simulated quarter hour, with \(K_p = 0.5\) and \(K_i = 0.05\), \(\gamma\) bounded to 0.3–2, and at most 0.2 of change in \(\ln \gamma\) per step. The error uses spend so far today against plan so far, with a small slack added to both, 2% of the budget, so the first impressions of a day don’t swing \(\gamma\). This is the step, lightly trimmed:
planned := v.DailyBudget * plan // the share of the day's plan due by now
d := paceSlack * v.DailyBudget
e := math.Log((planned + d) / (v.SpendToday + d))
s.Integral += e
target := math.Log(s.Gamma0) + PaceKp*e + PaceKi*s.Integral
cur := math.Log(s.Gamma)
step := math.Max(-PaceMaxStep, math.Min(PaceMaxStep, target-cur))
s.Gamma = math.Max(PaceMin, math.Min(PaceMax, math.Exp(cur+step)))Its forecast replays the newest day’s priced bids at a range of multipliers, with the win rates observed at each bid level, and starts each campaign at the multiplier whose spend matches its budget. Figure 22.1 shows a day of it.
Three patterns showed up in the table. Campaigns pinned at 2 couldn’t spend their budgets at any multiplier the controller allows; in our run, those were the ROAS campaigns, whose value per install is tiny in this market, and a few campaigns with narrow targeting. They need a person, not a higher bound. Campaigns near 0.3 would overspend even at the lowest multiplier. Campaign 1 tracked its plan until mid-afternoon, then pulled ahead and spent its budget by 19:30, with \(\gamma\) already near its floor. Its plan was shaped like all of our traffic, not the traffic it’s eligible for; a plan from each campaign’s own eligible requests is the fix, and a reader exercise. And where the forecast started a campaign far from where the controller ended its day, the forecast’s win curve was off.
Pacing with the Win Model
The win model is also the core of spend forecasting. If we know the win rate at the bid we would place for each request, and how many requests a campaign will see, we can predict wins, spend, and conversions for any pacing multiplier before bidding. For a campaign that expects \(R\) eligible requests over a period, and a pacing multiplier \(\gamma\) that scales its values up or down:
\[\hat{N}_{wins}(\gamma) = R\;\mathbb{E}_x\big[W(b^*_\gamma \mid x)\big]\]
\[\hat{S}(\gamma) = R\;\mathbb{E}_x\big[b^*_\gamma\,W(b^*_\gamma \mid x)\,p_{clear}(x)\big]\]
\[\hat{N}_{installs}(\gamma) = R\;\mathbb{E}_x\big[W(b^*_\gamma \mid x)\,p_{clear}(x)\,p_{install}(x)\big]\]
where \(b^*_\gamma\) is the shaded bid when the value is scaled by \(\gamma\), and the expectations are averages over a recent sample of requests. These are the forecasts that the pacing controllers in this chapter solve against the remaining budget. Figure 22.2 shows them for one campaign.
Two details connect the models. First, the spend elasticity, \(\varepsilon = \partial \ln \hat{S} / \partial \ln \gamma\), comes straight from the win model, and sets a stable gain for the pacing controller, \(K_p \approx 1/\varepsilon\). For the campaign in the figure, \(\varepsilon\) is about 1.2 at \(\gamma = 1\). For the single request in the shading example, it’s about 2. The campaign’s elasticity is lower, because many of its requests sit on flat parts of their win rate curves, where small changes in the bid barely change the win rate. Second, a target win rate can serve as a pacing heuristic of its own, raising bids until the forecast win rate meets a goal, but it ignores value. Pacing on the forecast spend from value-based shading spends the same budget on better impressions.
One caution applies when reading pacing results. When \(\gamma\) rises, the campaign wins more on segments that were previously out of reach, which are often cheaper and lower in value. Overall cost per install can then get worse even while it improves within every segment, because the mix of segments changed. This is an example of Simpson’s paradox, and it’s why pacing changes should be evaluated within segments as well as overall.
Pacing Under CPI and ROAS Constraints
Spending the budget isn’t enough. The campaign also has a goal. Raising \(\gamma\) to spend more raises bids above the advertiser value, which spends more per install, so at some point spending the budget means missing the target.
The walk DSP treats the goal as a constraint. Two multipliers are computed for each campaign: \(\gamma_{\text{budget}}\), from the spend controller, and \(\gamma_{\text{goal}}\), from a second controller that compares the campaign’s realized CPI or ROAS with its target. The campaign bids with the smaller of the two:
\[\gamma = \min(\gamma_{\text{budget}}, \gamma_{\text{goal}})\]
When the campaign can spend its budget within its goal, the budget controller sets \(\gamma\). When it can’t, the goal controller holds it back, and the campaign underspends rather than missing its target. Which one should win is the advertiser’s choice, and Chapter 33 adds campaigns that prefer budget priority.
The goal controller has a problem the spend controller doesn’t: its input is delayed. Spend is known within minutes, but installs take hours to days, and revenue longer. So the two controllers run on different loops. The spend controller is the fast loop, every few minutes. The goal controller is a slow loop, updated a few times a day from matured labels, using predicted outcomes for recent impressions and correcting as real ones arrive.
Replacing Manual Overbids
In Chapter 4, we saw how manual overbids accumulate: an account manager raises a campaign’s bids to hit a spend target, the campaign starts depending on them, and removing one drops spend. Over time, a DSP can end up with so many manual levers that nobody knows what the system would do without them, and the data the models train on is shaped by them.
A pacing controller is the bounded, automated replacement for most overbids, because it does what overbids were used for: raising bids when a campaign needs to spend more. Migrating from one to the other takes a few steps:
- Log overbids, as a separate term in the bid ledger, so their effect is visible and the win model can exclude or account for them, as in Chapter 20.
- Cap them, so no new overbid can exceed a limit, and existing ones are brought down to it.
- Move spend control into \(\gamma\). Turn on the controller for the campaign with its overbid still in place, then lower the overbid in steps while the controller makes up the difference.
- Retire them. When the overbid reaches 1, remove it, and leave the campaign to the controller.
Some manual control remains legitimate, such as a deliberate push for a launch week. That belongs in the campaign’s budget and goal, where the controller can act on it, not in a multiplier that bypasses the pricing.
The reference DSP takes a manual overbid per campaign, logged apart from \(\gamma\). We gave campaign 9 an overbid of 2 and played a day. The controller fought it: \(\gamma\) fell to its floor of 0.3 within hours, and the campaign ran ahead of plan all day anyway, because the overbid had used up the controller’s room. Then we lowered it in steps, a day each. At 1.5, \(\gamma\) stayed pinned at 0.3. At 1, it rose to about 0.5, and the campaign tracked its plan through the day, in Figure 22.3, with the controller in charge again. An overbid doesn’t add to the controller; it takes away its range.
New Campaigns and Weekly Budgets
New campaigns have no spend history and uncertain predictions. Start them from a feedforward forecast built from similar campaigns’ traffic, with a conservative \(\gamma\), and let the controller ramp up over the first days rather than chasing the full budget on day one. A ramp also limits the cost of a misconfigured campaign before anyone notices.
Weekly budgets give the controller flexibility. A campaign with a weekly budget can spend more on days with better traffic and less on worse ones, as long as the week adds up. A simple approach plans each day’s budget from the remaining weekly budget and the forecast value of each remaining day, and replans daily.
Monitoring Pacing
Pacing gets its own dashboard panels and alerts:
- Spend against plan, for each campaign, through the day.
- \(\gamma\) over time, with its bounds. A campaign pinned at the upper bound for hours can’t spend its budget at any allowed price, and needs a person to look at its targeting, goal, or creatives.
- Which controller is binding: budget or goal. A campaign whose goal controller binds all day is underspending to protect its target.
- Controller saturation and oscillation: \(\gamma\) swinging between bounds means the gain is too high.
First-Time Pitfalls
- Controller windup at the start of the day. The integral term accumulates error while a campaign can’t spend, such as overnight in its geo, and then overshoots when traffic arrives. Bound the integral, reset or decay it daily, and ramp \(\gamma\) at the start of the day. The reference DSP’s controller holds still until 1% of the day’s plan has passed, so a campaign that started the day at a forecast of 2 bid at twice its value through the quiet first hour; it now starts each day at no more than 1, and the step limit raises \(\gamma\) toward its starting value over the first hour of control.
- A spend spike when the day resets. Every campaign starts the day with a full budget and a fresh controller. Stagger resets, or carry \(\gamma\) over from the previous day’s end. The reference DSP’s throttling, in Part II, first reset every campaign’s rate to 100% at midnight, with the same result.
- Budget edits mid-day. When an advertiser changes a budget during the day, decide whether the plan resets or continues from the spend so far, and test both cases.
Pace a campaign through a simulated day with the PI controller, starting from the replay forecast, and plot spend against plan and \(\gamma\) over the day. Then give a second campaign a manual overbid, migrate it to the controller in steps, and compare its spend and CPI before and after.
Status: runs with the companion code (dsp 0.14, adtrain 0.8, adsim 0.3). The Pricing tab’s pacing card forecasts each campaign’s starting multiplier, switches on the PI controller, charts spend against plan and \(\gamma\), and takes manual overbids. Commands and screenshots are in WALKTHROUGH.md, under this chapter.
Conclusion
In this chapter, we replaced throttling and manual levers with a controller on the pacing multiplier \(\gamma\). Bid modification gives up the least valuable impressions first, so it beats throttling for the same spend. A PI controller in log space, with a gain from the win model’s spend elasticity and a feedforward start from a replay forecast, keeps spend on plan. A slower goal controller holds bids back when spending the budget would miss the target, overbids migrate into the controller in steps, and new campaigns and weekly budgets get their own handling, with pacing monitored like any model.
But attributed results include installs that would have happened anyway. Next, we measure how many installs the DSP actually causes.