Papers · Reinforcement learning and alignment · 2015

Trust Region Policy Optimization

John Schulman, Sergey Levine, Philipp Moritz and others

The notation of the TRPO paper, explained: its 69 displayed equations, then every symbol it uses, grouped by category and shown the way the paper writes it.

Read the paper on arXiv

Read from arXiv's HTML version: 69 displayed equations and 225 pieces of inline math. 65 symbols and constructs from the catalog, read as reinforcement learning.

The paper's displayed equations

Open any of them in the decoder for a symbol-by-symbol reading.

  1. η(π)=Es0,a0,…[∑t=0∞γtr(st)], wheres0∼ρ0(s0), at∼π(at∣st), st+1∼P(st+1∣st,at).\begin{gathered}\eta(\pi)=\mathbb{E}_{s_{0},a_{0},\dots}\left[\sum_{t=0}^{\infty}\gamma^{t}r(s_{t})\right],\text{ where} \\ s_{0}\sim\rho_{0}(s_{0}),\ a_{t}\sim\pi(a_{t}|s_{t}),\ s_{t+1}\sim P(s_{t+1}|s_{t},a_{t}).\end{gathered}
    Decode →
  2. Qπ(st,at)=Est+1,at+1,…[∑l=0∞γlr(st+l)],Vπ(st)= Eat,st+1,…[∑l=0∞γlr(st+l)],Aπ(s,a)= Qπ(s,a)−Vπ(s), whereat∼π(at∣st),st+1∼P(st+1∣st,at) for t≥0.\begin{gathered}Q_{\pi}(s_{t},a_{t})=\mathbb{E}_{s_{t+1},a_{t+1},\dots}\left[\sum_{l=0}^{\infty}\gamma^{l}r(s_{t+l})\right], \\ V_{\pi}(s_{t})=\ \mathbb{E}_{a_{t},s_{t+1},\dots}\left[\sum_{l=0}^{\infty}\gamma^{l}r(s_{t+l})\right], \\ A_{\pi}(s,a)=\ Q_{\pi}(s,a)-V_{\pi}(s),\text{ where} \\ \quad a_{t}\sim\pi(a_{t}|s_{t}),s_{t+1}\sim P(s_{t+1}|s_{t},a_{t})\text{\ for $t\geq 0$}.\end{gathered}
    Decode →
  3. (1)
    η(π~)=η(π)+Es0,a0,⋯∼π~[∑t=0∞γtAπ(st,at)]\eta(\tilde{\pi})=\eta(\pi)+\mathbb{E}_{s_{0},a_{0},\dots\sim\tilde{\pi}}\left[\sum_{t=0}^{\infty}\gamma^{t}A_{\pi}(s_{t},a_{t})\right]
    Decode →
  4. ρπ(s) ⁣= ⁣P(s0=s) ⁣+ ⁣γP(s1=s) ⁣+ ⁣γ2P(s2=s) ⁣+ ⁣…,\rho_{\pi}(s)\!=\!P(s_{0}=s)\!+\!\gamma P(s_{1}=s)\!+\!\gamma^{2}P(s_{2}=s)\!+\!\dots,
    Decode →
  5. (2)
    η(π~)=η(π)+∑t=0∞∑sP(st=s∣π~)∑aπ~(a∣s)γtAπ(s,a)=η(π)+∑s∑t=0∞γtP(st=s∣π~)∑aπ~(a∣s)Aπ(s,a)=η(π)+∑sρπ~(s)∑aπ~(a∣s)Aπ(s,a).\begin{gathered}\eta(\tilde{\pi}) =\eta(\pi)+\sum_{t=0}^{\infty}\sum_{s}P(s_{t}=s|\tilde{\pi})\sum_{a}\tilde{\pi}(a|s)\gamma^{t}A_{\pi}(s,a) \\ =\eta(\pi)+\sum_{s}\sum_{t=0}^{\infty}\gamma^{t}P(s_{t}=s|\tilde{\pi})\sum_{a}\tilde{\pi}(a|s)A_{\pi}(s,a) \\ =\eta(\pi)+\sum_{s}\rho_{\tilde{\pi}}(s)\sum_{a}\tilde{\pi}(a|s)A_{\pi}(s,a).\end{gathered}
    Decode →
  6. (3)
    Lπ(π~)=η(π)+∑sρπ(s)∑aπ~(a∣s)Aπ(s,a).L_{\pi}(\tilde{\pi})=\eta(\pi)+\sum_{s}\rho_{\pi}(s)\sum_{a}\tilde{\pi}(a|s)A_{\pi}(s,a).
    Decode →
  7. (4)
    Lπθ0(πθ0)=η(πθ0),∇θLπθ0(πθ)∣θ=θ0=∇θη(πθ)∣θ=θ0.\begin{gathered}L_{\pi_{\theta_{0}}}(\pi_{\theta_{0}}) =\eta(\pi_{\theta_{0}}), \\ \nabla_{\theta}L_{\pi_{\theta_{0}}}(\pi_{\theta})\big\rvert_{\theta=\theta_{0}} =\nabla_{\theta}\eta(\pi_{\theta})\big\rvert_{\theta=\theta_{0}}.\end{gathered}
    Decode →
  8. (5)
    πnew(a∣s)=(1−α)πold(a∣s)+απ′(a∣s).\pi_{\mathrm{new}}(a|s)=(1-\alpha)\pi_{\mathrm{old}}(a|s)+\alpha\pi^{\prime}(a|s).
    Decode →
  9. (6)
    η(πnew) ⁣≥ ⁣Lπold(πnew)−2ϵγ(1−γ)2α2 where ϵ=max⁡s∣Ea∼π′(a∣s)[Aπ(s,a)]∣.\begin{gathered}\eta(\pi_{\mathrm{new}}) \!\geq\!L_{\pi_{\mathrm{old}}}(\pi_{\mathrm{new}})-\frac{2\epsilon\gamma}{(1-\gamma)^{2}}\alpha^{2} \\ \text{ where }\epsilon=\max_{s}\left|\mathbb{E}_{a\sim\pi^{\prime}(a|s)}\left[A_{\pi}(s,a)\right]\right|.\end{gathered}
    Decode →
  10. (7)
    DTVmax(π,π~)=max⁡sDTV(π(⋅∣s) ∥ π~(⋅∣s)).D^{\rm max}_{\rm TV}(\pi,\tilde{\pi})=\max_{s}D_{TV}(\pi(\cdot|s)\ \|\ \tilde{\pi}(\cdot|s)).
    Decode →
  11. (8)
    η(πnew)≥Lπold(πnew)−4ϵγ(1−γ)2α2 where ϵ=max⁡s,a∣Aπ(s,a)∣\begin{gathered}\eta(\pi_{\mathrm{new}})\geq L_{\pi_{\mathrm{old}}}(\pi_{\mathrm{new}})-\frac{4\epsilon\gamma}{(1-\gamma)^{2}}\alpha^{2} \\ \quad\text{ where }\epsilon=\max_{s,a}{\left|A_{\pi}(s,a)\right|}\end{gathered}
    Decode →
  12. (9)
    η(π~)≥Lπ(π~)−CDKLmax(π,π~), where C=4ϵγ(1−γ)2.\begin{gathered}\eta(\tilde{\pi})\geq L_{\pi}(\tilde{\pi})-C{D^{\rm max}_{\rm KL}}(\pi,\tilde{\pi}), \\ \qquad\text{ where }C=\frac{4\epsilon\gamma}{(1-\gamma)^{2}}.\end{gathered}
    Decode →

