Pretraining Transformers with Quantized Softmax in Attention
Abstract
Low-precision Transformer systems increasingly quantize attention matrix multiplications, while softmax often remains at higher precision. During pretraining, an approximate softmax changes the gradients that train the model as well as its forward computation. We study this interaction with K-interval attention, which approximates the exponential using K+1 grid values. We vary per-row grid calibration, interpolation versus hard rounding, and the placement of a straight-through surrogate relative to normalization. We derive the corresponding backward rules, including calibration derivatives, and compare these choices in pretraining experiments matched on model, data, and optimizer. Detaching the row extrema leaves the forward computation unchanged but produces a delayed increase in validation loss, under both min-max and fixed-window calibration. With hard rounding at K=4, min-max calibration and a pre-normalization surrogate incur a large loss gap; changing either choice substantially reduces it. At 124M parameters and 2.5B training tokens, fixed-window calibration with interpolation ends +0.007 nats from softmax at K=4; with hard rounding it ends +0.019 nats at K=4 under a post-normalization surrogate and +0.004 nats at K=16 under a pre-normalization surrogate.
Create a lesson
Related papers
From Attention Sensitivity to Layer Role: Revisiting Mixed-Precision Quantization of Transformers
Shared title terminologycs.LGNafiseh HosseinpourFardi, Negar Alihadi, Mahmoudreza Babaei et al.
PQ-HSA: Reusing Product-Quantized Scores for Hybrid Sparse-Approximate Attention
Shared title terminologycs.LGKunming Shao, Jierun Chen, Yanli Wang et al.
Approximating Softmax in Pretrained LLMs: Model Sensitivity and Kernel Acceleration
Shared title terminologycs.LGShangzhen Zhu, Muyan Hu, Tomasz Kozlowski
Linear Attention Has Superlinear Capacity
Shared title terminologycs.LGHao Guo, Sudhaunshu Hardikar, Simon Dennis et al.
Strong EEG Decoding without EEG-Specific Pretraining: A Simple Reversible Interface for Vision Backbones
Shared title terminologycs.LGZi Liang, Haibo He, Peng Hu et al.
Local Affine Quantization for KV Caches: From Shared Ranges to Prediction Error
Shared title terminologycs.LGShrey Shah, Rohith Kukkala