Vibeleaderboard
← All Intel
Intel / article

GradLoc traces an RL gradient spike back to a single token

Source
github.com
Publisher
Tencent
Author
Tencent Hy
Date

Context

Tencent's GradLoc is a diagnostic for one specific failure in reinforcement-learning runs on language models (the RLVR setting the README targets): a gradient spike, where the update computed from a batch suddenly becomes abnormally large and can derail . Rather than guessing which samples caused it, GradLoc runs a distributed binary search. It repeatedly splits the suspect work and re-runs forward and backward passes on the pieces, narrowing from the global batch to a micro-batch, then to one worker (rank), then to the single responsible. Because each probe halves the search space, the number of probes grows only logarithmically with the amount of data searched, which is the O(log N) cost the team cites.

The released code is a patch rather than a standalone library. It applies to one fixed commit of the veRL training framework and changes four files, including the PPO trainer, the actor worker and a math-verification reward scorer. Three settings drive it: a trigger threshold on the token-level gradient norm (640.0 in the example script), a cap of 128 forward/backward probes for the search, and a directory where localization artifacts are written. The team says it intends to repackage GradLoc later as a configurable feature closer to merging into upstream veRL.

What the found in Tencent's own runs is not covered here. The research blog post behind the release, whose citation title pairs token-level gradient diagnosis with layerwise clipping as a way to stabilize RLVR, could not be read, so its findings and any results for the clipping method are left out. The announcement thread presents the release as a shift from heuristic trial-and-error toward deterministic diagnostics.

Terms in this piece · Glossary
  • Training — The process that adjusts a model using examples and a measure of how well it performs.
  • Token — A piece of text, such as a word, part of a word or a punctuation mark, that a language model represents as numbers and handles as a unit.
  • Tool — An operation that the software around a model makes available for the model to request, with a name, expected inputs and a kind of result.

Get the Brief

A cited digest of what matters for people building with AI, every morning. Unsubscribe anytime. See today’s edition

More from Tencent Hy
Recommended reads