Precision Floors That Grow With Context Length: Pruning Mixed-Precision Search for Transformers

Methods that choose a different number of bits for each part of a neural network (mixed-precision quantization search) all judge candidates on the data they see during search. For Transformers that data has a fixed sequence length. Recent theory suggests this is a trap. Every Bit Counts proves that the attention mechanism, the part of a Transformer that decides which earlier tokens to look at, does not lose ability gradually as bits are removed. Instead it falls off a cliff: for a given input length $m$, an equality-style comparison is possible with $p$ bits and impossible with $p-1$, and the required $p$ depends on $m$. A bit allocation that looks safe at the search length can therefore sit just above a cliff that moves past it at deployment length. No existing search method would notice.

We propose to measure, for each attention component, the smallest bit-width that still works at several short lengths. We then fit how that minimum grows with length and extrapolate it to the target deployment length. Every search option below the extrapolated floor is deleted before any search runs. The deletion has two effects. It shrinks the exponentially large space of per-layer choices, and it removes exactly the configurations that would fail silently on long inputs. Put in two sentences: precision requirements in attention grow with context length, so a mixed-precision search tuned on short sequences is biased toward allocations that break on long ones. Measuring and extrapolating these length-dependent floors fixes that bias cheaply and also makes the search smaller.

Core Claim

We make three claims, and each can be tested. First, per-component bit thresholds for attention scores and softmax inputs grow with sequence length in a regular, fittable way. A counting argument suggests roughly logarithmic growth, because separating $m$ positions or distinct values needs about $\log_2 m$ bits of resolution. We treat that form as a hypothesis to fit, not as an assumption. Second, standard mixed-precision searches run at a fixed training length produce allocations whose accuracy collapses at two to eight times that length. Third, pruning the search space with extrapolated floors removes this collapse at little extra cost, and does it better than searching directly at a single longer length. The part that is new is the length dependence. Prior search methods treat a component's precision requirement as a property of the component. We treat it as a function of the component and the deployment context length.

Relation to Prior Work

Our motivation comes from theory about finite precision. Every Bit Counts supplies the one-bit threshold result for single-layer softmax attention. It also shows that quantization-aware training cannot recover accuracy below that threshold. Its limits are that it proposes no search procedure and does not analyze multi-layer, mixed-precision models. We take its prediction that thresholds depend on length and turn it into a measurable, per-component quantity inside real multi-layer models.

Chain of Thought Empowers Transformers shows that constant-precision, fixed-depth Transformers are confined to shallow circuit classes. Pause Tokens shows that moving from constant to logarithmic precision changes which circuits are reachable. The phrase "logarithmic precision" is itself a statement that precision should scale with input size. That is the scaling we propose to measure empirically. Ahvonen et al. shows the same effect for counting in floating-point graph networks: once a running sum is large enough, adding one more no longer changes it, so counts stall. This is a second reason to expect floors that depend on length, especially for floating-point formats with short significands.

Our search machinery comes from existing work, and our pruning changes the space that machinery searches. EdMIPS relaxes discrete bit choices into continuous probabilities for CNNs, using a complexity penalty based on bit operations. AQ-BERT applies a Gumbel-Softmax relaxation to groups of BERT weights. However, it fixes activations at 8 bits, so it cannot see attention-score cliffs at all. FLIQS uses a reinforcement-learning controller that picks integer or floating-point formats per layer. It adds an entropy schedule to keep the shared weights stable during search. All three evaluate candidates only on the search-time data distribution, and none uses a lower bound to delete options in advance.

Nascimento et al. restricts the space differently, by forcing bit-widths to follow smooth curves across depth ("early layers high, late layers low"). That restriction is a heuristic about depth. Ours is a floor about length, and the two can be combined.

Zero-shot proxies such as TE-NAS and ETAS score architectures at initialization under full-precision assumptions. They constrain our design in one way: they show that cheap pre-search signals can rank well. They are not direct competitors, because neither models bit-width.

Research Program

We first define the components that receive their own bit-widths. For each layer and head these are the query-key score computation, the softmax input and output, the value path, and the feed-forward weights and activations. Candidate formats are INT8, INT4, INT2, and FP8 variants, plus simulated intermediate bit-widths for mapping thresholds only. We keep the simulated widths out of the deployable space, because commodity hardware supports a fixed set of formats.

Floor estimation starts from a trained full-precision model. We lower one component at a time while holding the rest at 8 bits. For each lengths $m \in \{m_0, 2m_0, 4m_0\}$ we record the smallest bit-width $p_c(m)$ at which held-out accuracy or perplexity stays within a tolerance of full precision. Here $c$ indexes the component and $m_0$ is the search length. We fit

$$p_c(m) \approx a_c + b_c \log_2 m,$$

