Marketing Mix Model Validation: A Knowledge Graph, Three Checks and an Open Leaderboard

Papilon 0.5 and PyCausalSim 0.5 let a marketing team write down its assumptions, grade a marketing mix model on brands with known returns, and rank which lift test to run first.

Marketing mix model validation in Papilon 0.5: a butterfly and a Lorenz attractor beside a small knowledge graph with one flagged driver and a response curve whose range misses one true value

Why marketing mix model validation is hard

A marketing mix model reads a few years of weekly spend and sales and reports what each channel returned. Validating it is hard for one reason: nobody knows the true return on your search budget, so there is nothing to compare the answer to. A model that fits history well can still credit the wrong channels, and the budget plan built on it can lose money.

I created two open-source libraries to work on that problem, and built both right here in Kansas City. Papilon is a Bayesian marketing mix model. PyCausalSim is a causal simulator that builds brands with known returns for the model to be graded on. Version 0.5 of both went out on November 11, 2026, free under the Apache License 2.0.

This release adds four things a team can use to validate a marketing mix model before moving money: a knowledge graph of the brand's assumptions, three checks the model runs on itself, a way to rank lift tests by what they are worth, and an open leaderboard that scores any model on the same simulated brands. You get the two scores that matter, runnable Python for each piece, the first leaderboard results including where Papilon falls short, and the limits of all of it. The single-brand model can be explored in the live Papilon demo, and the method behind the defaults is in Marketing Mix Modeling You Can Check.

Two scores that define a valid model

A marketing mix model makes two kinds of claims, and each needs its own score.

The first is the estimate: a return on ad spend for each channel with a 90% range. On brands where the truth is known, the score is coverage, the share of ranges that contain the true return:

coverage = 1 / (N K) Σ_i=1^N Σ_c=1^K 1[ ell_i,c ≤ r_i,c ≤ u_i,c ]

N is the number of brands, K the number of channels, r the true return, and ℓ and u the ends of the model's range. A calibrated model scores about 90%. On the standard track below, Papilon's ranges held the truth for 61 of 64 brand and channel pairs, which is 95%.

The second claim is the plan: where to move the budget. The score is the true gain of the recommended plans as a share of the best gain that was available:

capture = (Σ_i [ S_i(x_i^plan) − S_i(x_i^now) ]) / (Σ_i [ S_i(x_i^best) − S_i(x_i^now) ])

S is a brand's true weekly sales from media at a given spend mix. Capture is 100% for a perfect planner, 0% for one that never moves, and negative for one that destroys value. Alongside it sits the share of brands where the plan did worse than leaving the budget alone.

A model can pass the first score and fail the second. That was the main finding of the earlier benchmark, and it is why both are reported everywhere below.

Write down what you believe: the knowledge graph

Every marketing mix model depends on facts the data cannot supply: which channels feed which, what else moves sales, and which of those drivers can be measured. In most projects these assumptions live in one analyst's head. Papilon 0.5 adds MarketingGraph, a small ontology for writing them down. It has five kinds of node (outcome, channel, driver, group, experiment) and five relations (drives, sets spend, mediates, belongs to, measured by).

import papilon as pp

df, truth = pp.make_synthetic_mmm()          # 156 weeks, four channels, known answer

g = pp.MarketingGraph("sales")
g.channel("paid_search", stage="lower").channel("paid_social", stage="mid")
g.channel("online_video", stage="upper").channel("display", stage="mid")
g.driver("seasonality", ["paid_search", "sales"], modeled=True)   # search spend follows demand
g.driver("price", ["sales"], column="price_index").driver("promo", ["sales"], column="promo")
g.event("launch", ["paid_search", "paid_social", "sales"])        # no column: we have no launch data
g.mediates("online_video", "paid_search")                         # video lifts branded search

print(g.audit(df)[["severity", "issue", "subject"]])

The audit returns three findings. Two are high severity: launches raise paid search and paid social spend together with sales and have no data, so the return on those two channels cannot be learned from this dataset. The third is medium: part of video's effect arrives through search, so the model will credit that part to search. The audit's advice for the first two is specific: run a lift test and attach it with g.experiment(...), or add a launch column.

The same graph builds the model. Media, controls and lift-test priors come from it, and upper-funnel channels become candidates for delayed carryover:

model = g.build_model(df, date_col="date", seed=11)
print(model.compare_carryover(g.carryover_candidates()))
print(model.get_roi().round(2))

On the sample brand the data prefers delayed carryover for video by a log Bayes factor of 20.9 (263.6 against 242.6), and the returns come out at 1.77 for online video, 0.98 for paid social, 0.65 for paid search and 0.64 for display. A graph does not make assumptions true. It makes them visible to the model and to whoever reviews it, which is where validation starts.

Three checks before you move money

print(model.backtest(13).attrs["summary"])
print(model.self_check(12).attrs["summary"])
print(model.self_check(12, confounded={"paid_search": 0.5}).attrs["summary"])

The backtest refits without the last 13 weeks and forecasts them using the spend that ran. On the sample brand the forecast error was 2.7% against 7.5% for a naive forecast (the same week a year earlier), and all 13 weeks fell inside the 90% range. That rules out a broken baseline and nothing more, because two channels that move together can swap credit without changing the forecast.

The self-check goes further. Papilon builds 12 simulated copies of the brand, each with the real spend and calendar and with channel returns drawn from the fitted model, refits to each, and grades itself against the answer key. Here 45 of 48 ranges held the truth (94%), no plan lost money, and the plans captured 50% of the best gain. This answers a narrow question well: with this data, could this model recover returns like the ones it reports?

