Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
orchestra-research avatar

Awq Quantization

  • 401 installs
  • 11.2k repo stars
  • Updated June 16, 2026
  • orchestra-research/ai-research-skills

awq-quantization is an ML optimization skill that quantizes open LLM weights to 4-bit AWQ format and selects GEMM versus GEMV kernels based on inference latency and batch shape requirements.

About

awq-quantization is an Orchestra Research agent skill for ML engineers deploying open-weight LLMs who need smaller, faster models without unacceptable quality loss. AWQ (Activation-aware Weight Quantization) identifies roughly 1% of salient weights by examining activation distributions, applies mathematical scaling to protect critical channels, and quantizes remaining weights to 4-bit with minimal error using the core formula L(s) = ||Q(W * s)(s^-1 * X) - W * X||. The skill guides kernel selection between GEMM and GEMV based on batch size and latency targets, and contrasts AWQ tradeoffs against GPTQ for production inference. Reach for awq-quantization when GPU memory limits block a model, batch inference needs throughput tuning, or 4-bit weights must ship to llama.cpp or vLLM runtimes.

  • Explains activation-aware scaling (~1% salient weights) and the core AWQ loss formula versus GPTQ Hessian reconstruction
  • Compares AWQ vs GPTQ on calibration size (128–1024 tokens), overfitting risk, and cross-domain generalization
  • Documents WQLinear_GEMM for batch throughput and WQLinear_GEMV for batch_size=1 (~20% faster streaming)
  • Shows quant_config version switches and practical deployment tradeoffs for chat vs batch inference

Awq Quantization by the numbers

  • 401 all-time installs (skills.sh)
  • +35 installs in the week ending Jul 18, 2026 (Skillselion tracking)
  • Ranked #488 of 2,066 Data Science & ML skills by installs in the Skillselion catalog
  • Security screen: HIGH risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/orchestra-research/ai-research-skills --skill awq-quantization

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs401
repo stars11.2k
Security audit1 / 3 scanners passed
Last updatedJune 16, 2026
Repositoryorchestra-research/ai-research-skills

How do you quantize LLM weights with AWQ 4-bit?

Quantize open LLM weights with AWQ (4-bit) and pick GEMM vs GEMV kernels for your inference latency and batch shape.

Who is it for?

ML engineers reducing open LLM memory footprint and tuning inference throughput who need activation-aware 4-bit quantization with kernel selection guidance.

Skip if: Developers running pre-quantized models unchanged or teams needing 8-bit or FP16 precision without any quality tradeoff.

When should I use this skill?

GPU memory blocks model loading, batch inference latency needs kernel tuning, or open weights must convert to 4-bit AWQ format.

What you get

4-bit AWQ-quantized model weights with selected GEMM or GEMV kernel configuration for deployment.

  • 4-bit AWQ weight files
  • kernel configuration for inference runtime

By the numbers

  • Identifies ~1% salient weights from activation distributions
  • Quantizes remaining LLM weights to 4-bit AWQ format

Files

SKILL.mdMarkdownGitHub ↗

AWQ (Activation-aware Weight Quantization)

4-bit quantization that preserves salient weights based on activation patterns, achieving 3x speedup with minimal accuracy loss.

When to use AWQ

Use AWQ when:

  • Need 4-bit quantization with <5% accuracy loss
  • Deploying instruction-tuned or chat models (AWQ generalizes better)
  • Want ~2.5-3x inference speedup over FP16
  • Using vLLM for production serving
  • Have Ampere+ GPUs (A100, H100, RTX 40xx) for Marlin kernel support

Use GPTQ instead when:

  • Need maximum ecosystem compatibility (more tools support GPTQ)
  • Working with ExLlamaV2 backend specifically
  • Have older GPUs without Marlin support

Use bitsandbytes instead when:

  • Need zero calibration overhead (quantize on-the-fly)
  • Want to fine-tune with QLoRA
  • Prefer simpler integration

Quick start

Installation

# Default (Triton kernels)
pip install autoawq

# With optimized CUDA kernels + Flash Attention
pip install autoawq[kernels]

# Intel CPU/XPU optimization
pip install autoawq[cpu]

Requirements: Python 3.8+, CUDA 11.8+, Compute Capability 7.5+

Load pre-quantized model

from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer

model_name = "TheBloke/Mistral-7B-Instruct-v0.2-AWQ"

model = AutoAWQForCausalLM.from_quantized(
    model_name,
    fuse_layers=True  # Enable fused attention for speed
)
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Generate
inputs = tokenizer("Explain quantum computing", return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Quantize your own model

from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer

model_path = "mistralai/Mistral-7B-Instruct-v0.2"

# Load model and tokenizer
model = AutoAWQForCausalLM.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)

# Quantization config
quant_config = {
    "zero_point": True,      # Use zero-point quantization
    "q_group_size": 128,     # Group size (128 recommended)
    "w_bit": 4,              # 4-bit weights
    "version": "GEMM"        # GEMM for batch, GEMV for single-token
}

# Quantize (uses pileval dataset by default)
model.quantize(tokenizer, quant_config=quant_config)

# Save
model.save_quantized("mistral-7b-awq")
tokenizer.save_pretrained("mistral-7b-awq")

Timing: ~10-15 min for 7B, ~1 hour for 70B models.

AWQ vs GPTQ vs bitsandbytes

FeatureAWQGPTQbitsandbytes
Speedup (4-bit)~2.5-3x~2x~1.5x
Accuracy loss<5%~5-10%~5-15%
CalibrationMinimal (128-1K tokens)More extensiveNone
Overfitting riskLowHigherN/A
Best forProduction inferenceGPU inferenceEasy integration
vLLM supportNativeYesLimited

