Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Trends: multi-agent RL, offline RL and RLHF

Short notes on three current trends in reinforcement learning: multi-agent reinforcement learning (MARL), offline (batch) reinforcement learning, and reinforcement learning from human feedback (RLHF).

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Engineers use these trends when designing systems that must learn in realistic settings: multi-agent reinforcement learning (MARL) when many agents must coordinate or compete (robots, networked control, traffic), offline reinforcement learning when learning must use only pre-collected data (healthcare, recommender systems, safety-critical domains), and reinforcement learning from human feedback (RLHF) when aligning learned policies with human preferences (chatbots, assistants). These topics address practical limits of the standard online RL pipeline and are widely used in industry research and product systems.

Key ideas

Definitions (each term bolded when first used):

  • Agent: an entity that takes actions in an environment to maximise cumulative reward.
  • Multi-agent reinforcement learning (MARL): learning problem with two or more learning agents that interact in a shared environment where each agent's reward can depend on other agents' actions.
    • Assumptions: agents may be cooperative, competitive, or mixed; the environment may be fully observable or partially observable; agents can be independent learners or share information.
  • Centralised training with decentralised execution (CTDE): training paradigm where at training time a centralised critic or data sharing is allowed, but at execution each agent runs its own policy using only local observations.
    • Common exam statement: CTDE reduces gradient variance and apparent non-stationarity by using a centralised critic during training, at the cost of requiring access to other agents' data during training.
  • Offline reinforcement learning (offline RL / batch RL): learning a policy from a fixed dataset of transitions collected by some behaviour policy, without further interaction with the environment.
    • Assumptions: dataset is finite and may not cover all states/actions (coverage issue); distributional shift between behaviour and target policy must be handled to avoid overestimation.
  • Distributional shift: mismatch between the state-action distribution in the dataset and the distribution induced by the learned policy; causes unreliable value estimates.
  • Conservatism / regularisation in offline RL: methods that bias the learned policy towards actions in the dataset (behaviour cloning constraint, support constraints, pessimistic value estimates) to avoid spurious high values for unseen actions.
  • Reinforcement learning from human feedback (RLHF): framework that uses human preference data to train a reward model, which then guides policy optimisation (often via policy gradient or PPO) to align agent behaviour with human values.
    • Typical components: a reward model trained on pairwise human preference labels, a policy optimisation loop using the learned reward model, and safety/penalty terms (e.g., KL to a reference policy).

