Back to the episode map

Guide

How to Evaluate LLM Quantization on a Real Workload

Compare a quantized LLM with its reference model by freezing artifact identity and measuring task quality, safety, latency, throughput, memory, and cost.

Aug 4, 20265 min readBy Dalton Anderson

How to Evaluate Quantization Without Losing the Model Identity

Evaluate a quantized language model as a new deployable artifact. Compare it with a frozen reference under matched conditions, then decide whether the measured memory, speed, and cost gains justify any task, safety, or operational regressions.

Do not make the decision from bit width or file size alone.

flowchart LR
    A["Deployment requirement"] --> B["Freeze reference artifact"]
    B --> C["Build and identify candidate"]
    C --> D["Match prompts, settings, and workload"]
    D --> E["Measure behavior and operations"]
    E --> F["Analyze regressions by task"]
    F --> G{"Thresholds met?"}
    G -->|Yes| H["Accept with rollback"]
    G -->|No| I["Reject or rebuild candidate"]

Begin with the deployment requirement

Name the constraint that makes quantization worth considering.

The reference model may not fit the available accelerator memory. Latency may exceed an interactive target. Throughput may make the service uneconomic. A local or edge environment may have hard power or storage limits.

Turn the constraint into a measurable threshold. Specify available hardware, concurrency, context length, batch behavior, response requirement, memory ceiling, budget, and quality or safety limits.

If the resource problem is vague, a smaller file can look like success without improving the actual service.

Freeze the reference model

Record the reference model's publisher, repository, exact weights, hash, tokenizer, prompt format, license, runtime, kernels, hardware, generation settings, and evaluation date.

The model name is not enough. Two artifacts with the same marketing name may use different weight versions, prompt templates, tokenizers, conversions, or runtime defaults.

Meta's Llama 3.1 model card is one example of a publisher identity record. It describes the source family, sizes, modalities, context, release date, intended use, license, and reported evaluations. A deployment still needs its own exact file and runtime record.

Preserve the reference so a regression can be reproduced and the deployment can roll back.

Identify the quantized candidate

Record how the candidate was created.

Include the source weights, quantization method, target precision, weight and activation treatment, granularity, calibration data, calibration settings, conversion tool and version, builder, resulting format, hash, runtime, and required kernels.

Hugging Face's current quantization concepts guide distinguishes post-training quantization from quantization-aware training and explains per-tensor, per-channel, group, and block granularities. Those choices can affect accuracy, memory, performance, and compatibility.

Labels such as int8, int4, FP8, GPTQ, AWQ, GGUF, or bitsandbytes do not fully identify an artifact. The same headline precision can produce different behavior through another method, calibration set, group size, runtime, or kernel.

Match the comparison

Use the same task cases, prompt template, system instructions, retrieved context, tool definitions, generation settings, output parser, and scoring method for the reference and candidate.

Keep hardware and runtime matched where possible when comparing behavior. If the deployment requires different hardware or kernels, disclose the difference and treat the result as a system comparison.

Warm-up, caching, batching, concurrency, prompt length, generated length, and streaming can materially change latency and throughput. Define them before measurement.

Run enough repetitions to understand variation. Preserve raw results rather than only an average.

Test the intended workload

General benchmarks can help detect broad regressions, but the decision belongs to the actual workload.

Build representative cases from the work the system is authorized to do. Include ordinary inputs, difficult inputs, long context, structured output, tool selection, multilingual content where supported, missing information, and expected refusals.

Add high-consequence cases even if they are rare. A small average quality change can hide a severe regression in one extraction field, safety boundary, code path, or language.

Stanford's HELM framework emphasizes multiple scenarios and metrics rather than one score. The same principle applies to a local comparison: quality, robustness, calibration, efficiency, and safety can move differently.

Measure behavior and operations

DimensionWhat to record
Task qualityCorrectness, completeness, groundedness, format validity, and reviewer effort
Safety behaviorPolicy compliance, sensitive output, injection handling, tool choice, and refusal quality
MemoryModel load, peak resident use, cache growth, and out-of-memory failures
LatencyLoad time, time to first token, inter-token delay, and end-to-end completion
ThroughputRequests or tokens under realistic concurrency and batching
StabilityCrashes, malformed output, numerical failure, timeout, and recovery
Cost and powerMeasured service cost and energy proxy under the intended environment

Do not assume speed improves because precision is lower. Conversion overhead, memory bandwidth, kernel support, hardware, batch size, and runtime can change the outcome.

The Llama 3 paper reports source-era inference and model experiments. Those findings are useful historical evidence, not a universal result for every conversion.

Analyze regressions by task

Compare distributions and categories, not just aggregate means.

Find cases where the reference succeeds and the candidate fails. Group the differences by task, length, language, output type, safety policy, and other operationally meaningful dimensions.

Inspect outputs. A metric can miss a changed refusal, invented citation, malformed object, altered tool argument, or subtle loss of instruction following.

Set separate thresholds for severe behavior. A candidate with a good average should still fail the gate if it violates a critical privacy, safety, authorization, or correctness rule.

Make a versioned decision

Accept the candidate when it satisfies the deployment constraint, stays within task-specific regression thresholds, and has an owned rollback path.

Record the accepted artifact, evidence, known limitations, monitoring, review owner, and triggers for reevaluation.

Reevaluate when the source model, quantization method, runtime, kernel, hardware, prompt format, context, workload, safety policy, or tool set changes.

The current Llama 4 model card documents multiple released precision paths and on-the-fly quantization in that later family. It reinforces the need to identify the exact artifact rather than treating one precision as the model.

Use [[How to Design Layered Controls for an Open Model System]] before deploying the accepted candidate. Use [[What Meta's Llama 3 Safety Paper Taught Me]] for the correction to E031's broad precision rule.

This evaluation guide was developed with AI assistance from E031, current technical documentation, Meta's model records, and the linked artifact framework. Dalton Anderson remains the author. Technical, performance, safety, reproducibility, license, current-source, and founder review are mandatory before publication or deployment. Publication is not authorized.

Sources

Follow the evidence.

  1. ai.meta.com: the llama 3 herd of modelsai.meta.com
  2. ai-challenges.nist.gov: genaiai-challenges.nist.gov
  3. owasp.org: www project top 10 for large language model applicationsowasp.org
  4. youtu.be: 1KNOcY e9Tsyoutu.be
  5. github.com: PurpleLlamagithub.com
  6. crfm.stanford.edu: indexcrfm.stanford.edu
  7. NIST AI Risk Management Frameworknist.gov
  8. mlcommons.org: jailbreak 0 7mlcommons.org
  9. mlcommons.org: safety faqmlcommons.org
  10. github.com: MODEL CARDgithub.com
  11. ai-challenges.nist.gov: ariaai-challenges.nist.gov
  12. github.com: MODEL CARDgithub.com
  13. daltonanderson.ghost.io: metas llama 3 safety scaling and simple solutionsdaltonanderson.ghost.io
  14. ai.meta.com: meta llama 3 1 ai responsibilityai.meta.com
  15. NIST Generative AI Profilenvlpubs.nist.gov
  16. mlcommons.org: safety methodologymlcommons.org
  17. huggingface.co: concept guidehuggingface.co
  18. github.com: MODEL CARDgithub.com
  19. csrc.nist.gov: red teamingcsrc.nist.gov
  20. open.spotify.com: 44o5OPSumaZJcvRkXutorBopen.spotify.com
How to Evaluate LLM Quantization on a Real Workload