Marketing attribution spent years fixated on user-level tracking. Privacy restrictions have tightened since, and now everyone is sprinting back to Open Source MMM (Marketing Mix Modeling). The catch is what the market is selling: mostly agencies and vendors pitching a “black box” where you pour money in, get “magic” insights out, and never once see the math.
Why open source MMM beats proprietary black boxes
I have seen this movie before. A client pays six figures for a proprietary analytics platform, then finds out three months later that nobody can export the raw coefficients or explain to the board why the model wants the search budget cut. That is vendor lock-in doing exactly what it was built to do.
An Open Source MMM framework such as Google’s Meridian moves that leverage back to your side. The code is yours, and so are the Bayesian priors underneath it and the layer people interact with. Pair Meridian with a local large language model like Mistral 7B and the statistical output gets translated into plain business logic without your data ever leaving for a third-party API.
I made a related point in my post on Decision Intelligence Systems. Dashboards fail when they hand over data with no context, and an LLM layer is what closes that gap.
The architectural stack: Meridian + Mistral 7B
The workflow is short, though it does not tolerate sloppiness. Google Meridian does the heavy Bayesian inference and hands back ROI, channel coefficients, and response curves. That structured output then goes into an LLM, which turns it into recommendations somebody can act on.
Step 1: setting up the Meridian model
In the Meridian engine you define your “priors,” meaning what you already know about how each channel behaves. This is where most junior devs stop and leave the defaults sitting there. If you know TV carries a long lag effect, bake that in.
# Initializing the Meridian class with customized model specifications
from meridian.model import spec
from meridian.model import prior_distribution
roi_mu = 0.2
roi_sigma = 0.9
# Setting modeling priors for each channel
prior = prior_distribution.PriorDistribution(
roi_m=tfp.distributions.LogNormal(roi_mu, roi_sigma, name="ROI_M")
)
model_spec = spec.ModelSpec(prior=prior, enable_aks=True)
mmm = model.Meridian(input_data=data, model_spec=model_spec)
# Running the posterior sampling
mmm.sample_posterior(n_chains=10, n_keep=1000)
Step 2: the GenAI insights layer
The model output should not reach the marketing manager as a raw CSV. Pipe it into a local instance of Mistral 7B instead, which keeps sensitive spend data on your own infrastructure.
from llama_cpp import Llama
# Initialize the local LLM
llm = Llama(model_path="./mistral-7b-instruct-v0.2.Q4_K_M.gguf")
prompt = f"""
You are a marketing mix modeling expert.
Summarize the ROI of these channels:
{genai_input_json}
Identify channels with diminishing returns and suggest budget reallocations.
"""
response = llm(prompt, max_tokens=300)
print(response["choices"][0]["text"])
The gotcha: data quality is still king
The “Gen AI” wrapper is the least interesting part of this. Feed it garbage and your Open Source MMM will tell you, with total confidence, to put the entire budget into fax machine ads. What it needs is clean, aggregated time series data. Broken tracking at the source is not something Bayesian math or a clever Mistral prompt can rescue.
Fourteen years of fixing “broken” systems, and most of them turned out to be perfectly good engines being fed bad data. Fix the pipeline first, then build the model.
If Open Source MMM work is eating your dev hours, I can take it off your plate. I have been wrestling with WordPress, WooCommerce, and custom data integrations since the 4.x days.
Takeaway
Saving money on vendor fees is the smaller win here. Being able to see the math is the bigger one. Build an Open Source MMM stack on tools like Google Meridian and you can defend a budget with statistics instead of agency slides. Refactor the analytics stack before you spend another dime on a black box.