How does clipping gradients by global L2 norm differ from clipping element-wise by value? Given a gradient vector g=[3,4]⊤ and threshold τ=2, what is the clipped gradient under each method, and which preserves the steepest-descent direction?

Deep learning, Optimisation of deep networks
Level L2 Elementary. Length Short. Nature Mat Mathematical.

What's being asked

Whether you can compute both clipping rules and explain the geometric difference in update direction.

Key idea

Global norm clipping scales the entire gradient vector by τ/∥g∥2 whenever ∥g∥2>τ, keeping its direction intact; value clipping clamps each coordinate independently to [−τ,τ], which rotates the gradient direction. On g=[3,4]⊤ with τ=2, norm clipping gives [1.2,1.6]⊤ while value clipping gives [2,2]⊤.

Steps

  1. Norm clipping: compute ∥g∥2=32+42=5>τ=2. Scale the whole vector by τ∥g∥2=25=0.4: gnorm=0.4 [3,4]⊤=[1.2,1.6]⊤ (which has norm 2 and points in the exact direction of g).
  2. Value clipping: clamp each entry to [−2,2] independently: gval=[min⁡(3,2), min⁡(4,2)]⊤=[2,2]⊤ (which has norm 8≈2.83 and points along 45∘, no longer parallel to [3,4]⊤).
  3. Comparison: global norm clipping is usually preferred in RNNs and Transformers because it caps step size at steep cliffs without biasing the direction of steepest descent.

Common mistakes

How long your answer should be

4–5 lines with both vectors computed.

Last checked on 4 December 2026.

Read this

Previous in Deep learning: What are the Huber loss Lδ(r) for residual r=y^−y with threshold δ>0 and its derivative Lδ′(r)? For δ=1, what are Lδ(r) and Lδ′(r) at r=0.5 and r=4, and why does Huber loss combine the benefits of MSE and MAE?
Next in Deep learning: A network uses cosine annealing without restarts from ηmax⁡=0.1 down to ηmin⁡=0 over T=100 steps: ηt=ηmin⁡+12(ηmax⁡−ηmin⁡)(1+cos⁡(πt/T)). What is the learning rate at t=0,25,50,75,100, and why is cosine decay often preferred over step decay?