MMM Optimizer: Methodology
Problem statement
Let index a media vehicle (the unit the optimizer allocates to), its annual spend, its current annual spend, and the total budget. Each vehicle has a response curve in annual units and a unit value (profit per unit of response).
The optimizer chooses annual spend for every vehicle to maximize total value, subject to the budget, vehicle bounds, and group shares.
Terms: is the vehicle's contribution to the chosen objective; is the total budget; and are the vehicle's lower and upper spend bounds; indexes a group (Traditional / Digital, or a brand); and are the group's minimum and maximum share of the budget.
A scenario changes only the constraints and the total budget. The same solver runs unchanged for every scenario.
Response curves
Every vehicle's response is a saturating function of annual spend, evaluated directly on spend. Carryover (adstock) is already embedded in the curve, so the optimizer does no time shifting.
Weibull-CDF curve (Naukr AI default)
Response rises from zero toward a ceiling; the scale sets where the curve bends and the shape sets how sharply.
Terms: is annual incremental response at spend ; is the response ceiling; is the scale in spend units (response reaches about 63% of the ceiling at ); is the shape.
The spend at which the curve reaches half of its ceiling is
Half-saturation spend follows from the scale and shape.
Terms: is the spend giving 50% of the ceiling; and are the scale and shape; is the natural logarithm of 2.
This is the same curve family as the model's own saturation. With and as in the MMM Models tab, equals the form above with and . The model fits it on normalized exposure; the optimizer needs it on annual spend, which is what the next section builds.