Famous equations in this paper

Symbols, by category

Most used first. The examples are written as the paper writes them.

Notation conventions

  1. s0s_{0}, a0a_{0}, sts_{t}

    Subscript (index or label) 623 uses

    A subscript picks an element (xᵢ), a time step (h_t), a named copy (W_q), or the parameters (p_θ).

  2. tt, LL, DD

    Italic letters (variables) 199 uses

    A plain italic letter is a variable; conventions say what kind (x input, y target, W weights…).

  3. π~\tilde{\pi}, a~\tilde{a}, G~\tilde{G}

    Tilde accent 146 uses

    A modified version of the variable: noisy, corrupted, proposed or intermediate.

  4. γt\gamma^{t}, γ2\gamma^{2}, (1−γ)2(1-\gamma)^{2}

    Superscript (power or label) 60 uses

    Usually a power (x² = x·x), but a capital or a word up there is often just a label (W^Q).

  5. D‾\overline{D}, Aˉ\bar{A}

    Bar (mean) 43 uses

    A bar usually marks an average: x̄ is the mean of the x values.

  6. …\dots

    Dots (ellipsis) 24 uses

    “And so on”: continue the pattern.

  7. Q^\hat{Q}

    Hat (estimate) 3 uses

    A hat marks an estimate or prediction: ŷ is the model’s guess for y.

  8. γl\gamma^{l}

    Superscript in parentheses 2 uses

    An index in a superscript: x⁽ⁱ⁾ is the i-th training example, W⁽ˡ⁾ the weights of layer l. Not a power.

  9. ℓ\ell

    Loss (ℒ) 2 uses

    The loss: the number training tries to make small. Also written L, J(θ) or ℓ.

  10. X\mathcal{X}

    Calligraphic letters 2 uses

    A script capital usually names a set, a space, a distribution or a loss.

  11. mean⁡\operatorname{mean}

    Multi-letter names 2 uses

    A run of italic letters like pos or model is usually one name, not a product of single letters.

