Sub topic 12
Weighing gains against cost and complexity
This chapter assumes you can already compare a candidate model with a baseline on the same splits, and that you know the baseline's score and its noise level. Here you decide whether a measured gain justifies what the better model costs to build and run.
A gain is not free
A candidate that beats the baseline by a real margin can still be the wrong choice. A more complex model usually adds costs that never show up in the validation score:
- Compute: training time, inference latency, and hardware or cloud spend.
- Engineering effort: feature pipelines, tuning, and code that someone must review.
- Maintenance: retraining, monitoring for drift, and debugging when predictions look wrong.
- Opacity: harder explanations for users, auditors, and your own team.
- Fragility: more inputs and more dependencies that can fail in production.
A baseline such as a linear model or a rule has the opposite profile. It is cheap to run, easy to inspect, and easy to fix.
Convert the gain into the same units as the cost
Metric points are hard to compare with money or engineer-weeks. Translate the gain into the effect it has on the task. Fewer errors mean fewer missed fraud cases, fewer wasted calls, or fewer bad recommendations. Then multiply by the cost of an error, which you should already have from the metric and good-enough work.
The sketch below compares two models by total yearly cost. The numbers are invented, so replace them with your own.
cost_per_error = 20.0
predictions_per_year = 100_000
models = {
"logistic regression": {"error_rate": 0.080, "yearly_cost": 2_000},
"gradient boosting": {"error_rate": 0.074, "yearly_cost": 30_000},
}
for name, m in models.items():
error_cost = m["error_rate"] * predictions_per_year * cost_per_error
total = error_cost + m["yearly_cost"]
print(f"{name}: errors {error_cost:,.0f} + running {m['yearly_cost']:,} = {total:,.0f}")The boosted model makes 600 fewer errors a year. That saves 12,000 units, but it adds 28,000 units of running cost. The simple model wins, with a total of 162,000 against 178,000.
A decision path
Common errors
- Counting only the gain. Teams record the accuracy improvement and leave out the cost of serving the model.
- Ignoring scale. A small gain can pay off across millions of predictions and be worthless across a few hundred.
- Ignoring hard limits. Latency budgets, memory limits, and explainability rules can rule out a model whatever its score. Check these as pass or fail constraints before you compute any trade-off.
- Pricing every error the same. Missing a rare case often costs far more than a false alarm. Use costs per error type if you have them.
- Assuming costs stay fixed. Maintenance grows over time, so count it for the model's full lifetime and not only for launch.
A practical rule
Prefer the simplest model that meets your good-enough criteria. Move to something more complex only when the gain exceeds noise, covers its full cost, and satisfies every hard constraint. Record the baseline's score and cost next to the candidate's, so the decision can be checked later.
Exercise
A random forest lowers the error rate from 5.0% to 4.8% compared with a linear model. You make 50,000 predictions per year, each error costs 10 units, and the forest adds 6,000 units of yearly running cost. Is it worth deploying on cost alone?
Show answer
No. The forest avoids 0.2% of 50,000 = 100 errors, saving 100 × 10 = 1,000 units. That is far below the 6,000 units of added cost, so the linear model is the better choice even before you check whether the 0.2-point gain exceeds noise.