压缩与遗忘:bitsandbytes量化加剧大语言模型中的主动干扰 Compress and Forget: bitsandbytes Quantization Amplifies Proactive Interference in LLMs 预印本
原文摘要
查看英文原文摘要
Proactive interference (PI) is a documented failure mode in large language models in which retrieval of a repeatedly overwritten value degrades as prior overwrites accumulate, mirroring a classical phenomenon in human working memory. Post-training quantization (PTQ) is now the default deployment path for open-weight models, yet its effect on this failure mode has not been tested. We evaluate three precision levels (FP16, INT8, INT4/NF4, via bitsandbytes) across three architecturally distinct instruction-tuned models (Qwen2.5-7B-Instruct, Mistral-7B-Instruct-v0.3, Phi-3.5-mini-instruct), holding the retrieval task fixed. INT4 quantization significantly reduces accuracy under high interference in every model (e.g., from 81.0% to 68.3% for Qwen), confirmed by paired McNemar's tests ($p \le 2.6 \times 10^{-6}$) and a mixed-effects regression spanning all interference levels; INT8, often assumed safe, also carries a smaller but real penalty in two of three models. The effect is specific to semantically similar (word-type) distractors and reverses sign under a numeric control condition, and is mechanistically linked to a rise in same-key intrusion errors under INT4 (from 21.5% to 24.6% of trials, $p = 4.8 \times 10^{-7}$). A follow-up ablation shows the effect originates in the quantized transformer backbone rather than the output projection layer. These results suggest that bitsandbytes 4-bit quantization can impose an additional cost on applications relying on long, updatable, semantically dense contexts, even when aggregate benchmark accuracy appears largely unaffected. We release our code and tokenizer-verified vocabulary construction method at https://github.com/ShayanShahrabi/compress-and-forget
📚 参考文献 (24 条)
查看24 条参考文献
- [1] Tim Dettmers, Mike Lewis, Younes Belkada, and Luke Zettlemoyer. LLM.int8(): 8-bit matrix multi- plication for transformers at scale. In Advances in Neural Information Processing Systems (NeurIPS), 2022.
- [2] Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. QLoRA: Efficient finetuning of quantized LLMs. In Advances in Neural Information Processing Systems (NeurIPS), 2023.
- [3] Elias Frantar, Saleh Ashkboos, Torsten Hoefler, and Dan Alistarh. GPTQ: Accurate post-training quantization for generative pre-trained transformers. In International Conference on Learning Repre- sentations (ICLR), 2023.
- [4] Ji Lin, Jiaming Tang, Haotian Tang, Shang Yang, Wei-Ming Chen, Wei-Chen Wang, Guangxuan Xiao, Xingyu Dang, Chuang Gan, and Song Han. AWQ: Activation-aware weight quantization for LLM compression and acceleration. In Proceedings of Machine Learning and Systems (MLSys), 2024.
- [5] Chupei Wang and Jiaqiu Vince Sun. Unable to forget: Proactive interference reveals working memory limits in LLMs beyond context length. arXiv preprint arXiv:2506.08184, 2025.
- [6] Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang. Lost in the middle: How language models use long contexts. Transactions of the Associ- ation for Computational Linguistics, 2024. arXiv:2307.03172.
- [7] Sourav Chattaraj and Kanak Raj. Transformers remember first, forget last: Dual-process interference in LLMs. arXiv preprint arXiv:2603.00270, 2026.
- [8] Ying Xie. Learning to forget: Sleep-inspired memory consolidation for resolving proactive interfer- ence in large language models. arXiv preprint arXiv:2603.14517, 2026.
- [9] Jiaqi Zhao et al. Benchmarking post-training quantization in LLMs: Comprehensive taxonomy, unified evaluation, and comparative analysis. arXiv preprint arXiv:2502.13178, 2025.
- [10] Michael S. Zhang, Rishi A. Ruia, Arnav Kewalram, Saathvik Dharmapuram, Utkarsh Sharma, and Kevin Zhu. When less is more: 8-bit quantization improves continual learning in large language models. arXiv preprint arXiv:2512.18934, 2025.
- [11] Zhiwei Zhang, Fali Wang, Xiaomin Li, Zongyu Wu, Xianfeng Tang, Hui Liu, Qi He, Wenpeng Yin, and Suhang Wang. Catastrophic failure of LLM unlearning via quantization. In International Conference on Learning Representations (ICLR), 2025.
- [12] Zhongqian Fu, Tianyi Zhao, Kai Han, Hang Zhou, Xinghao Chen, and Yunhe Wang. An empirical study of world model quantization. arXiv preprint arXiv:2602.02110, 2026. Huawei Noah’s Ark Lab. 14
- [13] Anmol Mekala, Anirudh Atmakuru, Yixiao Song, Marzena Karpinska, and Mohit Iyyer. Does quanti- zation affect models’ performance on long-context tasks? In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pages 9422–9470, Suzhou, China, 2025. Associ- ation for Computational Linguistics. arXiv:2505.20276.
- [14] Qwen Team. Qwen2.5 technical report. arXiv preprint arXiv:2412.15115, 2024.
- [15] Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, L´elio Re- nard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Tim- oth´ee Lacroix, and William El Sayed. Mistral 7B. arXiv preprint arXiv:2310.06825, 2023.
- [16] Marah Abdin, Jyoti Aneja, Hany Awadalla, Ahmed Awadallah, Ammar Ahmad Awan, Nguyen Bach, Amit Bahree, Arash Bakhtiari, Jianmin Bao, Harkirat Behl, et al. Phi-3 technical report: A highly capable language model locally on your phone. arXiv preprint arXiv:2404.14219, 2024.
- [17] Skipper Seabold and Josef Perktold. Statsmodels: Econometric and statistical modeling with Python. In Proceedings of the 9th Python in Science Conference (SciPy), 2010.
- [18] Nathan Mantel and William Haenszel. Statistical aspects of the analysis of data from retrospective studies of disease. Journal of the National Cancer Institute, 22(4):719–748, 1959. A Full Task Design: Prompts, Scoring, and Vocabulary Construction Prompt template. Each trial consists of a sequence of natural-language update statements followed by a retrieval question. Given an interference level k, exactly k update statements are generated for the same subject and the same attribute, with each statement overwriting the previous value. The updates appear in chronological order, and the final update always contains the ground-truth value. The retrieval question is appended after a blank line and explicitly instructs the model to report only the most recent value. For example, a word-type trial takes the following form: Example prompt (word-type tria with k equal to 3) Adam’s mood is now happy. Adam’s mood is now nervous. Adam’s mood is now calm. Based only on the most recent update above, what is Adam’s mood right now? Reply with a single word and nothing else. Numeric attributes use the same structure but replace the update template and question accordingly (e.g., temperature or stock price) while requesting only the final numeric value. Thus every prompt follows the general pattern Update1, Update2, . . . , Updatek | {z } chronological overwrites →Retrieval Question where the only correct answer is the value introduced in the final update, and the prompt structure remains identical across all trials. Prompts are provided to each model through its native instruction-chat template (e.g., Qwen, Mistral, and Phi chat formats) using the tokenizer’s built-in function, as a single user message with no system prompt. 15
- Scoring and exact-match criteria. Models are prompted to answer with a single word (word-type at- tributes) or a single number (numeric attributes) and nothing else, and generation is capped at 12 new tokens. The raw response is lowercased and stripped of leading/trailing whitespace and a single trailing period, if present. For word-type attributes, we take the first contiguous alphabetic substring in the cleaned response (via a simple regular expression) and compare it against the gold value, also lowercased; a trial is scored correct only on an exact string match, with no partial-credit or fuzzy matching. For numeric attributes, we take the first contiguous run of digits (optionally signed) in the cleaned response and compare it against the gold integer as a string. Because generation is greedy and prompts explicitly instruct a single-token-style answer, the overwhelming majority of responses consist of exactly the target word or number with no ad- ditional content; the regular-expression extraction step exists primarily to strip a stray trailing period or an occasional short preamble rather than to resolve ambiguous outputs. We apply no normalization beyond casing, whitespace, and the trailing-period strip described above (e.g. no stemming, no synonym match- ing, no numeric tolerance window), so scoring is deliberately conservative in the same way across all three quantization levels. Tokenizer-verified vocabulary construction. For word-type attributes, each interference level k requires k unique values sampled without replacement from that attribute’s vocabulary pool. A naive approach risks two confounds as pools are made large enough to support high k: (1) word rarity drift (later-added words being less common), and (2) token-length drift (later-added words spanning more subword tokens). Both would let interference level and item difficulty covary, contaminating any accuracy-vs-level relationship. We mitigate this by fixing one large candidate list per category (80–140 common, everyday words) and filtering it, per tokenizer, to keep only words that occupy exactly one token as they actually appear in the trial template. We determine this by tokenizing the fully instantiated template string and checking, via the tokenizer’s character-offset mapping, how many resulting tokens overlap the candidate word’s character span. This check is robust across tokenizer families: byte-level BPE tokenizers (e.g. Qwen) fuse a leading space into the following word’s token, while SentencePiece-based tokenizers (e.g. Mistral, Phi) may add a constant leading token independent of content; both behaviors are correctly handled by reading offsets directly off the real tokenized sentence rather than inferring token count arithmetically from separately- encoded fragments.1 This yields a fixed, per-model, per-category vocabulary pool whose maximum usable interference level differs by model (Table 7) but whose quality does not vary with k: every level for a given model/category samples from the same fixed, filtered pool. Table 7: Maximum interference level tested per word-type attribute, by model (limited by tokenizer-filtered single-token vocabulary size). Model mood favorite color favorite animal occupation Qwen2.5-7B-Instruct 64 32 32 32 Mistral-7B-Instruct-v0.3 32 16 16 16 Phi-3.5-mini-instruct 16 16 8 16 Numeric attributes draw from a pool of ∼990 unique integers per category and therefore support all tested interference levels for every model. Unlike the word-type pools, we do not explicitly filter numeric values to be single-token: integers in our range (3–998) can span one or two tokens depending on the tokenizer and value. This does not reintroduce the level-drift confound the word-type filtering was designed 1An earlier version of our pipeline used exactly such an arithmetic approach (subtracting a ”blank” baseline encoding) and produced silently corrupted vocabulary pools for one tokenizer family while appearing to work for another – we flag this as a methodological pitfall worth documenting for others building similar evaluations. 16
- to prevent, because the numeric pool is fixed and level-invariant – every interference level samples from the same range of integers, so token-count composition does not systematically covary with k the way an insufficiently large word pool would. We nonetheless flag this as a minor asymmetry in rigor between the two conditions (Section 6). B Reproducibility: Model Loading Configuration All experiments were conducted on a single NVIDIA RTX 3090 GPU with 24 GB of VRAM. Unless other- wise specified, all models were loaded using the configuration summarized in Table 8. No additional dtype autocasting was applied beyond the compute dtype specified for INT4 quantization. Table 8: Model loading and quantization configuration used in all experiments. Setting Value GPU NVIDIA RTX 3090 (24 GB VRAM) Device map {"":0} Low CPU memory usage True INT8 configuration BitsAndBytes load in 8bit=True LLM.int8 outlier threshold 6.0 (default) llm int8 skip modules None INT4 configuration BitsAndBytes load in 4bit=True Quantization type NF4 Double quantization Enabled Compute dtype FP16 (torch.float16) NF4 block size 64 (default) modules to not convert None Additional dtype autocasting None C Trial Budget, Seeds, and Paired Design Each experimental condition (model × quantization × interference level × attribute) was evaluated using five independent random seeds, resulting in a total of 69,225 trials (28,050 word-type and 41,175 numeric) across 45 (model × quantization × seed) runs. For a fixed (model, seed) pair, the complete sequence of generated trials (including subject names, distractor values, trial ordering, attributes, and interference levels) was identical across FP16, INT8, and INT4. Thus, each quantization level was evaluated on exactly the same set of prompts, with the model weights being the only difference between runs. Consequently, all FP16–INT8 and FP16–INT4 comparisons reported in this paper are performed using paired trials rather than independently sampled trials, eliminating variation in item difficulty as a potential confounding factor. Across different seeds, subject names and distractor values were sampled independently from the same fixed, tokenizer-filtered vocabulary pool. Finally, the trial budget was intentionally weighted toward higher interference levels, where floor and ceiling effects are less likely to obscure the impact of quantization (Table 9). 17
- Table 9: Trials per interference level, per (model, quantization, seed, attribute) cell. Level k 1 2 4 8 16 32 64 96 Trials 15 15 20 25 60 50 60 60 D Statistical Methodology: Full Details For each model, we identify the interference level with the greatest statistical power for detecting a quantiza- tion effect – i.e. farthest from ceiling (ceiling effects dominate at low k for all models) and farthest from floor (floor effects dominate at very high k for the weaker models): Qwen at k = 64, Mistral at k = 16, and Phi at k = 8. At each selected level we compare FP16 vs. INT4 accuracy via Fisher’s exact test and report the odds ratio with a 95% confidence interval (computed with statsmodels; 17), and separately confirm the direction of the effect (FP16 > INT4) is consistent across all 5 seeds individually. To test whether the effect gener- alizes across models rather than relying on three separate per-model tests, we compute a Mantel–Haenszel test [18], pooling the three models’ 2 × 2 tables into a single common odds ratio, confidence interval, and significance test that controls for model identity as a stratifying variable. Second, and more importantly, because the per-model level selection above is chosen post-hoc for statis- tical power (a reasonable but auditable choice that a skeptical reader might still flag as researcher degrees of freedom), we additionally fit a mixed-effects logistic regression using all interference levels simultaneously, for every model and seed at once: correct ∼quant mode ∗log2(interference level) + (1 | model) + (1 | seed) + (1 | attribute) fit via variational Bayes using a Bayesian mixed generalized linear model (statsmodels; 17), with FP16 as the reference level for quantization mode and random intercepts for model, seed, and attribute. The attribute- level random intercept is included because our word-type and numeric attributes differ substantially in base- line difficulty (e.g. mood is markedly harder than favorite animal at the same interference level); without it, this attribute-level heterogeneity could in principle be partly absorbed into the fixed effects and inflate their apparent significance. The key term is the quantization-mode × log-interference-level interaction: a significant negative coefficient for INT4 means the INT4 accuracy penalty relative to FP16 grows as inter- ference increases, using the complete dataset rather than any selected subset. We fit this model separately for word-type and numeric attributes, since the specificity claim predicts opposite signs for the two. Paired significance testing (McNemar’s test). The per-model comparisons above (Fisher’s exact test, Mantel–Haenszel) are unpaired: they compare aggregate correct/incorrect counts between two quantization levels without exploiting the fact that, by construction, the same trial content is presented to both. We verified this pairing holds exactly across our full dataset: for every one of the 23,075 unique (model, seed, attribute, level, trial) combinations, the logged subject name and gold value are identical across all three quantization levels, with zero mismatches. Given this, we report McNemar’s exact test as our primary per-model signifi- cance test at each model’s selected level: this test uses only the discordant pairs (trials on which the two com- pared quantization levels disagree) and is therefore substantially better powered than the marginal Fisher’s exact test, which discards the pairing entirely. We retain the unpaired Fisher’s-exact/Mantel–Haenszel re- sults as a more conservative cross-check that does not depend on the pairing assumption. Random-slopes robustness check. To rule out the possibility that a model-specific or attribute-specific interference-level slope is being absorbed into the fixed-effect interaction terms of the mixed model above, we refit it with two additional variance components: random slopes for log2(level) by model and by attribute, alongside the random intercepts already described. 18
- Error-type classification (same-key intrusion analysis). Because trial generation is fully deterministic given its random seed, we reconstruct the exact ordered sequence of overwritten distractor values for every trial by replaying the seeded sampling procedure, and confirm this reconstruction exactly reproduces the logged subject name and gold value for all 23,075 unique trials, with zero mismatches. This lets us classify every incorrect response as a same-key intrusion (the extracted answer exactly matches one of the k −1 overwritten values for that trial) or a non-matching error, and to compute an intrusion rate as a fraction of all trials, not just of errors. Numeric token-length stratification. To address the token-length asymmetry between our tokenizer- filtered word-type pools and the unfiltered numeric pool, we separately tokenize every numeric value actu- ally used in a trial, in its real template context, per model tokenizer, using the same offset-mapping method as the word-type filtering. We use this to check whether token-length composition drifts with interference level (which would reintroduce the confound the word-type filtering was designed to avoid) and to stratify the FP16-vs-INT4 numeric comparison by token length. Interference Endurance Score (IES). Following Wang and Sun [5], we define IES as the area under the accuracy-vs-interference-level curve, computed via trapezoidal integration over a log2-scaled interference axis. We report a normalized variant – raw AUC divided by the tested log2 range – so that IES falls on the same [0, 1] scale as accuracy and remains comparable across models despite differing maximum tested inter- ference levels (Table 7). IES is computed directly from the paper’s existing trial-level dataset (Section 3.3), requiring no new experiments. E Additional Results and Robustness Checks Phi non-monotonicity at k = 16. Table 10 shows the one condition in our data where INT8 accuracy falls below INT4. We report this rather than omit it; it does not change the paper’s overall conclusions, since Phi’s key-level comparison (Table 2, Table 3) is conducted at k = 8, not k = 16. Table 10: Phi-3.5-mini-instruct at k = 16: the one condition in our data where INT8 accuracy falls below INT4, n = 300 per cell. FP16 INT8 INT4 Accuracy 37.1% 30.7% 35.3% Interpreting the mixed-model main effects. Beyond the interaction terms reported in Table 5, the model also shows sizeable negative main effects for both INT8 and INT4 relative to FP16, in both word-type and numeric attributes. Because interference level is log-transformed and centered at log2(1) = 0, these main-effect coefficients describe the quantization gap specifically at the lowest interference level (k = 1), where accuracy is near ceiling for every model and condition (Table 1, Figure 2). A significant main effect alongside a near-ceiling raw accuracy simply reflects that logistic regression coefficients operate on the log-odds scale, where small absolute probability differences near 100% correspond to comparatively large log-odds differences; it should not be read as evidence of a practically meaningful gap at k = 1, where raw accuracy differences between quantization levels are well under one percentage point in our data. The interaction terms, not the main effects, are the theoretically relevant quantities for this paper’s hypothesis, since they capture how the quantization gap changes with interference rather than its value at one arbitrary reference level. 19
- Robustness to random slopes. Table 5 includes random intercepts for model, seed, and attribute, but not random slopes for interference by model or attribute – leaving open the possibility that a model-specific or attribute-specific interference trend is being absorbed into the fixed-effect interaction terms. Refitting with random slopes for log2(level) by both model and attribute leaves the key interaction essentially unchanged in both panels: for word-type, the INT4 × log-interference-level interaction becomes β = −0.048, OR = 0.95, 95% CI [0.94, 0.97], z = −5.62, p = 1.9×10−8 (vs. β = −0.046, p = 5.7×10−8 without random slopes); for numeric, it becomes β = +0.059, OR = 1.06, 95% CI [1.05, 1.07], z = 11.84, p < 10−16 (vs. β = +0.053, p < 10−16). The opposite-signed specificity result – this paper’s central claim – is therefore not an artifact of unmodeled model- or attribute-specific interference trends. One secondary term does change: the numeric INT8 × log-interference-level interaction, weakly significant without random slopes (p = 0.0049), becomes non-significant with them (β = +0.004, p = 0.369); this term is not part of the main hypothesis (which concerns INT4), so it does not affect our conclusions. Ruling out a token-length confound. Because the numeric pool is not tokenizer-filtered to be single- token, unlike the word-type pools, a skeptical reading of the specificity result is that it reflects token-length differences rather than semantic (non-)confusability. Two checks address this. First, the token-length com- position of the numeric values actually used is essentially flat across all eight interference levels (dominated by 3-token numbers at 89.9–92.4% of trials at every level, with 2-token and 1-token values each main- taining a roughly constant share), confirming the numeric pool does not exhibit the level-drift confound the word-type filtering was designed to prevent. Second, stratifying the FP16-vs-INT4 comparison at high inter- ference levels (32, 64, 96 pooled) by token length shows the specificity direction holds in every stratum and is individually significant in the dominant 3-token stratum, which accounts for >89% of all numeric trials: FP16 69.4% vs. INT4 71.2% (n = 6,882 pairs, OR = 0.92, 95% CI [0.85, 0.99], p = 0.021). The 1-token (n = 32) and 2-token (n = 736) strata point in the same direction but are individually underpowered (OR = 0.86, p = 0.78; OR = 0.94, p = 0.57). The numeric-attribute asymmetry flagged in Section 6 does not appear to drive the specificity result. IES on numeric (control) attributes. Table 11 reports the same INT8/INT4 IES penalty computed on numeric attributes, for comparison with the word-type results in Section 4.3. The pattern only partially corroborates the specificity result of Section 4.5. For Mistral, the INT4 penalty is clearly larger under word-type interference (5.1%) than numeric (2.6%), consistent with the paper’s central claim. For Qwen, both penalties are small and comparable (1.8% vs. 0.05%), which is consistent with the cliff-dilution effect discussed above rather than with a genuine word/numeric asymmetry at this model’s tested levels. For Phi, INT4’s numeric IES is higher than FP16’s (−3.98%, i.e. INT4 nominally outperforms FP16 on the numeric control by this metric); this is a small-magnitude reversal consistent with the sign flip already established for numeric attributes in the mixed-effects analysis (Section 4.4), and we treat it as a null/mixed result for this model rather than evidence against the paper’s specificity claim. Phi’s INT8 numeric penalty (5.49%) is notably larger than its word-type INT8 penalty (3.53%); we have not independently traced this to a specific interference level and report it as an observed, unexplained asymmetry rather than folding it into the main narrative. A methodological detail not independently re-verified. IES for word-type attributes pools across four attributes (mood, favorite color, favorite animal, occupation) whose tokenizer-filtered vocabulary caps differ within a model (Table 7: e.g. for Qwen, mood reaches k = 64 but occupation caps at k = 32). We did not verify how the underlying computation handles this asymmetry – whether the highest tested levels are pooled only across the attributes that support them, or some other convention – and report the IES values in Section 4.3 as provided, flagged here as an unverified detail rather than a confirmed part of the methodology. 20
- Table 11: INT8/INT4 IES penalty (% lost relative to FP16) on numeric (control) attributes, for comparison with the word-type results in Table 4. Model INT8 % IES lost INT4 % IES lost Qwen2.5-7B-Instruct −0.07% 0.05% Mistral-7B-Instruct-v0.3 0.76% 2.60% Phi-3.5-mini-instruct 5.49% −3.98% F lm head Ablation: Additional Methodological Detail Our first attempt at this ablation reran the INT4 configuration with the output projection (lm head) explicitly excluded from quantization via a skip-list argument. This produced outputs identical to the original INT4 condition on all 5,050 paired trials, token for token. Inspecting the loaded model revealed why: under the installed library version, lm head is left at full precision by default irrespective of this argument. This means the INT4 condition used throughout the paper never quantized lm head in the first place – a property of the library’s defaults, not an error in our setup – so every INT4 result in the main text reflects backbone-only quantization. To obtain the intended comparison, we instead manually converted lm head to a genuine 4-bit layer on top of the standard INT4 model, matching the backbone’s quantization settings, and confirmed the conver- sion took effect before running any trials. This corrected condition differs from the original backbone-only INT4 condition on 4.0% of paired trials (203/5,050) – a small but genuine footprint, as expected from quan- tizing one additional layer, and the basis for the comparison reported in Section 4.7. Full implementation details are available in the released code repository. 21