Friction Aware Reward Shaping for Policy Optimization

25 concepts18 papers1 proposal

In idealized environments, optimization agents operate without consequences for the act of changing their minds. If a predictive model forecasts a minor upward tick in an asset's value, a frictionless strategy will immediately buy; if the next tick looks marginally lower, it will instantly sell.

In the real world, however, execution is never free. Every action incurs a transaction cost—whether in the form of financial fees, market slippage, or operational penalties. When standard machine learning models are applied to these environments, they often suffer from hyperactive behavior, generating high-turnover strategies where the costs of execution completely erode the theoretical returns.

To solve this, a powerful paradigm has emerged: friction-aware reward shaping. Instead of treating transaction costs as an accounting step performed after policy generation, researchers embed these frictions directly into the agent's optimization objective. This structural shift fundamentally alters how the agent learns, forcing it to internalize the cost of movement and naturally develop stable, long-term strategies.


The Pitfall of Frictionless Prediction

Traditional approaches to sequential decision-making, such as algorithmic trading, often treat the problem as a sequence of independent classification or regression tasks. A model is trained to predict the direction of the next price movement, and a rule-based system executes trades based on those predictions.

As Ralph Neuneier demonstrated in Optimal Asset Allocation using Adaptive Dynamic Programming, reframing asset allocation as a Markov Decision Process (MDP) rather than a simple price prediction task allows an agent to optimize for cumulative, long-term returns. When an agent optimizes purely for directional accuracy, it treats a $0.1\%$ gain and a $5\%$ gain with similar weight if both are correct predictions. However, if executing a trade costs $0.2\%$, the first trade loses money, while the second is highly profitable.

By optimizing a cumulative reward signal derived from the actual magnitude of price changes rather than a binary classification, reinforcement learning (RL) frameworks can prioritize high-yield opportunities and ignore low-volatility periods where potential gains are minimal, as shown by Jinho Lee et al. in Global Stock Market Prediction Based on Stock Chart Images Using Deep Q-Network.


Internalizing Friction via Reward Shaping

The core mechanism of friction-aware optimization is the modification of the reward function $R(s, a)$ to include an explicit penalty for action changes. Instead of receiving a reward based solely on the environment's state transition, the agent is penalized proportionally to the distance between its new action and its previous action:

$$R_{shaped}(s_t, a_t) = R_{raw}(s_t, a_t) - c \cdot |a_t - a_{t-1}|$$

where $c$ represents the cost coefficient.

This simple modification completely changes the agent's behavioral incentives. In Effectively training neural networks for stock index prediction: Predicting the S&P 500 index without using its index data, Jaewoo Kang et al. explain that incorporating transaction penalties directly into the reward function forces models to ignore weak, low-confidence signals. The agent learns that unless the expected gross return of a position change exceeds the threshold of the transaction cost, the net reward will be negative. Consequently, the model chooses to hold its current position.

This mechanism is not exclusive to financial markets. For instance, in digital advertising, R. Afshar et al. applied a similar reward structure to the "Waterfall Strategy" for ad network selection in A Reinforcement Learning Method to Select Ad Networks in Waterfall Strategy. By assigning a fixed negative penalty for sequential failures, their model learned to account for the implicit costs of unsuccessful attempts in a sequential pipeline, prioritizing high-value targets over risky, high-frequency adjustments. Similarly, in energy markets, Malte Lehna et al. demonstrated in A Reinforcement Learning Approach for the Continuous Electricity Market of Germany: Trading from the Perspective of a Wind Park Operator that adding a volume imbalance penalty to a profit-based reward function shifts an agent's behavior from risky speculation to operational compliance as physical delivery deadlines approach.


Differentiable Objectives and Turnover Regularization

For policy gradient methods and direct portfolio optimization, friction can be integrated directly into a differentiable objective function. This ensures that the optimization gradients themselves reflect the financial penalties of trading.

[Raw Market Signals] ──> [Policy Network] ──> [Proposed Action (a_t)]
                                                     │
                                                     ▼
[Gradients Adjusted] <── [Differentiable] <── [Calculate Turnover Penalty]
  by Friction Cost        Objective Loss        (Compare a_t with a_{t-1})

Lin Li 0088, in Selecting Portfolios Directly Using Recurrent Reinforcement Learning (Student Abstract), demonstrates that embedding transaction costs into a differentiable objective function allows the model to learn to avoid excessive rebalancing end-to-end. Because the penalty is differentiable, the backpropagated gradients actively suppress weight updates that cause erratic, high-frequency portfolio churn.

