Inferensys

Glossary

Markov Decision Process (MDP)

A mathematical framework for modeling sequential decision-making in stochastic environments, defined by states, actions, transition probabilities, and rewards.
Governance lead reviewing model governance framework on laptop, policy documents visible, executive office setup.
SEQUENTIAL DECISION-MAKING FRAMEWORK

What is Markov Decision Process (MDP)?

A Markov Decision Process (MDP) is a mathematical framework for modeling sequential decision-making in stochastic environments, defined by states, actions, transition probabilities, and rewards.

A Markov Decision Process (MDP) is a formal framework for modeling decision-making where outcomes are partly random and partly under the control of a decision-maker. It is defined by the tuple (S, A, P, R, γ), where S is the state space, A is the action space, P is the state transition probability function, R is the reward function, and γ is the discount factor. The Markov property ensures that the future depends only on the current state and action, not on the history of prior states.

The objective in an MDP is to find an optimal policy π(s) that maps states to actions to maximize the expected cumulative discounted reward. This is formalized through the Bellman equation, which recursively decomposes the value of a state into the immediate reward plus the discounted expected value of the subsequent state. In quantitative finance, MDPs underpin deep reinforcement learning for trading, where the state represents market microstructure features, actions correspond to order placements, and rewards reflect profit-and-loss or risk-adjusted metrics like the Differential Sharpe Ratio.

FOUNDATIONAL FRAMEWORK

Core Components of an MDP

A Markov Decision Process provides the mathematical scaffolding for sequential decision-making under uncertainty. Each component defines how an agent perceives, acts, and learns from its environment.

01

State Space (S)

The state is a complete snapshot of the environment at a specific time step. It must satisfy the Markov property: the future is conditionally independent of the past given the present state.

  • Discrete States: Finite set of distinct configurations (e.g., grid cells in a maze).
  • Continuous States: Infinite values in a range (e.g., portfolio value, volatility).
  • Market Example: A state vector might include current price, position size, and a 14-period RSI value.
  • Representation: Raw market data is often transformed into a compact feature vector or order book embedding before being fed to the agent.
02

Action Space (A)

The set of all possible moves the agent can execute in a given state. The agent's policy maps states to a probability distribution over these actions.

  • Discrete Actions: Finite set of choices (e.g., Buy, Sell, Hold).
  • Continuous Actions: Real-valued vectors (e.g., order size as a fraction of portfolio, limit price offset in basis points).
  • Trading Context: A continuous action might be a vector [0.7, -0.2] indicating buy 70% of max position for asset 1 and short 20% for asset 2.
  • Constraints: Actions are often bounded to prevent short-selling violations or exceeding available capital.
03

Transition Probability (P)

The dynamics model defining the probability of moving from state s to state s' after taking action a. This captures the environment's stochasticity.

  • Notation: P(s' | s, a) — the conditional probability of the next state given the current state and action.
  • Model-Free vs. Model-Based: In model-free RL (e.g., DQN, PPO), the agent does not learn an explicit transition model. In model-based RL, the agent learns or is given P.
  • Market Reality: True market transition dynamics are unknown and non-stationary. Agents typically operate model-free, learning from sampled experience rather than a predefined P.
04

Reward Function (R)

A scalar signal R(s, a, s') emitted by the environment after each transition. The agent's sole objective is to maximize the expected cumulative discounted reward.

  • Profit-Driven: Simple reward can be the change in portfolio mark-to-market value.
  • Risk-Adjusted: Use the Differential Sharpe Ratio to directly optimize for risk-adjusted returns in an online fashion.
  • Transaction Cost Penalization: Subtract explicit fees and estimated slippage from the reward to prevent the agent from learning unrealistic high-frequency churning.
  • Sparsity: Rewards can be dense (every step) or sparse (only at episode end). Dense rewards often accelerate learning but require careful engineering to avoid unintended behaviors.
05

Discount Factor (γ)

A parameter γ ∈ [0, 1] that determines the present value of future rewards. It controls the agent's planning horizon.

  • γ ≈ 0: Myopic agent. Prioritizes immediate reward only. Equivalent to a scalper seeking instant profit.
  • γ ≈ 1: Farsighted agent. Values distant rewards almost as much as immediate ones. Suitable for long-term portfolio growth.
  • Mathematical Role: Ensures the infinite sum of rewards converges to a finite value in continuing tasks.
  • Trading Calibration: A γ of 0.99 is common for daily trading, while 0.999 might be used for longer-horizon strategic asset allocation.
06

Policy (π)

The agent's brain — a mapping from states to actions. It defines the behavior at every step.

  • Deterministic Policy: a = μ(s). Always outputs the same action for a given state.
  • Stochastic Policy: π(a | s). Outputs a probability distribution over actions, enabling exploration.
  • Parameterization: In deep RL, the policy is a neural network with weights θ, denoted π_θ.
  • Optimization: Algorithms like PPO and SAC directly adjust θ to maximize expected return. The policy is the primary output of the training process.
MDP FUNDAMENTALS

Frequently Asked Questions

Clear, technical answers to the most common questions about the mathematical framework underlying modern reinforcement learning and algorithmic trading agents.

A Markov Decision Process (MDP) is a mathematical framework for modeling sequential decision-making in stochastic environments where outcomes are partly random and partly under the control of a decision-maker. An MDP is formally defined by a 5-tuple (S, A, P, R, γ): a finite set of states S representing all possible configurations of the environment; a finite set of actions A available to the agent; a state transition probability function P(s'|s, a) defining the probability of moving to state s' given action a in state s; a reward function R(s, a, s') providing a scalar feedback signal; and a discount factor γ ∈ [0,1] that trades off immediate versus future rewards. The defining Markov property asserts that the future state depends only on the current state and action, not on the history of prior states—the present is a sufficient statistic for the past. At each discrete time step t, the agent observes state s_t, selects action a_t according to its policy π(a|s), receives reward r_{t+1}, and transitions to s_{t+1}. The objective is to learn an optimal policy π* that maximizes the expected cumulative discounted return E[Σ γ^t r_t]. In algorithmic trading, an MDP might model the market state (price, volume, position), actions (buy, sell, hold), and rewards (profit-and-loss or a Differential Sharpe Ratio).

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.