Manuscript Offprint

arXiv:2609.37887

Behavioral Capacity Certificates for Quantized Language Models

Arian Eamaz, Mojtaba Soltanalian

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Activation and key-value cache precision change what a quantized language model computes without altering its stored weights. Direct weight-code bounds, however, assign identical complexity to deployments that behave differently and charge separately for weight codes that behave identically. Behavioral Capacity Certificates (BCC) charge for behavior using the aggregate prior mass of complete implementations—weights, scales, activation and cache rules—that induce the same bounded loss. When quantization merges implementations, this shared mass lowers the complexity penalty, and a break-even law determines when the saving survives the cost of validating it. BCC supports a three-step deployment workflow, and our experiments verify each step. First, a forward-only screen shortlists per-layer bit-widths by how often candidate perturbations preserve the reference predictions, with quality comparable to Hessian-guided selection at lower preprocessing cost. Second, margin-certified cells identify weights that can be pruned or sign-flipped without changing the deployed behavior: every permitted combination preserves all declared predictions, and on OLMoE-1B-7B and SmolLM2-1.7B, independent probes bound the probability that any permitted combination changes a prediction on new text. Third, BCC bounds the population loss of the deployed model, nonvacuously for complete decoders and more tightly than the compressed-code route. At equal cache memory, giving keys higher precision than values yields lower NLL and higher prediction agreement on GPT-2, Qwen2.5, and SmolLM2, together with a tighter complexity bound in the GPT-2 audit.

1 INTRODUCTION

Weight quantization reduces parameter storage of large language models (Frantar et al., 2022; Lin et al., 2024). But a deployment is not solely defined by a weight bit-width. At long context, the key-value (KV) cache can dominate inference memory, motivating its quantization alongside the weights (Liu et al., 2024). Activation quantization also helps meet computation budgets by enabling low-precision matrix multiplications and reducing activation storage (Xiao et al., 2023). Activation precision, cache precision, scaling conventions, and clipping rules shape the computation and can be varied while stored weight tensors remain fixed. It is therefore plausible to expect scenarios in which deployments with byte-identical weight checkpoints compute different functions, while activation rounding absorbs weight differences, allowing distinct checkpoints to produce identical outputs.

Compression-based generalization bounds connect empirical loss to a description of a reconstructed predictor, including PAC–Bayesian compression approaches (Zhou et al., 2019; Lotfi et al., 2022; 2024). When numerical conventions are fixed as side information, a direct weight-code charge assigns identical complexity to a 16-bit and a 4-bit cache even when their outputs differ. This motivates a complementary question to choosing the best weight–activation (W/A) format for a transformer’s feed-forward network (FFN): how should generalization be certified when different W/A formats and cache rules induce the same bounded loss on the declared domain? Behavioral Capacity Certificates address this question by aggregating prior probability over complete implementations with the same

Code and reproduction instructions: https://github.com/eamaz/bcc.

Figure

Figure 1: BCC aggregates prior mass by bounded loss. Construction-derived cells additionally pay independent-probe transfer.

bounded loss function. Their shared mass determines the behavioral complexity, allowing the bound to credit alternative implementations of the same task behavior.

Background and prior art. PAC–Bayes relates population loss to empirical loss and divergence from a sample-independent prior (Shawe-Taylor & Williamson, 1997; McAllester, 1998; 1999; Maurer, 2004). Compression analyses reduce that divergence by giving the predictor a short description: noise-stable networks admit compressed surrogates (Arora et al., 2018), and explicit codes yield nonvacuous bounds for stochastic networks and language models (Dziugaite & Roy, 2017; Zhou et al., 2019; Lotfi et al., 2024). Our setting differs in two ways. First, these bounds charge for the description of one predictor; we charge for the pooled prior mass of every implementation inducing the same loss, so activation and cache choices that leave the weights unchanged still enter the certificate. Second, under a declared perturbation law that mass is the probability that an implementation change leaves the loss unchanged, so one quantity bounds both complexity and perturbation risk. Functional-equivalence covers (Shen, 2024) and symmetry-based PAC–Bayes bounds (Beck & Ochs, 2025) exploit hidden-unit permutations or other group actions that preserve the input–output map; we merge implementations across quantization formats that share a loss on every declared input. HAWQ-V2 (Dong et al., 2020) and SmoothQuant (Xiao et al., 2023) choose precisions with curvature or rescaling heuristics defined on weights; we score candidates by the behavior they preserve.

