Squashes attention or output logits through a scaled tanh so no single value can run away.
Popularized inJul 2024Gemma 2: Improving Open Language Models at a Practical Size
Softcapping bounds logits to a fixed range by passing them through tanh scaled by a cap value. Gemma-2 popularized it for both attention scores and final output logits as a training stabilizer. Extreme logits otherwise cause saturation and loss spikes. Newer models often replace it with QK-Norm, but you will still find it in several current architectures.
Open any of these on hfviewer to find this block in the interactive architecture graph.
hfviewer renders the full architecture of 3,500+ Hugging Face models as interactive graphs. Hover any block to see what it does, with this model’s real numbers.
Browse all model graphs →