⚡
Brief IA
›

Lightweight LLMs: Quantifying Gains and Avoiding Pitfalls

🤖 Models & LLM·Tom Levy·

Lightweight LLMs: Quantifying Gains and Avoiding Pitfalls

Lightweight LLMs: Quantifying Gains and Avoiding Pitfalls
⚡
Key Takeaways
170B in FP16 requires ~140 GB and about four A100s, totaling $80,000 to $100,000 in hardware before use
24-bit quantization reduces this volume to ~35–40 GB and can fit on a single card
3Gemma 4 offers quantization-sensitive checkpoints, with a ~1 GB variant executable on a phone
💡Why it matters — these techniques reduce hardware footprint and latency without a uniform quality guarantee, necessitating targeted evaluations.

Loading 70 billion parameters in FP16 requires about 140 GB of VRAM and up to four A100 GPUs, amounting to $80,000 to $100,000 in hardware costs before the first query. Quantization and pruning reduce these requirements to manageable sizes, but their impact on quality varies significantly depending on the models and tasks. Here’s an overview of the gains, pitfalls, and an immediate implementation in 4 bits.

Heterogeneous Quality Loss Demands Targeted Evaluation

The quality of a compressed model cannot be summed up by a universal rule. Red Hat analyzed over 500,000 evaluations of quantized models and found that performance loss varies by model, task, and method used. Some models handle aggressive compression well, while others see their quality drop rapidly. To assess the robustness of a compressed model, it must be evaluated on tasks close to its intended use, rather than merely checking the grammaticality of the outputs. Regarding pruning, the magnitude-based method, historically simple, fails on LLMs even at modest sparsity levels, as documented by the team behind Wanda. Large models are more challenging to prune without loss than smaller networks for which this technique was designed.

The Hardware Bill for an Uncompressed LLM Skyrockets Quickly

A team can spend three weeks fine-tuning a model only to find, at deployment time, a checkpoint of 140 GB. At this point, most rack-mounted GPUs become unusable, the deployment plan must be revised, and the launch week turns into a search for four A100s that were not budgeted. Loading 70 billion parameters in FP16 requires about 140 GB of VRAM and, in practice, four A100s, costing $80,000 to $100,000 in hardware tied up before any queries. Skipping compression often leads to a model that is impossible to host on existing hardware, an inference bill that is too high, or latencies incompatible with uses such as live chat, voice assistants, or autocomplete.

Quantizing to 4 Bits: From Cluster to Workstation, and Beyond the Smartphone

Reducing a model from 70 billion to 4 bits via AWQ or GPTQ brings its size down to about 35 to 40 GB, allowing it to be loaded onto a high-end workstation card rather than a cluster, according to a 2026 guide. This evolution is taking shape in major labs: Google’s Gemma 3 (27 billion parameters) reduces from 54 GB to about 14 GB in 4 bits, while halving the quality loss compared to traditional post-training quantization. Gemma 4 goes further by offering quantization-sensitive checkpoints; its smallest variant of 2 billion reaches about 1 GB, compact enough to run on a phone. Apple applies a similar logic on iPhone, compressing weights to 2 bits through tailored training rather than adjusting scales afterward. The tangible benefits are numerous: fewer GPUs to acquire or rent, reduced latency per query as less data is transferred in memory, and the ability to run models on hardware that wouldn’t have supported the full version.

⚡Le brief IA que lisent les pros

Le brief IA que les pros lisent chaque soir

Les 7 actus IA du jour, décryptées en 5 min. Gratuit.

Inclus dès l'inscription : notre sélection des meilleurs guides & comparatifs IA.

Choisis ton rythme

Gratuit · Pas de spam · Désabonnement en 1 clic

What Quantization and Pruning Do, and Why to Combine Them

Quantization involves reducing the numerical precision of weights, for example, moving from 16-bit floating point to 8 or 4-bit integers, without changing the number of parameters. This decreases the memory required and can speed up calculations. Pruning, on the other hand, removes weights or entire structures—connections, attention heads, or even layers—thereby reducing the total number of parameters. Both techniques lighten models along different axes and can be combined. However, they remain underutilized, often due to fears of quality degradation, whereas it is primarily about choosing the method suited to the context.

Overview of Methods: Calibration Only, 2:4 Sparsity, and Typical Gains

Several families of approaches exist. For quantization, some methods require only calibration and rely on GPU services in production, with a wide availability of pre-quantized models and good performance on recent cores. For pruning, a common goal is structured sparsity 2:4, which allows for real hardware accelerations. There are also one-shot schemes with weight updates, as well as single-pass methods suited for very large models when pruning speed is a criterion. In practice, some pruning methods can reduce size by a factor of 2 to 50% sparsity.

bitsandbytes NF4 and QLoRA: An Immediate Implementation in 4 Bits

The 4-bit quantization NF4 from bitsandbytes is often the best entry point. NF4 (NormalFloat4) leverages the normal distribution of weights by concentrating the 4-bit values where they cluster. It is the only method mentioned that supports QLoRA, allowing a model to be loaded in 4 bits and fine-tuned with small low-rank adapters, without touching the frozen weights. For implementation, load_in_4bit=True converts weights at loading; bnb_4bit_quant_type="nf4" selects the format; computation is done in bfloat16 via bnb_4bit_compute_dtype, as there are currently no native 4-bit kernels; bnb_4bit_use_double_quant=True also quantizes constants, saving about 0.4 bits per parameter. device_map="auto" distributes layers between GPU and CPU if needed. An example configuration uses meta-llama/Llama-3.1-8B-Instruct.

⚡

Brief IA — L'actualité IA en français

L'essentiel de l'actualité de l'intelligence artificielle, décrypté et expliqué chaque jour.