Deep & Advanced RL
Time limit: 2 hours 30 minutes Total marks: 60 Instructions: Answer ALL three questions. Show derivations fully; state assumptions. Code answers may be written in NumPy/PyTorch-style pseudocode but must be logically complete.
Question 1 — Policy Gradients, Baselines & Variance (20 marks)
Consider a single-step (bandit-like) stochastic policy over a finite action set , with scalar reward . Define the objective for a fixed state .
(a) Derive the policy gradient from first principles using the log-derivative (score function) trick. State clearly why the identity holds. (5)
(b) Prove that subtracting any action-independent baseline from the reward leaves the gradient estimator unbiased. Then, treating the single-sample estimator as a random vector, derive the value of the scalar baseline that minimises . (7)
(c) For a softmax policy over with , compute explicitly. Given and rewards , compute the exact gradient and the optimal constant baseline from part (b). (8)
Question 2 — DQN Target Objects & Overestimation (20 marks)
(a) Write the tabular Q-learning update and the DQN loss using a target network with parameters . Explain, in terms of the bias–variance and stability of the regression target, why the target network and why experience replay each help. Give the precise failure mode each mitigates. (6)
(b) Overestimation bias. Let where the errors are i.i.d. zero-mean with variance across actions, and suppose all true values are equal, . Show that , i.e. the max operator produces a non-negative bias. Then explain precisely how Double DQN decouples action selection from action evaluation to reduce this bias, writing its target explicitly. (8)
(c) Dueling architecture. The dueling network outputs . Explain why this decomposition is unidentifiable, and derive/justify the standard identifiability fix used in practice (subtracting the mean advantage). Show that with the fix the mapping from to is unique. (6)
Question 3 — PPO / TRPO and Entropy-Regularised RL (20 marks)
(a) TRPO maximises the surrogate subject to . State the PPO clipped objective and explain, with a case analysis on the sign of , how clipping the probability ratio approximates the trust-region constraint without a hard KL constraint. (8)
(b) For two Gaussians and with equal variance, derive . Comment on how this relates to a quadratic penalty on the policy-mean shift in continuous-control TRPO/PPO. (6)
(c) Soft Actor-Critic. SAC augments the reward with an entropy term, optimising . For a discrete state with two actions and Q-values , derive the optimal soft policy (the one maximising ) and show it is the Boltzmann/softmax distribution over . Evaluate the optimal action probabilities for . (6)
Answer keyMark scheme & solutions
Question 1
(a) (5) .
- Log-derivative identity : (2)
- Final expectation form: (1)
- Zero-score fact: . Holds because probabilities sum to 1 (normalisation constant). (2)
(b) (7) Unbiasedness: subtracting adds , so . (3)
Minimise variance/second moment. Let . Set derivative w.r.t. to zero:
- Expand second moment: (2)
- Differentiate and solve: (2) (This is the classic -weighted reward baseline.)
(c) (8) Softmax score: . So ; similarly . (2)
With : . Gradient: . Only contributes: (3)
Baseline: , ; , . (3)
Question 2
(a) (6) Tabular: . DQN loss: . (2)
- Target network: keeps the regression target fixed for many steps, breaking the feedback loop where updating instantly moves the target ("chasing a moving target"), which otherwise causes oscillation/divergence. (2)
- Experience replay: samples transitions uniformly from buffer, breaking temporal correlation of consecutive samples (which violates i.i.d. and biases SGD) and improving data efficiency by reusing transitions. Failure mode mitigated: catastrophic correlation-induced instability & forgetting. (2)
(b) (8) By Jensen (max is convex): . Since errors are zero-mean, for all , so the RHS , giving bias ; strictly positive whenever and . (4) Double DQN target: Selection uses the online net ; evaluation uses the target net . Because the noise driving the argmax (online) is independent of the noise in the evaluation (target), the selected action is no longer systematically the one whose evaluation noise is largest, removing the upward coupling and reducing overestimation. (4)
(c) (6) Unidentifiability: for any constant ; infinitely many give the same , so the network cannot recover and separately. (2) Fix: . (2) Uniqueness: averaging both sides over gives , so is pinned to the mean of , and then up to the enforced zero-mean constraint. The constraint removes the free constant , making the map bijective. (2)
Question 3
(a) (8) PPO clipped objective: (2) Case analysis:
- (good action): objective increases with but caps it at ; no incentive to push probability beyond . (2)
- (bad action): objective favours decreasing ; the clip at (via the of two negative terms selecting the smaller/more-negative unclipped one only until the bound) prevents the ratio from being driven arbitrarily far below, limiting the pessimistic step. (2) Net effect: the ratio is confined near 1, keeping close to — a first-order, penalty-free surrogate for TRPO's KL trust region, cheaper (no Fisher/CG) and reusable over minibatches. (2)
(b) (6) Expanding and using , : (4) It is a quadratic in the mean shift; hence bounding KL bounds — the trust region on a Gaussian policy is (locally) a quadratic penalty on how far the action-mean may move per update, matching the Fisher-metric quadratic used in TRPO. (2)
(c) (6) Maximise s.t. . Lagrangian: , so (4) Boltzmann/softmax over — the SAC soft-optimal policy. Evaluate : (2)
[
{"claim":"Q1c policy pi(1)=1/4, pi(2)=3/4 for theta=(0,ln3)",
"code":"import sympy as sp; t1,t2=0,sp.log(3); p1=sp.exp(t1)/(sp.exp(t1)+sp.