This technique is often formalized as turnover regularization. As Wee Ling Tan et al. show in Deep Learning for Options Trading: An End-To-End Approach, turnover regularization acts as a vital constraint when training deep networks on highly volatile options data. It penalizes excessive trading activity, promoting realistic execution and enabling models to maintain superior risk-adjusted performance even under high transaction cost regimes.

When optimizing complex allocations across multiple assets, Yifan Zhang et al. utilized a direct policy gradient algorithm in Relation-Aware Transformer for Portfolio Policy Learning that explicitly incorporates transaction costs into the logarithmic cumulative return objective, ensuring the learned policy accounts for the friction of rebalancing in dynamic environments.


Why It Works: Policy Smoothing and State Conditioning

To understand why friction-aware reward shaping works so effectively, we must look at how it alters the mathematical structure of the policy.

First, it acts as a policy smoothing mechanism. In Foreign exchange trading: a risk-averse batch reinforcement learning approach, Lorenzo Bisi et al. show that incorporating risk-aversion or friction parameters into the objective functions functions as a regularizer, encouraging longer holding periods. This smoothing behavior reduces the agent's sensitivity to high-frequency market noise, preventing it from overreacting to transient price fluctuations. As a result, agents become more passive when execution costs are high, a behavioral adaptation documented by Thibaut Théate and Damien Ernst in An application of deep reinforcement learning to algorithmic trading.

Second, it forces the policy to become state-dependent. In a frictionless environment, the optimal action at time $t$ depends only on the market state $s_t$. In a friction-aware environment, the optimal action must depend on the previous action $a_{t-1}$, because the cost incurred depends on the transition from $a_{t-1}$ to $a_t$.

The authors of Financial Trading with Feature Preprocessing and Recurrent Reinforcement Learning exploit this by utilizing a recurrent structure where the current action is explicitly conditioned on the previous state's position. This architectural choice allows the network to directly model and minimize transaction costs during the forward pass. Rather than executing large-scale, costly asset turnover, the agent learns to perform incremental adjustments, maintaining target risk profiles without incurring massive fees—an effect also observed by Haoran Wang in Robo-Advising: Enhancing Investment with Inverse Optimization and Deep Reinforcement Learning.


Implicit vs. Explicit Friction Modeling

When designing these systems, researchers face a choice: model the exact, complex cost structures of the real world (such as tiered broker commissions, exchange fees, and asset-specific taxes), or use simplified mathematical proxies.

Weiwei Shen et al. argue in Doubly Regularized Portfolio with Risk Minimization that explicitly modeling intricate market frictions is often mathematically intractable or computationally inefficient. Instead, they propose using mathematical regularization terms—specifically penalties for sparsity (investing in fewer assets) and consistency (minimizing changes between trades). This implicit modeling approach simplifies the optimization objective while achieving the identical practical goal of reducing profit erosion from trading fees.

Modeling Approach Mechanism Pros Cons
Explicit Modeling Exact fee formulas embedded in $R(s,a)$ Highly accurate to specific market rules Can result in non-differentiable or highly complex reward landscapes
Implicit Regularization Mathematical penalties (e.g., L1/L2 norm of $\Delta a$) Smooth gradients, simplifies optimization Requires tuning coefficients to match real-world costs

Whether explicit or implicit, these penalties serve as a powerful filter. In Stochastic Portfolio Theory: A Machine Learning Approach, Yves-Laurent Kom Samo and Alexander Vervuurt demonstrate that incorporating transaction cost penalties ensures the model prioritizes strategies with sustainable returns over high-frequency turnover. The penalty acts as a filter that discards noisy, short-lived signals and forces the model to focus exclusively on persistent market trends that are robust enough to survive trading frictions.

Ultimately, by internalizing friction as a negative reward, reinforcement learning agents naturally bridge the gap between theoretical backtesting and practical, cost-effective deployment. As originally formulated by Ralph Neuneier in Enhancing Q-Learning for Optimal Asset Allocation, integrating these costs directly into the training process allows the agent to autonomously navigate the trade-off between frequent trading and capital preservation, arriving at policies that are inherently optimized for the realities of execution.

Key Foundational Work

Enhancing Q-Learning for Optimal Asset Allocation (1997) — contributed 2 concept elements to this direction.
Optimal Asset Allocation using Adaptive Dynamic Programming (1995) — contributed 2 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_transaction_cost_mitigation_9b0612a9,
  title = {transaction cost mitigation},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/transaction-cost-mitigation/rdr_9b0612a9ed6b40d385b9ab28363c9a1a},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-24},
}

This exact version (version 1, frozen text):

@misc{lacuna_transaction_cost_mitigation_9b0612a9_v1,
  title = {transaction cost mitigation},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/transaction-cost-mitigation/rdr_9b0612a9ed6b40d385b9ab28363c9a1a/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-24},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake