EasyDeepLearn
Reinforcement Learning · section 1 of 12

Fundamentals & MDPs

56 interview questions on fundamentals & mdps, each answered in full. Free to read, no account needed.

Define the RL setting: agent, environment, state, action, reward, policy.

easy
  • An agent observes a state s from the environment, picks an action a via its policy π(as)\pi(a \mid s), receives a reward r and a new state s'.
  • The goal is to maximize the expected cumulative discounted reward (return).
  • Formalized as a Markov Decision Process (S, A, P, R, gamma).
  • The agent learns pi (or a value function) from interaction with the environment.

On-policy vs off-policy learning — what's the difference?

medium
  • On-policy methods learn from data generated by the current policy (e.g., SARSA, REINFORCE, PPO).
  • Off-policy methods learn from data collected by a different (behavior) policy — this enables replay buffers and reusing old data (e.g., Q-learning, DQN, SAC, DDPG).
  • Off-policy is more sample-efficient; on-policy is often more stable and easier to tune.

What does the Bellman equation say?

medium
  • For a policy pi: Vπ(s)  =  E[r  +  γ    Vπ(s)]V_{\pi}(s)\; = \;E[r\; + \;\gamma\; \cdot \;V_{\pi}(s)].
  • For the optimal value: V(s)  =  maxaV \cdot (s)\; = \;\operatorname{max}_{a} E[r + gamma · V*(s')].
  • It expresses the value of a state as the immediate reward plus the discounted value of the next state.
  • Solving the Bellman equation is the core of dynamic programming, TD learning, and Q-learning.

What role does the discount factor gamma play?

easy
  • Gamma in [0, 1) weights how much future rewards matter compared to immediate ones.
  • Gamma close to 0 = myopic (only care about immediate reward); gamma close to 1 = far-sighted (care about long-term).
  • Also ensures the return sum converges in infinite-horizon problems.
  • Choose based on the task horizon and stability of value estimates.

What is the credit assignment problem?

hard
  • In sequential tasks with delayed rewards, it's hard to know which past action caused a given reward.
  • Long horizons, sparse rewards, and stochasticity make it worse.
  • Methods that help: temporal-difference learning, eligibility traces, n-step returns, GAE (generalized advantage estimation), and hindsight experience replay.

Model-based vs model-free RL — when do you prefer each?

medium
  • Model-based RL learns a model of the environment (transitions and rewards) and uses it to plan (e.g., MuZero, Dreamer).
  • It is more sample-efficient — great when real interactions are expensive (robotics, healthcare).
  • Model-free RL learns policy or values directly from experience — simpler, and it wins when the environment is complex/hard to model.
  • Modern successes often combine both.

What is the Markov property and why does it matter?

medium
  • P(st+1    st,  at,  st1,  ,  s0)  =  P(st+1    st,  at)P(s_{t + 1}\; \mid \;s_{t}, \;a_{t}, \;s_{t - 1}, \;, \;s_{0})\; = \;P(s_{t + 1}\; \mid \;s_{t}, \;a_{t}) — the future depends only on the current state, not the history.
  • Enables efficient RL: policy and value functions depend on state alone, not history.
  • When violated (partial observability), we use POMDPs, recurrent nets, or state-stacking (Atari frame stack) to recover a Markovian representation.
#fundamentals#theoryPermalink & quiz →

POMDP — how does it differ from MDP?

hard
  • Partially Observable MDP: agent observes oto_{t} which gives incomplete info about state sts_{t}.
  • Add observation function O(o    s)O(o\; \mid \;s).
  • Belief state b(s) = posterior over s given history → sufficient statistic for optimal policy.
  • Solving POMDPs is PSPACE-hard exactly; approximate via RNN/LSTM encoding of history, or particle filter beliefs, or transformer over recent observations.
  • Realistic robotics / partial-info games.
#fundamentals#theoryPermalink & quiz →

V(s) vs Q(s, a) — the difference.

easy
  • V(s) = expected return from state s following policy π.
  • Q(s, a) = expected return from state s taking action a THEN following π.
  • Relationship: V(s)  =  ΣaV(s)\; = \;{\Sigma}_{a} π(as){\pi}(a \mid s) Q(s, a).
  • Optimal: V(s)  =  maxaV \cdot (s)\; = \;\operatorname{max}_{a} Q*(s, a).
  • Q allows action selection without a model (Q-learning); V requires a model to compute argmax over actions.
  • Actor-critic methods often estimate V (simpler) but use per-action advantage A = Q - V.
#fundamentals#value-methodsPermalink & quiz →

What is the advantage function?

medium
  • A(s, a) = Q(s, a) - V(s) → how much better is action a than the average action in state s.
  • Reduces variance in policy-gradient estimates (baseline subtraction preserves the gradient in expectation but shrinks variance).
  • Standard estimators: TD-residual A ≈ r + γ V(s') - V(s) (biased low variance); n-step or GAE for bias-variance tradeoff.
  • Used in A2C, PPO, TRPO.
#theory#actor-criticPermalink & quiz →

Different notions of return — MC, TD(0), n-step, GAE.

hard
  • MC return: Gt  =  ΣG_{t}\; = \;{\Sigma} γk{\gamma}^{k} rt+kr_{t + k} — full episode, unbiased, high variance.
  • TD(0): rt  +  γr_{t}\; + \;{\gamma} V(st+1)V(s_{t + 1}) — biased (bootstrap), low variance. n-step: rt  +  γr_{t}\; + \;{\gamma} rt+1r_{t + 1} + ... + γn1{\gamma}^{n - 1} rt+n1  +  γnr_{t + n - 1}\; + \;{\gamma}^{n} V(st+n)V(s_{t + n}) — knob n interpolates.
  • GAE (Generalized Advantage Estimation): weighted sum over n-step advantages with parameter λ — smooth bias-variance tradeoff.
  • GAE with λ ≈ 0.95 is default in PPO.
#theory#actor-criticPermalink & quiz →

What is TD error?

medium
  • δt  =  rt  +  γ{\delta}_{t}\; = \;r_{t}\; + \;{\gamma} V(st+1)    V(st)V(s_{t + 1})\; - \;V(s_{t}) — difference between the bootstrapped target and current estimate.
  • Drives all TD-based updates: V ← V + α δ, Q-learning target is δ with max in bootstrap.
  • Positive δ = state was better than expected; negative = worse.
  • Fundamental signal for value learning.
  • Modern uses: PPO advantage, GAE, prioritized replay weighting (δ magnitude).
#theory#value-methodsPermalink & quiz →

Policy iteration vs value iteration.

medium
  • Policy iteration: alternate (a) policy evaluation (compute  Vπ  by  solving  Bellman  until  convergence)(\mathrm{compute}\;V{\pi}\;\mathrm{by}\;\mathrm{solving}\;\mathrm{Bellman}\;\mathrm{until}\;\mathrm{convergence}), (b) policy improvement (π    greedy  on  Vπ)({\pi}\; \leftarrow \;\mathrm{greedy}\;\mathrm{on}\;V{\pi}).
  • Converges in finite steps.
  • Value iteration: V ← maxa\operatorname{max}_{a} (r + γ V(s')) repeatedly — combines both in one step.
  • Value iteration is a special case of policy iteration with only one evaluation sweep.
  • Both are dynamic programming, require the model.

TD(λ) — how does it work?

hard
  • Interpolates between TD(0) (λ=0, low variance biased) and MC (λ=1, unbiased high variance).
  • Uses eligibility traces et(s)e_{t}(s) that decay by γλ each step and increment at visited states.
  • Update: V(s) ← V(s) + α δ e(s) for every s.
  • Online, single-pass, works with function approximation.
  • Foundation of Sutton-Barto RL; GAE is essentially TD(λ) for advantages.

Monte Carlo methods in RL — when to use?

medium
  • Estimate V_π(s) or Q_π(s, a) via sample-average returns from full episodes.
  • Unbiased (no bootstrap error), but only usable in episodic tasks + high variance.
  • Every-visit MC: average over every visit to s in an episode.
  • First-visit MC: only first occurrence.
  • Rare in modern deep RL (TD methods better for long / continuous tasks) but foundation of return-conditioned methods and offline RL (Decision Transformer).

Tabular vs function-approximation RL — the challenge.

hard
  • Tabular: one entry per (s, a) — convergence guaranteed but doesn't scale.
  • Function approximation (neural nets): scales to huge state spaces but breaks convergence guarantees.
  • The 'deadly triad': off-policy + function approximation + bootstrapping → potential divergence.
  • Modern deep RL uses tricks (target networks, replay, gradient clipping) to work despite the triad.
  • Understanding this trap is key.
#theory#deep-rlPermalink & quiz →

Why do Bellman operators converge?

hard
  • Bellman operator T is a γ-contraction in the max norm: ||TV1    TV2\mathrm{TV}_{1}\; - \;\mathrm{TV}_{2}||_∞ ≤ γ ||V1    V2V_{1}\; - \;V_{2}||_∞.
  • By Banach fixed-point theorem, iterating T converges to unique fixed point V* at rate γk{\gamma}^{k}.
  • Underlies value iteration, TD(0) convergence in tabular case, policy iteration.
  • Function approximation can break the contraction (projected Bellman operator may not contract) → divergence.

TD vs MC — how they differ in bias-variance.

medium
  • MC: use full episodic return GtG_{t} → unbiased estimator of V_π, but high variance (many random rewards over full trajectory).
  • TD(0): use rt  +  γr_{t}\; + \;{\gamma} V(s') → biased (bootstrap error from imperfect V estimate) but lower variance (only one reward). n-step and TD(λ) interpolate.
  • Choice: TD when episodes are long or variance dominates, MC when bias is intolerable + episodes short.

Linear function approximation for value functions — pros and cons.

medium
  • V(s) ≈ w'φ(s) with hand-crafted features φ.
  • Convergence guarantees under on-policy (LSPI, LSTD) but poor scaling; requires domain-designed features.
  • Baird's counterexample: off-policy + linear FA + bootstrap → divergence.
  • Foundation of classic RL theory (Sutton, Bertsekas), superseded by neural nets in practice.
  • Still valuable in tiny state spaces, small-embedded systems, or theoretical proofs.

When does tabular Q-learning provably converge?

hard
  • (1) All (s, a) visited infinitely often (adequate exploration), (2) Learning rate α satisfies Robbins-Monro: Σα = ∞, Σα2{\Sigma}{\alpha}^{2} < ∞, (3) Bounded rewards.
  • Under these, QkQ_{k} → Q* almost surely.
  • Real deep-RL breaks (1) severely (state space huge) and mostly ignores (2).
  • Classical theory guides intuition but doesn't guarantee anything in modern deep RL — that's why empirical care matters.

When does tabular Q-learning fail in practice?

medium
  • (1) State space too large: even discretized MazeGrid > 1M states makes tabular infeasible.
  • (2) Continuous features: discretization fights curse of dimensionality.
  • (3) Function structure across states unexploited (Q for nearby states should be similar → NN generalizes; tabular treats them independently).
  • (4) Slow: no generalization means each state must be visited separately.
  • Every real RL problem > toy uses function approximation (usually NN).
#theory#deep-rlPermalink & quiz →

Why is subtracting a baseline OK in policy gradient?

hard
  • Because E[b(s)  log  π(as)]  =  0E[b(s)\; \nabla \operatorname{log}\;{\pi}(a \mid s)]\; = \;0 for any function b(s) independent of a.
  • This adds no bias but shrinks variance by centering the reward signal.
  • Choice of baseline: constant, moving average of returns, or state-dependent V(s) (best — cancels state-level variance).
  • Advantage function A(s, a) = Q(s, a) - V(s) is the popular choice → gives us actor-critic architectures.
#policy-methods#theoryPermalink & quiz →

The log-derivative trick — why is it central to policy gradients?

hard
  • For expectation of f under π_θ: ∇_θ E_π[f] = E_π[f  θ  log  πθ][f\; \nabla {\theta}\;\operatorname{log}\;{\pi}{\theta}].
  • Enables Monte Carlo estimation of gradient using only samples from π and gradient of log-likelihood — no need to differentiate through the reward function or the environment.
  • Foundation of REINFORCE, actor-critic, natural gradient, and importance sampling.
  • Trick: π_θ(x) ∇_θ log π_θ(x) = ∇_θ π_θ(x).
#theory#policy-methodsPermalink & quiz →

What is natural gradient in policy gradient methods?

hard
  • Follow the direction of steepest ascent in policy space measured by KL divergence (Fisher information metric) instead of Euclidean.
  • Update: θ ← θ + α F(θ)1F({\theta}) - 1 ∇J where F is Fisher information matrix.
  • Invariant to reparameterization.
  • Foundation of TRPO (approximate) and NPG.
  • Practically: F1F^{- 1} expensive — use Conjugate Gradient (TRPO) or K-FAC.
  • Underpins why PPO's clipping approximates a trust region.
#policy-methods#theoryPermalink & quiz →

Reparameterization trick in stochastic policies.

hard
  • For continuous stochastic policy π_θ(as)  =  N(μθ(s),  σθ(s)2)(a \mid s)\; = \;N({\mu}{\theta}(s), \;{\sigma}{\theta}(s)^{2}), sample a = μ + σ ⊙ ε with ε ~ N(0, I) → gradient flows through μ, σ directly.
  • Enables low-variance path-wise gradients rather than score-function REINFORCE-style gradients.
  • Used in SAC.
  • Also foundation of VAEs.
  • Doesn't work directly for discrete actions (use Gumbel-softmax as continuous relaxation).
#policy-methods#deep-rl#theoryPermalink & quiz →

GAE — Generalized Advantage Estimation formula.

hard
  • AtGAE(γ,  λ)  =  Σl=0A_{t}^{\mathrm{GAE}({\gamma}, \;{\lambda})}\; = \;{\Sigma}_{l = 0}^∞ (γλ)l({\gamma}{\lambda})l δt+l{\delta}_{t + l} where δt  =  rt  +  γ{\delta}_{t}\; = \;r_{t}\; + \;{\gamma} V(st+1)    V(st)V(s_{t + 1})\; - \;V(s_{t}). λ = 0 → TD(0) advantage (biased, low var). λ = 1 → MC advantage (unbiased, high var).
  • Typical λ = 0.95 in PPO.
  • Provides smooth bias-variance tradeoff.
  • Compute efficiently backward from end of trajectory.
  • Standard advantage estimator in modern policy gradient methods.
#theory#actor-criticPermalink & quiz →

Off-policy policy gradient — how does importance sampling enter?

hard
  • Data collected under behavior πb{\pi}_{b}, but want to update target π_θ: use importance weight ρ = π_θ(as)/πb(as)(a \mid s) / {\pi}_{b}(a \mid s) → ∇J ≈ E_π_b[ρ ∇log π_θ · A].
  • Weight variance explodes when π_θ far from πb{\pi}_{b}.
  • Solutions: clip ratio (PPO), truncate importance weights (Retrace, V-trace in IMPALA), or use deterministic policy gradient (no IS needed — DDPG/SAC).
#policy-methods#theoryPermalink & quiz →

V-trace off-policy correction formula.

hard
  • vs  =  V(ss)  +  Σtv_{s}\; = \;V(s_{s})\; + \;{\Sigma}_{t} γts{\gamma}^{t - s} (Π  ρi)({\Pi}\;{\rho}_{i}) δtV{\delta}_{t}^{V} with δtV  =  rt  +  γ{\delta}_{t}^{V}\; = \;r_{t}\; + \;{\gamma} V(st+1)    V(st)V(s_{t + 1})\; - \;V(s_{t}), and ρi  =  min(ρ,  π/μ){\rho}_{i}\; = \;\operatorname{min}({\rho}, \;{\pi} / {\mu}) clipped importance ratio.
  • Different clipping thresholds for ρ (target) vs c (trace) allow bias-variance trade.
  • Off-policy corrections without exploding variance.
  • Enables IMPALA-style distributed training.
  • Modern reference for scalable off-policy actor-critic.
#actor-critic#theoryPermalink & quiz →

Retrace(λ) — safe off-policy Q updates.

hard
  • Munos et al. 2016.
  • Q-target: r + γ Σl{\Sigma}_{l} (γλ)l({\gamma}{\lambda})l Πi=1l{\Pi}_{i = 1}^{l} cic_{i} δt+l{\delta}_{t + l} with ci  =  λc_{i}\; = \;{\lambda} min(1,  π/πb)\operatorname{min}(1, \;{\pi} / {\pi}_{b}).
  • Guaranteed convergence in off-policy setting + low variance from truncation.
  • Underlies ACER algorithm.
  • Elegant unification of importance sampling + eligibility traces.
  • Modern off-policy actor-critics still cite Retrace's design principles.
#actor-critic#theoryPermalink & quiz →

Policy gradient as mirror descent — the connection.

hard
  • Policy gradient can be viewed as mirror descent on the policy simplex with the KL divergence as Bregman divergence.
  • Natural gradient = mirror descent step in log-policy space.
  • TRPO's KL constraint is explicit mirror-descent step.
  • This unification (Kakade & Langford, later Vieillard et al.) clarifies why entropy regularization, KL constraints, and log-space parameterization all improve stability.
#theory#policy-methodsPermalink & quiz →

UCB — Upper Confidence Bound for exploration.

medium
  • In bandits: pick a = argmax [Q(a)  +  c  (ln  t  /  na)][Q(a)\; + \;c\; \sqrt (\operatorname{ln}\;t\; / \;n_{a})].
  • Confidence bound term inflates rarely-tried actions.
  • Provides O(√T log T) regret bound.
  • In tree search (PUCT): a = argmax Q + c · πprior{\pi}_{\mathrm{prior}} · √N  /  (1  +  na)N\; / \;(1\; + \;n_{a}).
  • Uses: bandit algorithms, MCTS, contextual bandits.
  • Modern application: exploration bonus in some RL papers (BOOTSTRAPPED DQN, RND).
#exploration#theoryPermalink & quiz →

Model bias in MBRL — the challenge.

hard
  • Learned model has errors that compound over rollout → policy trained in imagined trajectories exploits model exploits.
  • Solutions: (1) short rollouts (MBPO uses only 1-15 steps of imagination between real data), (2) ensemble of models for uncertainty (PETS: use variance to penalize plans), (3) careful data collection (COMBO, MOReL) that regularizes toward known regions, (4) uncertainty-aware planning (avoid uncertain trajectories).
#model-based#theoryPermalink & quiz →

LQR — Linear Quadratic Regulator and where it's still used.

medium
  • For linear dynamics xt+1  =  Ax_{t + 1}\; = \;A xt  +  Bx_{t}\; + \;B ut  +  noiseu_{t}\; + \;\mathrm{noise} and quadratic cost x'Qx + u'Ru, optimal policy is linear in state: u = -K x.
  • Solve via discrete-time Riccati equation.
  • Closed-form + fast + optimal for LQ systems.
  • Basis of iLQR (linearize around trajectory + LQR iteratively) — used in robotics locomotion + humanoid control.
  • Modern MBRL uses iLQR / LQR inside planning loops.
#planning#theoryPermalink & quiz →

When does planning beat learning?

medium
  • (1) Compact known dynamics (games, physics).
  • (2) Long horizons where credit assignment is hard for learning.
  • (3) Rare edge cases (planning can reason zero-shot; learning needs data).
  • (4) Test time compute available.
  • AlphaZero + MuZero show planning + learning outperform either alone.
  • Modern LLM reasoning (o1, DeepSeek-R1) is analogous: test-time 'thinking' as planning augments learned priors.
#planning#theoryPermalink & quiz →

Decision Transformer — how does it recast RL?

hard
  • Chen et al. 2021: treat RL as sequence modeling.
  • Given (return-to-go, state, action) sequence, predict next action autoregressively.
  • Trained on offline trajectories via cross-entropy.
  • At inference, condition on desired return-to-go.
  • Fully removes TD learning + bootstrapping — no value functions.
  • Competitive with offline RL on D4RL.
  • Foundation of return-conditioned RL and modern LLM-based agents.
#offline-rl#theoryPermalink & quiz →

Trajectory Transformer — variant of Decision Transformer.

hard
  • Janner et al. 2021: model entire trajectory (s0,  a0,  r0,  s1,  a1,  r1,  )(s_{0}, \;a_{0}, \;r_{0}, \;s_{1}, \;a_{1}, \;r_{1}, \;) as sequence via GPT-style transformer.
  • Planning via beam search over action tokens in learned model.
  • More flexible than Decision Transformer's return-conditioning: can compute value estimates, do MPC-style planning, etc. Foundation of transformer-based world models / offline RL.
#offline-rl#model-based#theoryPermalink & quiz →

Nash equilibrium in multi-agent RL — what and when?

hard
  • Policy profile (π1,  ,  πn)({\pi}_{1}, \;, \;{\pi}_{n}) where no agent can improve unilaterally.
  • In zero-sum games (Rock-Paper-Scissors, Chess, Go, StarCraft): minmax = maxmin = Nash.
  • Solved via self-play (AlphaZero) or fictitious play + best-response.
  • In mixed-motive / general-sum: multiple Nash equilibria + hard to find.
  • Related concepts: correlated equilibrium, coarse correlated equilibrium (used in AlphaStar).
#multi-agent#theoryPermalink & quiz →

Fictitious play — what is it?

hard
  • Iterative: each iteration, each player computes best response to the empirical distribution of opponents' past strategies.
  • Converges to Nash in zero-sum games (Robinson 1951).
  • Foundation of self-play theory.
  • Modern deep variants: NFSP (Neural Fictitious Self-Play, Heinrich & Silver 2016) — combines RL best response with supervised average-strategy learning.
  • PSRO (Policy Space Response Oracle) generalizes further.
#multi-agent#theoryPermalink & quiz →

Options framework — formalization.

hard
  • Sutton, Precup, Singh 1999.
  • An option = (I, π, β): initiation set I (states where the option can start), intra-option policy π, termination condition β(s) (probability of stopping).
  • High-level policy chooses among options.
  • Bellman equations extend naturally.
  • Foundational abstraction for hierarchical RL.
  • Modern: skill discovery methods (DIAYN, OPAL) auto-discover options from unsupervised interaction.
#policy-methods#theoryPermalink & quiz →

DPO derivation — the key mathematical insight.

hard
  • The optimal policy under KL-constrained reward max is π(yx){\pi} \cdot (y \mid x)πref(yx){\pi}_{\mathrm{ref}}(y \mid x) exp(r(x,  y)/β)\operatorname{exp}(r(x, \;y) / {\beta}).
  • Invert: r(x, y) = β log(π(yx)/πref(yx))  +  const\operatorname{log}({\pi} \cdot (y \mid x) / {\pi}_{\mathrm{ref}}(y \mid x))\; + \;\mathrm{const}.
  • Substitute into Bradley-Terry preference model → loss depends only on π_θ, not r: L(θ) = -E[log  σ(β  log(πθ(ywx)/πref(ywx))    β  log(πθ(ylx)/πref(ylx)))]E[\operatorname{log}\;{\sigma}({\beta}\;\operatorname{log}({\pi}{\theta}(y_{w} \mid x) / {\pi}_{\mathrm{ref}}(y_{w} \mid x))\; - \;{\beta}\;\operatorname{log}({\pi}{\theta}(y_{l} \mid x) / {\pi}_{\mathrm{ref}}(y_{l} \mid x)))].
  • Skips reward model + PPO entirely; direct MLE on preference data.
#llm#alignment#theoryPermalink & quiz →

Meta-RL — learning to learn.

hard
  • Train agent across a distribution of related tasks so it adapts to new tasks quickly.
  • Approaches: (1) Recurrent meta-RL (RL2)(\mathrm{RL}^{2}): LSTM policy learns adaptation from context.
  • (2) MAML for RL: gradient-based meta-learning that produces initialization enabling few-step adaptation.
  • (3) PEARL: context-conditioned policy with latent task variable.
  • Applications: fast robot adaptation, personalized recommenders.
  • Modern LLM in-context learning is analogous.

How does transfer learning work in RL?

medium
  • Warm-start new policy from related-task policy (fine-tune) or pretrained representation.
  • Techniques: (1) Progressive networks (Rusu et al.).
  • (2) Distillation from teacher policy.
  • (3) Pretrained visual encoders (VC-1, R3M) for vision-based robotics.
  • (4) Task embedding + shared trunk.
  • Modern: SL-pretrained transformer + RL fine-tune (LLM RLHF is transfer RL).
  • Challenge: negative transfer if source task too different.
#theory#applicationsPermalink & quiz →

Successor features — what and why?

hard
  • Barreto et al. 2017.
  • Decompose reward as r = φ(s, a, s') · w.
  • Value function factors: V(s) = ψ(s) · w where ψ(s)  =  E[Σ  γk  φ(sk,  ak,  sk)]{\psi}(s)\; = \;E[{\Sigma}\;{\gamma}^{k}\;{\varphi}(s_{k}, \;a_{k}, \;sk)] are 'successor features'.
  • New task (new w) can reuse learned ψ — instant transfer without relearning value function.
  • Foundation of generalized policy improvement (GPI) across tasks; applications in continual learning + universal RL.

Reward machines — structured reward specification.

hard
  • Represent complex non-Markovian rewards as finite-state automata: state tracks task progress (e.g., 'first find A, then find B').
  • Enables decomposition + credit assignment across sub-goals.
  • Alternative to hand-crafted shaping.
  • Foundation of LTL (Linear Temporal Logic) constrained RL.
  • Applications: robotics multi-step tasks, curriculum learning.
  • Modern extension: neuro-symbolic RL combining reward machines with NNs.
#reward-design#theoryPermalink & quiz →

Potential-based reward shaping — why is it safe?

hard
  • Ng, Harada, Russell 1999.
  • Add r'(s, a, s') = r(s, a, s') + γΦ(s') - Φ(s).
  • Any potential function Φ is safe: doesn't change optimal policy (only value baseline).
  • Because Σt{\Sigma}_{t} γt{\gamma}^{t} (γΦ(st+1)    Φ(st))({\gamma}{\Phi}(s_{t + 1})\; - \;{\Phi}(s_{t})) telescopes to  Φ(s0)  +  γT\mathrm{to}\; - {\Phi}(s_{0})\; + \;{\gamma}^{T} Φ(sT){\Phi}(s_{T}) → same argmax over policies.
  • Enables safe reward engineering without changing task.
  • Standard technique in robotics reward design.
#reward-design#theoryPermalink & quiz →

How do you handle partial observability in deep RL?

medium
  • (1) State-stacking: last k observations as input (DQN frame stack).
  • (2) RNN / LSTM policy: hidden state summarizes history (R2D2).
  • (3) Transformer over recent history (Decision Transformer).
  • (4) Belief-state approximation via VAE or particle filter.
  • (5) Reward-conditioned models.
  • Rule: for weakly non-Markovian (short history matters), stacking + short RNN suffices.
  • For long-horizon dependencies, transformer or explicit memory.
#fundamentals#theoryPermalink & quiz →

LQG — Linear Quadratic Gaussian control.

hard
  • Extension of LQR to noisy partial observations.
  • Optimal controller = Kalman filter (state estimation) + LQR (control).
  • Certainty equivalence: LQ control on filtered state estimate is optimal.
  • Bridge between control theory + POMDP-RL.
  • Modern: neural networks approximate both filter + controller.
  • Foundation of classical control theory taught in every EE / ME curriculum.
#planning#theoryPermalink & quiz →

Generalization in RL — why is it hard?

hard
  • Deep RL overfits to training environments — Cobbe et al. 2019 showed Atari-trained agents fail on procedurally-generated variants.
  • Root causes: (1) narrow training distribution.
  • (2) Memorization of trajectory-specific features.
  • Fixes: (1) diverse env procedurally (ProcGen benchmark).
  • (2) Regularization (dropout, weight decay).
  • (3) Data augmentation.
  • (4) Domain randomization.
  • (5) Learn invariant / causal features.
  • (6) Meta-learning.
  • Ongoing challenge.
#theory#engineeringPermalink & quiz →

Catastrophic forgetting in continual RL.

hard
  • When switching between tasks or environments, RL agents forget previously learned skills.
  • Root: SGD on new-task data overwrites old-task weights.
  • Fixes: (1) EWC (Elastic Weight Consolidation): regularize toward important old-task weights.
  • (2) Progressive networks: freeze old columns + add new.
  • (3) Rehearsal: replay old experiences.
  • (4) Modular networks: separate columns per task.
  • (5) Meta-learning shared initialization.
  • Ongoing research area.
#deep-rl#theoryPermalink & quiz →

Generalist agents — Gato and DeepMind's approach.

hard
  • Reed et al. 2022 (Gato): single transformer trained on 600+ tasks (Atari, robotics, chat, image captioning) as tokenized sequences.
  • Uses cross-attention over task tokens.
  • Modest per-task performance, but shows one architecture can handle many domains.
  • Followed by RT-2 (robotics VLA), OpenVLA, PI-0 (Pi Zero) — multi-task foundation models for embodied AI.
  • Modern trend: transformer + massive data across modalities.
#theory#applicationsPermalink & quiz →

Quantile regression in QR-DQN — the loss.

hard
  • Predict N quantiles τi{\tau}_{i} of return distribution.
  • Loss on target y for quantile prediction ZiZ_{i} at level τi{\tau}_{i}: ρ_τ(y    Zi)(y\; - \;Z_{i}) where ρ_τ(u) = u(τ - I(u < 0)) (asymmetric absolute error).
  • Total loss  =  Σi\mathrm{loss}\; = \;{\Sigma}_{i} E[ρτi(TDtarget    Zi)]E[{\rho}{\tau}_{i}(\mathrm{TD}_{\mathrm{target}}\; - \;Z_{i})].
  • Trains each quantile to correct level.
  • Extension of C51 to continuous quantiles.
  • Foundation of IQN.
#value-methods#theoryPermalink & quiz →

Deadly triad — the three ingredients.

hard
  • (1) Function approximation (neural nets, not tabular).
  • (2) Bootstrapping (TD target uses V, not full MC).
  • (3) Off-policy data.
  • Combining all three can cause divergence (Baird's counterexample: linear FA + off-policy TD → weights blow up).
  • Modern deep RL usually has all three (DQN, SAC) — works empirically via replay + target nets + gradient clip.
  • Understanding this triad is core RL theory.

Where is RL heading (2025+)?

hard
  • Trends: (1) RL for reasoning: verifier-based training becomes standard for math / code / science (o1, R1 continue).
  • (2) Agent RL: WebArena / SWE-bench become primary post-training targets.
  • (3) Multi-turn RL for LLMs: not just single response.
  • (4) Test-time compute as first-class tuning knob.
  • (5) Robotics VLA at scale (RT-2 successors).
  • (6) World models finally matching model-free (Dreamer V3+).
  • (7) Continual + open-ended learning.
  • Frontier: superhuman capability via search + RL + LLM.

How do you choose the discount factor, and what goes wrong at the extremes?

medium
  • It sets the effective horizon, roughly one over one minus gamma steps, so pick it from how far ahead consequences actually matter in your problem rather than by convention.
  • Too low and the agent is myopic: it ignores delayed reward entirely, which in a game looks like refusing to invest a move for a later gain.
  • Too high and two things degrade, because the variance of returns grows with horizon length and the value function has to represent a much larger range, so bootstrapped estimates become unstable and slow to converge.
  • In episodic tasks with a natural end, a value near one is defensible; in continuing tasks it is a variance knob you tune.
  • A common practical trick is to train with a lower value and anneal it upward as the value function stabilizes.
#theory#fundamentalsPermalink & quiz →

What is the deadly triad and how do practical algorithms cope with it?

hard
  • The combination of function approximation, bootstrapping, and off-policy learning.
  • Each is fine alone, but together they can make value estimates diverge, because a bootstrapped target is computed from the same approximator being updated, and off-policy data means the states are not distributed according to the policy whose values you are fitting.
  • Deep Q-learning uses all three, which is why it needs the stabilizers it has: a target network to freeze the bootstrap target for a while, a replay buffer to decorrelate updates, and reward or gradient clipping to bound the magnitude.
  • Double Q-learning additionally removes the maximization bias that makes divergence more likely.
  • None of these are cosmetic; removing any one of them typically makes training visibly unstable.
#deep-rl#theoryPermalink & quiz →

Why can't you just run Q-learning on a fixed dataset?

hard
  • Because the maximization step queries actions the dataset never contains.
  • The target takes a maximum over actions, and for unseen actions the network's value is an extrapolation with no data to correct it, so overestimation errors get selected precisely because they are overestimates.
  • Bootstrapping then propagates those inflated values through the dataset, and the learned policy prefers exactly the actions nobody ever tried.
  • Without environment interaction there is no corrective feedback loop, which is what makes offline learning qualitatively different from off-policy learning with a replay buffer.
  • The fixes constrain the policy to the data: behaviour regularization, conservative value penalties on out-of-distribution actions, or filtered imitation of the best observed trajectories.
#offline-rl#theoryPermalink & quiz →

Practise Reinforcement Learning