Overview of the Field
Understanding Reinforcement Learning Categories is a Must. Reinforcement Learning (RL) spans a wide range of algorithms, each based on different assumptions, optimization principles, and feedback structures. Unlike supervised learning, the diversity of RL approaches—each requiring different theory, tools, and implementation strategies—makes the learning curve steep but rewarding.
Model-Based vs Model-Free: Availability of Transitions. A core distinction in RL is whether the transition dynamics—represented as , the probability of ending up in state after taking action in state —are known. In model-based RL (aka DP settings), these dynamics are known or learned and explicitly used to plan optimal behavior. In model-free RL (aka RL settings), we assume no access to this underlying probability, which reflects most real-world situations.
Model-Free RL: Learning Without Transition Knowledge. When we don’t know , we resort to model-free methods, which learn from direct interaction. These approaches can be further divided into:
- Gradient-Free Methods, where updates are not derived from explicit gradients.
- Off-Policy methods (e.g., Q-learning, DQN) learn an optimal policy (action determiner) from data generated by a different behavior policy, allowing better exploration.
- On-Policy methods (e.g., SARSA, TD learning) learn from and about the same policy, often with more stable but sample-inefficient updates.
- Gradient-Based Methods, such as Policy Gradient approaches, optimize expected cumulative reward via gradient ascent in the parameter space of a policy network.
Deep RL: A Revolution in Expressiveness. Deep Reinforcement Learning integrates deep neural networks with RL algorithms to handle high-dimensional state and action spaces. Deep RL enable breakthroughs in games (e.g., Atari, Go), robotics, and complex control systems. Deep RL also blurs traditional boundaries, DQNs bring deep learning to value-based methods, while Actor-Critic methods combine policy gradients and value estimation. This integration brings power, but also introduces stability and sample efficiency challenges.
Problem Formulation: Markov Decision Process
This section is a personal revision on [zulfikar2025mdp] that summarized a week lecture at University of Indonesia Machine Reinforcement Learning by Vektor Dewanto.
Formal Definition of MDP. The Markov Decision Process (MDP) is a foundational framework used across disciplines—from AI and control theory to economics and operations research. An MDP is defined as the tuple , where:
- is the state set,
- is the action set,
- is the time set, , usually people skip this because mostly we only deals with discrete time
- is the initial state distribution, probability of starting at a .
- is the transition function, defined as , probability of ends in given doing action in
- is the reward function, specifying the expected reward received for taking action in state . Other form such is also possible and could easily converted by marginalization.
Remember that represent state 0, represent state 0 at time .
Lets Assume Stationary MDPs for Simplicity. In this setting, the state and action sets remain unchanged over time, and our goal is to find a stationary optimal policy. Formally, this means. State space, Action space, transition probability, and reward function is independent of time.
This relaxation could be imagine in chess as, the available actions for any board configuration never change, which simplifies modeling. In contrast, non-stationary MDPs allow these components to vary over time reflects many real-world problem.
Assuming Infinite Horizon and Discrete Time. In addition to stationarity, we often assume an infinite time horizon (i.e., the agent interacts with the environment indefinitely) and discrete time steps. Finite-horizon MDPs are also studied especially in planning problems, but often lead to time-dependent policies. We also assume finite state and action spaces, which enables representations in finite computer’s memory and guarantees convergence.
Markovian: The Markov Assumption on Time Dependency. A core assumption of MDPs is the Markov property, which states that the future state depends only on the current state and action, not on the entire history. This simplifies the transition function to:
rather than
This also often called the first-order Markov assumption. While real-world scenarios often violate this assumption, we either redefine the state to be more informative or use memory-based models (e.g., RNNs in Deep RL) when necessary.
MDP Visual Interpretation. A helpful intuition for this is shown in the diagram below. The agent transitions between various states like “Wake Up”, “Netflix”, “Code & Debug”, and “Deploy”, receiving different rewards depending on its action.
This environment is Markovian: the next state and reward depend only on the current state and action—not on how the agent reached that state. For example, regardless of whether the agent arrived at “Code & Debug” from “Nap” or “Wake Up”, the outcome of choosing “Sleep” will always transition to “Sleep” with a reward of 3.
Policy: The Solution to the MDP. Policy defines the agent’s behavior by specifying the probability of choosing each action in each state.
There are two main classes of policies:
- Represent set of Stationary Randomized/Stochastic policies.
- Represent set of Stationary Deterministic policies, one action with probability 1, will always be chosen.
A deterministic policy maps single state to single action. It can be viewed as a special case of stochastic policy.
Showing that
Matrix Representation of a Policy. A policy can also be represented as a matrix, where each row corresponds to a state and each column corresponds to an action:
We see that in ith-row, , represent action distribution at state , the best action is the maximum among this rows. Please also note that sum over actions must be one .
Markov Chain: Unique Action MDP. Every MDP with a fixed policy induces a Markov Chain (MC). A Markov Chain is an MDP where each state has a unique action. Because and we fix , could be derived called stochastic transition matrix or one-step state-transition matrix denoted as matrix. Formally
describes the probability of ending at given current state .
is stochastic meaning that
- Probability entries
- , we will always ended up in one of state given current state .
K-th Step Transitions. Given Markov Chain (fixed policy), the probability of ending at time k for all states could be computed as
now represent the probability of starting (at ) at and ended up in .
State Classification in Markov Chain. Knowing class of a markov chain, we could assure the convergence of an algorithm. In Markov Chains (MC), states can be classified into two main categories:
- Recurrent: If the probability of returning to s from s is 1. This means that the state will be visited infinitely many times.
- Transient: If there is a non-zero probability of never returning to s. This means that the state might be left.
Markov Chains Classification. Some theorem will be based on implication of some markov chains class.
-
Recurrent Markov Chain: All states are recurrent, meaning that from any state it is possible to return to that state eventually. There are no transient states in a recurrent Markov Chain. EXAMPLE
-
Unichain Markov Chain: Contains a single recurrent class and possibly some transient states. A recurrent class is a set of states where each state can be reached from any other state within the class, and once entered, the process cannot leave the class. Transient states are those that, once left, cannot be returned to. EXAMPLE
-
Multichain Markov Chain: Contains more than one recurrent class. Each recurrent class is a set of states where each state can be reached from any other state within the class, and once entered, the process cannot leave the class. There may also be transient states that do not belong to any recurrent class. EXAMPLE
Theorem. In Finite MDP, there exists at least one chain.. We classify MDPs as follows:
- Unichain MDP: All induced MCs are unichain.
- Multichain MDP: At least one induced MC is multichain.
Markov Chains Limiting State Transition Matrix P. Denote the limiting state transition matrix or converged transition after time.
Since computers cannot compute indefinitely until reaching infinity, we need practical methods to approximate . Here are two common approaches:
- Iterative method, we enumerate and stop for predefined constant or comparing converge tollerance , for preference matrix norm and real threshold .
- Close form solution,
with contraint of is a stochastic matrix i.e
Theorem. In Unichain Markov Chains, all rows of the limiting state transition matrix are identical
Then matrix could be represented by single vector that satisfy linear system of equations.
Because it is an overdetermined equation, the trick is to
- Replace the last row of with and store it in matrix .
- Replace the corresponding entry on the right-hand side (which was originally a zero vector) with 1.
- Solve the modified system to get the :
Optimality Criteria and Optimal Policies is the solution for Markov Reward Process (MRP)., MRP is a Markov Chain with an addition to transitioning between states based on a probability distribution, each state also has an associated reward. We need to measure with respect to some optimality criterion denote by . We parameterize startign state since starting state will sure affect the quality, more general form could easily derive from marginalizing over initial state distribution, . We then could define the optimal policy is the one that maximize value function .
Theorem. In a finite MDP, an optimal deterministic policy exists. This means we could reduce the solution search into domain which is finite, hence a brute force solution will exists with time complexity of (remember that deterministic policy is a function of state to action, we will generate every possible action in every possible state).
Kind of reward value function . Note that all these value function is a function of policy and states. Given fixed policy , the form of is actually a vector of size . Optimal policy is based on which value function (optimal criterion) is used.
- Total Value Function .
Using this, as , which is unusable in infinite horizon MDP.
- Average Reward Function .
This average reward can be calculated using these closed form formula obtained from converge transition probability along with the states reward.
- Discounted Reward
The discount factor ensures convergence by weighting future rewards less as they are further into the future.
- Bias Reward
The summation term represents the immediate reward and represents the long-term reward. Thus, their difference can be interpreted as a measure of bias. Derived from the Bellman Average Reward Evaluation Equation (BEE) that will be explained in the following paragraphs.
Theorem. In a unichain Markov Chain, all average reward for different state is the same.
This means that does not depend on the initial state , so we only need to compute once then define
Form of Reward Function. Take a note that all these reward assume fixed policy . And their form is using usual convention, stacking states as the first dimension.
- State action state general form
- State action form
- State based form
Best visualization for MDP. MDP intuitively could be imagine as a directred acyclic graph with an edge represent possibility.
Bellman Evaluation and Bellman Optimal Equation
Bellman Average Reward Evaluation Equation (BEE). Fundamental equation, the idea is to express immediate and future reward in one equation.
However, there are unknowns with number of equations ( of (one for each state) and single unknown ). This forms an under-determined Linear Equations that will be solved later in following paragraphs.
Making Under-Determined BEE Well-Determine. To solve the under-determined Bellman Average Reward Evaluation Equation (BEE) System of Linear Equations (SLE), we introduce an additional constraint by setting the bias of a reference state to zero.
- Choose a reference state, say , and set its bias to zero:
- Rewrite the formula
Closed-form Solution for . Remember that . Using this definition, we could manipulate in matrix form then solve it directly.
Note that is not a stochastic matrix anymore.The last expression is derive using special case that is a fixed point, this implies . Trust me you don’t want to see the proof, its really specific. I accept and trust this work from our ancesstor completely without any question. Ask gpt in case you need, he’s capable of deriving this.
Bellman Optimality Equation (BOE). Fundamental concept, it describes the relationship between the value of a state under an optimal policy and the expected return from that state. Optimality condition ensures the equation holds only to the optimal policy, denoted as . It is written as
To derive the optimal policy , we first obtain optimal and then greedily act wrt the righthand side (RHS) of BOE. Although there may be multiple optimal policies , there exists only a single optimal and a single optimal .
BOE vs BEE.
- Applicability: BEE applies to all policies, whereas BOE applies only to the optimal policy.
- Action Selection: BEE computes the expectation over actions taken by a given policy (), while BOE selects actions that maximize the expected value ().
- Linearity: BEE is a linear equation because it averages over policy actions, whereas BOE is non-linear due to the maximization operator.
- Value Function Properties: BEE helps evaluate a policy’s value but does not necessarily lead to optimality. In contrast, BOE guarantees that the resulting value function is optimal when solved.
State Action Value Function
The Concept of State Action Value Function . In model-free (RL settings), we don’t know the transition probability , thus we introduce state action bias (aka state action) that could eliminate the need for transition probability.
BOE on State Action Value (). The optimal action value function satisfies the equation:
Thus the optimal policy can be derived as.
Benefits of BOE for Action Values over State Values .
- The optimal policy is greedy with respect to
- incorporates the effects of , and without estimating them separately --- crucial since and are unknown in the RL settings.
Closed-Form Solution for . We start from the actual definition of action values .
-Learning for Discounted Optimality. Where we use
Alternatively
forms the Right-Hand Side (RHS) of the Bellman Optimality Equation (BOE ) applied to .
Convergence criteria for -Learning. Ideally, under the Bellman Optimality Equation (BOE ), the difference between the RHS and LHS should be zero upon convergence. Mathematically, this can be expressed as:
Inexact Policy Evaluation
Inexact Policy Evaluation, avoiding the needs for transition probability. In DP setting, we can exactly evaluate a policy via for arbitrar optimality criterion . However, in RL settings, we have no access in transition probability and reward scheme . Another problem is that tabular DP method require enumeration of state (or state-action) values which is infeasible for massive large state spaces.
Function Approximation. We approximate value function that can be classify into two categories, parametric and non-parametric.
Parametric Function Approximation. Fixed and finite number of parameters adjusted during learning process. Parametric can simply be broken down into Linear Function (in terms of parameter) and Non-linear Function (Decision Tree and Neural Network).
Non-Parametric Function Approximation. No fixed number of parameters, the complexity grows with the amount of data (KNN, Kernel Methods).
Linear Function Approximation. We define value function as a linear function to approximate . We define feature vector and parameter vector .
Where We then learn moving into optimization problem to find by using optimality criterion .
Where the optimiality criterion could be mean squared (MS) or projected Bellman (PB).
Linear Function Approximation with (Weighted) Mean Squared Error. We would have a stationary distribution over states that assigns a weight to each state with a motivation that some states will be visited more often than others. We define weighted mean squared error as
In discrete state spaces, we can expand the expectation and write it down as:
Where is a diagonal matrix with on the diagonal.
To obtain optimal that minimize MSE, we can use gradient descent.
Approximation of true in RL settings. Since there are no training data (i.e true is also unknown), we approximate this using TD or Monte Carlo (MC). We approximate using
This involves the approximation of , hence it’s bootstrapping (i.e using an estimation of a value to estimate another one). Because it is an expectation, it is sampling-friendly (i.e using sample of single interaction (s, a, r′, s′) to get the expectation approximation)
Inexact Policy Iteration
Policy Iteration with a Parametric Approach. Since in policy iteration there are two main components, policy evaluation and policy improvement, we could divide the approximation separately.
Approximate Policy Evaluation. We approximate or depending which one we adopt. We define finite fixed parameter , thus The goal is to minimize error with the true value through similar processes, MSE or TD error. Sometimes we assume linear function approximation such that
Where is a feature vector. Pretty identical to Inexact Value Iteration. Sometimes becoming a one-hot vector.
Approximate Policy Improvement. Once we have sufficient accurate or , we perform policy improvement. We update (potentially parameterized to be ). In some scenarios, we might select an action a that maximizes to yield a deterministic policy.
Identical process, error minimization through optimization. Both then define error criterion then optimize using gradient descent. Identical to Indexact Value Iteration and regular Machine Learning framework.
Value Approximation Criterion : Bellman Error and Projected Bellman Error
Above section explain the usage of MSE. Here we will explain the usage of PB. Here we will revisit Bellman Equation, defining bellman error, and then the solution proposed called Projected Bellman Error.
Bellman Equation revisit. The Bellman equation for a value function can be written in the form
Bellman error measures how well a candidate value function satisfies the Bellman equation. Basically the difference between approximated and the true .
When the Bellman error is zero for all states, exactly satisfies the Bellman equation.
Projected Bellman Error (PBE). Using BEE error, may lie in a restricted function space (e.g cannot be represented by as an implication that we assume is linear but actual is not for example). Hence, we cannot always solve in exact, we use projection operator into our parameter space. Projected bellman error defined as
Where is the Bellman operator. We project bellman operation into our parameter space .
Minimizing the PBE is a common strategy in methods such as LSTD, where we seek a parameterized value function that is as close as possible (in a projected sense) to the Bellman update.
How to perform projection . Suppose we have feature matrix and diagonal weighting Each row in is a feature vector with diagonal in represent stationary distribution over states. We wish to define a projection
where is the column space spanned by . The projection is taken under the -norm weighted by denoted as
Formally, for any vector , we want to satisfy
Since can be represented as for some , the problem becomes
This becomes a least squares problem, and the solution is given by
The optimal projection then become
Deriving to Minimize Projected Bellman Error (PBE). Above is general projection formula if we want to project into . Now we want to project bellman operator on ().
Utilizing PBE Norm for Precise Objective. We want PBE , since PBE is a vector, we would need to turn into scalar for optimization which we will use norm. Usually PBE = is impossible, we want to be as close as as possible. Weighted norm could be used.
Full formula for .
Under suitable assumption, invertibility of , we could derive the closed form formuka (well known LSTD solution). It also could be solved using least square.
Main advantage, we do not need the true value function . From these, we can construct the Bellman operator (or an empirical version of it) and compare to . This approach is stable because it relies on the self-consistency property of the Bellman equation rather than on direct knowledge of true .
Connection with TD Error. Methods like Temporal Difference (TD) learning effectively estimate the Bellman error incrementally. A TD update can be viewed as trying to drive the quantity
to zero over time, which corresponds to making satisfy the Bellman equation in expectation.
Value Approximation : Building Matrix Encoding Transition and Stationary Distribution in RL settings
Another technique for linear approximation of value function, Encoding Transition and Stationary Distribution. We will define as a feature vector for state , and stationary distribution and transition probability respectively. We will ended up as simple as solving System of linear equations later on.
Intuition of X. We want to build that encode effect of transition.
We would like to encode the LHS of the above bellman equation.
Direct Definition of . One way is to sum over all states and possible next statets through outer product.
Note that is an outer product that form matrix, , that capture pairwise interactions in feature vector. Lets define feature matrix as a matrix of feature vectors. Then we could write as :
Definition of y. Continuing on average reward scenario, we could precisely define as.
Where is immediate reward, g could be discount factor or baseline. We multiply by to lift (project) the scalar reward into same feature space.
Linear Equation Interpretation. We will have
where is a vector derived from rewards or td-terms. If is non singular, typically represents the parameters of an approximate value function in RL.
Main Advantage, Sample-Based Approximation of X. Without sampling friendly of this formulation, solving will need and which is not available in RL settings. is sample friendly due to direct expectation that could be approximated without involving and (r for all states). Even if we know them, computing is still infeasible for large state space and feature.
Similarly we could perform unbiased sample estimate for .
Both contructed as sample mean making them unbiased estimator for each .
These are called Least Square Temporal Difference (LSTD) Solution solving TD fixed-point equation. Where we solve where both using sample estimate. We often add regularization term to the matrix to force it singular.
This technique usually called L2-regularization in the context of LSTD.
Special Feature Vector as One Hot Encoding Case. Where or where if else . This raise dimensionality issues since dimension of w has to match this. Another implication is that solving is equivalent to solving exact value of each state. So LSTD or TD(0) in this case reduce to solving well-known tabular forms showing that tabular method simply special case for linear approximator with one-hot feature space.
Inexact Policy Improvement : Policy Gradient
Goal of Policy Improvement. In policy improvement, we want to find better policy under some optimality criterion such that
Remember that in Policy iteration, we seek improvement, not optimal policy under .
Policy Gradient Methods. The idea is to perform gradient ascent on the objective function where indicates the chosen optimality criterion (e.g., discounted return, average reward, total reward, or bias). It is formulated as
Challenge is Computing the Gradient of wrt , Direct Policy Parameterization vs Explicit Policy Parameterization. A direct application of this concept, called direct policy parameterization, attempts to compute partial derivatives of with respect to the policy itself. However, this approach is challenging since
- Policy may not be simple differentiable form
- Directly working in the space of all possible policy can be extremely high dimensional
These challenges motivate an alternative known as explicit policy parameterization.
Motivation for Explicit Policy Parameterization. We introduce parameter vector for arbitrary . Then we defined family of policy in parameter space . Thus, the value function could be written as . This way we could compute gradient of with respect to with advantage of
- Flexible High-Dimensional Function Approximation, we could use neural network or simple linear regression one
- Systematic Exploration Control, stochastic parameterization can naturally incorporate exploration
- Compatibility with Gradient-Based Optimization, powerful optimization algorithms can be applied
- Empirical Success in State-of-the-Art Algorithm, many of the best-performing RL algorithms in continuous control and high-dimensional settings rely on explicit policy parameterization.
Policy Parameterization for Discrete Action Spaces
Policy Parameterization for Discrete Action Spaces. We parameterize as a categorical distribution which commonly approached by using softmax parameteriation.
Where is a feature vector for state-action pair. Since (optimizing for equivalent of optimizing for ), we could choose to optimize for for numerical stability that is commonly use.
This expression is essential for computing the policy gradient in REINFORCE and actor-critic methods.
Computing . The policy gradient theorem states that
So the gradient of value function is the weighted sum of with weight .
Approximating Gradient through Sample Mean. Since stationary distribution is unknown, we use sample mean to approximate the gradient in RL settings. For each we observe, we take the approximation as
If is replaced by an unbiased return estimate (e.g., Monte Carlo returns, bootstrapped estimates, or advantage functions), then equation above is an unbiased stochastic gradient of .
Semi-Stochastic Approach in Practice. In practice, some approximations introduce bias. For instance, may be approximated by a learned critic or truncated returns. Moreover, during learning, may change faster than we can gather fully on-policy samples. This mismatch between the policy used to gather data and the updated policy parameters can create a semi-stochastic gradient approach. While theoretically these approximations may introduce some bias, in many real-world tasks they are sufficiently accurate to yield strong performance and stable learning
In Summary about Policy Gradient.
- Inexact but Monotonically Improving: Each update step aims to increase .
- Unbiased or Semi-Unbiased Estimates: Depending on how is estimated, the gradient update may be unbiased (e.g., Monte Carlo returns) or partially biased (e.g., bootstrapped estimates, off-policy data).
- Computational Feasibility: Sampling-based methods are often the only viable approach in high-dimensional or continuous RL problems.
- Compatibility with Practical Hyperparameters: Even if the procedure is not strictly on-policy or if there is some mismatch in distributions, these methods still tend to work well in practice.
Discounted Reward Policy Gradient
Discounted Reward and the Policy Gradient Theorem. Revise the definition of the discounted reward objective
Where is the discounted resolvent (the total discounted visitation across time).
Defining Discounted State Distribution. To capture how much each state contributes to the return, accounting for discounting. We define discounted state distribution as
We multiply by to make this sum a proper probability distribution. This corresponds to a geometric distribution over state visitation (trial until first success). This reflects that recent states are weighted more heavily than distant ones.
How to Properly Sample a State from the Discounted Distribution. Let denote the normalized (since we multiply by ) discounted state.
- Sample a length , representing number of steps to run in the episode
- Run trajectory from to and let the sampled state be
In practice, people often use all states to construct an unbiased gradient estimate more efficiently.
Gradient of the Discounted Performance. When differentiating the performance objective with respect to parameters , a challenge arises:
- is unknown
- is not sampling friendly
To be precise, we are looking into the following expression
Note that is incorporated inside . The discounted transition is not a proper probability distribution. And the dependency on future state visitation makes it difficult to sampling since it relies on off-policy like expectations over future trajectories.
The Policy Gradient Theorem. Despite the problem above, we can still derive useful result.
Where the gradient does not involve , and the proportionality constant depends on . This result allows us to construct stochastic estimates of the policy gradient using sample trajectories.
Sampling-Friendly Estimation of Policy Gradient Theorem. Keep this in mind since we will see this formulation in almost every SOTA policy gradient algorithm. We can rewrite the gradient as
See the different that in standard gradient ascent, we the hill directly (where is the lower and where is the higher on a single point), here, we estimate the hill that will be very noisy and delayed using reward signal. Which forms the basis of REINFORCE and other policy gradient algorithms.
REINFORCE Algorithm with Discounted Return. In practice, for episodic tasks, we define the update rule as:
Where is monte carlo discounted return (if sampled approximated). This form emphasizes the timeweighted contribution of each reward.
Variance Reduction in Policy Gradient
High Variance in Policy Gradient Methods. While the standard estimator of policy gradient theorem is unbiased, it can have high variance.
Two common strategy to reducing it without introducing bias are
- Using baseline (or control variate) that is independent of the action
- Employing an actor-critic approach, which leverages learned value functions.
Baseline as a Control Variate. A control variate is a technique from statistics used to reduce the variance of an estimator without adding bias. We define that does not depend on action so that it leaves the expected gradient unbiased
Since , second terms disappear leaving the estimate unbiased. However, the variance reduced significantly by a good choice of . We called as the advantage function that is flexible to design.
Advantage Function Example. One common example is that yield
The advantage function indicates how much better or worse an action is relative to the average value of state .
Actor-Critic. Consist of two components, actor that update policy parameter via gradient ascent and critic that estimates value function or used as baselines to reduce variance. Because the critic can learn (or ) online using data, it provides an adaptive baseline that improves over time, helping the actor’s updates become more stable.
Critic Example, Temporal-Difference (TD) Learning. Seen in many actor-critic method. We will utilize TD target for
Note that we want to minimize td error , it seems like we did gradient ascent (which to maximize) which a wrong way of seeing it, the sign flipped because of negative gradient. Although single-step TD target can introduce bias, it converges to the true value function thus serves as an unbiased estimator in the limit.
Using a Parametric Critic to Reduce Variance Further. Many policy gradient methods incorporate a parametric critic to approximate the value function or the action-value function.
Baseline via Parametric Value Function. If we choose as the baseline, then the policy gradient update becomes
where is an approximate advantage. In practice, itself often replaced by critic estimate .
Actor Critic: Single Samples Updates. Each transition can be used to
- Update the critic parameter (e.g via temporal-difference learning above), aiming to improve and .
- Update the actor parameter using the critic’s estimates to form a low variance gradient update
Combining Baseline and Actor-Critic. We often employ both a baseline and an actor-critic approach:
- The baseline ensures that subtracting something like does not introduce bias but can substantially reduce variance.
- The actor-critic ensures that this baseline (or the action-value approximation) is adaptively learned via single-sample updates (e.g., using TD methods).
Instead of only subtracting a static baseline, we can directly learn and refine (or ) to compute advantage . This approach typically converges faster and is more stable than using Monte Carlo returns (REINFORCE Algorithm) for the baseline.
Benefit of Parametric Critic. By maintaining a parameterized function or , the method can:
- Provide continuous improvement in baseline quality, thus continually adaptively reducing variance.
- Combine seamlessly with neural network approximations, allowing scalability to large state-action spaces.
Sensitivity of Optimal Policy
Essence of Each Optimality Criterin. Average reward often associated with a stationary state distribution that we believe exists and will converge. Discounted reward apply discount factor to future rewards imply that there is a probability of terminating at each step thus placing more emphasis on recent states.
Dependency on the Initial State Distribution. Different initial state distribution might lead into different optimal policy. Thus the ideal way of writing policy is to separate (for a particular initial distribution) and (for the initial distribution ).
Deep RL
Recall GPI in Policy Gradient.
Vanilla Policy Gradient.
- Init
- for , evaluate and improve.
- Evaluate
- Improve
Intro to TPRO. We define advantage .
for another policy . We interpret this as, the expectation of advantage is the gain different between and . We use this fact for policy improvement / critic.
The problem is that, we need to sample with respect to new policy with parameter . We need to modify the above such that it involve .
TODO: Derive TRPO formula
…
Importance sampling.
TODO: Kemeneng constant
Algorithm Summary
Policy Iteration Algorithm, Exact Average Reward.
- Initialize iteration index and random starting policy
- Exact Policy Evaluation : Obtain through closed form or solve BEE SLE
- Exact Policy Improvement : Update to be greedy wrt . See equation below.
- Check for convergence : check if current is the same as before, otherwise repeat 2.
Policy Iteration Implementation Considerations.
- Handling multiple optimal policies: The algorithm should be modified to handle multiple optimal policies. If multiple optimal policies exist, the algorithm may switch back and forth between them indefinitely. By knowing that only single optimal and , we could use this as the convergence criteria instead.
- Synchronous updates: Updating for all possible states is called synchronous update. In RL, asynchronous updates are often used for large state space.
- Stable policy: Stability is achieved when the policy no longer changes for all states. If one or more state changes, then the policy is still evolving and not yet stable.
Value Iteration Algorithm, An Alternative to Exact Policy Iteration. Policy Iteration relies on the Bellman Expectation Equation (BEE) to iteratively evaluate and improve a policy, Value Iteration leverages the Bellman Optimality Equation (BOE) to directly compute the optimal value function. Value Iteration avoids the need for explicit policy evaluation steps, making it a more straightforward approach.
- Initialize: iteration number, initial value function, and tolerance ()
- Update Value : using equation below
- Check Convergence : , where if yes repeat 2 else continue to 4
- Output Greedy Policy :
Value Iteration Implementation Issue. One issue with Exact Value Iteration is that Step 2 is not contractive, which means that may diverge/explode. To address this, we introduce the Exact Relative Value Iteration algorithm. The solution is Exact Relative Iteration
Exact Relative Value Iteration (in DP Settings).
- Initialize: iteration number, value function for reference state, tolerance, reference state ()
- Update Value : using reference state written on equation below
- Check Convergence : , where if yes repeat 2 else continue to 4
- Output Greedy Policy :
Exact Relative Value Iteration (in DP Settings).
- Initialize: iteration number, value function, tolerance and reference state
- Update value : using reference state written on equation below
- Check Convergence, if yes repeat 2 else 4
- Output Greedy Policy :
Where is an approximation of and is an approximation of
Algorithm Summary
Dynamic Programming (DP) Methods
-
Setting: Model-based (known transition probabilities and reward function )
-
Key Assumption: Complete knowledge of the MDP dynamics
-
Policy Evaluation (PE). Computes the value function for a given policy by iteratively applying the Bellman expectation equation:
- Policy Improvement (PI). Creates a better policy by acting greedily with respect to the current value function:
- Policy Iteration. Alternates between policy evaluation and policy improvement until convergence:
- Initialize policy arbitrarily
- Policy Evaluation: Compute precisely
- Policy Improvement: Compute from
- If , return optimal policy ; otherwise set and go to step 2
- Value Iteration. Combines policy evaluation and improvement into a single update:
Mental Model: DP methods learn from complete knowledge of the MDP dynamics, making them particularly effective for tasks where the dynamics are known.
Monte Carlo (MC) Methods
-
Setting: Model-free, episodic environments
-
Key Assumption: Access to complete episodes, but no knowledge of transition dynamics
-
First-Visit MC. Updates value function based on the first visit to a state in each episode:
Where is the return from time until the episode terminates at time .
-
Every-Visit MC. Similar to first-visit, but updates based on every visit to a state in an episode.
-
MC Control with Exploring Starts. Combines MC policy evaluation with policy improvement:
- Initialize arbitrary policy and value function
- Generate episode using exploring starts (begin in random state-action pairs)
- For each in the episode, update toward the return
- Improve policy:
- Mental Model: MC methods learn from experience by averaging returns from complete episodes, making them particularly effective for episodic tasks where gathering complete trajectories is feasible.
Temporal-Difference (TD) Learning
-
Setting: Model-free, can work in both episodic and continuing tasks
-
Key Assumption: No knowledge of dynamics, but can bootstrap from incomplete episodes
-
TD(0) for Policy Evaluation. Updates value estimates toward a bootstrapped target:
Where is the TD target and is the TD error .
- SARSA (On-Policy TD Control). Updates Q-values using the current policy’s next action:
- Q-Learning (Off-Policy TD Control). Updates Q-values using the maximum next action value, regardless of the policy followed:
- Q-Learning for Discounted Return (-Learning). Specifically optimizes for discounted returns in the off-policy setting:
- Mental Model: TD methods blend ideas from MC and DP—they learn from experience like MC but bootstrap like DP, allowing for online, incremental learning without requiring complete episodes.
Function Approximation Methods
-
Setting: Large or continuous state spaces where tabular methods become impractical
-
Least-Squares Temporal Difference (LSTD). Uses linear function approximation with feature vectors:
Where:
- is the feature vector for state
- is a regularization parameter
- Mental Model: Function approximation methods generalize experience across similar states, enabling reinforcement learning in complex environments where enumerating all states is impossible.
Policy Approximation Methods
-
Setting: Continuous action spaces or where stochastic policies are beneficial
-
Policy Gradient (REINFORCE). Directly optimizes policy parameters via gradient ascent:
Where is the return from time step .
- Policy Gradient with Baseline. Reduces variance by subtracting a baseline value:
Common baseline: , the state value function.
-
Actor-Critic Methods. Combine policy gradient (actor) with value function approximation (critic):
- Critic: Updates value function via TD learning
- Actor: Updates policy parameters using critic’s value estimates
Where is the TD error.
-
Mental Model: Policy-based methods directly optimize the policy, avoiding the limitations of value-based approaches in continuous action spaces and naturally handling stochastic policies.
Important Takeaways
RL Algorithm Selection Framework:
-
If model is known: Use Dynamic Programming methods
- For efficiency: Value Iteration
- For policy stability: Policy Iteration
-
If model is unknown (model-free):
- For episodic tasks with manageable episodes: Monte Carlo methods
- For continuing tasks or when bootstrapping is beneficial: TD methods
- For off-policy learning: Q-Learning
- For continuous action spaces: Policy Gradient methods
- For reduced variance: Actor-Critic methods
-
For large state/action spaces:
- Linear approximation: LSTD
- Non-linear approximation: Deep RL methods (DQN, DDPG, PPO, etc.)
Remember: The core insight across all RL algorithms is finding the balance between exploration (gathering information) and exploitation (maximizing reward), while effectively handling the credit assignment problem (which actions led to which outcomes).