TL;DR
Task-Aware Quantization (TAQ) is a training-free, mixed-precision framework that allocates more bits to the specific transformer layers most critical for a given downstream task. By using unlabeled calibration prompts to identify task-relevant "hotspots" in the residual stream, TAQ achieves superior accuracy-memory trade-offs and significant hardware speedups compared to task-agnostic quantization methods.
What Problem Does This Paper Address?
Large Language Models (LLMs) are massive, making them expensive to deploy. Post-training quantization (PTQ) helps by compressing weights (e.g., from 16-bit to 4-bit), but standard methods are "one-size-fits-all." They treat every layer as equally important or use generic proxies for "salience" that don't change whether the model is solving calculus or writing Python.
The authors argue that this is wasteful. Mechanistic interpretability research shows that different tasks rely on different regions of the model. If you over-compress a layer that is vital for coding logic, performance collapses, even if that layer is "unimportant" for general conversation. The challenge is identifying these task-critical layers efficiently without expensive retraining or labeled data.
Methods
The authors introduce Task-Aware Quantization (TAQ), a weight-only, mixed-precision framework. It uses a small set (e.g., 512) of unlabeled prompts from a target task to score layer importance. Based on these scores, it keeps the most important layers at 8-bit and compresses the rest to 4-bit.
They propose three scoring mechanisms:
- TAQ-IS (Information and Stability): A label-free metric that looks at the "hidden representations." It uses spectral entropy (how dispersed the information is) and activation variance (how stable the signals are). High entropy and low variance suggest a layer is doing heavy lifting for that specific task.
- TAQ-KL (Output Sensitivity): This injects a small amount of "quantization-like" noise into a specific layer and measures how much the final output distribution (logits) changes using KL divergence.
- TAQ-O (Oracle): A diagnostic tool that quantizes layers one by one and measures the actual drop in task accuracy. This requires labels and is used as a "gold standard" for comparison rather than a deployment method.
Datasets
The framework was evaluated across three diverse domains using four open-weight model families (Qwen2/2.5, Gemma-2, Llama-3.1, and Phi-4):
- Knowledge Retrieval: TriviaQA (Exact Match and F1).
- Code Understanding: CodeMMLU (Exact Match).
- Mathematical Reasoning: MMLU-Pro (Exact Match).
Key Insights and Ideas
- Task-Specific "Hotspots": The paper confirms that task-relevant information is not uniformly distributed. For example, coding tasks might rely on different layers than factual retrieval. TAQ identifies these "boundary layers" where task-conditioned computation is concentrated.
- Quantization as Denoising: In some cases, TAQ-quantized models actually outperformed the original FP16 models. The authors hypothesize that task-aware quantization can act as a form of "task-conditioned denoising," suppressing irrelevant activation noise while preserving the signal.
- The "Mixed-Task" Bonus: Surprisingly, calibrating TAQ on a mix of different tasks (math, code, and trivia) often yielded better results than calibrating on a single task. This suggests that a broader calibration pool can act as a regularizer, preventing the quantization policy from overfitting to a specific prompt style.
- Stability of the Residual Stream: The authors found that layer importance rankings remain remarkably stable even after upstream layers have been quantized. This justifies using "clean" model statistics to make quantization decisions for the entire stack.
Key Results
- Better Trade-offs: On MMLU-Pro, TAQ outperformed stronger mixed-precision baselines like SliM-LLM while using 1–2 fewer bits per layer on average.
- Accuracy Gains: On CodeMMLU with Qwen2.5-3B, TAQ-KL achieved 46.83% EM, dwarfing GPTQ (24.66%) and AWQ (20.61%) at similar memory footprints.
- Hardware Speedups: Validated on NVIDIA A40 GPUs, TAQ-IS provided a 35% throughput improvement and a 26% reduction in latency compared to the FP16 baseline at batch size 1.
- Compression: TAQ achieved roughly 2.6x weight compression while maintaining high task performance, effectively bridging the gap between the efficiency of 4-bit models and the accuracy of 8-bit models.
Limitations and Future Work
- Distribution Shift: TAQ relies on calibration prompts that represent the target task. If the model encounters a wildly different distribution in production, the bit allocation might no longer be optimal.
- Local vs. Global: The scoring rules are "local proxies"—they look at layers in isolation or their direct effect on the output. They don't explicitly account for complex, higher-order interactions between multiple quantized layers.
- Beyond Layers: The current work focuses on per-layer allocation. The authors suggest that future work could extend this to "sub-layer" components (like specific attention heads or MLP neurons) or integrate it with activation steering techniques.
Summary updated