Greek letters

  1. π\pi

    Pi 360 uses

    A policy π(a | s) in reinforcement learning, or the constant 3.14159…

  2. θ\theta

    Theta 186 uses

    The model’s parameters: all of its weights and biases, as one collection.

  3. γ\gamma

    Gamma 76 uses

    The discount factor in reinforcement learning, or the learned scale in normalization layers.

  4. η\eta

    Eta 54 uses

    The learning rate in most gradient-descent papers.

  5. ρ\rho

    Rho 54 uses

    A correlation coefficient, a decay rate (RMSprop, Adadelta), or an importance ratio in RL.

  6. α\alpha

    Alpha 49 uses

    Often a learning rate or step size; also attention weights αᵢⱼ or a mixing weight.

  7. Δ\Delta

    Delta (capital) 30 uses

    A change or update: ΔW is the change to the weights W.

  8. μ\mu

    Mu 30 uses

    A mean: the average of a distribution, a batch, or a layer’s features.

  9. ϵ\epsilon

    Epsilon 16 uses

    A tiny constant for numerical safety (10⁻⁸ in Adam), or noise ε ~ 𝒩(0, I).

  10. τ\tau

    Tau 16 uses

    A temperature that sharpens or flattens a softmax; in RL, a trajectory.

  11. δ\delta

    Delta (lowercase) 13 uses

    A small change, or the error signal δ = ∂L/∂z in backpropagation.

  12. β\beta

    Beta 8 uses

    Usually a decay rate (Adam’s β₁, β₂), a shift parameter in normalization, or a weight on a loss term.

  13. λ\lambda

    Lambda 2 uses

    Usually the strength of a regularization term; also eigenvalues.