Key insight: AWQ assumes not all weights are equally important. It protects ~1% of salient weights identified by activation patterns, reducing quantization error without mixed-precision overhead.

Kernel backends

GEMM (default, batch inference)

quant_config = {
    "zero_point": True,
    "q_group_size": 128,
    "w_bit": 4,
    "version": "GEMM"  # Best for batch sizes > 1
}

GEMV (single-token generation)

quant_config = {
    "version": "GEMV"  # 20% faster for batch_size=1
}

Limitation: Only batch size 1, not good for large context.

Marlin (Ampere+ GPUs)

from transformers import AwqConfig, AutoModelForCausalLM

config = AwqConfig(
    bits=4,
    version="marlin"  # 2x faster on A100/H100
)

model = AutoModelForCausalLM.from_pretrained(
    "TheBloke/Mistral-7B-AWQ",
    quantization_config=config
)

Requirements: Compute Capability 8.0+ (A100, H100, RTX 40xx)

ExLlamaV2 (AMD compatible)

config = AwqConfig(
    bits=4,
    version="exllama"  # Faster prefill, AMD GPU support
)

HuggingFace Transformers integration

Direct loading

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "TheBloke/zephyr-7B-alpha-AWQ",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("TheBloke/zephyr-7B-alpha-AWQ")

Fused modules (recommended)

from transformers import AwqConfig, AutoModelForCausalLM

config = AwqConfig(
    bits=4,
    fuse_max_seq_len=512,  # Max sequence length for fusing
    do_fuse=True           # Enable fused attention/MLP
)

model = AutoModelForCausalLM.from_pretrained(
    "TheBloke/Mistral-7B-OpenOrca-AWQ",
    quantization_config=config
)

Note: Fused modules cannot combine with FlashAttention2.

vLLM integration

from vllm import LLM, SamplingParams

# vLLM auto-detects AWQ models
llm = LLM(
    model="TheBloke/Llama-2-7B-AWQ",
    quantization="awq",
    dtype="half"
)

sampling = SamplingParams(temperature=0.7, max_tokens=200)
outputs = llm.generate(["Explain AI"], sampling)

Performance benchmarks

Memory reduction

ModelFP16AWQ 4-bitReduction
Mistral 7B14 GB5.5 GB2.5x
Llama 2-13B26 GB10 GB2.6x
Llama 2-70B140 GB35 GB4x

Inference speed (RTX 4090)

ModelPrefill (tok/s)Decode (tok/s)Memory
Mistral 7B GEMM3,8971145.55 GB
TinyLlama 1B GEMV5,1794312.10 GB
Llama 2-13B GEMM2,2797410.28 GB

Accuracy (perplexity)

ModelFP16AWQ 4-bitDegradation
Llama 3 8B8.208.48+3.4%
Mistral 7B5.255.42+3.2%
Qwen2 72B4.854.95+2.1%

Custom calibration data

# Use custom dataset for domain-specific models
model.quantize(
    tokenizer,
    quant_config=quant_config,
    calib_data="wikitext",       # Or custom list of strings
    max_calib_samples=256,       # More samples = better accuracy
    max_calib_seq_len=512        # Sequence length
)

# Or provide your own samples
calib_samples = [
    "Your domain-specific text here...",
    "More examples from your use case...",
]
model.quantize(tokenizer, quant_config=quant_config, calib_data=calib_samples)

Multi-GPU deployment

model = AutoAWQForCausalLM.from_quantized(
    "TheBloke/Llama-2-70B-AWQ",
    device_map="auto",  # Auto-split across GPUs
    max_memory={0: "40GB", 1: "40GB"}
)

Supported models

35+ architectures including:

  • Llama family: Llama 2/3, Code Llama, Mistral, Mixtral
  • Qwen: Qwen, Qwen2, Qwen2.5-VL
  • Others: Falcon, MPT, Phi, Yi, DeepSeek, Gemma
  • Multimodal: LLaVA, LLaVA-Next, Qwen2-VL

Common issues

CUDA OOM during quantization:

# Reduce batch size
model.quantize(tokenizer, quant_config=quant_config, max_calib_samples=64)

Slow inference:

# Enable fused layers
model = AutoAWQForCausalLM.from_quantized(model_name, fuse_layers=True)

AMD GPU support:

# Use ExLlama backend
config = AwqConfig(bits=4, version="exllama")

Deprecation notice

AutoAWQ is officially deprecated. For new projects, consider:

  • vLLM llm-compressor: https://github.com/vllm-project/llm-compressor
  • MLX-LM: For Mac devices with Apple Silicon

Existing quantized models remain usable.

References

  • Paper: AWQ: Activation-aware Weight Quantization (arXiv:2306.00978) - MLSys 2024 Best Paper
  • GitHub: https://github.com/casper-hansen/AutoAWQ
  • MIT Han Lab: https://github.com/mit-han-lab/llm-awq
  • Models: https://huggingface.co/models?library=awq

Related skills

How it compares

Choose AWQ when activation-aware 4-bit compression and kernel tuning matter more than a one-click pre-quantized model download.

FAQ

How does AWQ quantization protect model quality?

AWQ identifies roughly 1% of salient weights from activation distributions and applies scaling before 4-bit quantization. awq-quantization uses this activation-aware approach so critical channels retain accuracy while most weights compress to 4-bit.

When should developers pick GEMM over GEMV in AWQ?

awq-quantization recommends GEMM kernels for larger batch shapes where matrix throughput matters and GEMV for low-batch or single-token latency-sensitive inference. Kernel choice depends on batch size and target latency profile.

Is Awq Quantization safe to install?

skills.sh reports 1 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Data Science & MLllmautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.