Implement GAE (the backward recursion) given per-token rewards and value estimates

RLHF & Preference Optimization2 / 7

Chapter 122 / 7

RLHF & Preference Optimization

Implement GAE (the backward recursion) given per-token rewards and value estimates

Medium
Target interface
compute_gae(rewards, values, gamma=0.99, lam=0.95, last_value=0.0)

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.