AI Glossary · Letter O

Optimization.

The mathematical process of finding the values of variables that minimize or maximize an objective function. Optimization is the engine of machine learning, used to find model parameters during training, and is also the formal framework for budget allocation, bid setting, and campaign scheduling decisions that agencies make on behalf of clients.

Also known as mathematical optimization, numerical optimization, gradient optimization

What it is

A working definition of optimization.

An optimization problem has three components: decision variables, whose values can be chosen; an objective function, which is evaluated as a function of those variables and must be minimized or maximized; and constraints, which define the feasible set of variable values. In machine learning, the decision variables are the model’s parameters, the objective function is the loss on the training data, and the constraints include implicit constraints such as parameter magnitude through regularization. In media planning, the decision variables are channel budget allocations, the objective function is projected reach or conversions, and the constraints include total budget, channel-level minimum and maximum spends, and audience frequency caps.

Gradient descent is the primary optimization algorithm for machine learning training: it starts from an initial parameter configuration and iteratively moves in the direction of steepest decrease in the objective function. The gradient of the objective with respect to the parameters points toward the direction of steepest increase; moving in the opposite direction by a step proportional to the learning rate produces a sequence of parameter updates that converge to a local minimum. For convex objective functions with a single global minimum, gradient descent converges to the global optimum. For non-convex objectives with many local minima, such as those of deep neural networks, gradient descent converges to a local minimum that is often good enough for practical purposes, even if it is not the global optimum.

Budget optimization in marketing is a constrained optimization problem: find the allocation of budget across channels and audiences that maximizes projected conversions (or other KPIs) subject to a total budget constraint and channel-specific constraints. This is a convex optimization problem when the response curves are concave (exhibiting diminishing returns), and it can be solved exactly with standard convex optimization methods. The quality of the solution depends on the accuracy of the response curves used as inputs: response curves estimated from media mix models determine the optimal allocation, and errors in the response curve estimates propagate directly into suboptimal budget recommendations.

Why ad agencies care

Why understanding optimization improves both AI tool evaluation and media budget decision quality.

A working ad agency uses optimization in two distinct contexts every day: machine learning model training, where optimization finds model parameters, and media planning and campaign management, where optimization finds the best allocation of budget and bids across channels and placements. Understanding optimization as a unified concept enables agencies to apply insights from one domain to the other, to evaluate whether optimization-based tools are well-formulated, and to communicate the mathematical foundations of recommendations to technically sophisticated clients.

Budget optimization tools are only as good as the response functions they optimize over. A budget optimization platform that recommends allocating $2 million across six channels is computing the allocation that maximizes projected conversions given estimated response curves for each channel. If those response curves are estimated from a poorly specified media mix model, or from attribution data that overstates the contribution of high-intent channels, the optimization will find the “optimal” allocation for the wrong objective. Agencies using AI budget optimization tools should ask vendors what data and models are used to estimate response curves and whether those estimates are validated against actual experiment results.

Bid optimization is real-time constrained optimization that must respect budget, ROAS, and frequency constraints simultaneously. Automated bidding systems solve an optimization problem on every available impression: how much to bid to maximize the probability of winning a valuable impression while respecting campaign-level budget constraints, target CPA or ROAS constraints, and audience frequency caps. The solution to this problem requires simultaneously estimating the impression’s value given its audience signals, the auction clearing price given competitive dynamics, and the remaining budget available. Modern bidding systems use neural networks to learn these estimates from historical data, converting the impression-level optimization into a fast prediction problem.

Constrained optimization for media planning handles real-world planning constraints that unconstrained models ignore. Real media plans have constraints that pure performance optimization would violate: minimum spends to maintain platform relationships, maximum spends that reflect concerns about channel saturation, geographic must-buys for brand presence, and diversity requirements that prevent over-concentration in a single channel. Incorporating these constraints into the optimization model ensures that the recommended plan is both mathematically optimal and operationally feasible. AI planning tools that ignore these constraints produce recommendations that must be manually adjusted, reducing the value of the automated optimization.

In practice

What optimization looks like inside a working ad agency.

An agency is managing a $3.2 million quarterly digital budget for a financial services client across 5 channels: paid search, display, social, connected TV, and email. The client has approved a target CPA of $120 and has channel-specific constraints: paid search must receive at minimum $800k due to contractual commitments; CTV cannot receive more than $600k; and the remaining three channels have no binding constraints beyond the total budget. The agency uses a budget optimization tool that takes the agency’s current media mix model channel response curves as inputs and solves for the allocation that minimizes projected CPA across the constrained budget. The optimization outputs an allocation: search $800k (at minimum), CTV $400k, display $600k, social $900k, email $500k. The projected CPA at this allocation is $104. The agency tests the sensitivity of the recommendation to the response curve estimates by running the optimization with response curves adjusted plus and minus 20% from the point estimates. The sensitivity analysis reveals that the social allocation is robust to uncertainty in the social response curve estimate, while the display allocation is highly sensitive to the display curve estimate, which has wide confidence intervals due to limited spend variation in the historical data. The agency presents the primary recommendation alongside the sensitivity results and recommends a matched-market test of an alternative allocation that shifts $200k from display to email, which the sensitivity analysis suggests may improve projected CPA if the display response curve is at the lower end of its credible interval.

Build the optimization foundations that improve both media allocation and AI system evaluation through The Creative Cadence Workshop.

The generative AI foundations module covers mathematical optimization as applied to both machine learning training and marketing decision problems, explaining gradient descent, constrained optimization, and the response function estimation that makes budget optimization actionable.