Key formal points and derivations universities ask for:

  1. Multi-agent Markov game (exact definition):
  • A Markov game with N agents is a tuple (S, A^1,...,A^N, P, r^1,...,r^N, γ) where S is state space, A^i is action space for agent i, P(s'|s,a^1...a^N) is transition probability, r^i(s,a^1...a^N) is reward for agent i, and γ∈[0,1) is discount factor. A policy for agent i is π^i(a^i|o^i) possibly conditioned on local observation o^i. Solution concepts: Nash equilibrium (for general-sum games) and cooperative optimality (for fully cooperative games where a common reward exists).
  1. Centralised critic (derivation sketch):
  • For cooperative MARL with joint action a and joint policy π_θ(a|s)=∏i π^i{θ_i}(a^i|o^i), the policy gradient for agent i using a centralised critic Q^π(s,a) is:
    • Start from objective J(θ)=E[Σ_t γ^t r_t] and derive gradient w.r.t. θ_i using likelihood ratio:
      • ∇{θ_i}J = E[∇{θ_i} log π^i_{θ_i}(a^i|o^i) · A^i(s,a)] where A^i(s,a)=Q^π(s,a)-V^π(s).
    • The centralised critic provides Q^π(s,a) computed using full state and joint action, reducing variance compared to decentralised critics that estimate Q^i(s^i,a^i).
    • Assumptions: differentiable policies, access to joint state/action at training time.
  1. Importance sampling for off-policy evaluation (derivation):
  • Given behaviour policy µ and target policy π, the off-policy estimate of expected return using per-decision importance sampling is derived from re-weighting trajectory probabilities; see Formulas section.
  • Assumption: support(π) ⊆ support(µ) (i.e., µ must have non-zero probability for actions π may take), otherwise estimator undefined or infinite variance.
  1. Offline RL conservatism idea (formal statement):
  • Many offline RL algorithms impose a constraint such that the learned policy π satisfies some closeness to behaviour policy µ (e.g., KL(π||µ) ≤ ε) or penalise Q-values for actions not well supported by data. Exact theorems about safe policy improvement require assumptions on dataset coverage and estimator concentration.
  1. RLHF policy update (sketch):
  • Train a reward model r_ϕ from human labels. Then optimise policy π_θ to maximise E_π[r_ϕ] minus a regulariser λ·KL(π_θ||π_ref) where π_ref is a reference policy (often the pretrained language model). Under small learning steps, the policy gradient is:
    • ∇_θ J ≈ E[∇_θ log π_θ(a|s) (R̂ - λ·log π_θ(a|s) + λ·log π_ref(a|s))] where R̂ is cumulative reward from r_ϕ; this treats the KL penalty as an augmented reward term in small-step updates.
  • Assumptions: reward model is a fixed differentiable proxy; KL acts as trust-region.

Diagrams to draw (describe exactly):

  • For CTDE: draw two boxes labelled "Training" and "Execution". Inside Training draw N agents with arrows into a central box labelled "Centralised Critic / Joint Replay Buffer". From Centralised Critic arrow back to each agent (policy updates). Execution box: show N agents each using only local observation arrow to actions; no central box.
  • For RLHF pipeline: draw blocks left-to-right: "Human preference data" → "Reward model r_ϕ (train)" → "Policy π_θ (optimise using r_ϕ + KL to π_ref)" → "Policy outputs sampled for human labelling" (loop back).

Note on theory: safe policy improvement guarantees in offline RL typically assume bounded concentrability coefficients and high-confidence value estimates (e.g., SPIBB-style results); precise constants vary by paper and are beyond the scope of this summary.

Formulas

J(θ) = E_{τ~π_θ}[∑_{t=0}^∞ γ^t r_t] where J(θ) is expected discounted return, τ is a trajectory, γ is discount factor (unitless), applicable for episodic/infinite-horizon discounted RL.

∇_{θ_i}J = E_{s,a~π}[∇_{θ_i} log π^i_{θ_i}(a^i|o^i) · A^i(s,a)] where A^i(s,a)=Q^π(s,a)-V^π(s); expectations under trajectories from joint policy π; unitless.

w_{0:t} = ∏_{k=0}^t π(a_k|s_k) / µ(a_k|s_k) where w_{0:t} is importance weight up to time t, π is target policy, µ is behaviour policy; unitless; applies when µ(a_k|s_k)>0 for all k. V^π(s_0) = E[∑_{t=0}^{T-1} γ^t w_{0:t} r_t] per-decision importance sampling estimator of return (episodic horizon T; truncate/infinite horizon handled analogously).

V^π(s) = E_{a~π}[Q^π(s,a)] where V^π is state-value; unitless.

L_R(ϕ) = -∑_{i} log σ(r_ϕ(τ_i^+) - r_ϕ(τ_i^-)) where L_R is cross-entropy loss for pairwise preference data, σ is sigmoid, τ_i^+ and τ_i^- are two trajectories where human preferred + over -; unitless; used in RLHF reward model training.

J_{RLHF}(θ) = E_{τ~π_θ}[∑_{t} r_ϕ(s_t,a_t) ] - λ · KL(π_θ||π_ref) where λ≥0 is regularisation weight; unitless; practical policy optimisation objective for RLHF.

Note: units for RL quantities are unitless (rewards are problem-dependent scalars).

Worked examples

Example 1 — CTDE policy gradient for two-agent cooperative game (theory / exam model answer): Question: For two agents in a cooperative Markov game with joint reward r(s,a^1,a^2), derive the policy gradient for agent 1 using a centralised critic. Answer (model): Define joint policy π_θ(a|s)=π^1_{θ1}(a^1|o^1)π^2_{θ2}(a^2|o^2). Objective J(θ)=E[Σ γ^t r_t]. Using likelihood-ratio trick for θ1:

  1. ∇{θ1}J = E[∑t γ^t ∇{θ1} log π^1{θ1}(a^1_t|o^1_t) · G_t] where G_t is return from t.
  2. Substitute advantage: G_t can be replaced by A^1(s_t,a_t)=Q^π(s_t,a_t)-V^π(s_t) to reduce variance.
  3. So final: ∇{θ1}J = E[∇{θ1} log π^1_{θ1}(a^1|o^1) · A^1(s,a)]. Centralised critic estimates Q^π(s,a) using full state and both actions. Assumptions: differentiability and access to full state/actions in training. Full-marks answer states definitions, shows steps 1–3 and explains why centralised critic reduces non-stationarity.

Example 2 — Offline RL importance sampling numeric (exam-style numerical): Question: Behaviour policy µ chooses actions A or B with µ(A|s)=0.8, µ(B|s)=0.2. A dataset has one one-step trajectory: s→a=A with immediate reward r=2. Consider target policy π with π(A|s)=0.5, π(B|s)=0.5. Compute importance-sampling estimate of V^π(s) using this single sample (per-decision, one-step). Answer (model): Importance weight w = π(A|s)/µ(A|s) = 0.5/0.8 = 0.625. Estimate V^π(s) ≈ w · r = 0.625·2 = 1.25. Final answer: 1.25. Note high variance and bias with single sample; if µ(A|s) were 0 then estimator undefined.

Example 3 — RLHF model answer (theory): Question: Sketch the RLHF training loop and the role of KL penalty. Answer (model): Steps:

  1. Collect human labels: given pairs of model outputs (or trajectories), humans indicate preference.
  2. Train reward model r_ϕ to predict preferences using cross-entropy on pairwise differences; loss L_R as in Formulas.
  3. Optimise policy π_θ with an RL algorithm (e.g., PPO) using r_ϕ as reward; include KL penalty to π_ref to avoid policy drifting into regions where r_ϕ is unreliable. Explain why KL is used: it stabilises training by keeping π_θ close to pretrained behaviour distribution, reducing exploitation of reward-model errors. Full-marks answer lists the loop, loss functions, and justification of KL.

Common mistakes

  • In offline RL, using standard off-policy Q-learning without any conservatism, which leads to overestimation for actions not in the dataset.
  • Applying importance sampling without checking support(π)⊆support(µ) and not clipping weights — leads to infinite variance or numerical instability.
  • For RLHF, assuming the reward model is ground truth — it is an approximation; ignoring reward gaming and distributional shift leads to bad policies.

For your exam

Typical question types and what full-marks answers include:

  • Definitions and short notes: define MARL, CTDE, offline RL, RLHF; list assumptions and main problems (non-stationarity, distributional shift, reward misspecification). Full marks: concise definition + two key implications.
  • Derivations: derive multi-agent policy gradient with a centralised critic; derive importance-sampling estimator for off-policy evaluation. Full marks: clear step-by-step algebra and statement of assumptions (e.g., support condition, differentiability).
  • Numericals: compute importance-sampling estimate or simple weight-clipped IS; compute clipped importance weight and corrected estimate. Full marks: show formula application, numerical steps, final units or unitless value.
  • Diagrams: draw CTDE architecture or RLHF pipeline. Full marks: labelled boxes and arrows showing training vs execution and feedback loop.
  • Conceptual essay: trade-offs between offline RL conservatism and policy improvement. Full marks: discuss coverage, pessimism, ways to enforce conservatism, and practical examples.

Quick check

  1. What does CTDE stand for and why is it used?
  2. State the support condition required for importance sampling in off-policy evaluation.
  3. In RLHF, why is a KL penalty to a reference policy commonly used?

Answers: CTDE = centralised training with decentralised execution; it allows centralised critics during training to reduce non-stationarity while keeping execution local. Support condition: for all (s,a) where π(a|s)>0, µ(a|s)>0 (support(π) ⊆ support(µ)). KL penalty: keeps policy close to reference to prevent exploitation of reward-model errors and stabilise training.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?