Marketing Budget Optimization from a Mix Model: Marginal ROAS, Response Curves and Plans That Hold Up

Marketing budget optimization on a brand with a known answer: the textbook plan promised $13,000 a week and delivered $860. Three guards fix it.

Marketing budget optimization on a simulated brand with a known answer: four budget plans from the same marketing mix model, each with the weekly gain it promised and the gain it delivered against the true response curves. The textbook plan promised $13,000 and delivered $860; the guarded, averaged plan promised $10,900 and delivered $4,300, against a best possible $5,570

Marketing budget optimization starts where the model ends

Most 2027 marketing budgets are being set right now, and Gartner's 2026 CMO Spend Survey puts them at 7.8% of company revenue, up from 7.7% a year earlier. With the total flat, the money that moves is the money reallocated between channels. That is the job of marketing budget optimization: take a marketing mix model's response curves and find the split that buys the most sales for the same total.

The textbook method is simple. Move money toward whichever channel returns the most on its next dollar until every channel's next dollar returns the same. I ran that rule on a simulated brand where the true response curves are known, so every plan can be graded against what it would really have earned. The textbook plan promised $13,000 a week in extra sales. Against the truth it delivered $860, which is 15% of the best gain available.

The model was not badly wrong. Its 90% ranges held every channel's true return. The trouble is what an optimizer does with a model that is slightly wrong, and it shows up in most budget plans built this way. This article shows the math of marginal ROAS, why plans overpromise, the three guards that fixed it across 40 simulated brands, and how to run all of it with Papilon 1.0, the open-source library I released on November 12.

Average ROAS grades the past; marginal ROAS spends the next dollar

A channel's ROAS is the sales it caused divided by what it cost. It answers whether past spend paid off. A budget decision is about the next dollar, and the next dollar earns less than the average, because every channel saturates.

A common way to model saturation is the Hill curve. For channel c at a steady weekly spend x, the weekly sales it adds are:

S_c(x) = β_c x / (x + κ_c)

β is the most the channel could ever add per week, and κ is the spend at which it delivers half of that. Marginal ROAS is the slope of that curve:

m_c(x) = dS_c / dx = (β_c κ_c) / ((x + κ_c)²)

On the sample brand, paid social runs at $49,200 a week with a true average return of 1.54 but a true marginal return of 0.81. Every dollar added there today returns 81 cents in sales. A channel can be profitable on average and unprofitable at the margin, and only the margin matters when you move money.

The textbook plan: equalize marginal ROAS

With a fixed weekly budget B, the plan that maximizes total sales sets every funded channel's marginal ROAS to the same value λ:

begingathered max_x Σ_c S_c(x_c) subject to Σ_c x_c = B Longrightarrow m_c(x_c) = λ for every c with x_c > 0 endgathered

If one channel's next dollar returned more than another's, moving a dollar between them would raise sales, so the best plan leaves no such gap. λ is what one more dollar of total budget would return. When λ is below the margin your business needs on a dollar of sales, the budget itself is too large; that question comes before the split.

On the sample brand's true curves, the best split of $149,200 a week puts every channel at a marginal return of 0.83, and it adds $5,570 a week over the current mix. That is the target every plan below is graded against.

What the textbook plan did on a brand with a known answer

The brand is the one bundled with Papilon: 156 weeks of sales and spend on paid search, paid social, online video and display, in $ thousands, generated from known curves. Search spend follows seasonal demand, which makes search hard to separate from the season, the most common trap in real data.

import numpy as np
import papilon as pp
from scipy import optimize

df, truth = pp.make_synthetic_mmm()            # 156 weeks, $ thousands, known answer
media = ["paid_search", "paid_social", "online_video", "display"]

model = pp.MMM(df, target="sales", media=media, date_col="date",
               controls=["price_index", "promo"], seed=11)
model.compare_carryover({"all_geometric": [], "video_delayed": ["online_video"]})

now = df[media].mean()                          # today's weekly spend per channel
total = now.sum()                               # $149.2K a week
for c in media:                                 # marginal ROAS: slope of the curve at today's spend
    rc = model.response_curve(c, np.array([now[c], now[c] + 1.0]))
    print(c, round(rc.contribution_mean.diff().iloc[1], 2))

plans = {
    "textbook":          model.optimize_budget(total, objective="mean", max_change=None),
    "expected, capped":  model.optimize_budget(total, objective="mean"),
    "guarded":           model.optimize_budget(total),             # 1.0 default
    "guarded, averaged": model.optimize_budget(total, bagging=10),
}

# grade each plan against the true response curves the data came from
T = truth["channels"]
beta = np.array([T[c]["beta"] for c in media])
kappa = np.array([T[c]["half_sat"] for c in media])
true_sales = lambda x: float(np.sum(beta * x / (x + kappa)))
x_now = now.to_numpy()
best = optimize.minimize(lambda x: -true_sales(x), x_now, method="SLSQP", bounds=[(0, None)] * 4,
                         constraints=[{"type": "eq", "fun": lambda x: x.sum() - total}]).x
best_gain = true_sales(best) - true_sales(x_now)

