Saved in:
Bibliographic Details
Main Authors: Fang, Sen, Ding, Weiyuan, Mastropaolo, Antonio, Xu, Bowen
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2506.22776
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908427294343168
author Fang, Sen
Ding, Weiyuan
Mastropaolo, Antonio
Xu, Bowen
author_facet Fang, Sen
Ding, Weiyuan
Mastropaolo, Antonio
Xu, Bowen
contents Quantization has emerged as a mainstream method for compressing Large Language Models (LLMs), reducing memory requirements and accelerating inference without architectural modifications. While existing research primarily focuses on evaluating the effectiveness of quantized LLMs compared to their original counterparts, the impact on robustness remains largely unexplored.In this paper, we present the first systematic investigation of how quantization affects the robustness of LLMs in code generation tasks. Through extensive experiments across four prominent LLM families (LLaMA, DeepSeek, CodeGen, and StarCoder) with parameter scales ranging from 350M to 33B, we evaluate robustness from dual perspectives: adversarial attacks on input prompts and noise perturbations on model architecture. Our findings challenge conventional wisdom by demonstrating that quantized LLMs often exhibit superior robustness compared to their full-precision counterparts, with 51.59% versus 42.86% of our adversarial experiments showing better resilience in quantized LLMs. Similarly, our noise perturbation experiments also confirm that LLMs after quantitation generally withstand higher levels of weight disturbances. These results suggest that quantization not only reduces computational requirements but can actually enhance LLMs' reliability in code generation tasks, providing valuable insights for developing more robust and efficient LLM deployment strategies.
format Preprint
id arxiv_https___arxiv_org_abs_2506_22776
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Smaller = Weaker? Benchmarking Robustness of Quantized LLMs in Code Generation
Fang, Sen
Ding, Weiyuan
Mastropaolo, Antonio
Xu, Bowen
Software Engineering
Artificial Intelligence
Programming Languages
Quantization has emerged as a mainstream method for compressing Large Language Models (LLMs), reducing memory requirements and accelerating inference without architectural modifications. While existing research primarily focuses on evaluating the effectiveness of quantized LLMs compared to their original counterparts, the impact on robustness remains largely unexplored.In this paper, we present the first systematic investigation of how quantization affects the robustness of LLMs in code generation tasks. Through extensive experiments across four prominent LLM families (LLaMA, DeepSeek, CodeGen, and StarCoder) with parameter scales ranging from 350M to 33B, we evaluate robustness from dual perspectives: adversarial attacks on input prompts and noise perturbations on model architecture. Our findings challenge conventional wisdom by demonstrating that quantized LLMs often exhibit superior robustness compared to their full-precision counterparts, with 51.59% versus 42.86% of our adversarial experiments showing better resilience in quantized LLMs. Similarly, our noise perturbation experiments also confirm that LLMs after quantitation generally withstand higher levels of weight disturbances. These results suggest that quantization not only reduces computational requirements but can actually enhance LLMs' reliability in code generation tasks, providing valuable insights for developing more robust and efficient LLM deployment strategies.
title Smaller = Weaker? Benchmarking Robustness of Quantized LLMs in Code Generation
topic Software Engineering
Artificial Intelligence
Programming Languages
url https://arxiv.org/abs/2506.22776