Vectors and matrices

  1. ⋅\cdot

    Centre dot 35 uses

    A dot product between vectors, plain multiplication between numbers, or an empty slot f(·).

  2. ∣Aπ(s,a)∣\left|A_{\pi}(s,a)\right|, ∣Aˉ(s)∣\left|\bar{A}(s)\right|, ∣Aˉ(s)∣|\bar{A}(s)|

    Absolute value (bars) 25 uses

    Absolute value of a number; for a set, its size; for a matrix, sometimes its determinant.

  3. ∥A∥1\|A\|_{1}, ∥Aρ∥1\|A\rho\|_{1}, ∥ρ∥1\|\rho\|_{1}

    L1 norm 13 uses

    The sum of the absolute values of the entries.

  4. (θold−θ)T(\theta_{\mathrm{old}}-\theta)^{T}, (θ−θold)T(\theta-\theta_{\mathrm{old}})^{T}, (βs)T(\beta s)^{T}

    Transpose 10 uses

    Swap rows and columns. xᵀy is a dot product; xyᵀ is an outer product.

  5. G−1G^{-1}, G~−1\tilde{G}^{-1}, (θold)−1(\theta_{\mathrm{old}})^{-1}

    Inverse 8 uses

    The matrix inverse, A⁻¹A = I; for a function, its inverse function; for a number, 1/x.

  6. ∥θ−θold∥2\|\theta-\theta_{\mathrm{old}}\|^{2}, ∥γrGΔ∥∞\|\gamma rG\Delta\|_{\infty}, ∥vΔ∥∞\|v\Delta\|_{\infty}

    Norm 4 uses

    The length (size) of a vector. With subscript 2 or none, the Euclidean length √(Σxᵢ²).

  7. ×\times

    Times (cross) 3 uses

    Usually the “by” in a shape (n × d); also plain multiplication or a cross product.

Calculus and gradients

  1. π′\pi^{\prime}, s′s^{\prime}, ′\prime

    Prime 24 uses

    Either a derivative, f′(x), or simply "another one": x′ is a second sample, s′ the next state.

  2. ∞\infty

    Infinity 16 uses

    Infinity; as a norm subscript, ‖x‖_∞ is the largest absolute entry.

  3. ∂∂θi\frac{\partial}{\partial\theta_{i}}, ∂∂θj\frac{\partial}{\partial\theta_{j}}, ∂μa(x)∂θi\frac{\partial\mu_{a}(x)}{\partial\theta_{i}}

    Partial derivative 13 uses

    A partial derivative: how one quantity changes when one input changes and the others are held fixed.

  4. ∇θ\nabla_{\theta}

    Nabla (gradient) 5 uses

    The gradient: the vector of partial derivatives. ∇_θ L is how the loss changes with each parameter.

Probability and statistics

  1. ∣|

    Given (conditional bar) 95 uses

    “Given”: p(y | x) is the probability of y given that x is known.

  2. PP, qq, pp

    Probability p(x) 66 uses

    A probability or probability density; p is usually the true or model distribution, q an approximation.

  3. ∼\sim

    Distributed as (tilde) 53 uses

    “Is drawn from” or “is distributed as”: x ~ p means x is a sample from the distribution p.

  4. Es0,a0,…\mathbb{E}_{s_{0},a_{0},\dots}, Est+1,at+1,…\mathbb{E}_{s_{t+1},a_{t+1},\dots}, Eat,st+1,…\mathbb{E}_{a_{t},s_{t+1},\dots}

    Expectation 48 uses

    The expected value: the average of what is inside, weighted by the probabilities in the subscript.

  5. ∥\|

    KL divergence 15 uses

    How different distribution q is from p. Zero when they match; not symmetric.

  6. log⁡\log

    Logarithm 2 uses

    A logarithm, almost always the natural log (base e) in ML papers.

  7. N\mathcal{N}

    Normal distribution 1 use

    The normal (Gaussian) distribution with the given mean and variance.

  8. ;;

    Semicolon (parameterized by) 1 use

    In p(x; θ), the semicolon separates the variable x from fixed parameters θ.

  9. exp⁡\exp

    Exponential 1 use

    The exponential function eˣ, with e ≈ 2.718. Always positive.

