Putting Trading Costs Into the Training Objective
A model trained to minimize prediction error alone has no reason to prefer a stable, low-turnover signal over a noisy, high-turnover one with the same accuracy — building cost awareness into the objective itself changes what "better" means during training.
Prerequisites: When an ML Signal Becomes a Strategy, Turnover Control in ML Strategies
Two models can have identical prediction accuracy and produce wildly different amounts of real profit, because one model's predictions flicker from day to day — forcing constant, costly rebalancing — while the other's evolve smoothly. A standard training objective like mean-squared error can't tell these two models apart; it only sees prediction error, not the trading cost that error's pattern will generate downstream. A cost-aware objective builds that distinction into the loss function itself.
Standard loss functions score a model purely on how close its predictions are to the target, with no penalty for how erratically those predictions change over time — adding a turnover or trading-cost penalty to the training objective pushes the model toward predictions that are not just accurate but also cheap to act on.
Why accuracy alone is the wrong thing to optimize
A model can improve its raw prediction accuracy by reacting quickly to every small shift in the input features, but each reaction the model makes translates, one for one, into a trade — and every trade costs money. If the extra accuracy from reacting quickly is worth less than the extra trading cost it generates, that "improvement" actually makes the strategy less profitable, even though it looks better by the standard training metric. A cost-aware objective directly trades off the two:
In words: the loss the model tries to minimize is no longer just how wrong its predictions are — it's a weighted combination of prediction error and how much the predictions (and therefore the resulting trades) churn from period to period. The weight controls how much the model is willing to sacrifice raw accuracy in exchange for smoother, cheaper-to-trade output.
Adding the turnover term reshapes the loss surface the model is descending — the minimum it settles on is no longer the point of pure minimum prediction error, but a point trading a little of that away for a smoother path to get there.
Worked example
A researcher compares two versions of the same model architecture trained on identical data, one with a standard mean-squared-error loss and one with a turnover-penalized loss ().
- Standard loss model. Achieves a slightly better out-of-sample IC (0.045 vs 0.041) but its daily score changes are, on average, twice as large as the cost-aware version, generating roughly double the turnover when converted into a trading strategy.
- Cost-aware loss model. Slightly lower raw IC (0.041), but daily rebalancing needs are far smaller because the model's predictions move more smoothly through time.
- Net-of-cost comparison. At a realistic 8 basis point round-trip cost, the standard-loss model's higher turnover eats enough into its slightly better gross returns that the cost-aware model actually delivers a higher net Sharpe ratio — the "less accurate" model wins once trading costs are the actual scoreboard.
What this means in practice
Cost-aware training is especially valuable for short-horizon or high-turnover strategies, where trading costs are a large fraction of gross returns, and less critical for slow, low-turnover strategies where costs are already a small drag. The penalty weight itself needs tuning like any other hyperparameter — too small and it does nothing, too large and the model becomes so reluctant to change its predictions that it stops responding to genuine new information.
Adding a turnover penalty after the fact, at the portfolio-construction stage, is a legitimate alternative to changing the training objective — but the two are not equivalent. A model trained purely for accuracy and then smoothed downstream may still have "wasted" its accuracy on signal that later gets smoothed away; training with cost awareness from the start lets the model use its capacity on signal that survives the smoothing.
Related concepts
Practice in interviews
Further reading
- Grinold & Kahn, Active Portfolio Management (ch. on transaction costs)
- Garleanu & Pedersen, 'Dynamic Trading with Predictable Returns and Transaction Costs'