Does quantization affect models’ performance on long-context tasks?

A. Mary Mekala, Anirudh Atmakuru, Yixiao Song, Marzena Karpinska, Mohit Iyyer

Abstract

Large language models (LLMs) now support context windows exceeding 128K tokens, but this comes with significant memory requirements and high inference latency. Quantization can mitigate these costs, but may degrade performance. In this work, we present the first systematic evaluation of quantized LLMs on tasks with long inputs (64K tokens) and long-form outputs. Our evaluation spans 9.7K test examples, five quantization methods (FP8, GPTQ-int8, AWQ-int4, GPTQ-int4, BNB-nf4), and five models (Llama-3.1 8B and 70B; Qwen-2.5 7B, 32B, and 72B). We find that, on average, 8-bit quantization preserves accuracy (~0.8% drop), whereas 4-bit methods lead to substantial losses, especially for tasks involving long-context inputs (drops of up to 59%). This degradation tends to worsen when the input is in a language other than English. Crucially, the effects of quantization depend heavily on the quantization method, model, and task. For instance, while Qwen-2.5 72B remains robust under BNB-nf4, Llama-3.1 70B experiences a 32% performance drop on the same task. These findings highlight the importance of a careful, task-specific evaluation before deploying quantized LLMs, particularly in long-context scenarios and for languages other than English.

Introduction

As Large Language Models (LLMs) scale to support massive context windows (128K+ tokens), the computational and memory overhead becomes a significant bottleneck for deployment. Quantization—reducing weight precision to 4-bit or 8-bit—is a standard solution to mitigate these costs. However, existing benchmarks primarily focus on short-context tasks (under 2K tokens). This study investigates whether "squeezing" model weights impairs the ability to maintain coherence or retrieve information across long documents.

Experimental Framework

The researchers conducted a systematic evaluation using 9.7K test examples across five models: Llama-3.1 (8B, 70B) and Qwen-2.5 (7B, 32B, 72B). They compared five post-training quantization (PTQ) methods, ranging from 8-bit (FP8, GPTQ-int8) to 4-bit (AWQ-int4, GPTQ-int4, BNB-nf4).

Overview of the models, quantization methods, and evaluation benchmarks used in the study.

The evaluation utilized five benchmarks categorized by input/output type:

  • Long-Input Retrieval: RULER (English) and OneRuler (multilingual covering 26 languages).
  • Long-Input Reasoning: NoCha (claim verification based on entire books).
  • Long-Form Output: FActScore (biography generation) and CS4 (story generation with complex constraints).

Impact of Quantization on Long Contexts

The results reveal a stark contrast between 8-bit and 4-bit quantization. 8-bit methods (FP8 and GPTQ-int8) are remarkably robust, with an average performance drop of only ~0.8%. In contrast, 4-bit methods exhibit significant volatility, particularly in information retrieval tasks.

Performance degradation w.r.t. BF16 as context length increases from 8K to 128K across different quantization methods.

As shown in the figure above, performance degradation is non-linear and worsens significantly as the context window expands. At the 128K token limit, 4-bit methods like BNB-nf4 can lead to accuracy drops of up to 23% on average, with specific models like Llama-3.1 70B seeing drops as high as 59% in multilingual retrieval.

Key Findings:

  • The "Language Tax": Quantization disproportionately affects non-English languages. Performance drops in non-Latin scripts were up to five times higher than in English under the same quantization level.
  • Architecture Sensitivity: Model size is not a perfect predictor of robustness. While Qwen-2.5 72B remained stable under 4-bit quantization, Llama-3.1 70B experienced a massive 32% drop on identical tasks.
  • Output Quality: In long-form generation, 4-bit quantization slightly reduced factuality but significantly impacted story coherence and constraint satisfaction, especially in smaller (7B/8B) models.

Conclusion and Future Work

While 8-bit quantization offers a nearly "lossless" path for long-context deployment, 4-bit methods require extreme caution. The accumulation of quantization noise in positional embeddings (RoPE) likely contributes to the observed retrieval failures. Future work should explore long-context calibration and multilingual-aware quantization to mitigate these losses. Developers should perform task-specific evaluations rather than relying on general-purpose benchmarks when deploying quantized models for long-context applications.

Summary updated

Abstract

Large language models (LLMs) now support context windows exceeding 128K tokens, but this comes with significant memory requirements and high inference latency.Quantization can mitigate these costs, but may degrade performance.In this work, we present the first systematic evaluation of quantized LLMs on tasks with long inputs (64K tokens) and long-form outputs.Our evaluation spans 9.7K test examples, five quantization methods (FP8, GPTQ-int8, AWQ-int4, GPTQ-int4, BNB-nf4), and five models (Llama-3.1 8B and 70B; Qwen-2.5 7B, 32B, and 72B).We find that, on average, 8-bit quantization preserves accuracy (~0.8% drop), whereas 4-bit methods lead to substantial losses, especially for tasks involving longcontext inputs (drops of up to 59%).This degradation tends to worsen when the input is in a language other than English.Crucially, the effects of quantization depend heavily on the quantization method, model, and task.For instance, while Qwen-2.5 72B remains robust under BNB-nf4, Llama-3.1 70B experiences a 32% performance drop on the same task.These findings highlight the importance of a careful, task-specific evaluation before deploying quantized LLMs, particularly in long-context scenarios and for languages other than English.github.com/molereddy/long-context-quantization
BibTeX
@misc{mekala2025does,
  author = {A. Mary Mekala and Anirudh Atmakuru and Yixiao Song and Marzena Karpinska and Mohit Iyyer},
  title = {{Does quantization affect models’ performance on long-context tasks?}},
  year = {2025},
  eprint = {2505.20276},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.20276},
}
Figure