Functions and operators

  1. ∑t=0∞\sum_{t=0}^{\infty}, ∑l=0∞\sum_{l=0}^{\infty}, ∑s\sum_{s}

    Summation 51 uses

    Add up the expression for every value of the index, from the bottom limit to the top.

  2. 2ϵγ(1−γ)2\frac{2\epsilon\gamma}{(1-\gamma)^{2}}, 4ϵγ(1−γ)2\frac{4\epsilon\gamma}{(1-\gamma)^{2}}, πθ(a∣sn)q(a∣sn)\frac{\pi_{\theta}(a|s_{n})}{q(a|s_{n})}

    Fraction 28 uses

    Division: the top divided by the bottom.

  3. max⁡s\max_{s}, maxmax, max⁡s,a\max_{s,a}

    Max and min 27 uses

    The largest (or smallest) value, over the arguments or over the range in the subscript.

  4. ::, →\rightarrow

    Arrow (maps to) 13 uses

    Maps to (f: X → Y), tends to (x → 0), or implies (⇒).

  5. arg max⁡π\argmax_{\pi}, arg max⁡a\argmax_{a}, arg max⁡π′\argmax_{\pi^{\prime}}

    Argmax 3 uses

    The input that makes the function largest, not the largest value itself.

  6. OO

    Big-O notation 2 uses

    How a cost grows with size, ignoring constants: O(n²) means at most proportional to n² for large n.

  7. 2δ/sTAs\sqrt{2\delta/s^{T}As}

    Square root 1 use

    The square root. In attention, dividing by √d_k keeps dot products at a sensible scale.

Reinforcement learning

  1. ss, aa

    State s and action a 489 uses

    sₜ is the state at step t, aₜ the action taken there; s′ is the next state.

  2. AA

    Advantage A 89 uses

    A(s, a) = Q − V: how much better action a is than the policy’s average action in state s.

  3. GG

    Return G 59 uses

    Gₜ is the return: the total discounted reward from step t onward. The agent maximizes its expectation.

  4. rr

    Reward r 26 uses

    rₜ is the reward received at step t; R(s, a) is the reward function that hands it out.

  5. QQ

    Action-value function Q 20 uses

    Q(s, a) is the expected total reward from taking action a in state s, then following the policy.

  6. VV

    Value function V 18 uses

    V(s) is how much total discounted reward to expect from state s onward.

  7. S\mathcal{S}, A\mathcal{A}

    State and action spaces 12 uses

    𝒮 is the set of all states and 𝒜 the set of all actions in a Markov decision process.

  8. JJ

    Objective J 8 uses

    J(θ) is the objective: the quantity to maximize, such as the expected return of a policy.

Sets, shapes and definitions

  1. ≥\geq, ≤\leq, >>

    Inequalities 55 uses

    Less than / greater than (or equal). ≪ means “much smaller than”.

  2. ≈\approx

    Approximately equal 6 uses

    Approximately equal: often a Monte Carlo estimate or a Taylor approximation.

  3. {a1,a2,…,aK}\left\{a_{1},a_{2},\dots,a_{K}\right\}, {Wi,bi}\left\{W_{i},b_{i}\right\}, {1,2,…,Nk}\left\{1,2,\dots,N_{k}\right\}

    Set braces 5 uses

    A set: a collection of items. {x | condition} is every x that satisfies the condition.

  4. ≠\neq

    Not equal 4 uses

    The two sides are different.

  5. R\mathbb{R}

    Real numbers (ℝ) and shapes 3 uses

    The real numbers. ℝⁿˣᵈ is the set of n × d arrays of reals: it states a shape.

  6. ∈\in

    Element of 2 uses

    “Is in” or “belongs to”: x ∈ S says x is a member of the set S.

8 things the catalog has no entry for yet
  • \rm \rm 44
  • maximize⁡\operatorname*{maximize} maximize 9
  • ∣\rvert \rvert 6
  • :\vcentcolon \vcentcolon 6
  • kl⁡\operatorname{kl} kl 5
  • stdev⁡\operatorname{stdev} stdev 2
  • NeuralNet⁡\operatorname{NeuralNet} NeuralNet 1
  • dim⁡\dim \dim 1

Formulas from arXiv's HTML version of the paper, © their authors; the explanations are this site's. Title and authors as arXiv lists them.

More reinforcement learning and alignment papers