Certifying shared behavior. Let E\mathcal{E} be the countable set of complete implementations, and let Π(e)=ge\Pi(e) = g_e map each implementation to its bounded loss function ge:X→[0,1]g_e : \mathcal{X} \to [0,1]. The fiber of a behavior gg is its preimage:

F(g):=Π−1(g)={e∈E:ge(X)=g(X)foreveryX∈X}.\mathcal{F}(g):=\Pi^{-1}(g)=\{e\in\mathcal{E}:g_{e}(X)=g(X)\mathrm{f o r e v e r y}X\in\mathcal{X}\}.

For a sample-independent prior ν\nu, its mass and behavioral complexity are

νˉ(g)=ν(F(g))=∑e∈F(g)ν(e),KW,A(g)=−ln⁡νˉ(g).(1)\bar{\nu}(g)=\nu(\mathcal{F}(g))=\sum_{e\in\mathcal{F}(g)}\nu(e),\qquad K_{W,A}(g)=-\ln\bar{\nu}(g). \tag{1}

The behavioral quotient E/∼\mathcal{E}/\sim is the set of these fibers, grouping implementations that have identical loss on every declared input; thus e∼e′e \sim e' exactly when ge=ge′g_e = g_{e'}. The Occam–KL bound certifies deterministic deployments at this complexity. With a uniform B-bit prior, a size- NgN_g fiber costs B−log⁡2NgB - \log_2 N_g bits. Certified subsets lower-bound its mass and thus upper-bound its complexity. A three-implementation toy example can be a uniform prior over three complete implementations, differing only in their quantized weight vectors: w1=(−1,−1,+1)w_1 = (-1, -1, +1), w2=(−1,+1,+1)w_2 = (-1, +1, +1), and w3=(+1,−1,+1)w_3 = (+1, -1, +1), with ν(ei)=1/3\nu(e_i) = 1/3. Suppose e1e_1 and e2e_2 induce the same bounded loss function gAg_A on every declared input, while e3e_3 induces gB≠gAg_B \neq g_A. The fiber F(gA)={e1,e2}\mathcal{F}(g_A) = \{e_1, e_2\} therefore has mass νˉ(gA)=2/3\bar{\nu}(g_A) = 2/3. Naming e1e_1 costs −ln⁡(1/3)=ln⁡3-\ln(1/3) = \ln 3, whereas naming its behavior costs KW,A(gA)=−ln⁡(2/3)=ln⁡(3/2)K_{W,A}(g_A) = -\ln(2/3) = \ln(3/2). BCC thus saves ln⁡2\ln 2 nats, exactly one bit, in the certificate's complexity penalty while keeping the same empirical loss. This saving comes from shared behavior and requires no parameter-space metric. A practitioner chooses weight and activation precision, compresses the KV cache, prunes weights, and must tolerate faults in the stored ones; each of these changes the implementation, and a guarantee tied to one implementation's description survives none of them. Because BCC certifies behavior rather than a particular implementation, every change that stays inside the certified fiber keeps the same guarantee, and the certificate identifies which changes stay inside it. This supports a simple workflow: screen candidates cheaply, certify the changes that preserve behavior, and bound the model finally deployed. The main target is a certificate that stays valid through the decisions a deployment actually makes.

Our contributions are:

• Nonvacuous bounds beyond lossless compression. BCC aggregates prior mass across complete implementations that induce the same bounded loss function. We derive population-risk bounds and identify when aggregation savings survive independent validation. Complete-decoder experiments yield nonvacuous bounds tighter than lossless histogram-and-order coding; exact finite-task comparisons also improve on the cheapest Huffman-coded realization under the same prior (Tables 2 and 7).

• One mass for generalization and stability. Under a declared perturbation law, the probability of preserving the entire loss function bounds both behavioral complexity and expected perturbation damage, with the mixture-prior cost included. The provided certificate does not need any parameter metric, differentiability, or local minimum as discussed in Proposition 4.2. Proposition 4.1 identifies weight signs that may be flipped and weights that may be zeroed while every reference prediction on the declared domain is preserved. Many such perturbations change the weights and not the behavior: they remain in the same fiber, so a practitioner may deploy them and keep the same certificate. Margin certificates identify large families of simultaneous output-head sign flips and pruning edits with prediction-preservation guarantees, validated on GPT-2 and OLMoE across cache precisions (Table 4 and Appendix B.16).