Hill curve (compatible engines)
Curves fitted by other supported engines use the Hill family, and the optimizer accepts both:
Hill saturation on spend.
Terms: is the ceiling; is the half-saturation spend, ; is the shape. A shape above 1 gives an S-curve; a shape of 1 or below is concave from the origin.
Marginal response: the optimization signal
The optimizer climbs the marginal response, the exact analytic derivative of the curve. There is no finite differencing and no sampling.
Marginal response of the next unit of spend, for each family.
Terms: is the change in annual response per extra unit of spend; the other symbols are the curve parameters above. A tiny spend floor keeps the derivative finite at zero spend for shapes below 1.
Average ROI is reported to humans but is never the objective:
Derived business metrics for a vehicle at spend .
Terms: is average return per dollar; is the return of the next dollar; is profit per unit of response; is the saturation ratio, the share of the ceiling already reached.
From the Bayesian model to optimizer curves
The MMM fits response on normalized exposure (a multiple of each media node's typical execution level). The optimizer needs annual spend per vehicle. A bridge rebuilds each vehicle's spend-space curve from the approved model and registers it as a Weibull-CDF curve.

1. Group curves. For each pooling group , take the published posterior-median half-response point and shape , and the group's response share
The model's own response share at normalized exposure .
Terms: is the response share between zero and one; is exposure as a multiple of the node's typical level; is the 50% response point; is the shape.
The published parameters are used directly when they reproduce the published mean curve to within 2% of the ceiling; otherwise they are refitted from the published curve points.
2. Vehicle curve. A vehicle is a set of media nodes and weeks. Scaling the vehicle's spend by a multiplier scales every node's exposure by , so
Vehicle response at spend multiplier , anchored to the reference-year incremental volume.
Terms: is the vehicle's annual response when spend is times the reference level; is its reported incremental volume in the reference year; is the set of node-week cells with positive exposure in that year; is the pooling group of cell ; is the cell's exposure relative to its node's typical level (the median positive exposure over the history).
The curve is evaluated on a grid of 61 multipliers from 0 to 3, at spend where is the vehicle's reference-year spend.
3. Single Weibull in spend space. One Weibull-CDF is fitted to those points, with the ceiling at least the largest response on the grid, the scale between 2% and 50 times the reference spend, and the shape between 0.5 and 6.
4. Unit value. The profit basis comes from the same reference year:
Profit per unit of response.
Terms: is the unit value used by the profit objective; and are the vehicle's incremental profit and incremental volume in the reference year.
Reference year. The latest complete year: the latest year whose total spend is at least 80% of the median year's total spend.
Quality gates. A vehicle is registered only if all of these hold:
| Gate | Threshold |
|---|---|
| Each group's published curve follows the model's own form | Maximum gap at most 2% of the ceiling |
| The vehicle curve is well described by one Weibull | Maximum gap at most 3% of the vehicle's yearly response |
| The registered curve reproduces the reported outcome at current spend | Difference at most 3% |
| Shape stays in a stable range | Between 0.5 and 6 |
| The vehicle had positive incremental volume and profit and execution in the reference year | Required |
A run is optimizable only when every vehicle that spent in the reference year converts cleanly, and only when it is a production run. A smoke (non-production) run publishes curves for display but is never used to move budget.
Assumptions recorded with every conversion: spend and exposure move together; saturation is evaluated on the period's exposure, with carryover not re-simulated; a node's typical level is the median of its positive exposure over the whole history.
Objective functions
The objective is a sum over every vehicle of every brand in the solve.
Per-vehicle contribution for each objective.
Terms: is revenue per unit of response (it defaults to when no price is set); is profit per unit of response; is the vehicle's spend.
The gradient of each contribution is the marginal response scaled the same way (, , or ), so the objective and its gradient always share one basis.
Because the budget constraint fixes , the profit objective equals . For a given budget, the profit and margin-weighted revenue objectives therefore choose the same allocation; the profit objective value is simply reported net of spend.
What an optimum looks like
Attach a multiplier to the budget constraint. At an optimum, the first-order conditions say that every vehicle that is free to move earns the same marginal value, and every vehicle held at a bound is on the correct side of it.
First-order (equal-marginal-return) conditions at the optimum, for the profit objective.
Terms: is the optimal spend; is the common marginal return implied by the budget; and are the bounds. With a binding group-share constraint, the vehicles in that group share a value shifted by that constraint's multiplier. This is a standard consequence of the Lagrangian, not an extra rule in the solver.
This is why the result is explainable: a vehicle sitting at its upper bound with a marginal ROI above the shared value is being held back by a guardrail, and loosening that guardrail would raise the objective.

For S-shaped curves () the problem is not concave, so these conditions identify a local optimum. The solver safeguards below, and the validation gates, exist to catch the failure modes this creates.
Constraints and bounds
Vehicle bounds
For each vehicle, in this order of precedence:
- Locked vehicles are pinned at current spend: .
- Otherwise start from the hard guardrails (default 0) and (default unbounded).
- Narrow by the scenario's change limits.
- If the result is inverted, collapse to the upper bound.
Effective bounds for an unlocked vehicle.
Terms: is current spend; and are the allowed decrease and increase as fractions of current spend; and are hard dollar limits.
Budget and feasibility
The budget is an equality constraint, . Before solving, the optimizer checks that the problem is feasible:
Pre-solve feasibility check.
Terms: is the smallest total the bounds allow; is the largest. If the budget falls outside, the run stops with a plain-language error that says to reduce a pinned vehicle's change, unlock a vehicle, or change the budget.
Group shares
A group (Traditional, Digital, or a brand) is constrained as a share of the budget: . Both limits are enforced natively by the solver.
From a business request to constraints
The same mapping is used for every surface (see the Single Brand and Cross Brand tabs for the group and brand layers).
Total budget
The requested change applies to the movable slice of the budget; locked spend is added back unchanged.
Target total budget for a requested change .
Terms: is the current spend of locked vehicles; is the current spend of unlocked (reallocatable) vehicles; is the requested change as a fraction (positive for an increase, negative for a decrease, zero for no change).
Applying to the full current total instead would demand that the movable slice absorb a disproportionately large change whenever much of the budget is locked.
Default vehicle guardrail
Vehicles without an explicit limit get a hard default of with . The guardrail widens only if the budget itself moves further than , otherwise the target would be unreachable.
Default guardrail, widened only when the budget moves more than the default.
Terms: is the ratio of the target movable budget to the current movable budget; is the default guardrail (15%); and are the effective increase and decrease limits.
Explicit vehicle limits
| Request | Meaning |
|---|---|
| Increase 0, decrease 0 | No explicit limit; the default guardrail applies |
| Only an increase or only a decrease | A directional target: the vehicle is pinned to exactly |
| Both an increase and a decrease | A range: |
The solver
The problem is solved with sequential least squares programming (SLSQP) using the exact analytic gradient.
Normalization. Raw spend is around ten million, which flattens the objective in the saturated regime and makes SLSQP stall. The solve runs in budget-normalized space with , so variables are of order 0.1 and the budget equality is of order 1. The objective, gradient and constraints are converted in kind (the chain-rule factor cancels exactly in the gradient).
Feasible start. The starting point clamps current spend into the bounds, then redistributes the remaining budget into vehicles with headroom (or out of vehicles with room), for up to 64 passes.
Settings. At most 300 iterations, with a function tolerance of .
Stall recovery. SLSQP can report success after a single iteration while having moved essentially nowhere. A stall is detected when the solve took at most one iteration, moved less than from its start, and some vehicle actually had freedom to move. The solver then retries from the start nudged along its own gradient:
Restart point after a detected stall.
Terms: is the original feasible start; is the number of vehicles; is the ascent direction scaled to unit maximum. The retry is adopted only if it moved, converged, met the budget equality, and reached an objective at least as good as the stalled solution, so recovery can never make a result worse.
Each iteration's objective and spend are recorded, so a run shows the objective climbing toward the optimum.
Diagnostics and validation
Saturation zones
Each vehicle is labelled by how much of its ceiling it has reached. The band edges are an internal rule, not universal constants.
| Saturation ratio | Zone |
|---|---|
| Below 0.10 | Threshold |
| Below 0.45 | Growth |
| Below 0.70 | Optimal |
| Below 0.90 | Diminishing |
| 0.90 and above | Saturation |
Per-vehicle rows
For every vehicle the output reports current and optimized spend, the change in dollars and percent, current and optimized response, average and marginal ROI, the saturation ratio, the zone, and whether the optimum sits on its lower or upper bound.
Validation gates
Five checks run on every solution and are published in the summary:
| Gate | Passes when |
|---|---|
| Budget equality | Total optimized spend equals the budget within a relative tolerance of |
| Bounds respected | Every vehicle lies inside its own bounds |
| Locked unchanged | Every locked vehicle still equals its current spend |
| Marginal declines | Marginal response does not rise as spend grows, checked only past 50% saturation (below that, an S-curve legitimately rises) |
| Solver success | The solver reported convergence |
Weekly flighting
The solver produces one annual number per vehicle. The flighting engine phases it into 52 weeks.
Historical-share phasing
Each vehicle's annual optimum is phased by its own historical weekly share.
Terms: is the planned spend for vehicle in week ; is that vehicle's historical spend in week ; is its optimized annual spend. A vehicle with no history is phased flat at . Without a historical file, every vehicle is phased flat.
Efficiency tilt
When the model provides per-week attribution, spend is tilted toward weeks that were historically more efficient, then rescaled so the annual total is unchanged.
Weekly efficiency, tilt, and per-week cap.
Terms: is the model's own attributed contribution in week ; is the vehicle's average efficiency (ratio of sums); is the week's efficiency relative to average; the exponent 0.3 keeps the tilt gentle (a ratio of 2 scales a week by about 1.23); widens a week's cap from 1 to at most 1.5 times the base cap when its signal is strong; is the final weekly spend.
A vehicle needs at least 8 weeks with positive attribution and spend before it is tilted at all; otherwise it keeps its historical-share phasing unchanged.

Aggregate weekly cap
A second, cross-vehicle cap bounds each week's combined spend against that week's historical combined spend:
Aggregate weekly band.
Terms: is the historical combined spend in week ; is each vehicle's planned spend. Violating weeks are scaled to the nearest edge, and each vehicle's other weeks are rescaled to restore its annual total, for up to 5 rounds.
A feasibility guard runs first. If the optimized annual total already falls outside the sum of every week's band (for example a large annual increase phased into 52 weeks each capped at 15%), no weekly plan can satisfy both, so the cap is skipped rather than silently dropping budget. The annual decision made by the solver always wins.
Reporting metrics
The detailed media analysis is built from the optimized spend and the curves.
Reported metrics for a vehicle or any aggregate.
Terms: is price (revenue per unit); is margin (profit per unit); is response volume at the shown spend. ROI here is profit over spend, not revenue over spend.
Macro assumptions. Media-cost inflation (CPM) and price inflation apply to the optimized, forward-looking side only; the current column is always the untouched historical reference:
Macro adjustment of the optimized side.
Terms: is the net media-cost inflation (increase minus decrease): more cost means fewer response units per dollar; is the net price inflation, which raises value per unit.
Assumptions and limits
| Assumption | Consequence |
|---|---|
| Carryover is embedded in each curve | The optimizer does not re-simulate adstock; weekly plans phase by history, not by model |
| Annual spend maps to annual response | Curves are fitted and compared on an annual basis |
| One fitted mean curve per vehicle | Credible bands are published for display; they do not enter the solve |
| S-shaped curves are not concave | The result is a local optimum; the gates report convergence and validity |
| Guardrails are business inputs | A vehicle at a bound is a decision to review, not a modeling result |