EEcommerce Coffee Break
← All frameworks
FinanceMati Ram

Cross-Channel Knapsack Budget Optimization

Allocate one ad budget across campaigns using predicted marginal returns

Difficulty
Expert
Time to result
~months to results
Steps
8
Confidence
94%

The method treats paid advertising as a constrained portfolio-allocation problem. For every Google campaign and Facebook ad set that holds a budget, historical observations are used to model the relationship between spending and revenue. A regression line provides a prediction of likely revenue at different budget levels. The advertiser supplies the total available budget and a required return on ad spend. A knapsack-style optimization then evaluates combinations of allocations and selects the portfolio expected to produce the strongest overall outcome while respecting those inputs. Execution does not end with the initial allocation: AI monitors live auctions continuously, compares observed results with predictions, and reacts to anomalies or emerging trends. It can shift funds between platforms and alter bids when temporary auction conditions create unusually inexpensive opportunities.

Origin

Extracted from Ecommerce Coffee Break during Mati Ram's mathematical explanation of how AI can optimize an entire Google and Facebook advertising portfolio.

Core principles

  • 01Optimize total portfolio revenue rather than isolated platform results
  • 02Model the relationship between budget and revenue for every budget holder
  • 03Use business constraints as explicit model inputs
  • 04Allocate funds to the best combination of predicted opportunities
  • 05Monitor live auctions and react when outcomes diverge from predictions

How to run it

  1. 1

    Set the Constraints

    Specify the total advertising budget and the minimum acceptable return on ad spend or equivalent business objective.

    Pro tip Use a target grounded in actual margins and customer economics.

    Watch out An impossible return constraint can prevent any useful allocation.

  2. 2

    Map the Budget Holders

    List every Google campaign and Facebook ad set that independently receives budget.

    Pro tip Include all campaigns eligible to receive or surrender funds.

    Watch out Leaving out a major budget holder makes the portfolio model incomplete.

  3. 3

    Build Historical Distributions

    For each budget holder, assemble observations linking budget levels with resulting revenue.

    Pro tip Separate materially different campaign structures or market conditions when necessary.

    Watch out Historical attribution errors can distort the budget-to-revenue relationship.

  4. 4

    Fit Revenue Response Curves

    Estimate a regression relationship that predicts likely revenue for each possible budget level within each campaign or ad set.

    Pro tip Retain uncertainty ranges instead of treating every prediction as exact.

    Watch out Extrapolating far beyond observed spending levels can produce unreliable forecasts.

  5. 5

    Solve the Portfolio Allocation

    Use a knapsack-style model to compare feasible combinations and select the allocation that maximizes predicted portfolio revenue under the stated constraints.

    Pro tip Optimize the whole portfolio rather than selecting each campaign's individual optimum independently.

    Watch out The sum of isolated campaign optima is not necessarily the global optimum.

  6. 6

    Deploy Budgets and Bids

    Apply the selected allocation across Google campaigns and Facebook ad sets, adjusting bids where needed to pursue the predicted opportunity.

    Pro tip Keep changes within platform and operational guardrails.

    Watch out Large abrupt changes can alter delivery behavior and invalidate historical relationships.

  7. 7

    Monitor Prediction Error

    Compare live auction and revenue performance with the model's expected results around the clock.

    Pro tip Distinguish short-lived anomalies from persistent trends before making structural changes.

    Watch out Ignoring prediction error allows a previously optimal allocation to become stale.

  8. 8

    Exploit Live Opportunities

    Reallocate budgets or lower bids when auction conditions indicate that impressions can be obtained more efficiently than usual.

    Pro tip Use time-of-day baselines to identify conditions that are genuinely unusual.

    Watch out A temporary cheap click is valuable only if traffic quality and revenue remain acceptable.

In the wild

Capturing an Evening Auction Gap

Mati describes AI detecting that the evening relationship between cost per click and Google position is better than it normally is at that hour. The system infers that competitors may have exhausted their daily budgets, shifts money from Facebook, lowers bids, and attempts to capture inexpensive impressions.

→ The portfolio exploits a short-lived cross-channel opportunity that a daytime-only manager could miss.

Allocating a £10,000 Portfolio

An advertiser supplies a £10,000 budget and a 500 percent return target. The model evaluates the predicted revenue curves for every eligible Google campaign and Facebook ad set, then searches for the combination expected to produce the best total result under those inputs.

→ The budget is distributed according to predicted portfolio performance rather than platform silos or equal shares.

Common mistakes

Choosing Each Campaign's Local Optimum

The best budget for each campaign independently may exceed the available total or produce a weaker combined result. The objective is the optimum of the complete portfolio.

Treating Predictions as Permanent

Live auctions change continuously, so the system must compare forecasts with actual performance and react to anomalies or trends.

Ignoring Cross-Channel Opportunity Cost

Money left in one platform cannot fund a stronger opportunity elsewhere. Allocation decisions must compare Google and Facebook on the same portfolio basis.

Is it for you?

Best for

It is best for advertisers with multiple active campaigns, sufficient historical performance data, and flexibility to move spending across channels.

Not ideal for

It is not ideal for new advertisers without enough observations to estimate dependable budget-to-revenue relationships.

From the transcript

“There are three ways to optimize. It's budget optimization, bid optimization, and campaign structure.”

Mati Ram

“The goal, usually, is to maximize the revenue in the given budget, which means that the advertiser gives AdScale a budget, call it X, And…”

Mati Ram

“Now there is a mathematical model known as the knapsack problem, uh, that tries to find what is the optimum of all the optimums.”

Mati Ram

From the episode

Stop Losing Money On Ads! Try This Insane AI Hack — Mati Ram

Mati Ram

→