• Practical guidance for quantized deployment. A forward-only screen shortlists weight-precision choices with quality comparable to Hessian-guided selection at lower measured preprocessing cost (Table 5). At equal cache memory, our audits show that assigning higher precision to keys than values yields lower NLL and higher prediction agreement on GPT-2, Qwen2.5, and SmolLM2 (Table 3; Appendix B.15).

Notation. An implementation e=(aq,θ,s,t,r,k,mT)e = (a_q, \theta, s, t, r, k, m_T) specifies format, weights, scales, thresholds, residual/normalization rules, cache rules, and teacher/calibration metadata. Its predictor is fef_e, and e0e_0 denotes the reference implementation. For cache comparisons, e0,he_{0,h} uses cache setting hh. Let S∼DmS \sim \mathcal{D}^m and Z∼DnZ \sim \mathcal{D}^n be independent document samples for construction and probing. For ℓ(fe,X)∈[a,a+Δ]\ell(f_e, X) \in [a, a + \Delta], define ge=(ℓ(fe,⋅)−a)/Δg_e = (\ell(f_e, \cdot) - a)/\Delta, R0(g)=EDg(X)R_0(g) = \mathbb{E}_{\mathcal{D}} g(X), and R^0(g)=m−1∑ig(Xi)\widehat{R}_0(g) = m^{-1} \sum_i g(X_i). Thus R(fe)=a+ΔR0(ge)\mathcal{R}(f_e) = a + \Delta R_0(g_e) and R^S(fe)=a+ΔR^0(ge)\widehat{\mathcal{R}}_S(f_e) = a + \Delta \widehat{R}_0(g_e). For q∈[0,1]q \in [0, 1] and c≥0c \geq 0, kl+−1(q,c)=sup⁡{r∈[q,1]:kl(q∥r)≤c}\mathrm{kl}_+^{-1}(q, c) = \sup\{r \in [q, 1] : \mathrm{kl}(q \| r) \leq c\}, where kl\mathrm{kl} is binary KL divergence. In this paper, a certificate is a mathematically established guarantee on population loss or preservation of declared behavior, under the stated assumptions.