The third line shows what the self-check cannot see unless told. It adds demand that moves with paid search spend and is not caused by it, at half a standard deviation of sales per standard deviation of spend. Paid search is then overcredited by 6.97 in return on average and its range holds the truth in none of the 12 copies, while the other three channels stay close. An unmeasured driver of that size turns one of the weakest channels into the apparent best, and nothing in the fit statistics warns you.

Which lift test is worth running first

A lift test is the remedy for a driver the data cannot see, and tests cost money and time. value_of_lift_test() ranks them. For each channel it simulates plausible test results, updates the model on each one, re-plans, and scores the new plan against the world that produced the result. Updating needs no refit: each posterior draw k is reweighted by how well it agrees with the measured return m, given the test's standard error s:

w_k ∝ exp(− ((r_k − m)²) / (2 s²))

The expected gain of the new plan over today's plan, averaged over simulated results, is the value of running that test.

print(model.value_of_lift_test(sd=0.25).round(2))

On the sample brand this takes about four seconds. Paid search ranks first: its range runs from 0.03 to 1.66, and a test is worth 1.13 in weekly sales to the plan. Online video ranks last, at 0.05, because its range is already narrow (1.51 to 2.05) and no result would change the plan. The figures assume the model's form is right, so read them as a ranking.

An open leaderboard for any model

PyCausalSim 0.5 can score any marketing mix model, from any library, on the same simulated brands. An entry is a function that takes the data a modeler would see and returns a return with a range per channel and a budget plan:

from pycausalsim.futures import marketing_worlds, leaderboard, papilon_estimator, ols_estimator

worlds = marketing_worlds(60, seed=7)        # 60 brands, each with an answer key
families = {"all_geometric": [], "video_delayed": ["online_video"]}
board = leaderboard({"papilon": papilon_estimator(carryover=families), "least squares": ols_estimator()},
                    worlds, ids=range(16))
print(board.round(2))

The first results use 16 brands on each of three tracks. Standard brands have search spend that follows demand. Hard brands add product launches the model is not told about, plus creative wear-out. S-curve brands have response curves that start slowly, the form a concave model gets wrong.

TrackEntry90% range holds the truthBest gain capturedPlans that lost money
StandardPapilon defaults95%51%0%
StandardLeast-squares baseline45%-24%50%
HardPapilon defaults67%27%31%
HardLeast-squares baseline42%-24%44%
S-curvePapilon, curve shape chosen81%38%0%
S-curvePapilon defaults55%39%0%
S-curveLeast-squares baseline64%4%50%

Three things stand out. On standard brands Papilon is calibrated and its plans are safe, while a regression on adstocked spend loses money for half the brands. On S-curve brands, letting the data choose between a concave and an S-shaped curve (new in 0.5, compare_models()) lifts coverage from 55% to 81% and cuts the error in return from 0.80 to 0.52, though the plans capture about the same share either way. And on hard brands Papilon falls short: its ranges hold the truth 67% of the time and its plans lose money for 31% of brands.

I publish the hard-track number because a leaderboard that only flatters its author is not worth reading. It is also the practical argument for the two sections above: declare the launch in the graph, and run the lift test the ranking points to. The rules for entering a model are in the Papilon repository, and entries from other libraries are welcome.

Who this helps

A consumer brand with seasonal demand and product launches is the hard track in real life. Launches lift spend and sales together, and the graph audit and the confounded self-check show how far that can push a search estimate before any money moves.

A bank or insurer with a few channels and a long path from first contact to an opened account gets the most from the carryover comparison and the self-check, since slow channels and small samples are where ranges go wrong.

An agency or an in-house analytics team that compares models, its own or a vendor's, can enter each one on the leaderboard and read coverage and plan capture side by side, with the knowledge graph as a written brief of what the client believes.

Assistants that cannot invent numbers

Papilon 0.5 can hand a fitted model to an AI assistant as eight tools with JSON schemas, directly or over the Model Context Protocol.

from papilon.ai import ToolBox, SYSTEM_PROMPT

box = ToolBox(model, graph=g)
tools = box.specs("tool_use")                          # pass as the tool list of a chat model API
print(box.call("what_moves", {"node": "online_video"})["result"]["downstream"])

The model supplies every number and every warning. The warnings come from fixed rules (a fit that failed its gate, a range wider than the estimate, a plan outside past spend, a high-severity audit finding), so the same model always produces the same cautions. The assistant writes the sentences. Everything runs on the analyst's machine, and Papilon calls no language model itself.

Where it breaks

Simulated brands are kinder than real ones. The generator has four channels, tidy seasonality and noise that behaves, and a model that scores well there has met a necessary condition, not a sufficient one.

The self-check holds the model's form fixed. It finds weak data and overconfident priors. It cannot find a driver nobody thought to declare.

The knowledge graph is only as good as the person who writes it. A wrong edge yields a confidently wrong model, and the data can test only some edges.

Sixteen brands per track is a small sample. A coverage of 95% on 64 ranges is consistent with a calibrated 90%, and the plan scores move by several points from one set of brands to the next.

Papilon is also a small model. It does not fit geo-level hierarchies, time-varying effects, or reach and frequency.

The path forward

Write the graph first. An hour spent declaring channels, drivers and what you cannot measure will show which estimates deserve suspicion before any model is fitted.

Run the three checks on every refresh, and keep the confounded self-check for the channel whose spend follows demand most closely. For most brands that is paid search.

Run the lift test at the top of the ranking, add the result to the graph, and refit. One good test on the right channel does more than another year of weekly data.

Score whatever model you use on brands with known returns, and ask for both numbers: how often the ranges hold the truth, and how often the plans lose money.

The code, guides and leaderboard are on GitHub, and the Papilon demo shows the single-brand model in a browser.

Sources

Related research