Functions and operators

clip⁡(rt(θ),1−ϵ,1+ϵ)\operatorname{clip}(r_t(\theta), 1 - \epsilon, 1 + \epsilon) Clip

Limit a value to a range: clip(x, a, b) is a if x < a, b if x > b, else x.

In ML papers

clip⁡(x,a,b)\operatorname{clip}(x, a, b) (or clamp⁡\operatorname{clamp}) forces xx into the range [a,b][a, b]: values below aa become aa, values above bb become bb, the rest pass through. It equals min⁡(max⁡(x,a),b)\min(\max(x, a), b).

Its best-known use is PPO (Schulman et al. 2017): the probability ratio rt(θ)r_t(\theta) is clipped to [1−ϵ,1+ϵ][1 - \epsilon, 1 + \epsilon] so one update cannot move the policy too far. Gradient clipping is a related idea that usually rescales the whole gradient vector when its norm exceeds a threshold, rather than clipping each entry.

How to type it

LaTeXShows
\operatorname{clip}(x, a, b)clip⁡(x,a,b)\operatorname{clip}(x, a, b)
\operatorname{clamp}(x, a, b)clamp⁡(x,a,b)\operatorname{clamp}(x, a, b)

A worked example

clip⁡(1.3,0.8,1.2)=1.2,clip⁡(0.95,0.8,1.2)=0.95\operatorname{clip}(1.3, 0.8, 1.2) = 1.2, \quad \operatorname{clip}(0.95, 0.8, 1.2) = 0.95

With ϵ=0.2\epsilon = 0.2, a ratio of 1.31.3 is cut back to 1.21.2.

Common confusions

Equations that use it

Related

max⁡(0,x)\max(0, x)Max and minϵ\epsilonEpsilon∥x∥2\|\mathbf{x}\|_2NormAπ(s,a)=Qπ(s,a)−Vπ(s)A^\pi(s, a) = Q^\pi(s, a) - V^\pi(s)Advantage A

Decode this example →