References (100)

  • Stronger generalization bounds for deep nets via a compression approach
  • Symmetries in PAC-bayesian learning (opens arXiv in a new tab)
  • Sharp minima can generalize for deep nets
  • HAWQ-V2: Hessian aware trace-weighted quantization of neural networks
  • Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data (opens arXiv in a new tab)
  • Switch Transformers: Scaling to trillion parameter models with simple and efficient sparsity
  • GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers
  • Breaking the 1.58-bit barrier for ternary LLMs, 2026 (opens arXiv in a new tab)
  • Quantize what counts: More for keys, less for values (opens the publisher in a new tab)
  • Mixtral of Experts
  • AWQ: Activation-aware weight quantization for on-device LLM compression and acceleration
  • KIVI: A tuning-free asymmetric 2bit quantization for KV cache
  • PAC-bayes compression bounds so tight that they can explain generalization (opens arXiv in a new tab)
  • Non-vacuous generalization bounds for large language models
  • Andreas Maurer. A note on the PAC bayesian theorem. arXiv preprint cs/0411099, 2004. URL https://arxiv.org/abs/cs/0411099. (opens arXiv in a new tab)
  • David A. McAllester. Some PAC-Bayesian theorems. In Proceedings of the Eleventh Annual Conference on Computational Learning Theory, pp. 230–234. ACM, 1998. doi: 10.1145/279943.279989. URL https://doi.org/10.1145/279943.279989. (opens the publisher in a new tab)
  • David A. McAllester. PAC-Bayesian model averaging. In Proceedings of the Twelfth Annual Conference on Computational Learning Theory, pp. 164–170. ACM, 1999. doi: 10.1145/307400.307435. URL https://doi.org/10.1145/307400.307435. (opens the publisher in a new tab)
  • A PAC analysis of a Bayesian estimator (opens the publisher in a new tab)
  • SpindleKV: A novel KV cache reduction method balancing both shallow and deep layers (opens the publisher in a new tab)
  • SmoothQuant: Accurate and efficient post-training quantization for large language models
  • Non-vacuous generalization bounds at the ImageNet scale: A PAC-Bayesian compression approach
  • All logarithms are natural unless a base is shown; the main text defines the bounded losses and sampling events
  • For every countable implementation prior $\nu$ and behavior map $\Pi$, fix one representative $s(g) \in \Pi^{-1}(g)$ for each $g$ with $\bar{\nu}(g) > 0$ and define the sample-independent prior $\nu^{\dagger}(s(g)) = \bar{\nu}(g)$, with zero mass on the other implementations
  • Among all sample-independent direct and behavioral priors
  • Under an arbitrary joint prior the fiber still factorizes as a set, and its joint probability must be used
  • The inclusion holds for any architecture with known fiber mass
  • Set $c_g = [K_{W,A}(g) + \ln(1/\delta)]/m$ and allocate failure probability $\delta\bar{\nu}(g)$ to each countable behavior
  • Thus the posterior may be selected on $S$ without an extra posterior-selection union bound
  • When $U_{raw}$ is the interior KL root, the same threshold decomposes exactly as
  • Under the notation of Corollary 2.6, for a uniform implementation prior with fiber size $F$, $G = \log_2 F$
  • More generally, if a sequence of valid transfer bounds satisfies $\tau_n \to d_\infty$, then every sufficiently large $n$ wins when $d_\infty < \Delta_{\text{core}}$ and no sufficiently large $n$ wins when $d_\infty > \Delta_{\text{core}}$
  • The representation $\phi$ is recomputed for A4 and A8, so activation precision can change the certified radius
  • The population bounds on margins and feature magnitudes must be sound
  • At layer $\ell$, let $\Omega_\ell$ be a sample-independent, certified finite set of states that can reach the quantized boundary, and let $T_\ell(\theta_\ell) = (F_{\ell,\theta_\ell}(u) : u \in \Omega_\ell)$
  • The reachable-state sets must cover every admissible upstream choice
  • The kernel describes implementation variation; it need not equal the coding prior $\nu$, and an adaptively centered kernel is not automatically a legal sample-independent coding prior
  • Exact cells have $\tau = 0$; empirical cells obtain $\tau$ from independent probes (Theorem 2.4)
  • It need not beat direct certification of $R_\kappa$ from perturbed predictions
  • The population-margin construction uses nominal activations and margins, whose acquisition and processing carry a separate cost
  • If the nominal correctness probability c is known, both routes can also sample inputs conditional on nominal correctness: their estimators become $c\overline{Z}$ and $cw\overline{Y}$, respectively, and both variances are multiplied by $c^2$
  • Under Proposition A.5, let $0 < s < 1$, $w = 1 - s$, and let $N \geq 1$ be an integer direct-audit budget
  • For $r = 1$, $N - \lceil(1 - s)N\rceil = \lfloor sN\rfloor$, so the test is equivalent to $\lfloor sN\rfloor > b$, or $sN \geq \lfloor b\rfloor + 1$
  • Also $\mathbb{E}_{e' \sim \kappa_j'} R'(e') = \mathbb{E}_{e \sim \kappa_j} R(e)$ by loss preservation
  • Merging the first two implementations and adding their masses preserves those probabilities and the complexity $\ln(3/2)$ of $g_A$
  • Proposition 4.2 allows a declared dictionary of kernels and charges for choosing one, including its center
  • Increasing $s_{j}$ tightens both upper bounds for fixed $L_{j}$ and nominal risk
  • A margin-certified coordinate bank therefore supplies both bounds without enumerating every allowed fault combination
  • Then $R_{\kappa_j}(e) = s_j u + (1 - s_j)$ and $D_j^+(e) = (1 - s_j)(1 - u)$
  • The loss and sampling unit below specify each guarantee
  • For a fixed bias $b$ and three-class decoder $D$, the network predicts $\hat{y}_W(x) = \arg\max_c[DQ_A(\tanh(Wx + b))]_c$, where $W$ is $3 \times 3$
  • Cross-weight comparisons hold the task, decoder, bias, and labels fixed
  • A deterministic Huffman tree for $\rho_q$, with ties broken by code/node index, assigns length $L_q(w)$
  • Aggregation supplies a further 1.344 and 1.954 bits, tightening the compressed-code bounds in both tasks
  • This isolates the complexity saving obtained by pooling format choices
  • We use three existing four-layer character decoders with width 16, two attention heads, and a 65-character vocabulary
  • Conditioned on the fixed source checkpoint, the prior is uniform over the 256 format tuples, so an individual format choice costs eight bits
  • Continuation equality preserves any declared loss determined by the generated tokens and target, so the matching implementations belong to the same loss fiber on that domain
  • All four precision fields vary within each reported family
  • One-sided Clopper–Pearson bounds use three ledger entries with $\delta = 0.05/3$ , giving joint 95% confidence
  • Linear inputs use A4 or A8 dynamic max-absolute quantization
  • Each model trains for 16 epochs on 30,000 examples (data seed 7241), using AdamW with learning rate 0.003, weight decay $10^{-4}$, batch size 512, gradient clipping at one, and straight-through quantizer gradients
  • The deployed distribution is $p_{s,e} = (15 / 16)p_e + 1 / 256$
  • The likelihood bound converts back to bits as $a + \Delta U$ and applies to this smoothed deployment
  • For token embedding $E_{vj}$, position embedding $P_{tj}$, and fixed input quantizer $Q_{b,s}$, let
  • Table 2 reports NLL; Table 9 reports error
  • The 20,000-example held-out set is separate from the certificate sample
  • The existing width-16 checkpoints from seeds 1, 2, and 3 of Section B.6 are each deployed at W4/A4 and W4/A8
  • Every linear matrix uses per-row W4 quantization with stored FP32 row scales; embeddings use FP16 and normalization parameters FP32
  • One pair is one observation
  • Define $a = -\log_2(15/16 + 1/(16V))$ and $b = \log_2(16V)$
  • We compare NLL bounds with the stronger uniform-predictor baseline $\log_2 65 = 6.02237$ bits, as well as their bounded-loss ceiling
  • The twelve model/loss pairs consume 12/480 confidence; two simultaneous Occam events, one per loss, each consume 1/80 and cover every code route and model
  • Raw, compressed, and BCC controls share the same evaluated losses and confidence allocation
  • The exact target is 0–1 error; the Brier target is $g_e^{\mathrm{B}}(X) = \frac{1}{2}\sum_{k=1}^{16}(p_e(k\mid x) - \mathbf{1}\{k=y\})^2$
  • For Brier, candidates in the selected format are sorted by construction mean loss, and the uniform
  • The 4,000-probe control fails to improve the direct certificate in every format: for T/A8, 12.000 saved bits are insufficient against a 122.710-bit threshold
  • Only block 11's $768 \times 3072$ and $3072 \times 768$ FFN matrices are quantized; other fields are fixed
  • The score is a smoothed marginal retention statistic, rather than a joint fiber-mass estimate
  • The mean-escape score slightly improves on the logarithmic score; the covariance-aware Hessian has slightly lower Shakespeare NLL increase
  • BFMS takes 3.40–6.15 seconds versus 17.58–34.13 for 128 Hessian products; ratios against
  • Dense width-16 Hessian checks have symmetry residual at most $1.06\times 10^{-15}$ and finite-difference curvature error at most $4.43\times 10^{-7}$
  • $U_{440}$ uses the full allocation prior; $U_{6}$ uses the independently frozen finalists
  • The earlier isolated-layer selection underperformed HAWQ on NLL, motivating complete-model reevaluation
  • An independent integer-weight teacher supplies binary labels
  • For local behavior $g_{u}$ its mass is $p_{u}(g_{u}) = M_{u,\mathrm{bin}} / (22^{d_{u}}) + M_{u,\mathrm{tern}} / (23^{d_{u}})$; global mass is $\prod_{u} p_{u}(g_{u})$
  • Dynamic programming optimizes complexity at each encoded-bit and empirical-error state, then checks the KL bound
  • Its $768 \cdot 50,257 = 38,597,376$ symbols are binary or ternary with a fixed global scale
  • No A8 feature coordinate is identically zero
  • Pruning removes 50,623 W1 or 45,626 ternary weights; fault trials flip 5,063 signs
  • Every random mask changes more than 23,000 predictions
  • The certified bank has zero failures, and each activation-only bank fails every trial
  • All $2^{50,623}$ combinations remain within the same prediction-preserving cell and behavioral fiber, retaining the same 0–1 loss and, with the prior and certification data fixed, the same behavioral certificate
  • We evaluate allenai/OLMoE-1B-7B-0924 at pinned revision 6d84c485
  • The finite population is the 286,892 eligible endpoints in the pinned WikiText-2 test token stream at dataset revision b08601e0
  • A prefix fails if some permitted edit changes some required teacher-forced or greedy prediction
  • Head upper compares the frozen integer head with the raw head under BASE. Deployment changes compare each unedited deployment with BASE using the same frozen head
  • >Setting</td><td colspan=
  • The recorded execution visits all 64 experts in every layer in both teacher-forced and greedy modes
  • We evaluate HuggingFaceTB/SmolLM2-1.7B at pinned revision effd688a
  • The same 21,874-coordinate family is used in every row

Couldn't load all references. Reload the page to try again.