Prof. Dr. Sebastian Peitz
Chair of Safe Autonomous Systems, TU Dortmund
| Chapter | Topic | Content |
|---|---|---|
| Basics & tabular methods | ||
| 1-5 | Bandits, MDPs, Dynamic Programming, Monte Carlo, TD Learning | RL basics in finite dimensions |
| Deep-learning-based methods | ||
| 6-13 | DQN, policy gradients, actor-critic, PPO/SAC, exploration | Deep RL from basics to modern algorithms |
| Model-Based Control | ||
| 14-15 | Optimal & feedback control, MPC, planning, model-based RL | Planning & control when we know the model |
| Advanced Topics | ||
| 16 | Offline reinforcement learning | RL with a static, given dataset |
Source: Medium.com.
Source: Innovation campus future mobility.
\(\pluspoint\) Simple to implement.
\(\pluspoint\) No environment interaction during training.
\(\pluspoint\) Very fast.
\(\minuspoint\) Compounding errors / covariate shift: A small error at step one puts the agent in a state it has never seen before, causing increasingly poor decisions.
\(\minuspoint\) Assumes i.i.d. data distribution, which is false in sequential environments.
\(\pluspoint\) Robust to compounding errors.
\(\pluspoint\) Reward function can transfer well even if the environment changes slightly.
\(\minuspoint\) Expensive inner-loop problem: RL training in each iteration.
\(\minuspoint\) Mathematically underdetermined (many different reward functions can explain the same expert behavior).
\(\pluspoint\) Directly fixes covariate shift.
\(\pluspoint\) Forces the agent to learn how to recover from its own mistakes.
\(\minuspoint\) Requires an expert to be constantly available and online during training to label data.
\(\minuspoint\) Exhausting for humans and frequently impossible for complex setups.
\(\pluspoint\) Mimicks entire trajectories, not just single transitions as BC.
\(\pluspoint\) No expensive inner loop as in IRL.
\(\pluspoint\) Does not require an interactive expert like DAgger.
\(\minuspoint\) Inherits GAN instabilities (mode collapse, highly sensitive hyperparameters).
\(\minuspoint\) Very data hungry.
| Algorithm (class) | Key concept |
|---|---|
| Behavior cloning (BC) | Copy data (i.e., “expert” as closely as possible). |
| Inverse RL (IRL) | Identify reward from data \(\Rightarrow\) then standard RL. |
| Dataset aggregation (DAgger) | Expert corrects faulty behavior (meaning there is an online component). |
| Generative advarsarial imitation learning (GAIL) | The generative version of BC mimicking trajectories. |
BUT: What if we cannot get new data, but we still want to be better than the performance of the dataset?
Maybe the data came from
\(\Rightarrow\) Offline reinforcement learning!
\(\Rightarrow\) Data without optimization doesn’t allow us to solve new problems in new ways.
\(\Rightarrow\) Optimization without data is hard to apply to the real world outside of simulators.
Offline reinforcement learning: Use prior data for RL training, without any interactions with the environment!
Goal: Given a dataset \(\Dc\), learn the best possible policy \(\piphi\) that is supported by the dataset.
Stitching (Source: Sergey Levine’s CS285 lecture).
Takeaway: It’s not just imitation learning!
Intuition: Get order from chaos.
Fundamental problem: counterfactual queries
Inspired by Sergey Levine’s CS285 lecture.
\[ Q_\theta \gets r + \gamma \E_{s'\sim \psprimesa}\Big[\underbrace{\max_{a'\in\Ac} Q_{\bar{\theta}}(s',a')}_{\textbf{can go OOD}}\Big] \]
Formally: \[\begin{align*} \Dc &= \set{(s_i,a_i,s'_i,r_i)}_{i=1}^N \\ s &\sim \rho_\beta(s) \\ a &\sim \pi_\beta\agivenb{a}{s} \quad \fragment{ \text{(generally unknown)} } \\ s' &\sim \psprimesa \end{align*}\]
\[\text{RL objective:}\quad \max_\phi \sum_{t=0}^T \Expsub{\gamma^t r_t}{s\sim\rho_\phi, a\sim \piphi\agivenb{\cdot}{s}}\]
\[\theta = \arg\min_{\hat\theta} \Expsub{\cbracket{f_{\hat{\theta}}(x) - y}^2}{x\sim p(x), y\sim p\agivenb{y}{x}}\]
Question: Given some \(x^*\), is \(f(x^*)\) correct?
\[ x^* = \arg\max_x f_\theta(x) \]
💡 This is exactly what we’re exploiting in adversarial learning!
\[\begin{align*} \phi &= \arg\min_{\hat{\theta}} \Expsub{\norm{Q_\theta(s,a)-y}^2}{s\sim\rho_\beta,a\sim \textcolor{red}{\pi_\beta\agivenb{\cdot}{s}}}, \\ y_i &= r_i + \gamma \Expsub{Q_\theta(s'_i,a')}{s'_i\sim\rho_\beta,a'\sim \textcolor{blue}{\piphi\agivenb{\cdot}{s'_i}}} \end{align*}\]
\[f = \arg\min_{\hat f} \Expsub{\norm{f(s,a)-s'}_2^2}{s\sim\rho_\beta,a\sim\textcolor{red}{\pi_\beta\agivenb{\cdot}{s}}, s'\sim \psprimesa} \]
The following strategies (or classes of approaches) are the most common ones today:
Common theme: “Maximize return while staying close to the dataset.
Methods of the type \(\eqref{eq:OFF_ACBC}\) are often termed “AC + BC”:
actor-critic plus behavior cloning,
as the term \(\log\piphi\agivenb{a}{s}\) is typical in BC methods. Popular examples:
\(\bullet\) TD3 + BC, \(\quad\bullet\) DDPG + BC,
\(\bullet\) SAC + BC.
Mode seeking vs. mode covering (inspired by Sergey Levine’s CS285 lecture).
\(\circ\) Variational autoencoder (VAE) (Kingma and Welling 2013):
Adapted from Wikipedia.
\(\circ\) Gaussian policy: \(\pi_\psi\agivenb{a}{s} = \Nc(\mu_\psi(s), \sigma^2_\psi(s))\).
\(\circ\) Generative modeling
Source: Medium.com.
\(\pluspoint\) Mathematically tractable / closed-form solutions.
\(\pluspoint\) Direct penalization of OOD actions.
\(\pluspoint\) Smooth/soft regularization with tunable hyperparameter \(\lambda\).
\(\minuspoint\) Asymmetry (forward KL vs. reverse KL).
\(\minuspoint\) Overly conservative in unseen regions.
\(\minuspoint\) Sensitive to behavior policy estimation.
\(\pluspoint\) Bypasses densitiy estimation / works on samples .
\(\pluspoint\) No infinite penalty on unsupported actions.
\(\pluspoint\) Allows for multimodel generalization.
\(\minuspoint\) Computationally expensive.
\(\minuspoint\) High sample variance / hard to tune the kernel bandwidth.
\(\minuspoint\) Curse of dimensionality.
In (Wu, Tucker, and Nachum 2019), the authors present the Behavior Regularized Actor-Critic (BRAC).
Source: Berkley AI Research (BAIR) blog.
Drawbacks:
Drawbacks:
Instead of constraining the policy explicitly or penalizing unseen actions, IQL constrains the optimization implicitly by querying the \(Q\)-function only on state-action pairs that actually exist in the dataset.
Benefits of IQL (Kostrikov, Nair, and Levine 2021):
\(\pluspoint\) Simple to implement.
\(\minuspoint\) Single-step policy improvement.
\(\minuspoint\) Because AWR relies on static dataset returns \(g\) rather than propagating future values via Bellman backups (\(Q(s,a) = r + \gamma \max V(s')\)), it cannot stitch trajectories.
Approach: Expectile regression plus AWR!
Given: A dataset \(\Dc\)
Note: If we can get access to new data, the above procedure can be repeated iteratively with incoming data, after updating the replay buffer \(\Dc\).
💡 In principle, we could also train \(\eqref{eq:OFF_iql_q}\) directly, without training a separate value network via \(\eqref{eq:OFF_iql_value}\). But the authors of (Kostrikov, Nair, and Levine 2021) argue that this can lead to the exploitation of “lucky samples”, whereas the value averages out such conincidences.