for name, plan in plans.items():
    x = plan.optimal_spend.to_numpy()
    gain = true_sales(x) - true_sales(x_now)
    print(name, x.round(1), round(plan.attrs["summary"]["expected_lift"], 2), round(gain, 2), f"{gain / best_gain:.0%}")

The model's marginal returns at today's spend come out at 0.31 for paid search, 0.48 for paid social, 1.09 for online video and 0.33 for display. The true values are 0.73, 0.81, 1.12 and 0.48. Video is nearly right. Search is the furthest off, because the model gives the season some of the credit that belongs to search.

Plan (weekly spend, $K)SearchSocialVideoDisplayPromised gainDelivered gainShare of best
Current mix30.349.247.222.4
Best possible (true curves)26.048.166.48.6$5,570100%
Textbook13.939.884.810.7$13,020$86015%
Expected, capped at ±50%17.447.470.913.5$11,490$3,99072%
Guarded (Papilon default)20.940.769.018.6$10,360$3,17057%
Guarded, averaged22.241.770.314.9$10,940$4,30077%

The textbook plan read the model's low marginal return on search as a fact and cut search by more than half, to $13,900 a week. At that level search's true marginal return is 1.24, the highest of any channel. It also pushed video to $84,800 a week, past the point where video's true marginal return falls to 0.64. It moved the most money exactly where the model was most wrong.

Every plan flagged video's new level as more than the brand had ever sustained. That flag is a warning about the data, not the plan: the model's video curve past $70,000 a week is an extrapolation.

Why every plan overpromises

The gap between promised and delivered is not a bug in one model. Smith and Winkler named it the optimizer's curse in 2006: when you choose the option with the highest estimated value, you also tend to choose the one whose estimate erred upward, so the chosen option disappoints on average even when every estimate is unbiased. A budget optimizer chooses continuously across channels, and it leans hardest on the channels the model overrated. Jin and colleagues at Google made the same point about mix models in 2017: the optimal media mix inherits a large variance from the uncertainty in the parameters.

One brand can be lucky or unlucky, so I repeated the test on 40 brands. Each has the same true curves with a new spend history and new noise, and each was fit and planned the same way.

Planning rule, 40 brandsPromised, $K a weekDelivered, $K a weekShare of best gainBrands where the plan lost moneyWorst brand, $K a week
Textbook7.293.1049%6−2.79
Expected, capped at ±50%6.843.4955%4−1.72
Guarded (Papilon default)5.173.4855%01.03
Guarded, averaged5.123.5255%01.21

The best possible gain averaged $6,380 a week. The textbook plan promised 2.35 times what it delivered and lost money for 6 brands in 40. The guarded rules promised about 1.5 times what they delivered, which is still optimistic, and none of their 80 plans lost money.

import pandas as pd

rules = {"textbook": dict(objective="mean", max_change=None), "expected, capped": dict(objective="mean"),
         "guarded": {}, "guarded, averaged": dict(bagging=10)}
rows = []
for seed in range(1, 41):                      # 40 brands: same true curves, new spend history and noise
    df, truth = pp.make_synthetic_mmm(seed=seed)
    T = truth["channels"]
    beta = np.array([T[c]["beta"] for c in media])
    kappa = np.array([T[c]["half_sat"] for c in media])
    true_sales = lambda x: float(np.sum(beta * x / (x + kappa)))
    x_now = df[media].mean().to_numpy()
    total = x_now.sum()
    best = optimize.minimize(lambda x: -true_sales(x), x_now, method="SLSQP", bounds=[(0, None)] * 4,
                             constraints=[{"type": "eq", "fun": lambda x: x.sum() - total}]).x
    model = pp.MMM(df, target="sales", media=media, date_col="date",
                   controls=["price_index", "promo"], seed=11)
    model.compare_carryover({"all_geometric": [], "video_delayed": ["online_video"]})
    for name, kw in rules.items():
        plan = model.optimize_budget(total, **kw)
        rows.append({"rule": name, "promised": plan.attrs["summary"]["expected_lift"],
                     "delivered": true_sales(plan.optimal_spend.to_numpy()) - true_sales(x_now),
                     "best": true_sales(best) - true_sales(x_now)})

r = pd.DataFrame(rows).groupby("rule", sort=False)
print(pd.DataFrame({"promised": r.promised.mean(), "delivered": r.delivered.mean(),
                    "share_of_best": r.delivered.sum() / r.best.sum(),
                    "lost_money": r.delivered.apply(lambda v: int((v < 0).sum())),
                    "worst": r.delivered.min()}).round(2))

The run takes several minutes on a laptop.

Three guards that make a budget plan safe to fund

Each guard is a change to the optimization problem, not a judgment call made after it.

The first is a cap. No channel moves more than 50% from its current spend. On its own it lifted the share of the best gain from 49% to 55% across the 40 brands, because the largest moves are where the model's errors do the most damage. It still let 4 brands lose money.

The second is a downside objective. Instead of maximizing the expected gain, the plan maximizes a pessimistic one: the 10th percentile of the gain across the model's posterior draws.