where $a_c$ and $b_c$ are per-component constants. We compare this fit against a constant model and a linear model using held-out lengths. We then round the extrapolated $p_c(m_{\text{deploy}})$ up to the nearest supported format, and delete every lower option for component $c$ from the search space.

The single-component probing ignores interactions between components. We check for interactions by probing random pairs of components jointly and measuring how far the joint floor departs from the individual floors. If interactions are large, we add a safety margin calibrated on those pairs.

Any of the three search methods above then runs unchanged inside the pruned space. We keep the search methods themselves intact so that any gain can be attributed to the pruning.

Baselines

The naive reference is uniform INT8 for every component. It is hardware-friendly and should rarely hit an attention cliff, so it sets an accuracy ceiling for compressed models at the least compression. Its companion is uniform INT4, which marks the floor. Every Bit Counts reports equality-task accuracy at $m=100$ of about 92.7% with INT8 post-training quantization and about 59.7% with INT4, and we will reproduce those two numbers as a sanity check.

The strongest existing competitor is differentiable group-wise search in the style of AQ-BERT. We extend it to search activation and attention-score precision as well, since otherwise it cannot fail in the way we study. On SST-2 at a 20MB budget, AQ-BERT reports 91.1% accuracy against 84.6% for Hessian-guided Q-BERT. Beating it means two things. We must match that SST-2 figure within noise at the search length, and we must show clearly smaller degradation on long-context evaluations at equal memory and bit-operation budgets.

We also run an RL search with a cosine entropy schedule, following FLIQS, and EdMIPS-style composite relaxation. These cover the non-gradient and gradient families. Random search inside the same space serves as a cheap control, following the NAS-Bench-201 observation that random search is often competitive.

Every method gets the same pretrained model, the same data, the same number of candidate evaluations or GPU-hours, and the same hyperparameter tuning budget. Each method runs in both the unpruned and the pruned space, so that pruning is the only variable that changes.

Two ablations isolate the key ingredient. The first uses floors measured only at the search length $m_0$, with no extrapolation; it tests whether the length dependence matters or whether any pruning suffices. The second uses floors measured directly at $m_{\text{deploy}}$, which is expensive; it tests whether extrapolation gives up anything relative to the direct measurement.

Why not just…?

Why not just keep attention at INT8 and search everything else? This is the most serious threat. If a fixed rule of that kind matches our method, our contribution shrinks to a diagnosis of the failure mode rather than a new method. Our method should win if the fitted $b_c$ varies strongly across heads and layers, so that many heads tolerate INT4 even at long lengths while a few need more. The per-head floor map will show directly whether that is true. We will report the rule-based allocation at equal memory budget and accept the result either way.

Why not just run the search at the deployment length? Search cost grows with sequence length, and attention cost grows faster than linearly. Deployment length is also often unknown or varies across uses. The direct-floor ablation measures what extrapolation loses. The compute comparison measures what it saves. If extrapolation errors are small, fitting once and reusing the fit for several target lengths is strictly cheaper.

Why not just fix it with quantization-aware training afterward? Every Bit Counts reports that quantization-aware training does not rescue accuracy once bit-width falls below the threshold. We will re-test this claim in multi-layer models by fine-tuning the collapsed allocations found by the unpruned baselines at long length.

Why not just use Hessian sensitivity? Hessian-based sensitivity is computed at the calibration length and has no notion of length. AQ-BERT's reported margin over Q-BERT already suggests that it misallocates bits even at a fixed length.

Proposed Experiments

The synthetic stage uses three tasks. The equality task from Every Bit Counts is trained at $m=25$ and evaluated up to $m=200$. Parity and $S_5$ permutation composition, from Pause Tokens and Li et al., are given pause tokens or chain-of-thought steps so that the full-precision model succeeds at every length tested. Any failure after quantization can then be attributed to precision. Here we check whether the logarithmic fit predicts the true measured cliff at held-out lengths within one bit.

The language stage searches a GPT-2-style model on WikiText-103 at a 512-token context and evaluates perplexity at 1K, 2K, and 4K tokens. ETAS reports 21.72 perplexity for its full-precision discovered model. We found no reported result on Lacuna for mixed-precision search on WikiText-103 at extended context, so all quantized comparisons there are our own runs. The encoder stage uses BERT on SST-2 at the AQ-BERT budget and adds a long-document classification variant.

We apply two decisive checks. The first asks whether unpruned searches produce allocations whose long-length degradation clearly exceeds that of pruned searches at equal budget. If they do not, the premise is false and we will report that. The second asks whether the extrapolated floors track directly measured floors within one bit for most components. Secondary outcomes are the fraction of the per-layer choice space removed and the resulting reduction in search cost. We will also check floating-point formats separately, since the counting stall in Ahvonen et al. suggests their floors may grow faster than those of integer formats.