begingathered x^star = argmax_x Q_0.10[ Σ_c S_c^(k)(x_c) − Σ_c S_c^(k)(x_c^now) ] subject to Σ_c x_c = B, |x_c − x_c^now| ≤ 0.5 x_c^now endgathered

k runs over the posterior draws, so each draw is one plausible set of true curves. A plan that only pays off when the model happens to be right scores badly on this objective, because in the bottom tenth of draws it loses. That is what removed the losing brands. It does not raise the average: the guarded and capped plans both captured 55%.

The third is averaging. Papilon re-solves the plan on random halves of the posterior and averages the plans, so a move survives only if most halves agree on it. On the sample brand that took the guarded plan from 57% of the best gain to 77%. Across the 40 brands it made almost no difference, 3.52 against 3.48. Averaging matters most when two channels have nearly the same marginal return and the planner would otherwise swing money between them on noise. On the sample brand Papilon names one such pair: paid search and display, with a 0.45 chance that search's next dollar beats display's.

Before any of these plans goes to finance, play it forward. A steady-state curve says where the plan ends up, not how it gets there. Papilon's forecast on the sample brand shows the guarded, averaged plan costing about $3,100 in the first week, while search is cut and video's delayed carryover has not arrived, then adding about $10,900 a week from the eighth week on. Both are model numbers, and the 40-brand table says to expect less.

Papilon 1.0: what is new and how to use it for budget planning

Papilon 1.0.0 went to PyPI on November 12, 2026, under the Apache License 2.0. It is the first release with a stable API under semantic versioning, tested on Linux, Windows and macOS. For budget work, four additions matter. Plans can be played forward week by week with forecast() and compared on the same posterior draws with scenarios(), which reports the probability that one plan beats another. plan_stability(), indistinguishable_channels() and optimize_budget(bagging=n) show which moves the evidence supports. GeoMMM fits regional models with partial pooling across regions. And Loop turns the model into a quarterly cycle: refit on new weeks, score the last forecast, recommend the lift test worth the most to the plan, and add a small budget-neutral pulse between the two channels the model can least tell apart.

plan = model.optimize_budget(total, bagging=10)
board = model.scenarios({"current": model.future_frame(13),
                         "plan": model.future_frame(13, spend=plan.optimal_spend.round(2).to_dict())})
print(board[["outcome_mean", "gain_vs_first", "prob_beats_first"]])

loop = pp.Loop(df.iloc[:143], "sales", media, "date", controls=["price_index", "promo"],
               horizon=13, model_kwargs={"delayed": ["online_video"]})
cycle = loop.cycle()                  # plan, week-by-week schedule, forecast, test candidates
print(cycle["test_candidates"])

On the sample brand the 13-week scenario puts the plan $122,000 ahead of the current mix over the quarter, with a 0.99 probability of beating it. That is the model's own estimate and inherits its optimism. The loop, run on the first 143 weeks, valued a paid search lift test at $49,300 to the plan over a year against $52,200 in sales the holdout would give up, so it declined the test and scheduled a pulse between paid social and display instead. In Papilon's own six-quarter benchmark on eight simulated standard brands, the loop's plans captured 59% of the best gain by the sixth quarter, against 42% for refitting every quarter and 34% for fitting once.

Around the planner, 1.0 adds what a team needs to run it every quarter: validate_frame() to check the data, loaders for SQL, Snowflake and BigQuery, save() and load() without pickles, MLflow logging, monitor() to flag drift when new weeks arrive, and a self-contained HTML report for people who will never run Python. The checks from 0.5 are all still there: the knowledge graph audit, the backtest, the self-check on simulated copies of the brand and the ranking of lift tests, covered in Marketing Mix Model Validation.

Where it breaks

The brands are simulated, and kinder than real ones. They have four channels, Hill curves, tidy seasonality and noise that behaves. A planning rule that works here has passed a necessary test, not a sufficient one.

All 40 brands share the same true curves and differ only in spend history and noise. That isolates the planner, but it understates how much real brands differ.

Every plan here is a steady state. It ignores flighting, minimum buys, contracts already signed and creative that wears out. Papilon 1.0 can model wear-out with time_varying=, but these tests did not use it.

The guarded plans still promised 1.5 times what they delivered. The downside objective protects against losing money; it does not make the model's estimate of the gain honest. Read a plan's promised gain as an upper bound.

The benchmark numbers are mine, from my own library, on my own simulator. The code is above so anyone can rerun and challenge them.

The path forward

Plan on marginal ROAS, not average ROAS. Before any budget meeting, compute each channel's next-dollar return at today's spend and its range.

Cap every move. Half of current spend in either direction is a reasonable start; on these brands the cap did more for the average result than anything else.

Optimize for the bad case. Maximizing the 10th percentile of the gain gave up nothing on average here and removed every losing plan.

Average away the noise, and look at which channel pairs the model cannot rank. Money moved between them is a coin flip.

Play the plan forward a quarter so finance sees the dip before the gain.

Then test the channel the model knows least about. On most brands it is paid search, and Papilon's loop will say whether the test is worth what it costs.

The single-brand model and planner run in the browser in the Papilon demo, and the method behind the guarded plan is in Marketing Mix Modeling You Can Check.

Sources

Related research