SGLang supports various quantization methods, including offline quantization and online dynamic quantization.Offline quantization loads pre-quantized model weights directly during inference. This is required for quantization methods
such as GPTQ and AWQ, which collect and pre-compute various statistics from the original weights using the calibration dataset.Online quantization dynamically computes scaling parameters—such as the maximum/minimum values of model weights—during runtime.
Like NVIDIA FP8 training’s delayed scaling mechanism, online quantization calculates the appropriate scaling factors
on-the-fly to convert high-precision weights into a lower-precision format.Note: For better performance, usability and convenience, offline quantization is recommended over online quantization.If you use a pre-quantized model, do not add --quantization to enable online quantization at the same time.
For popular pre-quantized models, please visit Unsloth, NVIDIA ModelOpt
or NeuralMagic collections on HF for some
popular quality validated quantized models. Quantized models must be validated via benchmarks post-quantization
to guard against abnormal quantization loss regressions.
The following table summarizes quantization method support across NVIDIA and AMD GPUs, Ascend NPUs.
Method
NVIDIA GPUs
AMD GPUs (MI300X/MI325X/MI350X)
Ascend NPUs (A2/A3 Series, 950PR/DT Series)
Notes
fp8
Yes
Yes
WIP
Aiter or Triton backend on AMD
mxfp4
Yes
Yes
Yes (950PR/DT Series)
On GPU: requires CDNA3/CDNA4 with MXFP support (uses Aiter). On Ascend NPU (950PR/DT Series): W4A4 MXFP4 for Qwen3 dense and MoE LLMs (MXFP4 weights + activations) — dense models support online dual-level MXFP4; offline W4A4_MXFP4 dense and MoE checkpoints (single-level) are auto-detected via modelslim. On Intel GPUs (XPU): W4A16 MoE experts on Xe2/BMG via sgl-kernel-xpu, enabled automatically with —device xpu (see Intel GPUs (XPU))
mxfp8
No
No
Yes (950PR/DT Series for Diffusion, LLM Dense Linear and LLM MoE)
Ascend NPU only; online + offline MXFP8 for Diffusion models (e.g., Wan2.2), LLM Dense Linear, and LLM MoE (FusedMoE, e.g. Qwen3-30B-A3B) on 950PR/DT Series; uses CANN npu_dynamic_mx_quant / npu_quant_matmul (dense) and npu_grouped_matmul_swiglu_quant_v2 / npu_grouped_matmul (MoE) kernels
mxfp_w4a8
No
No
Yes (950PR/DT Series)
Ascend NPU only; online W4A8 for Qwen3 dense LLM (MXFP4 weights + MXFP8 activations) on 950PR/DT Series; offline W4A8_MXFP dense and MoE checkpoints are auto-detected via modelslim
blockwise_int8
Yes
Yes
No
Triton-based, works on both platforms
w8a8_int8
Yes
Yes
No
w8a8_fp8
Yes
Yes
No
Aiter or Triton FP8 on AMD
awq
Yes
Yes
Yes
Uses a JIT-compiled CUDA kernel on NVIDIA, Triton dequantize on AMD. Uses CANN kernels on Ascend
gptq
No
No
Yes
Removed on NVIDIA and AMD GPUs — use gptq_marlin instead. Uses CANN kernels on Ascend. Still supported on Intel CPUs with AMX
compressed-tensors
Yes
Yes
Partial
Aiter paths for FP8/MoE on AMD. Uses CANN kernels on Ascend, FP8 not supported yet
quark
Yes
Yes
No
AMD Quark quantization; Aiter GEMM paths on AMD
auto-round
Yes
Yes
Partial
Platform-agnostic (Intel auto-round). Uses CANN kernels on Ascend
NVIDIA ModelOpt; use Marlin W4A16 fallback on Ampere/Hopper and native FP4 backends on Blackwell; supports load-time BF16/FP16/FP8 MoE conversion with per-tensor FP32 activation scales
nvfp4_online
Yes (Blackwell/SM100 or SM103)
No
No
Online MoE-only NVFP4 weight quantization with per-token FP32 activation scales for BF16/FP16/FP8 checkpoints; use modelopt_fp4 for per-tensor FP32 activation scales; requires flashinfer_trtllm or flashinfer_trtllm_routed
petit_nvfp4
No
Yes (MI250/MI300X/MI325X)
No
Enables NVFP4 on ROCm via Petit; use modelopt_fp4 on NVIDIA Blackwell. Auto-selected when loading NVFP4 models on AMD. See LMSYS blog and AMD ROCm blog.
bitsandbytes
Yes
Experimental
No
Depends on bitsandbytes ROCm support
modelslim
No
No
Yes
Ascend quantization; Uses CANN kernels
On AMD, several of these methods use Aiter for acceleration — set SGLANG_USE_AITER=1 where noted. See AMD GPU setup for installation and configuration details.On Ascend, various layers quantization configurations are supported, see Ascend NPU quantization for details.
Backend selection applies to blockwise FP8, MXFP8 (dense linear), and NVFP4 GEMM. When running offline or online FP8 or FP4 quantized models, you can select the GEMM backend via --fp8-gemm-backend and --fp4-gemm-backend.
FlashInfer TensorRT-LLM backend; optimal for low-latency
flashinfer_cutlass
SM100/120
FlashInfer CUTLASS groupwise FP8 GEMM
flashinfer_deepgemm
SM90
Uses swapAB optimization for small M dimensions in decoding
cutlass
SM120
sgl-kernel CUTLASS
triton
All
Fallback; widely compatible
aiter
ROCm
AMD AITER backend
auto selection order: 1) DeepGEMM (SM90/SM100, installed); 2) FlashInfer TRTLLM (SM100, FlashInfer available); 3) CUTLASS (SM120); 4) AITER (AMD); 5) Triton (fallback).MXFP8 dense linear:auto uses flashinfer_cutlass on SM100 (else triton). flashinfer_cutlass is fastest on most shapes; flashinfer_trtllm is faster only at small M.
To load already quantized models, simply load the model weights and config. Again, if the model has been quantized offline,
there’s no need to add --quantization argument when starting the engine. The quantization method will be parsed from the
downloaded Hugging Face or msModelSlim config. For example, DeepSeek V3/R1 models are already in FP8, so do not add redundant parameters.
Take note, if your model is per-channel quantized (INT8 or FP8) with per-token dynamic quantization activation, you can opt to include --quantization w8a8_int8 or --quantization w8a8_fp8 to invoke the corresponding CUTLASS int8_kernel or fp8_kernel in sgl-kernel. This action will ignore the Hugging Face config’s quantization settings. For instance, with neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8-dynamic, if you execute with --quantization w8a8_fp8, the system will use the W8A8Fp8Config from SGLang to invoke the sgl-kernel, rather than the CompressedTensorsConfig for vLLM kernels.
from sglang.srt.configs.load_config import LoadConfigfrom sglang.srt.configs.model_config import ModelConfigfrom sglang.srt.model_loader.loader import get_model_loaderfrom sglang.srt.configs.device_config import DeviceConfig# Configure model with inc quantization and savingmodel_config = ModelConfig( model_path="meta-llama/Llama-3.2-3B-Instruct", quantization="auto-round-int8", trust_remote_code=True,)load_config = LoadConfig( inc_save_path="./quantized_model",)device_config = DeviceConfig(device="cpu")# Load and quantize the modelmodel_loader = get_model_loader(load_config, model_config)quantized_model = model_loader.load_model( model_config=model_config, device_config=device_config,)
known issues
Several limitations currently affect offline quantized model loading in sglang, These issues might be resolved in future updates of sglang. If you experience any problems, consider using Hugging Face Transformers as an alternative.
Mixed-bit Quantization LimitationsMixed-bit quantization is not fully supported. Due to vLLM’s layer fusion (e.g., QKV fusion), applying different bit-widths to components within the same fused layer can lead to compatibility issues.
Limited Support for Quantized MoE ModelsQuantized MoE models may encounter inference issues due to kernel limitations (e.g., lack of support for mlp.gate layer quantization). please try to skip quantizing these layers to avoid such errors.
Limited Support for Quantized VLMs
Details
Qwen2.5-VL-7Bauto_round:auto_gptq format: Accuracy is close to zero.GPTQ format: Fails with:
Output
The output size is not aligned with the quantized weight shape
auto_round:auto_awq and AWQ format: These work as expected.
Limited Support for SGlang API UsageSGlang API Usage only supports auto-round-int8 quantization method now, more quantization methods are on the way.
CPU servingAutoRound INT4 checkpoints (both auto_round:auto_gptq and auto_round:auto_awq packing formats) can be served on Intel CPUs with AMX support:
The current SGLang CPU backend supports only 4-bit AutoRound checkpoints on Intel AMX. Other AutoRound bit-widths and non-AMX CPU backends are not supported by this path.
NVIDIA Model Optimizer (ModelOpt) provides advanced quantization techniques optimized for NVIDIA hardware.Offline vs. Online Quantization:SGLang supports two modes for ModelOpt.
Offline Quantization (pre-quantized):
Usage: Download a pre-quantized model from Hugging Face or run hf_ptq.py once to create a new quantized checkpoint. Then load this quantized checkpoint.
Pros: Fast server startup, quantization can be validated before deployment, efficient resource usage.
Cons: Requires an extra preparation step.
Online Quantization (quant and serve):
Usage: Load a standard BF16/FP16 model and add a flag. The engine applies quantization on startup.
Pros: Convenient (no new checkpoint needed).
Cons:High startup time, increases VRAM usage during initialization (risk of OOM).
The following sections guide you through using the Offline path: loading pre-quantized models or creating your own checkpoints.
Using Pre-Quantized Checkpoints
If a model is already quantized (e.g., from Hugging Face), you can load it directly.
If a pre-quantized checkpoint is not available for your model, you can create one using NVIDIA Model Optimizer’s hf_ptq.py script.Why quantize?
Reduce VRAM usage
Higher throughput and lower latency
More flexible deployment (on smaller GPUs)
What can be quantized?
The entire model
MLP layers only
KV cache
Key options in hf_ptq.py:--qformat: Quantization formats fp8, nvfp4, nvfp4_mlp_only--kv_cache_qformat: KV cache quantization format (default: fp8)Note: The default kv_cache_qformat may not be optimal for all use cases. Consider setting this explicitly.Hardware requirements: Hopper and higher are recommended. Insufficient GPU memory may cause weight offloading, resulting in extremely long quantization time.For detailed usage and supported model architectures, see NVIDIA Model Optimizer LLM PTQ.SGLang includes a streamlined workflow for quantizing models with ModelOpt and automatically exporting them for deployment.
Installation
First, install ModelOpt:
Command
pip install nvidia-modelopt
Quantization and Export Workflow
SGLang provides an example script that demonstrates the complete ModelOpt quantization and export workflow. Run from the SGLang repository root (see modelopt_quantize_and_export.py):
Command
# Quantize and export a model using ModelOpt FP8 quantizationpython examples/usage/modelopt_quantize_and_export.py quantize \ --model-path TinyLlama/TinyLlama-1.1B-Chat-v1.0 \ --export-dir ./quantized_tinyllama_fp8 \ --quantization-method modelopt_fp8# For FP4 quantization (requires Blackwell GPU)python examples/usage/modelopt_quantize_and_export.py quantize \ --model-path TinyLlama/TinyLlama-1.1B-Chat-v1.0 \ --export-dir ./quantized_tinyllama_fp4 \ --quantization-method modelopt_fp4
Available Quantization Methods
modelopt_fp8: FP8 quantization with optimal performance on NVIDIA Hopper and Blackwell GPUs
modelopt_fp4: FP4 quantization with optimal performance on Nvidia Blackwell GPUs
Python API Usage
You can also use ModelOpt quantization programmatically:
Example
import sglang as sglfrom sglang.srt.configs.device_config import DeviceConfigfrom sglang.srt.configs.load_config import LoadConfigfrom sglang.srt.configs.model_config import ModelConfigfrom sglang.srt.model_loader.loader import get_model_loader# Configure model with ModelOpt quantization and exportmodel_config = ModelConfig( model_path="TinyLlama/TinyLlama-1.1B-Chat-v1.0", quantization="modelopt_fp8", # or "modelopt_fp4" trust_remote_code=True,)load_config = LoadConfig( modelopt_export_path="./exported_model", modelopt_checkpoint_save_path="./checkpoint.pth", # optional, fake quantized checkpoint)device_config = DeviceConfig(device="cuda")# Load and quantize the model (export happens automatically)model_loader = get_model_loader(load_config, model_config)quantized_model = model_loader.load_model( model_config=model_config, device_config=device_config,)
Deploying Quantized Models
After quantization and export, you can deploy the model with SGLang:
Or using the Python API (use the same path as modelopt_export_path from the quantize step):
Example
import sglang as sgldef main(): # Deploy exported ModelOpt quantized model # Path must match modelopt_export_path from quantize step (e.g., ./exported_model) llm = sgl.Engine( model_path="./exported_model", quantization="modelopt", ) # Run inference prompts = [ "Hello, how are you?", "What is the capital of France?", ] sampling_params = { "temperature": 0.8, "top_p": 0.95, "max_new_tokens": 100, } outputs = llm.generate(prompts, sampling_params) for i, output in enumerate(outputs): print(f"Prompt: {prompts[i]}") print(f"Output: {output['text']}")if __name__ == "__main__": main()
Advanced Features
Checkpoint Management: Save and restore fake quantized checkpoints for reuse:
Command
# Save the fake quantized checkpoint during quantizationpython examples/usage/modelopt_quantize_and_export.py quantize \ --model-path meta-llama/Llama-3.2-1B-Instruct \ --export-dir ./quantized_model \ --quantization-method modelopt_fp8 \ --checkpoint-save-path ./my_checkpoint.pth# The checkpoint can be reused for future quantization runs and skip calibration
Export-only Workflow: If you have a pre-existing fake quantized ModelOpt checkpoint, you can export it directly. See LoadConfig for the full API:
Example
from sglang.srt.configs.device_config import DeviceConfigfrom sglang.srt.configs.load_config import LoadConfigfrom sglang.srt.configs.model_config import ModelConfigfrom sglang.srt.model_loader.loader import get_model_loadermodel_config = ModelConfig( model_path="meta-llama/Llama-3.2-1B-Instruct", quantization="modelopt_fp8", trust_remote_code=True,)load_config = LoadConfig( modelopt_checkpoint_restore_path="./my_checkpoint.pth", modelopt_export_path="./exported_model",)# Load and export the model (DeviceConfig defaults to device="cuda")model_loader = get_model_loader(load_config, model_config)model_loader.load_model(model_config=model_config, device_config=DeviceConfig())
Benefits of ModelOpt
Hardware Optimization: Specifically optimized for NVIDIA GPU architectures
Advanced Quantization: Supports cutting-edge FP8 and FP4 quantization techniques
Seamless Integration: Automatic export to HuggingFace format for easy deployment
Calibration-based: Uses calibration datasets for optimal quantization quality
Production Ready: Enterprise-grade quantization with NVIDIA support
MindStudio-ModelSlim (msModelSlim) is a model offline quantization compression tool launched by MindStudio and optimized for Ascend hardware.
Installation
Command
# Clone repo and install msmodelslim:git clone https://gitcode.com/Ascend/msmodelslim.gitcd msmodelslimbash install.sh
LLM quantizationDownload the original floating-point weights of the large model. Taking Qwen3-32B as an example, you can go to Qwen3-32B to obtain the original model weights. Then install other dependencies (related to the model, refer to the huggingface model card).
Traditional quantification methods require the preparation of calibration data files (.jsonl formats) for calibration in the quantification process.
Command
Qwen3-32B/ # floating-point model downloaded from official HF (or modelscope) repomsmodelslim/ # msmodelslim repo |----- lab_calib # calibration date folder (put your dataset here in ```.jsonl``` format or use pre-prepared ones) |----- some file (such as laos_calib.jsonl) |----- lab_practice # best practice folder with configs for quantization |----- model folder (such as qwen3_5_moe folder) # folder with quantization configs |----- quant_config (such as qwen3_5_moe_w8a8.yaml) # quantization config |----- another foldersoutput_folder/ # generated by below command |----- quant_model_weights-00001-of-0001.safetensors # quantized weights |----- quant_model_description.json # file with description of the quantization methods for each layer (```W4A4_DYNAMIC```, etc.) |----- another files (such as config.json, tokenizer.json, etc.)
Run quantization using one-click quantization (recommended):
To enable online quantization, you can simply specify --quantization in the command line. For example, you can launch the server with the following command to enable FP8 quantization for model meta-llama/Meta-Llama-3.1-8B-Instruct:
Our team is working on supporting more online quantization methods. SGLang will soon support methods including but not limited to ["awq", "gptq", "marlin", "gptq_marlin", "awq_marlin", "bitsandbytes", "gguf"].
Use --quantization nvfp4_online to convert eligible BF16, FP16, or FP8 MoE expert weights to NVFP4 at load time with per-token FP32 activation scales. Use modelopt_fp4 for serialized NVFP4 checkpoints or the same load-time conversion with per-tensor FP32 activation scales.The design separates weight quantization from activation scaling:
Weights: SGLang quantizes each eligible MoE expert weight tensor as it is loaded, using standard 2D NVFP4 weight quantization. The generated NVFP4 weights use static E4M3 block scales plus static per-tensor FP32 scales derived from the weight amax. For gated MoE experts, the w1/w3 pair shares one per-tensor FP32 scale.
Activations: FlashInfer computes and propagates one FP32 scale per token at runtime. Backends that accept one per-tensor FP32 activation scale must use modelopt_fp4.
FP8 checkpoints: If an eligible expert weight is stored as FP8, SGLang first dequantizes that tensor with the checkpoint scale and then requantizes it to NVFP4 during loading.
Other layers: Dense linear layers stay in their source checkpoint precision or checkpoint quantization path.
Only --moe-runner-backend flashinfer_trtllm and --moe-runner-backend flashinfer_trtllm_routed are supported. If --moe-runner-backend is omitted, SGLang selects flashinfer_trtllm. Tensor parallelism is supported; activation per-token scales are computed locally on each TP rank, while online weight quantization still uses the loaded expert tensor’s per-tensor amax-derived FP32 scale.FlashInfer TRTLLM MoE backends disable shared-expert fusion, so online quantization applies to routed MoE experts while shared experts stay in the checkpoint precision. Both online modes honor SGLANG_FP4_IGNORED_LAYERS; for FP8 source checkpoints, listed experts remain FP8 instead of being converted to NVFP4.
SGLang running on AMD GPUs (CDNA3 or CDNA4 architecture) supports the quantization method --quantization quark_int4fp8_moe, that will replace MoE layers originally in high precision (bfloat16, float16 or float32) to use weights dynamically quantized to int4, that are upcasted to float8 during inference to run compute in float8 precision with activations dynamically quantized on the fly to float8.Other layers (e.g. projections in the attention layers) have their weights quantized online to float8 directly.
SGLang running on AMD GPUs with hardware FP4 support (CDNA4 architecture, e.g. MI355x) supports the quantization method --quantization quark_mxfp4, that will quantize BF16 or NVFP4 model weights to MXFP4 at load time, use dynamic MXFP4 quantization for activations and MXFP4 GEMMs instead of BF16 GEMMs.Example (BF16 to MXFP4 requantization):
The option --quantization quark_mxfp4 supports converting NVFP4 checkpoints (e.g. nvidia/Kimi-K2.6-NVFP4) to MXFP4 at load time to allow efficient inference using supported AMD hardware (gfx95x+):
The quantization metadata of the source NVFP4 checkpoint is read from either config.json (quantization_config) or a standalone hf_quant_config.json;
Producer-declared excluded modules will remain in higher precision;
NVFP4 checkpoints with mixed precision ("quant_algo": "MIXED_PRECISION", e.g. nvidia/Qwen3.5-397B-A17B-NVFP4-V2) are also supported.
SGLang supports quantization methods based on the advanced algorithm auto-round in Intel® Neural Compressor. You can simply specify --quantization auto-round-int8 to use this feature. It will quantize the model on the fly to target format. More online quantization methods are on the way.
SGLang-Diffusion supports MXFP8 quantization for diffusion models (such as Wan2.2) on Ascend 950PR/DT Series NPUs, in both online and offline (ModelSlim) modes. This is separate from the LLM serving path and uses the sglang serve / sglang generate CLI.Requirements: Ascend 950PR/DT Series, CANN ≥ 8.0.RC3
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"SGLang Documentation","colors":{"primary":"#d55816","light":"#d55816","dark":"#d55816"},"logo":{"light":"https://mintcdn.com/lmsysorg/iZdDMbLWP1BLEIzC/logo/logo.png?fit=max\u0026auto=format\u0026n=iZdDMbLWP1BLEIzC\u0026q=85\u0026s=b27d467947ee2167744cb07b69badf00","dark":"https://mintcdn.com/lmsysorg/iZdDMbLWP1BLEIzC/logo/logo.png?fit=max\u0026auto=format\u0026n=iZdDMbLWP1BLEIzC\u0026q=85\u0026s=b27d467947ee2167744cb07b69badf00"},"favicon":"https://mintcdn.com/lmsysorg/iZdDMbLWP1BLEIzC/favicon.png?fit=max\u0026auto=format\u0026n=iZdDMbLWP1BLEIzC\u0026q=85\u0026s=5524ba9694253eabf4da70fafa1db208","background":{"decoration":"grid","color":{"light":"#fffcfb","dark":"#1d1d1d"}},"footer":{"socials":{"github":"https://github.com/sgl-project/sglang","x":"https://x.com/lmsysorg","linkedin":"https://www.linkedin.com/company/sgl-project/posts?feedView=all","slack":"https://slack.sglang.io/","discord":"https://discord.gg/4ugb2t6YY2"}},"seo":{"metatags":{"google-site-verification":"bX3ofyYQhraIpAYf4DpyZQXZO_G4xLR_RqeBAKnJA7g","canonical":"https://docs.sglang.io"}},"fonts":{"heading":{"family":"Inter","weight":600},"body":{"family":"Inter","weight":400}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"lmsysorg","hasAudioNarration":false,"actualSubdomain":"lmsysorg","customDomains":["docs.sglang.io"],"gitSource":{"type":"github","owner":"sgl-project","repo":"sglang","deployBranch":"main","contentDirectory":"docs","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae2bd505bc74eedc39a8129","collectionId":"b2e5d9ff-5ade-44f0-8770-f4efeda65e32","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae2bd505bc74eedc39a8129"},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae2bd505bc74eedc39a8129","clientVersion":"0.0.4006","searchFilterCounts":[{"language":"default","tag":"Cookbook","count":327},{"language":"default","tag":"Autoregressive Models","count":121},{"language":"default","tag":"User Guide","count":99},{"language":"default","tag":"Hardware","count":66},{"language":"default","tag":"Hardware Platforms","count":66},{"language":"default","tag":"SGLang Diffusion","count":60},{"language":"default","tag":"Ascend NPUs","count":55},{"language":"default","tag":"Advanced Features","count":46},{"language":"default","tag":"Model Deployment","count":37},{"language":"default","tag":"Diffusion Models","count":34}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":"@keyframes sgdb-note-in{0%{opacity:0;transform:translateY(-2px)}to{opacity:1;transform:translateY(0)}}:where(*){scrollbar-width:none;-ms-overflow-style:none}:where(*)::-webkit-scrollbar{width:0;height:0}:where(pre, code, .code-block, .code-group, #request-example, #response-example, .sg-bench-scroll),:where(pre, code, .code-block, .code-group, #request-example, #response-example, .sg-bench-scroll) *{scrollbar-width:auto;-ms-overflow-style:auto}:where(pre, code, .code-block, .code-group, #request-example, #response-example, .sg-bench-scroll) ::-webkit-scrollbar,:where(pre, code, .code-block, .code-group, #request-example, #response-example, .sg-bench-scroll)::-webkit-scrollbar{width:10px;height:10px}table{width:100%;border-collapse:collapse;table-layout:fixed}table thead tr{border-bottom:2px solid #d55816}table thead th{text-align:left;padding:10px 12px;font-weight:700;white-space:nowrap}[data-theme=dark] table tbody tr:nth-child(odd) td,[data-theme=dark] table thead th:nth-child(odd),html.dark table tbody tr:nth-child(odd) td,html.dark table thead th:nth-child(odd),table tbody tr:nth-child(odd) td,table thead th:nth-child(odd){background-color:rgba(255,255,255,.02)}[data-theme=dark] table tbody tr:nth-child(even) td,[data-theme=dark] table thead th:nth-child(even),html.dark table tbody tr:nth-child(even) td,html.dark table thead th:nth-child(even),table tbody tr:nth-child(even) td,table thead th:nth-child(even){background-color:rgba(255,255,255,.05)}table tbody td{padding:9px 12px}table tbody td:first-child{font-weight:500}.sgd-model-catalog{margin:16px 0 24px;border-top:1px solid #e2e8f0}.sgd-model-entry{display:grid;grid-template-columns:minmax(138px,.34fr) minmax(0,1fr);column-gap:28px;min-width:0;padding:17px 0;border-bottom:1px solid #e2e8f0}.sgd-model-entry-ids,.sgd-model-entry-meta{min-width:0}.sgd-model-entry-meta h3{margin:0;color:#0f172a;font-size:.9rem;font-weight:650;letter-spacing:0;line-height:1.4}.sgd-model-id{min-width:0;padding:2px 0}.sgd-model-entry .sgd-model-id code{display:block;min-width:0;padding:0;border:0;background:0 0;box-shadow:none;color:#334155;font-size:.78rem;font-weight:500;line-height:1.5;overflow-wrap:anywhere;white-space:normal}.sgd-model-entry-note{margin:7px 0 0;color:#64748b;font-size:.76rem;line-height:1.45}.sgd-model-entry-link{display:inline-flex;gap:4px;align-items:center;margin-top:7px;color:#c2410c;font-size:.74rem;font-weight:600;text-decoration:none}.sgd-model-entry-link:hover{text-decoration:underline}@media (max-width:620px){.sgd-model-entry{grid-template-columns:minmax(0,1fr);row-gap:9px;padding:15px 0}.sgd-model-entry-meta{display:flex;align-items:baseline;justify-content:space-between;gap:16px}.sgd-model-entry-link{flex:none;margin-top:0}}.sgd-chip{display:inline-flex;align-items:center;margin:2px 4px 2px 0;padding:2px 8px;border:1px solid rgba(213,88,22,.22);border-radius:999px;background:rgba(213,88,22,.08);color:#9a3412;font-size:.75rem;font-weight:650;line-height:1.45}.sgd-model-tags{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:8px 0 30px}.sgd-model-tags .sgd-chip{margin:0;padding:4px 9px;border:0;background:#eef2ff;color:#3730a3;font-size:12px;font-weight:750;line-height:1.4}.sgd-model-tags+h2{margin-top:0}.prose:has(.sgd-model-tags){overflow-x:clip;overflow-y:visible}.sg-command-visualizer:not(.sgd-command-builder) :where(button:not(:disabled), .sg-command-visualizer-choice[aria-disabled=\"false\"], .sg-command-visualizer-tab){transition:transform 160ms ease-out,border-color 160ms ease-out,background-color 160ms ease-out,color 160ms ease-out}@media (hover:hover) and (pointer:fine){.sg-command-visualizer:not(.sgd-command-builder) :where(button:not(:disabled), .sg-command-visualizer-choice[aria-disabled=\"false\"], .sg-command-visualizer-tab):hover{transform:translateY(-1px) scale(1.015)}}.sg-command-visualizer:not(.sgd-command-builder) :where(button:not(:disabled), .sg-command-visualizer-choice[aria-disabled=\"false\"], .sg-command-visualizer-tab):active{transform:translateY(0) scale(.985)}.sg-command-visualizer:not(.sgd-command-builder) :where(button, .sg-command-visualizer-choice, .sg-command-visualizer-tab):focus-visible{outline:2px solid #e2775f;outline-offset:2px}@media (prefers-reduced-motion:reduce){.sg-command-visualizer:not(.sgd-command-builder) :where(button, .sg-command-visualizer-choice, .sg-command-visualizer-tab){transition:none;transform:none!important}}.sgd-command-builder{container:command-builder/inline-size;--sgdb-surface:white;--sgdb-raised:white;--sgdb-ink:oklch(22% 0.02 258);--sgdb-muted:oklch(50% 0.02 258);--sgdb-line:oklch(90% 0.008 258);--sgdb-brand:oklch(57% 0.15 35);--sgdb-serve:oklch(56% 0.13 40);--sgdb-request:oklch(60% 0.12 62);--sgdb-ok:oklch(52% 0.11 153);--sgdb-warn:oklch(59% 0.12 78);--sgdb-error:oklch(53% 0.16 25);--sgdb-well:oklch(45% 0.03 258 / 0.08);--sgdb-well-inset:inset 0 1px 2px oklch(30% 0.03 258 / 0.07);--sgdb-thumb-bg:linear-gradient(180deg, white, oklch(98.5% 0.003 258));--sgdb-thumb-shadow:0 0 0 0.5px oklch(30% 0.02 258 / 0.1),\n inset 0 1px 0 rgba(255, 255, 255, 0.9),\n 0 1px 1px oklch(30% 0.02 258 / 0.07),\n 0 4px 12px oklch(30% 0.02 258 / 0.1);--sgdb-pick-hover:oklch(45% 0.03 258 / 0.05);--sgdb-code-bg:oklch(97.5% 0.004 258);--sgdb-code-inset:oklch(30% 0.03 258 / 0.06);--sgdb-ease:cubic-bezier(0.32, 0.72, 0, 1);--sgdb-ease-dur:200ms;--sgdb-spring:cubic-bezier(0.3, 1.35, 0.45, 1);--sgdb-spring-dur:460ms;max-width:100%;margin:24px 0 40px;overflow:clip;border:1px solid var(--sgdb-line);border-radius:16px;background:var(--sgdb-surface);box-shadow:0 1px 2px oklch(30% .03 258/.04),0 12px 32px -12px oklch(30% .03 258/.12);color:var(--sgdb-ink)}.sgd-command-builder *,.sgd-command-builder ::after,.sgd-command-builder ::before{box-sizing:border-box}.sgd-command-builder :where(button, input, select){font:inherit}.sgd-builder-scope-tabs{position:relative;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin:12px 12px 0;padding:3px;border-radius:11px;background:var(--sgdb-well);box-shadow:var(--sgdb-well-inset)}.sgd-builder-scope-tabs::before{position:absolute;top:3px;bottom:3px;left:3px;width:calc((100% - 6px)/3);border-radius:8px;background:var(--sgdb-thumb-bg);box-shadow:var(--sgdb-thumb-shadow);content:\"\";transition:transform 300ms var(--sgdb-ease)}.sgd-builder-scope-tabs:has(>button:nth-child(2)[data-active=true])::before{transform:translateX(100%)}.sgd-builder-scope-tabs:has(>button:nth-child(3)[data-active=true])::before{transform:translateX(200%)}.sgd-builder-scope-tabs button{position:relative;z-index:1;min-width:0;min-height:34px;padding:0 4px;border:0;background:0 0;color:var(--sgdb-muted);cursor:pointer;font-size:12px;font-weight:590;white-space:nowrap;transition:color var(--sgdb-ease-dur) var(--sgdb-ease)}.sgd-builder-scope-tabs button[data-active=true]{color:var(--sgdb-ink)}.sgd-builder-main{display:flex;min-width:0;flex-direction:column}.sgd-builder-controls,.sgd-builder-output-rail{min-width:0}.sgd-builder-controls{container:builder-controls/inline-size;padding:4px 16px 20px}.sgd-builder-docs-tip{display:block;margin:0;padding:12px 16px;border-top:1px solid var(--sgdb-line);color:var(--sgdb-muted);font-size:12px;line-height:1.5}.sgd-builder-docs-tip a{color:var(--sgdb-serve);text-decoration:underline;text-underline-offset:3px}.sgd-builder-scope-panel{display:grid;gap:0}.sgd-builder-recipe{display:flex;min-width:0;padding:11px 0;gap:12px;align-items:center;justify-content:space-between;border-bottom:1px solid var(--sgdb-line)}.sgd-builder-recipe>div:first-child{display:grid;min-width:0;gap:3px}.sgd-builder-recipe>div:first-child span{color:var(--sgdb-muted);font-size:10.5px}.sgd-builder-recipe>div:first-child strong{font-size:12px;font-weight:590;line-height:1.4}.sgd-builder-recipe>div:last-child{display:flex;flex:none;gap:10px;align-items:center}.sgd-builder-recipe>div:last-child>small{color:var(--sgdb-muted);font-size:10px}.sgd-builder-section{min-width:0;padding:13px 0;border-bottom:1px solid var(--sgdb-line)}.sgd-builder-section:last-child{border-bottom:0}.sgd-builder-section-heading{display:flex;gap:8px;align-items:baseline;justify-content:space-between;margin-bottom:8px}.sgd-builder-section-heading>span{font-size:12px;font-weight:590}.sgd-builder-section-heading>small{color:var(--sgdb-muted);font-size:11px;line-height:1.35;text-align:right}.sgd-builder-choice-grid,.sgd-builder-hardware-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px;padding:3px;border-radius:11px;background:var(--sgdb-well);box-shadow:var(--sgdb-well-inset)}.sgd-builder-choice,.sgd-builder-hardware{position:relative;display:grid;min-width:0;padding:7px 10px;overflow:hidden;align-content:center;border:0;border-radius:8px;background:0 0;color:color-mix(in oklch,var(--sgdb-ink) 72%,transparent);cursor:pointer;font-size:12px;line-height:1.25;text-align:left;transition:background-color var(--sgdb-ease-dur) var(--sgdb-ease),color var(--sgdb-ease-dur) var(--sgdb-ease)}.sgd-builder-choice{min-height:38px}.sgd-builder-hardware{display:flex;min-height:34px;flex-flow:row wrap;align-items:baseline;gap:5px}.sgd-builder-hardware strong{font-size:12.5px;font-weight:590;letter-spacing:-.01em}.sgd-builder-choice small,.sgd-builder-hardware small{color:var(--sgdb-muted);font-size:10.5px}.sgd-builder-choice small{margin-top:1px}.sgd-builder-hardware small{margin-top:0}.sgd-builder-choice-dot{display:none}.sgd-builder-choice[data-selected=true],.sgd-builder-hardware[data-selected=true]{background:var(--sgdb-thumb-bg);box-shadow:var(--sgdb-thumb-shadow);color:var(--sgdb-ink)}.sgd-builder-choice:disabled,.sgd-builder-choice[data-blocked=true],.sgd-builder-hardware:disabled{cursor:not-allowed;opacity:.42}.sgd-builder-blocked-note{margin:8px 2px 0;color:var(--sgdb-warn);font-size:11px;line-height:1.45;animation:sgdb-note-in 220ms var(--sgdb-ease)}.sgd-builder-choice[data-soft=true][data-selected=true]::after{content:\"Not verified yet\";color:var(--sgdb-warn);font-size:10px;line-height:1.3;margin-top:1px}.sgd-builder-resource-grid{display:grid;gap:8px}.sgd-builder-stepper-field{display:flex;min-height:42px;padding:5px 6px 5px 12px;align-items:center;justify-content:space-between;border:0;border-radius:10px;background:var(--sgdb-well);box-shadow:var(--sgdb-well-inset)}.sgd-builder-stepper-field>div:first-child{display:grid;gap:2px}.sgd-builder-stepper-field span{font-size:12px;font-weight:500}.sgd-builder-stepper-field small{color:var(--sgdb-muted);font-size:10px}.sgd-builder-stepper{display:grid;grid-template-columns:28px 40px 28px;align-items:center;border-radius:8px;background:var(--sgdb-thumb-bg);box-shadow:var(--sgdb-thumb-shadow)}.sgd-builder-request-stepper button,.sgd-builder-stepper button{min-width:28px;min-height:30px;padding:0;border:0;border-radius:8px;background:0 0;color:var(--sgdb-ink);cursor:pointer;font-size:14px;transition:background-color var(--sgdb-ease-dur) var(--sgdb-ease)}.sgd-builder-stepper input{width:40px;height:30px;padding:0;border-right:.5px solid color-mix(in oklch,var(--sgdb-ink) 10%,transparent);border-left:.5px solid color-mix(in oklch,var(--sgdb-ink) 10%,transparent);border-top:0;border-bottom:0;border-radius:0;appearance:textfield;background:0 0;color:var(--sgdb-ink);font-size:12px;font-variant-numeric:tabular-nums;font-weight:590;line-height:30px;text-align:center}.sgd-builder-request-stepper input::-webkit-inner-spin-button,.sgd-builder-request-stepper input::-webkit-outer-spin-button,.sgd-builder-stepper input::-webkit-inner-spin-button,.sgd-builder-stepper input::-webkit-outer-spin-button{margin:0;appearance:none}.sgd-builder-request-stepper button:disabled,.sgd-builder-stepper button:disabled{opacity:.32;cursor:not-allowed}.sgd-builder-resource-summary{margin:8px 0 0;color:var(--sgdb-muted);font-size:11px;line-height:1.4}.sgd-builder-topology-toggle{margin-top:10px}.sgd-builder-text-action{justify-self:start;min-height:32px;padding:0;border:0;background:0 0;color:var(--sgdb-muted);cursor:pointer;font-size:11px;font-weight:500}.sgd-builder-text-action:disabled{cursor:not-allowed;opacity:.4}.sgd-builder-advanced{margin-top:12px;padding-top:12px;border-top:1px solid var(--sgdb-line)}.sgd-builder-advanced>p{margin:0 0 12px;color:var(--sgdb-muted);font-size:11px;line-height:1.5}.sgd-builder-topology-inputs{display:grid;gap:8px}.sgd-builder-topology-inputs label{display:grid;gap:5px;color:var(--sgdb-muted);font-size:10.5px}.sgd-builder-topology-inputs select{width:100%;min-height:38px;padding:0 8px;border:1px solid var(--sgdb-line);border-radius:6px;background:var(--sgdb-raised);color:var(--sgdb-ink);font-size:12px}.sgd-builder-messages{margin-top:12px;padding:8px 10px;border-radius:6px;background:color-mix(in oklch,var(--sgdb-warn) 9%,transparent);color:color-mix(in oklch,var(--sgdb-warn) 75%,var(--sgdb-ink))}.sgd-builder-messages[data-state=error]{background:color-mix(in oklch,var(--sgdb-error) 9%,transparent);color:color-mix(in oklch,var(--sgdb-error) 78%,var(--sgdb-ink))}.sgd-builder-messages :is(p, [data-as=\"p\"]){display:block;margin:0;font-size:11px;line-height:1.45}.sgd-builder-messages :is(p, [data-as=\"p\"])+:is(p, [data-as=\"p\"]){margin-top:5px}.sgd-builder-setting-item,.sgd-builder-setting-layout,.sgd-builder-setting-list{min-width:0}.sgd-builder-setting-item{border-bottom:1px solid var(--sgdb-line)}.sgd-builder-setting-item:last-child{border-bottom:0}.sgd-builder-setting-row{display:grid;grid-template-columns:minmax(76px,auto) minmax(0,1fr) auto auto;width:100%;min-height:44px;padding:8px;gap:8px;align-items:center;border:0;border-bottom:0;border-radius:8px;background:0 0;transition:background-color var(--sgdb-ease-dur) var(--sgdb-ease),color var(--sgdb-ease-dur) var(--sgdb-ease);color:var(--sgdb-ink);cursor:pointer;text-align:left}.sgd-builder-setting-row>span:first-child{color:var(--sgdb-muted);font-size:11px}.sgd-builder-setting-row strong{overflow:hidden;font-size:12px;font-weight:500;text-overflow:ellipsis;white-space:nowrap}.sgd-builder-setting-row small{color:var(--sgdb-ok);font-size:10px;font-weight:500}.sgd-builder-setting-row>span:last-child{color:var(--sgdb-muted);font-size:17px}.sgd-builder-setting-row[data-active=true]{background:color-mix(in oklch,var(--sgdb-serve) 4%,transparent);color:var(--sgdb-serve)}.sgd-builder-context{padding:16px 0 4px}.sgd-builder-context--inline{padding:12px 4px 16px;border-top:1px solid var(--sgdb-line)}.sgd-builder-context--rail{display:none}.sgd-builder-context-heading{display:flex;align-items:start;justify-content:space-between;gap:12px}.sgd-builder-context-heading>div>span,.sgd-builder-output-title strong{font-size:13px;font-weight:590}.sgd-builder-context-heading :is(p, [data-as=\"p\"]){display:block;margin:4px 0 0;color:var(--sgdb-muted);font-size:11px;font-weight:400;line-height:1.45}.sgd-builder-context-heading>small{flex:none;color:var(--sgdb-muted);font-size:10px}.sgd-builder-context-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:12px}.sgd-builder-context-note{margin-top:12px;padding-top:10px;border-top:1px solid var(--sgdb-line)}.sgd-builder-context-note :is(p, [data-as=\"p\"]){display:block;margin:0;color:var(--sgdb-muted);font-size:11px;line-height:1.5}.sgd-builder-context-note a{display:inline-flex;margin-top:8px;min-height:24px;align-items:center;gap:5px;color:var(--sgdb-serve);font-size:11px;font-weight:500;text-decoration:none;transition:color var(--sgdb-ease-dur) var(--sgdb-ease)}.sgd-builder-context-note a+a{margin-left:16px}.sgd-builder-context-note a svg{flex:none;transition:transform var(--sgdb-ease-dur) var(--sgdb-ease)}.sgd-builder-context-note a:hover{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}.sgd-builder-context-note a:hover svg{transform:translateX(1px) scale(1.08)}.sgd-builder-scope-panel[data-scope=request] .sgd-builder-context-note a{color:var(--sgdb-request)}.sgd-builder-request-stepper{display:grid;grid-template-columns:40px 52px 40px auto;gap:6px;align-items:center;margin-top:14px}.sgd-builder-request-stepper input{width:52px;min-width:0;height:34px;padding:0 4px;border:1px solid var(--sgdb-line);border-radius:6px;appearance:textfield;background:var(--sgdb-surface);color:var(--sgdb-ink);font-size:16px;font-variant-numeric:tabular-nums;font-weight:590;text-align:center}.sgd-builder-request-stepper>span{margin-left:4px;color:var(--sgdb-muted);font-size:11px}.sgd-builder-request-setting{border-bottom:1px solid var(--sgdb-line)}.sgd-builder-request-setting:last-child{border-bottom:0}.sgd-builder-request-setting .sgd-builder-context{padding:16px 0}.sgd-builder-output-rail{display:grid;gap:12px;padding:0 12px 16px;align-items:stretch}.sgd-builder-output{--output-accent:var(--sgdb-serve);display:flex;min-width:0;flex-direction:column;overflow:hidden;border:1px solid var(--sgdb-line);border-radius:12px;background:var(--sgdb-raised);box-shadow:0 1px 2px oklch(30% .03 258/.05);transition:border-color 160ms ease-out,transform 160ms ease-out}.sgd-builder-output[data-output=request]{--output-accent:var(--sgdb-request)}.sgd-builder-output[data-emphasized=true]{border-color:color-mix(in oklch,var(--output-accent) 24%,var(--sgdb-line))}.sgd-builder-output>header{display:grid;grid-template-columns:24px minmax(0,1fr) auto;gap:8px;align-items:center;min-height:50px;padding:8px 10px;border-bottom:1px solid var(--sgdb-line)}.sgd-builder-output[data-emphasized=true]>header{background:linear-gradient(180deg,color-mix(in oklch,var(--output-accent) 7%,transparent),color-mix(in oklch,var(--output-accent) 2%,transparent))}.sgd-builder-output-index{display:grid;width:20px;height:20px;place-items:center;border:0;border-radius:50%;background:var(--sgdb-well);color:var(--sgdb-muted);font-size:10px;font-weight:590;font-variant-numeric:tabular-nums}.sgd-builder-output-title{display:flex;min-width:0;gap:7px;align-items:baseline}.sgd-builder-output-tabs button,.sgd-builder-output-title span,.sgd-builder-status{color:var(--sgdb-muted);font-size:10.5px}.sgd-builder-status{display:inline-flex;gap:5px;align-items:center;font-size:10px;white-space:nowrap}.sgd-builder-status>span{width:6px;height:6px;border-radius:50%;background:var(--sgdb-warn);box-shadow:0 0 6px color-mix(in oklch,var(--sgdb-warn) 60%,transparent)}.sgd-builder-status[data-status=verified]>span{background:var(--sgdb-ok)}.sgd-builder-status[data-status=error]>span{background:var(--sgdb-error)}.sgd-builder-output-tabs{display:flex;min-height:38px;padding:5px 10px;gap:14px;align-items:center;border-bottom:1px solid var(--sgdb-line)}.sgd-builder-output-tabs button{min-height:28px;padding:0;border:0;border-bottom:1px solid transparent;background:0 0;cursor:pointer;font-weight:500}.sgd-builder-output-tabs button[data-selected=true]{border-bottom-color:var(--output-accent);color:var(--sgdb-ink)}.sgd-builder-node-fields{display:grid;grid-template-columns:minmax(0,1fr) 84px;gap:8px;padding:8px 10px;border-bottom:1px solid var(--sgdb-line)}.sgd-builder-node-fields label{display:grid;min-width:0;gap:4px;color:var(--sgdb-muted);font-size:10px}.sgd-builder-node-fields input{width:100%;min-width:0;min-height:34px;padding:0 7px;border:1px solid var(--sgdb-line);border-radius:6px;background:var(--sgdb-surface);color:var(--sgdb-ink);font-size:11px}.sgd-builder-code{position:relative;display:grid;min-width:0;flex:1 1 auto}.sgd-builder-code>pre{height:100%;max-height:calc(13.95em + 24px);min-width:0;margin:0;padding:12px;overflow:auto;border:0;border-radius:0;background:var(--sgdb-code-bg);box-shadow:inset 0 1px 3px var(--sgdb-code-inset);color:var(--sgdb-ink);font-size:clamp(11.5px,1.2cqi,12.5px);line-height:1.55;white-space:pre}.sgd-builder-code>pre::-webkit-scrollbar-corner{background:0 0}.sgd-builder-code>pre.is-expanded{height:auto;max-height:70vh}.sgd-builder-output code{background:0 0;color:inherit;font:inherit;font-variant-ligatures:none}.sgd-builder-output-error{padding:8px 10px;border-top:1px solid color-mix(in oklch,var(--sgdb-error) 35%,var(--sgdb-line));background:color-mix(in oklch,var(--sgdb-error) 8%,transparent);color:var(--sgdb-error);font-size:10.5px;line-height:1.4}.sgd-builder-output>footer{display:flex;min-height:44px;padding:5px 10px;align-items:center;justify-content:space-between;border-top:1px solid var(--sgdb-line)}.sgd-builder-output>footer>div{display:flex;margin-left:auto;gap:12px;align-items:center}.sgd-builder-copy{position:absolute;top:7px;right:7px;display:grid;width:28px;height:28px;padding:0;border:0;border-radius:7px;background:var(--sgdb-thumb-bg);-webkit-backdrop-filter:blur(8px) saturate(1.4);backdrop-filter:blur(8px) saturate(1.4);box-shadow:var(--sgdb-thumb-shadow);color:var(--sgdb-muted);cursor:pointer;opacity:0;place-items:center;transform:translateY(2px) scale(.9);transition:opacity var(--sgdb-ease-dur) var(--sgdb-ease),color var(--sgdb-ease-dur) var(--sgdb-ease),transform var(--sgdb-spring-dur) var(--sgdb-spring)}.sgd-builder-code:hover>.sgd-builder-copy,.sgd-builder-copy:focus-visible,.sgd-builder-copy[data-copied=true]{opacity:1;transform:translateY(0) scale(1)}@media (hover:none){.sgd-builder-copy{opacity:1;transform:none}}.sgd-builder-copy:disabled{cursor:not-allowed;color:color-mix(in oklch,var(--sgdb-muted) 45%,transparent)}.sgd-builder-copy svg{grid-area:1/1;pointer-events:none;transition:opacity 140ms var(--sgdb-ease),transform 220ms var(--sgdb-ease)}.sgd-builder-copy .sgd-builder-copy-check,.sgd-builder-copy[data-copied=true] .sgd-builder-copy-glyph{opacity:0;transform:scale(.5)}.sgd-builder-copy[data-copied=true]{color:var(--sgdb-ok)}.sgd-builder-copy[data-copied=true] .sgd-builder-copy-check{opacity:1;transform:scale(1)}@media (hover:hover) and (pointer:fine){.sgd-builder-scope-tabs button:not(:disabled):hover,.sgd-command-builder button:not(:disabled):not([data-blocked=true]):hover{color:var(--sgdb-ink)}.sgd-builder-choice:not(:disabled):not([data-blocked=true]):not([data-selected=true]):hover,.sgd-builder-hardware:not(:disabled):not([data-selected=true]):hover,.sgd-builder-request-stepper button:not(:disabled):hover,.sgd-builder-stepper button:not(:disabled):hover{background:var(--sgdb-pick-hover)}.sgd-builder-setting-row:not(:disabled):hover{background:color-mix(in oklch,var(--sgdb-serve) 5%,transparent)}.sgd-builder-copy:not(:disabled):hover{color:var(--sgdb-ink)}.sgd-builder-copy[data-copied=true]:hover{color:var(--sgdb-ok)}.sgd-builder-text-action:not(:disabled):hover{color:var(--output-accent, var(--sgdb-brand))}}.sgd-command-builder :where(button, input, select, a):focus-visible{outline:2px solid color-mix(in oklch,var(--sgdb-brand) 76%,white);outline-offset:2px}.sgd-command-builder button:not(:disabled):not([data-blocked=true]):active{transform:scale(.97);transition-duration:60ms}@container builder-controls (min-width: 560px){.sgd-builder-scope-panel[data-scope=base]{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:28px}.sgd-builder-scope-panel[data-scope=base]>.sgd-builder-recipe{grid-column:1/-1}.sgd-builder-scope-panel[data-scope=base] .sgd-builder-resource-grid{grid-template-columns:minmax(0,1fr)}.sgd-builder-setting-layout{display:grid;grid-template-columns:minmax(240px,.9fr) minmax(0,1.1fr)}.sgd-builder-setting-list{padding-right:16px;border-right:1px solid var(--sgdb-line)}.sgd-builder-context--inline{display:none}.sgd-builder-context--rail{display:block;padding:12px 0 4px 16px}.sgd-builder-request-direct{grid-template-columns:repeat(2,minmax(0,1fr))}.sgd-builder-request-setting{padding-right:16px;border-right:1px solid var(--sgdb-line);border-bottom:0}.sgd-builder-request-setting+.sgd-builder-request-setting{padding-right:0;padding-left:16px;border-right:0}}@container command-builder (max-width: 717px){.sgd-builder-output-rail{display:contents}.sgd-builder-controls{order:0}.sgd-builder-output{width:calc(100% - 24px);margin:12px 12px 16px;order:1}.sgd-builder-main[data-scope=request] .sgd-builder-output[data-output=request],.sgd-builder-main[data-scope=serve] .sgd-builder-output[data-output=serve]{order:-1}}@container command-builder (min-width: 718px) and (max-width: 957px){.sgd-builder-output-rail{order:-1;padding-top:12px}.sgd-builder-main[data-scope=base] .sgd-builder-output-rail{order:1;padding-top:0}.sgd-builder-output[data-emphasized=false]{order:1}}@container command-builder (min-width: 418px){.sgd-builder-scope-tabs{margin-inline:16px}.sgd-builder-scope-tabs button{font-size:13px}.sgd-builder-hardware-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.sgd-builder-resource-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sgd-builder-topology-inputs{grid-template-columns:repeat(3,minmax(0,1fr))}}@container command-builder (min-width: 718px){.sgd-builder-scope-panel[data-scope=base]{grid-template-columns:repeat(12,minmax(0,1fr));column-gap:16px}.sgd-builder-scope-panel[data-scope=base]>:where(.sgd-builder-recipe, .sgd-builder-section){grid-column:1/-1}.sgd-builder-scope-panel[data-scope=base]>.sgd-builder-section:nth-last-child(-n+2){grid-column:span 6}.sgd-builder-output-rail{grid-template-columns:minmax(0,1fr)}.sgd-builder-main[data-scope=base] .sgd-builder-output-rail{grid-template-columns:repeat(2,minmax(0,1fr))}.sgd-builder-choice-grid[data-density=compact]{grid-template-columns:repeat(3,minmax(0,1fr))}}@container command-builder (min-width: 958px){.sgd-builder-scope-tabs{margin-inline:20px}.sgd-builder-scope-tabs button{font-size:14px}.sgd-builder-main{display:grid;grid-template-columns:minmax(0,38fr) minmax(0,62fr)}.sgd-builder-controls{padding:8px 20px 24px;border-right:1px solid var(--sgdb-line)}.sgd-builder-output-rail{grid-template-columns:minmax(0,1fr);padding:16px}.sgd-builder-scope-panel[data-scope=base]{display:grid;grid-template-columns:minmax(0,1fr)}.sgd-builder-scope-panel[data-scope=base]>.sgd-builder-recipe,.sgd-builder-scope-panel[data-scope=base]>.sgd-builder-section,.sgd-builder-scope-panel[data-scope=base]>.sgd-builder-section:nth-last-child(-n+2){grid-column:1}.sgd-builder-hardware-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sgd-builder-output{box-shadow:0 1px 2px color-mix(in oklch,var(--sgdb-ink) 5%,transparent)}}[data-theme=dark] .sgd-command-builder,html.dark .sgd-command-builder{--sgdb-surface:oklch(24% 0.015 258);--sgdb-raised:oklch(27% 0.015 258);--sgdb-ink:oklch(94% 0.006 80);--sgdb-muted:oklch(71% 0.012 258);--sgdb-line:rgba(255, 255, 255, 0.09);--sgdb-brand:oklch(70% 0.14 40);--sgdb-serve:oklch(74% 0.11 45);--sgdb-request:oklch(77% 0.1 64);--sgdb-ok:oklch(74% 0.11 153);--sgdb-warn:oklch(76% 0.11 78);--sgdb-error:oklch(73% 0.14 25);--sgdb-well:rgba(0, 0, 0, 0.32);--sgdb-well-inset:inset 0 1px 2px rgba(0, 0, 0, 0.4);--sgdb-thumb-bg:linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.07));--sgdb-thumb-shadow:0 0 0 0.5px rgba(255, 255, 255, 0.16),\n inset 0 1px 0 rgba(255, 255, 255, 0.13),\n 0 2px 8px rgba(0, 0, 0, 0.35);--sgdb-pick-hover:rgba(255, 255, 255, 0.06);--sgdb-code-bg:oklch(18% 0.012 258);--sgdb-code-inset:rgba(0, 0, 0, 0.5);box-shadow:inset 0 1px 0 rgba(255,255,255,.06),0 16px 40px -16px rgba(0,0,0,.5)}@media (prefers-reduced-motion:reduce){.sgd-command-builder *,.sgd-command-builder ::after,.sgd-command-builder ::before{scroll-behavior:auto!important;transition:none!important;animation:none!important}}[data-theme=dark] .sgd-model-catalog,[data-theme=dark] .sgd-model-entry,html.dark .sgd-model-catalog,html.dark .sgd-model-entry{border-color:rgba(148,163,184,.2)}[data-theme=dark] .sgd-model-entry-meta h3,html.dark .sgd-model-entry-meta h3{color:#f1f5f9}[data-theme=dark] .sgd-model-entry .sgd-model-id code,html.dark .sgd-model-entry .sgd-model-id code{background:0 0;color:#cbd5e1}[data-theme=dark] .sgd-model-entry-note,html.dark .sgd-model-entry-note{color:#94a3b8}[data-theme=dark] .sgd-model-entry-link,html.dark .sgd-model-entry-link{color:#fb923c}[data-theme=dark] .sgd-chip,html.dark .sgd-chip{border-color:rgba(251,146,60,.3);background:rgba(251,146,60,.12);color:#fdba74}[data-theme=dark] .sgd-model-tags .sgd-chip,html.dark .sgd-model-tags .sgd-chip{border:0;background:rgba(129,140,248,.18);color:#c7d2fe}.prose b,.prose strong{font-weight:600}:not(pre)>code{background-color:rgba(0,0,0,.07);font-weight:600}[data-theme=dark] :not(pre)>code,html.dark :not(pre)>code{background-color:rgba(255,255,255,.13);font-weight:600}"}],"page":{"pagePath":"docs/advanced_features/quantization","slug":"/docs/advanced_features/quantization","pageMetadata":{"title":"Quantization","metatags":{"description":"SGLang quantization: FP8, FP4, AWQ, GPTQ, ModelOpt. Offline and online quantization methods for efficient LLM inference."},"description":null,"href":"/docs/advanced_features/quantization"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,blockquote:`blockquote`,code:`code`,em:`em`,h5:`h5`,input:`input`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,CodeBlock,Heading,Note,Table}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`SGLang supports various quantization methods, including offline quantization and online dynamic quantization.`}),`\n`,_jsx(_components.p,{children:`Offline quantization loads pre-quantized model weights directly during inference. This is required for quantization methods\nsuch as GPTQ and AWQ, which collect and pre-compute various statistics from the original weights using the calibration dataset.`}),`\n`,_jsxs(_components.p,{children:[`Online quantization dynamically computes scaling parameters—such as the maximum/minimum values of model weights—during runtime.\nLike NVIDIA FP8 training’s `,_jsx(_components.a,{href:`https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/examples/fp8_primer.html#Mixed-precision-training-with-FP8`,children:`delayed scaling`}),` mechanism, online quantization calculates the appropriate scaling factors\non-the-fly to convert high-precision weights into a lower-precision format.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Note: For better performance, usability and convenience, offline quantization is recommended over online quantization.`})}),`\n`,_jsxs(_components.p,{children:[`If you use a pre-quantized model, `,_jsxs(_components.strong,{children:[`do not add `,_jsx(_components.code,{children:`--quantization`}),` to enable online quantization at the same time`]}),`.\nFor popular pre-quantized models, please visit `,_jsx(_components.a,{href:`https://huggingface.co/unsloth`,children:`Unsloth`}),`, `,_jsx(_components.a,{href:`https://huggingface.co/collections/nvidia/inference-optimized-checkpoints-with-model-optimizer`,children:`NVIDIA ModelOpt`}),`\nor `,_jsx(_components.a,{href:`https://huggingface.co/collections/neuralmagic`,children:`NeuralMagic`}),` collections on HF for some\npopular quality validated quantized models. Quantized models must be validated via benchmarks post-quantization\nto guard against abnormal quantization loss regressions.`]}),`\n`,_jsx(Heading,{level:`2`,id:`platform-compatibility`,children:`Platform Compatibility`}),`\n`,_jsx(_components.p,{children:`The following table summarizes quantization method support across NVIDIA and AMD GPUs, Ascend NPUs.`}),`\n`,_jsxs(`table`,{children:[_jsx(`thead`,{children:_jsxs(`tr`,{children:[_jsx(`th`,{children:`Method`}),_jsx(`th`,{children:`NVIDIA GPUs`}),_jsx(`th`,{children:`AMD GPUs (MI300X/MI325X/MI350X)`}),_jsx(`th`,{children:`Ascend NPUs (A2/A3 Series, 950PR/DT Series)`}),_jsx(`th`,{children:`Notes`})]})}),_jsxs(`tbody`,{children:[_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`fp8`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`WIP`}),_jsx(`td`,{children:`Aiter or Triton backend on AMD`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`mxfp4`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes (950PR/DT Series)`}),_jsxs(`td`,{children:[`On GPU: requires CDNA3/CDNA4 with MXFP support (uses Aiter). On Ascend NPU (950PR/DT Series): W4A4 MXFP4 for Qwen3 dense and MoE LLMs (MXFP4 weights + activations) — dense models support online dual-level MXFP4; offline `,_jsx(`code`,{children:`W4A4_MXFP4`}),` dense and MoE checkpoints (single-level) are auto-detected via `,_jsx(`code`,{children:`modelslim`}),`. On Intel GPUs (XPU): W4A16 MoE experts on Xe2/BMG via `,_jsx(`code`,{children:`sgl-kernel-xpu`}),`, enabled automatically with `,_jsx(`code`,{children:`—device xpu`}),` (see `,_jsx(_components.a,{href:`/docs/hardware-platforms/xpu`,children:`Intel GPUs (XPU)`}),`)`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`mxfp8`})}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Yes (950PR/DT Series for Diffusion, LLM Dense Linear and LLM MoE)`}),_jsxs(`td`,{children:[`Ascend NPU only; online + offline MXFP8 for Diffusion models (e.g., Wan2.2), LLM Dense Linear, and LLM MoE (FusedMoE, e.g. Qwen3-30B-A3B) on 950PR/DT Series; uses CANN `,_jsx(`code`,{children:`npu_dynamic_mx_quant`}),` / `,_jsx(`code`,{children:`npu_quant_matmul`}),` (dense) and `,_jsx(`code`,{children:`npu_grouped_matmul_swiglu_quant_v2`}),` / `,_jsx(`code`,{children:`npu_grouped_matmul`}),` (MoE) kernels`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`mxfp_w4a8`})}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Yes (950PR/DT Series)`}),_jsxs(`td`,{children:[`Ascend NPU only; online W4A8 for Qwen3 dense LLM (MXFP4 weights + MXFP8 activations) on 950PR/DT Series; offline `,_jsx(`code`,{children:`W4A8_MXFP`}),` dense and MoE checkpoints are auto-detected via `,_jsx(`code`,{children:`modelslim`})]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`blockwise_int8`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Triton-based, works on both platforms`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`w8a8_int8`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`w8a8_fp8`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Aiter or Triton FP8 on AMD`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`awq`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Uses a JIT-compiled CUDA kernel on NVIDIA, Triton dequantize on AMD. Uses CANN kernels on Ascend`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`gptq`})}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Yes`}),_jsxs(`td`,{children:[`Removed on NVIDIA and AMD GPUs — use `,_jsx(`code`,{children:`gptq_marlin`}),` instead. Uses CANN kernels on Ascend. Still supported on Intel CPUs with AMX`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`compressed-tensors`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Partial`}),_jsxs(`td`,{children:[`Aiter paths for FP8/MoE on AMD. Uses CANN kernels on Ascend, `,_jsx(`code`,{children:`FP8`}),` not supported yet`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`quark`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`AMD Quark quantization; Aiter GEMM paths on AMD`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`auto-round`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Partial`}),_jsx(`td`,{children:`Platform-agnostic (Intel auto-round). Uses CANN kernels on Ascend`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`quark_int4fp8_moe`})}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`AMD-only; online INT4-to-FP8 MoE quantization (CDNA3/CDNA4)`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`awq_marlin`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Marlin kernels are CUDA-only`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`gptq_marlin`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Marlin kernels are CUDA-only`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`gguf`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`CUDA kernels in sgl-kernel; Ascend uses CPU pre-dequantization at load time`})]}),_jsxs(`tr`,{children:[_jsxs(`td`,{children:[_jsx(`code`,{children:`modelopt`}),` / `,_jsx(`code`,{children:`modelopt_fp8`})]}),_jsx(`td`,{children:`Yes (Hopper/SM90+)`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`No`}),_jsxs(`td`,{children:[_jsx(`a`,{href:`https://github.com/NVIDIA/Model-Optimizer`,children:`NVIDIA ModelOpt`}),`; requires NVIDIA hardware`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`modelopt_fp4`})}),_jsx(`td`,{children:`Yes (SM80-SM90 via Marlin; SM100+ native FP4)`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`No`}),_jsxs(`td`,{children:[_jsx(`a`,{href:`https://github.com/NVIDIA/Model-Optimizer`,children:`NVIDIA ModelOpt`}),`; use Marlin W4A16 fallback on Ampere/Hopper and native FP4 backends on Blackwell; supports load-time BF16/FP16/FP8 MoE conversion with per-tensor FP32 activation scales`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`nvfp4_online`})}),_jsx(`td`,{children:`Yes (Blackwell/SM100 or SM103)`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`No`}),_jsxs(`td`,{children:[`Online MoE-only NVFP4 weight quantization with per-token FP32 activation scales for BF16/FP16/FP8 checkpoints; use `,_jsx(`code`,{children:`modelopt_fp4`}),` for per-tensor FP32 activation scales; requires `,_jsx(`code`,{children:`flashinfer_trtllm`}),` or `,_jsx(`code`,{children:`flashinfer_trtllm_routed`})]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`petit_nvfp4`})}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Yes (MI250/MI300X/MI325X)`}),_jsx(`td`,{children:`No`}),_jsxs(`td`,{children:[`Enables NVFP4 on ROCm via `,_jsx(`a`,{href:`https://github.com/causalflow-ai/petit-kernel`,children:`Petit`}),`; use `,_jsx(`code`,{children:`modelopt_fp4`}),` on NVIDIA Blackwell. Auto-selected when loading NVFP4 models on AMD. See `,_jsx(`a`,{href:`https://lmsys.org/blog/2025-09-21-petit-amdgpu/`,children:`LMSYS blog`}),` and `,_jsx(`a`,{href:`https://rocm.blogs.amd.com/artificial-intelligence/fp4-mixed-precision/README.html`,children:`AMD ROCm blog`}),`.`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`bitsandbytes`})}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Experimental`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Depends on bitsandbytes ROCm support`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`modelslim`})}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`No`}),_jsx(`td`,{children:`Yes`}),_jsx(`td`,{children:`Ascend quantization; Uses CANN kernels`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`On AMD, several of these methods use `,_jsx(_components.a,{href:`https://github.com/ROCm/aiter`,children:`Aiter`}),` for acceleration — set `,_jsx(_components.code,{children:`SGLANG_USE_AITER=1`}),` where noted. See `,_jsx(_components.a,{href:`/docs/hardware-platforms/amd_gpu`,children:`AMD GPU setup`}),` for installation and configuration details.`]}),`\n`,_jsxs(_components.p,{children:[`On Ascend, various layers quantization configurations are supported, see `,_jsx(_components.a,{href:`/docs/hardware-platforms/ascend-npus/optimization/quantization`,children:`Ascend NPU quantization`}),` for details.`]}),`\n`,_jsx(Heading,{level:`2`,id:`gemm-backends-for-fp4/fp8-quantization`,children:`GEMM Backends for FP4/FP8 Quantization`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`Backend selection applies to `,_jsx(_components.strong,{children:`blockwise FP8`}),`, `,_jsx(_components.strong,{children:`MXFP8`}),` (dense linear), and `,_jsx(_components.strong,{children:`NVFP4`}),` GEMM. When running offline or online FP8 or FP4 quantized models, you can select the GEMM backend via `,_jsx(_components.code,{children:`--fp8-gemm-backend`}),` and `,_jsx(_components.code,{children:`--fp4-gemm-backend`}),`.`]})}),`\n`,_jsxs(Heading,{level:`3`,id:`fp8-gemm-backend-blockwise-fp8-gemm`,children:[_jsx(_components.code,{children:`--fp8-gemm-backend`}),` (Blockwise FP8 GEMM)`]}),`\n`,_jsxs(`table`,{children:[_jsx(`thead`,{children:_jsxs(`tr`,{children:[_jsx(`th`,{children:`Backend`}),_jsx(`th`,{children:`Hardware`}),_jsx(`th`,{children:`Description`})]})}),_jsxs(`tbody`,{children:[_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`auto`})}),_jsx(`td`,{children:`All`}),_jsx(`td`,{children:`Auto-selects based on hardware`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`deep_gemm`})}),_jsx(`td`,{children:`SM90, SM100`}),_jsx(`td`,{children:`JIT-compiled; enabled when DeepGEMM is installed`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`flashinfer_trtllm`})}),_jsx(`td`,{children:`SM100`}),_jsx(`td`,{children:`FlashInfer TensorRT-LLM backend; optimal for low-latency`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`flashinfer_cutlass`})}),_jsx(`td`,{children:`SM100/120`}),_jsx(`td`,{children:`FlashInfer CUTLASS groupwise FP8 GEMM`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`flashinfer_deepgemm`})}),_jsx(`td`,{children:`SM90`}),_jsx(`td`,{children:`Uses swapAB optimization for small M dimensions in decoding`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`cutlass`})}),_jsx(`td`,{children:`SM120`}),_jsx(`td`,{children:`sgl-kernel CUTLASS`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`triton`})}),_jsx(`td`,{children:`All`}),_jsx(`td`,{children:`Fallback; widely compatible`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`aiter`})}),_jsx(`td`,{children:`ROCm`}),_jsx(`td`,{children:`AMD AITER backend`})]})]})]}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`auto`}),` selection order:`]}),` 1) DeepGEMM (SM90/SM100, installed); 2) FlashInfer TRTLLM (SM100, FlashInfer available); 3) CUTLASS (SM120); 4) AITER (AMD); 5) Triton (fallback).`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`MXFP8 dense linear:`}),` `,_jsx(_components.code,{children:`auto`}),` uses `,_jsx(_components.code,{children:`flashinfer_cutlass`}),` on SM100 (else `,_jsx(_components.code,{children:`triton`}),`). `,_jsx(_components.code,{children:`flashinfer_cutlass`}),` is fastest on most shapes; `,_jsx(_components.code,{children:`flashinfer_trtllm`}),` is faster only at small M.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`fp4-gemm-backend-nvfp4-gemm`,children:[_jsx(_components.code,{children:`--fp4-gemm-backend`}),` (NVFP4 GEMM)`]}),`\n`,_jsxs(`table`,{children:[_jsx(`thead`,{children:_jsxs(`tr`,{children:[_jsx(`th`,{children:`Backend`}),_jsx(`th`,{children:`Hardware`}),_jsx(`th`,{children:`Description`})]})}),_jsxs(`tbody`,{children:[_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`auto`})}),_jsx(`td`,{children:`SM80+`}),_jsxs(`td`,{children:[`Auto-selects: `,_jsx(`code`,{children:`flashinfer_cutedsl`}),` on SM100; `,_jsx(`code`,{children:`marlin`}),` on SM80-SM90; `,_jsx(`code`,{children:`flashinfer_cutlass`}),` otherwise (including SM120)`]})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`flashinfer_cutlass`})}),_jsx(`td`,{children:`SM100/120`}),_jsx(`td`,{children:`FlashInfer CUTLASS backend`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`flashinfer_cudnn`})}),_jsx(`td`,{children:`SM100/120 (CUDA 13+, cuDNN 9.15+)`}),_jsx(`td`,{children:`FlashInfer cuDNN backend`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`flashinfer_cutedsl`})}),_jsx(`td`,{children:`SM100`}),_jsx(`td`,{children:`FlashInfer CuTe DSL backend`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`flashinfer_trtllm`})}),_jsx(`td`,{children:`SM100`}),_jsx(`td`,{children:`FlashInfer TensorRT-LLM backend`})]}),_jsxs(`tr`,{children:[_jsx(`td`,{children:_jsx(`code`,{children:`marlin`})}),_jsx(`td`,{children:`SM80-SM90`}),_jsx(`td`,{children:`Weight-only W4A16 fallback for NVFP4 checkpoints`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`On SM80-SM90, `,_jsx(_components.code,{children:`auto`}),` selects Marlin for NVFP4. NVFP4 GEMM requires FlashInfer to be installed.`]}),`\n`,_jsx(Heading,{level:`2`,id:`offline-quantization`,children:`Offline Quantization`}),`\n`,_jsxs(_components.p,{children:[`To load already quantized models, simply load the model weights and config. `,_jsxs(_components.strong,{children:[`Again, if the model has been quantized offline,\nthere’s no need to add `,_jsx(_components.code,{children:`--quantization`}),` argument when starting the engine. The quantization method will be parsed from the\ndownloaded Hugging Face or msModelSlim config. For example, DeepSeek V3/R1 models are already in FP8, so do not add redundant parameters.`]})]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python3`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` hugging-quants/Meta-Llama-3.1-8B-Instruct-AWQ-INT4`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30000`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.0.0.0`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Take note, if your model is `,_jsx(_components.strong,{children:`per-channel quantized (INT8 or FP8) with per-token dynamic quantization activation`}),`, you can opt to include `,_jsx(_components.code,{children:`--quantization w8a8_int8`}),` or `,_jsx(_components.code,{children:`--quantization w8a8_fp8`}),` to invoke the corresponding CUTLASS int8_kernel or fp8_kernel in sgl-kernel. This action will ignore the Hugging Face config’s quantization settings. For instance, with `,_jsx(_components.code,{children:`neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8-dynamic`}),`, if you execute with `,_jsx(_components.code,{children:`--quantization w8a8_fp8`}),`, the system will use the `,_jsx(_components.code,{children:`W8A8Fp8Config`}),` from SGLang to invoke the sgl-kernel, rather than the `,_jsx(_components.code,{children:`CompressedTensorsConfig`}),` for vLLM kernels.`]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python3`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` neuralmagic/Meta-Llama-3.1-8B-Instruct-FP8-dynamic`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` w8a8_fp8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30000`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.0.0.0`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`examples-of-offline-model-quantization`,children:`Examples of Offline Model Quantization`}),`\n`,_jsxs(Heading,{level:`4`,id:`using-unsloth`,children:[`Using `,_jsx(_components.a,{href:`https://docs.unsloth.ai/basics/inference-and-deployment/sglang-guide`,children:`Unsloth`})]}),`\n`,_jsxs(_components.p,{children:[`We strongly suggest the use of Unsloth to quantize and load the model. Please refer to `,_jsx(_components.a,{href:`https://docs.unsloth.ai/basics/inference-and-deployment/sglang-guide`,children:`SGLang Deployment \u0026 Inference Guide with Unsloth`}),`.`]}),`\n`,_jsxs(Heading,{level:`4`,id:`using-auto-round`,children:[`Using `,_jsx(_components.a,{href:`https://github.com/intel/auto-round`,children:`auto-round`})]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Install`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auto-round`})]}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`LLM quantization`}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:`Example`,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# for LLM`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` auto_round `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AutoRound`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"meta-llama/Llama-3.2-1B-Instruct\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`quant_path `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Llama-3.2-1B-Instruct-autoround-4bit\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Scheme examples: \"W2A16\", \"W3A16\", \"W4A16\", \"W8A16\", \"NVFP4\", \"MXFP4\" (no real kernels), \"GGUF:Q4_K_M\", etc.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`scheme `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"W4A16\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`format`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"auto_round\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`autoround `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AutoRound(model_id, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`scheme`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`scheme)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`autoround.quantize_and_save(quant_path, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`format`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`format`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# quantize and save`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`VLM quantization`}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:`Example`,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# for VLMs`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` auto_round `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AutoRoundMLLM`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Qwen/Qwen2-VL-2B-Instruct\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`quant_path `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Qwen2-VL-2B-Instruct-autoround-4bit\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`scheme `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"W4A16\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`format`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"auto_round\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`autoround `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AutoRoundMLLM(model_name, scheme)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`autoround.quantize_and_save(quant_path, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`format`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`format`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# quantize and save`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Command Line Usage (Gaudi/CPU/Intel GPU/CUDA)`}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`6`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`auto-round`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` meta-llama/Llama-3.2-1B-Instruct`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --bits`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --group_size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 128`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --format`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"auto_round\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --output_dir`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./tmp_autoround`})]}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`SGlang API Usage (CPU/CUDA)`}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:`Example`,numberOfLines:`23`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`23`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.configs.load_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` LoadConfig`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.configs.model_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ModelConfig`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.model_loader.loader `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` get_model_loader`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.configs.device_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DeviceConfig`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Configure model with inc quantization and saving`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ModelConfig(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"meta-llama/Llama-3.2-3B-Instruct\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` quantization`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"auto-round-int8\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` trust_remote_code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`load_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` LoadConfig(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` inc_save_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./quantized_model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`device_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DeviceConfig(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`device`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cpu\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Load and quantize the model`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_loader `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` get_model_loader(load_config, model_config)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`quantized_model `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` model_loader.load_model(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_config,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` device_config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`device_config,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`known issues`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Several limitations currently affect offline quantized model loading in sglang, These issues might be resolved in future updates of sglang. If you experience any problems, consider using Hugging Face Transformers as an alternative.`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Mixed-bit Quantization Limitations`}),`\n`,_jsx(_components.p,{children:`Mixed-bit quantization is not fully supported. Due to vLLM’s layer fusion (e.g., QKV fusion), applying different bit-widths to components within the same fused layer can lead to compatibility issues.`}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Limited Support for Quantized MoE Models`}),`\n`,_jsx(_components.p,{children:`Quantized MoE models may encounter inference issues due to kernel limitations (e.g., lack of support for mlp.gate layer quantization). please try to skip quantizing these layers to avoid such errors.`}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Limited Support for Quantized VLMs`}),`\n`,_jsxs(Accordion,{title:`Details`,id:`details`,children:[_jsx(_components.p,{children:`Qwen2.5-VL-7B`}),_jsx(_components.p,{children:`auto_round:auto_gptq format: Accuracy is close to zero.`}),_jsx(_components.p,{children:`GPTQ format: Fails with:`}),_jsx(CodeBlock,{filename:`Output`,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`The output size is not aligned with the quantized weight shape`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),_jsx(_components.p,{children:`auto_round:auto_awq and AWQ format: These work as expected.`})]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Limited Support for SGlang API Usage`}),`\n`,_jsxs(_components.p,{children:[`SGlang API Usage only supports `,_jsx(_components.code,{children:`auto-round-int8`}),` quantization method now, more quantization methods are on the way.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`CPU serving`}),`\n`,_jsxs(_components.p,{children:[`AutoRound INT4 checkpoints (both `,_jsx(_components.code,{children:`auto_round:auto_gptq`}),` and `,_jsx(_components.code,{children:`auto_round:auto_awq`}),` packing formats) can be served on Intel CPUs with AMX support:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`SGLANG_USE_CPU_ENGINE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`1`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:` python3`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` OPEA/Qwen2.5-0.5B-Instruct-int4-sym-inc`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` auto-round`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --device`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cpu`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --trust-remote-code`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The current SGLang CPU backend supports only 4-bit AutoRound checkpoints on Intel AMX. Other AutoRound bit-widths and non-AMX CPU backends are not supported by this path.`}),`\n`]}),`\n`]}),`\n`,_jsxs(Heading,{level:`4`,id:`using-gptqmodel`,children:[`Using `,_jsx(_components.a,{href:`https://github.com/ModelCloud/GPTQModel`,children:`GPTQModel`})]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# install`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` gptqmodel`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --no-build-isolation`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -v`})]}),`\n`]})})}),`\n`,_jsx(CodeBlock,{filename:`Example`,numberOfLines:`16`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` datasets `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` load_dataset`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` gptqmodel `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` GPTQModel, QuantizeConfig`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"meta-llama/Llama-3.2-1B-Instruct\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`quant_path `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Llama-3.2-1B-Instruct-gptqmodel-4bit\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`calibration_dataset `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` load_dataset(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"allenai/c4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`data_files`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"en/c4-train.00001-of-01024.json.gz\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` split`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"train\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ).select(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`range`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`quant_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` QuantizeConfig(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`bits`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`group_size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`128`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# quantization config`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` GPTQModel.load(model_id, quant_config) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# load model`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model.quantize(calibration_dataset, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`batch_size`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# quantize`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model.save(quant_path) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# save model`})]}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`4`,id:`using-llm-compressor`,children:[`Using `,_jsx(_components.a,{href:`https://github.com/vllm-project/llm-compressor/`,children:`LLM Compressor`})]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# install`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` llmcompressor`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Here, we take quantize `,_jsx(_components.code,{children:`meta-llama/Meta-Llama-3-8B-Instruct`}),` to `,_jsx(_components.code,{children:`FP8`}),` as an example to elaborate on how to do offline quantization.`]}),`\n`,_jsx(CodeBlock,{filename:`Example`,numberOfLines:`24`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`24`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` transformers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AutoTokenizer`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` llmcompressor.transformers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SparseAutoModelForCausalLM`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` llmcompressor.transformers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` oneshot`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` llmcompressor.modifiers.quantization `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` QuantizationModifier`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Step 1: Load the original model.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL_ID`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"meta-llama/Meta-Llama-3-8B-Instruct\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SparseAutoModelForCausalLM.from_pretrained(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` MODEL_ID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`device_map`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"auto\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`torch_dtype`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"auto\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tokenizer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AutoTokenizer.from_pretrained(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MODEL_ID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Step 2: Perform offline quantization.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Step 2.1: Configure the simple PTQ quantization.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`recipe `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` QuantizationModifier(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` targets`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Linear\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`scheme`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"FP8_DYNAMIC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ignore`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"lm_head\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Step 2.2: Apply the quantization algorithm.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`oneshot(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`recipe`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`recipe)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Step 3: Save the model.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`SAVE_DIR`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` MODEL_ID`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.split(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"-FP8-Dynamic\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model.save_pretrained(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`SAVE_DIR`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tokenizer.save_pretrained(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`SAVE_DIR`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Then, you can directly use the quantized model with `,_jsx(_components.code,{children:`SGLang`}),`, by using the following command:`]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python3`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` $PWD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/Meta-Llama-3-8B-Instruct-FP8-Dynamic`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30000`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.0.0.0`})]}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`4`,id:`using-nvidia-modelopt`,children:[`Using `,_jsx(_components.a,{href:`https://github.com/NVIDIA/Model-Optimizer`,children:`NVIDIA ModelOpt`})]}),`\n`,_jsx(_components.p,{children:`NVIDIA Model Optimizer (ModelOpt) provides advanced quantization techniques optimized for NVIDIA hardware.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Offline vs. Online Quantization:`})}),`\n`,_jsx(_components.p,{children:`SGLang supports two modes for ModelOpt.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Offline Quantization (pre-quantized):`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Usage:`}),` Download a pre-quantized model from Hugging Face or run `,_jsx(_components.code,{children:`hf_ptq.py`}),` once to create a new quantized checkpoint. Then load this quantized checkpoint.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Pros:`}),` Fast server startup, quantization can be validated before deployment, efficient resource usage.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Cons:`}),` Requires an extra preparation step.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Online Quantization (quant and serve):`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Usage:`}),` Load a standard BF16/FP16 model and add a flag. The engine applies quantization `,_jsx(_components.em,{children:`on startup`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Pros:`}),` Convenient (no new checkpoint needed).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Cons:`}),` `,_jsx(_components.strong,{children:`High startup time`}),`, increases VRAM usage during initialization (risk of OOM).`]}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`The following sections guide you through using the Offline path: loading pre-quantized models or creating your own checkpoints.`}),`\n`,_jsx(_components.h5,{children:`Using Pre-Quantized Checkpoints`}),`\n`,_jsx(_components.p,{children:`If a model is already quantized (e.g., from Hugging Face), you can load it directly.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`FP8 Models:`}),`\nUse `,_jsx(_components.code,{children:`--quantization modelopt_fp8`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python3`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` nvidia/Llama-3.1-8B-Instruct-FP8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` modelopt_fp8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30000`})]}),`\n`]})})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`FP4 Models:`}),`\nUse `,_jsx(_components.code,{children:`--quantization modelopt_fp4`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python3`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` nvidia/Llama-3.3-70B-Instruct-NVFP4`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` modelopt_fp4`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30000`})]}),`\n`]})})}),`\n`]}),`\n`]}),`\n`,_jsx(_components.h5,{children:`Creating Your Own Quantized Checkpoints`}),`\n`,_jsxs(_components.p,{children:[`If a pre-quantized checkpoint is not available for your model, you can create one using NVIDIA Model Optimizer’s `,_jsx(_components.code,{children:`hf_ptq.py`}),` script.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Why quantize?`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Reduce VRAM usage`}),`\n`,_jsx(_components.li,{children:`Higher throughput and lower latency`}),`\n`,_jsx(_components.li,{children:`More flexible deployment (on smaller GPUs)`}),`\n`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`What can be quantized?`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`The entire model`}),`\n`,_jsx(_components.li,{children:`MLP layers only`}),`\n`,_jsx(_components.li,{children:`KV cache`}),`\n`]}),`\n`,_jsx(_components.p,{children:_jsxs(_components.strong,{children:[`Key options in `,_jsx(_components.code,{children:`hf_ptq.py`}),`:`]})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`--qformat`}),`: Quantization formats `,_jsx(_components.code,{children:`fp8`}),`, `,_jsx(_components.code,{children:`nvfp4`}),`, `,_jsx(_components.code,{children:`nvfp4_mlp_only`})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`--kv_cache_qformat`}),`: KV cache quantization format (default: `,_jsx(_components.code,{children:`fp8`}),`)`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Note:`}),` The default `,_jsx(_components.code,{children:`kv_cache_qformat`}),` may not be optimal for all use cases. Consider setting this explicitly.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Hardware requirements:`}),` Hopper and higher are recommended. Insufficient GPU memory may cause weight offloading, resulting in extremely long quantization time.`]}),`\n`,_jsxs(_components.p,{children:[`For detailed usage and supported model architectures, see `,_jsx(_components.a,{href:`https://github.com/NVIDIA/Model-Optimizer/tree/main/examples/llm_ptq`,children:`NVIDIA Model Optimizer LLM PTQ`}),`.`]}),`\n`,_jsx(_components.p,{children:`SGLang includes a streamlined workflow for quantizing models with ModelOpt and automatically exporting them for deployment.`}),`\n`,_jsx(_components.h5,{children:`Installation`}),`\n`,_jsx(_components.p,{children:`First, install ModelOpt:`}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` nvidia-modelopt`})]}),`\n`]})})}),`\n`,_jsx(_components.h5,{children:`Quantization and Export Workflow`}),`\n`,_jsxs(_components.p,{children:[`SGLang provides an example script that demonstrates the complete ModelOpt quantization and export workflow. Run from the SGLang repository root (see `,_jsx(_components.a,{href:`https://github.com/sgl-project/sglang/blob/main/examples/usage/modelopt_quantize_and_export.py`,children:`modelopt_quantize_and_export.py`}),`):`]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`11`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Quantize and export a model using ModelOpt FP8 quantization`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` examples/usage/modelopt_quantize_and_export.py`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quantize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` TinyLlama/TinyLlama-1.1B-Chat-v1.0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --export-dir`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./quantized_tinyllama_fp8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization-method`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` modelopt_fp8`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# For FP4 quantization (requires Blackwell GPU)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` examples/usage/modelopt_quantize_and_export.py`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quantize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` TinyLlama/TinyLlama-1.1B-Chat-v1.0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --export-dir`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./quantized_tinyllama_fp4`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization-method`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` modelopt_fp4`})]}),`\n`]})})}),`\n`,_jsx(_components.h5,{children:`Available Quantization Methods`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`modelopt_fp8`}),`: FP8 quantization with optimal performance on NVIDIA Hopper and Blackwell GPUs`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`modelopt_fp4`}),`: FP4 quantization with optimal performance on Nvidia Blackwell GPUs`]}),`\n`]}),`\n`,_jsx(_components.h5,{children:`Python API Usage`}),`\n`,_jsx(_components.p,{children:`You can also use ModelOpt quantization programmatically:`}),`\n`,_jsx(CodeBlock,{filename:`Example`,numberOfLines:`25`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`25`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sgl`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.configs.device_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DeviceConfig`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.configs.load_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` LoadConfig`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.configs.model_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ModelConfig`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.model_loader.loader `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` get_model_loader`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Configure model with ModelOpt quantization and export`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ModelConfig(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"TinyLlama/TinyLlama-1.1B-Chat-v1.0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` quantization`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"modelopt_fp8\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# or \"modelopt_fp4\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` trust_remote_code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`load_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` LoadConfig(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` modelopt_export_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./exported_model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` modelopt_checkpoint_save_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./checkpoint.pth\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# optional, fake quantized checkpoint`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`device_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DeviceConfig(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`device`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cuda\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Load and quantize the model (export happens automatically)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_loader `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` get_model_loader(load_config, model_config)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`quantized_model `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` model_loader.load_model(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_config,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` device_config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`device_config,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsx(_components.h5,{children:`Deploying Quantized Models`}),`\n`,_jsx(_components.p,{children:`After quantization and export, you can deploy the model with SGLang:`}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`5`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Deploy the exported quantized model`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./quantized_tinyllama_fp8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` modelopt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30000`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.0.0.0`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Or using the Python API (use the same path as `,_jsx(_components.code,{children:`modelopt_export_path`}),` from the quantize step):`]}),`\n`,_jsx(CodeBlock,{filename:`Example`,numberOfLines:`30`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`30`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sgl`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` main`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`():`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Deploy exported ModelOpt quantized model`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Path must match modelopt_export_path from quantize step (e.g., ./exported_model)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` llm `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sgl.Engine(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./exported_model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` quantization`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"modelopt\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Run inference`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` prompts `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Hello, how are you?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"What is the capital of France?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sampling_params `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"temperature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"top_p\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.95`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"max_new_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` outputs `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` llm.generate(prompts, sampling_params)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` i, output `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` enumerate`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(outputs):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Prompt: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`prompts[i]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Output: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`output[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'text'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` __name__`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"__main__\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` main()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsx(_components.h5,{children:`Advanced Features`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Checkpoint Management`}),`: Save and restore fake quantized checkpoints for reuse:`]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`8`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Save the fake quantized checkpoint during quantization`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` examples/usage/modelopt_quantize_and_export.py`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quantize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` meta-llama/Llama-3.2-1B-Instruct`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --export-dir`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./quantized_model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization-method`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` modelopt_fp8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --checkpoint-save-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ./my_checkpoint.pth`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# The checkpoint can be reused for future quantization runs and skip calibration`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Export-only Workflow`}),`: If you have a pre-existing fake quantized ModelOpt checkpoint, you can export it directly. See `,_jsx(_components.a,{href:`https://github.com/sgl-project/sglang/blob/main/python/sglang/srt/configs/load_config.py`,children:`LoadConfig`}),` for the full API:`]}),`\n`,_jsx(CodeBlock,{filename:`Example`,numberOfLines:`19`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`19`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.configs.device_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` DeviceConfig`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.configs.load_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` LoadConfig`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.configs.model_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ModelConfig`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sglang.srt.model_loader.loader `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` get_model_loader`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ModelConfig(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"meta-llama/Llama-3.2-1B-Instruct\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` quantization`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"modelopt_fp8\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` trust_remote_code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`load_config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` LoadConfig(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` modelopt_checkpoint_restore_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./my_checkpoint.pth\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` modelopt_export_path`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./exported_model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Load and export the model (DeviceConfig defaults to device=\"cuda\")`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_loader `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` get_model_loader(load_config, model_config)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_loader.load_model(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`model_config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`model_config, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`device_config`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`DeviceConfig())`})]}),`\n`]})})}),`\n`,_jsx(_components.h5,{children:`Benefits of ModelOpt`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Hardware Optimization`}),`: Specifically optimized for NVIDIA GPU architectures`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Advanced Quantization`}),`: Supports cutting-edge FP8 and FP4 quantization techniques`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Seamless Integration`}),`: Automatic export to HuggingFace format for easy deployment`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Calibration-based`}),`: Uses calibration datasets for optimal quantization quality`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Production Ready`}),`: Enterprise-grade quantization with NVIDIA support`]}),`\n`]}),`\n`,_jsxs(Heading,{level:`4`,id:`using-modelslim`,children:[`Using `,_jsx(_components.a,{href:`https://gitcode.com/Ascend/msmodelslim`,children:`ModelSlim`})]}),`\n`,_jsx(_components.p,{children:`MindStudio-ModelSlim (msModelSlim) is a model offline quantization compression tool launched by MindStudio and optimized for Ascend hardware.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Installation`})}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Clone repo and install msmodelslim:`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`git`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` clone`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://gitcode.com/Ascend/msmodelslim.git`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`cd`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` msmodelslim`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`bash`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install.sh`})]}),`\n`]})})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`LLM quantization`})}),`\n`,_jsxs(_components.p,{children:[`Download the original floating-point weights of the large model. Taking Qwen3-32B as an example, you can go to `,_jsx(_components.a,{href:`https://huggingface.co/Qwen/Qwen3-32B`,children:`Qwen3-32B`}),` to obtain the original model weights. Then install other dependencies (related to the model, refer to the huggingface model card).`]}),`\n`,_jsxs(_components.blockquote,{children:[`\n`,_jsxs(_components.p,{children:[`Note: You can find pre-quantized validated models on `,_jsx(_components.a,{href:`https://modelscope.cn/models/Eco-Tech`,children:`modelscope/Eco-Tech`}),`.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:_jsxs(_components.em,{children:[`Traditional quantification methods require the preparation of calibration data files (`,_jsx(_components.code,{children:`.jsonl`}),` formats) for calibration in the quantification process.`]})}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`12`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`Qwen3-32B/`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # floating-point model downloaded from official HF (or modelscope) repo`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`msmodelslim/`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # msmodelslim repo`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`-----`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` lab_calib`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" # calibration date folder (put your dataset here in ```.jsonl``` format or use pre-prepared ones)\"})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`-----`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` some`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (such `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` laos_calib.jsonl`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`-----`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` lab_practice`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # best practice folder with configs for quantization`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`-----`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` model`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` folder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (such `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` qwen3_5_moe`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` folder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# folder with quantization configs`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`-----`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quant_config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (such `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` qwen3_5_moe_w8a8.yaml`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# quantization config`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`-----`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` another`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` folders`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`output_folder/`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # generated by below command`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`-----`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quant_model_weights-00001-of-0001.safetensors`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # quantized weights`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`-----`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quant_model_description.json`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" # file with description of the quantization methods for each layer (```W4A4_DYNAMIC```, etc.)\"})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`-----`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` another`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` files`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (such `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`as`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` config.json,`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` tokenizer.json,`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` etc.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Run quantization using one-click quantization (recommended):`}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`7`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`msmodelslim`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quant`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"--model_path ${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`MODEL_PATH`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:\"--save_path ${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`SAVE_PATH`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`--device `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`npu:0,1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`--model_type `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Qwen3-32B`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`--quant_type `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`w8a8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`--trust_remote_code `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`True`})]}),`\n`]})})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Usage Example`})}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python3`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`--model-path `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$PWD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/Qwen3-32B-w8a8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`--port `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`30000`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.0.0.0`})]}),`\n`]})})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Available Quantization Methods`}),`:`]}),`\n`,_jsxs(_components.ul,{className:`contains-task-list`,children:[`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,checked:true,disabled:true}),` `,` `,_jsx(_components.code,{children:`W4A4_DYNAMIC`}),` linear with online quantization of activations`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,checked:true,disabled:true}),` `,` `,_jsx(_components.code,{children:`W8A8`}),` linear with offline quantization of activations`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,checked:true,disabled:true}),` `,` `,_jsx(_components.code,{children:`W8A8_DYNAMIC`}),` linear with online quantization of activations`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,checked:true,disabled:true}),` `,` `,_jsx(_components.code,{children:`W4A4_DYNAMIC`}),` MOE with online quantization of activations`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,checked:true,disabled:true}),` `,` `,_jsx(_components.code,{children:`W4A4_MXFP4`}),` MOE with dynamic MXFP4 activation quantization`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,checked:true,disabled:true}),` `,` `,_jsx(_components.code,{children:`W4A8_DYNAMIC`}),` MOE with online quantization of activations`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,checked:true,disabled:true}),` `,` `,_jsx(_components.code,{children:`W4A8_MXFP`}),` MOE with dynamic MXFP8 activation quantization`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,checked:true,disabled:true}),` `,` `,_jsx(_components.code,{children:`W8A8_DYNAMIC`}),` MOE with online quantization of activations`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,` `,_jsx(_components.code,{children:`W4A8`}),` linear TBD`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,` `,_jsx(_components.code,{children:`W4A16`}),` linear TBD`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,` `,_jsx(_components.code,{children:`W48A16`}),` linear TBD`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,` `,_jsx(_components.code,{children:`W4A16`}),` MoE in progress`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,` `,_jsx(_components.code,{children:`W8A16`}),` MoE in progress`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,` `,_jsx(_components.code,{children:`KV Cache`}),` in progress`]}),`\n`,_jsxs(_components.li,{className:`task-list-item`,children:[_jsx(_components.input,{type:`checkbox`,disabled:true}),` `,` `,_jsx(_components.code,{children:`Attention`}),` in progress`]}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`For more detailed examples of quantization of models, as well as information about their support, see the `,_jsx(_components.a,{href:`https://gitcode.com/Ascend/msmodelslim/blob/master/example/README.md`,children:`examples`}),` section in ModelSLim repo.`]}),`\n`,_jsx(Heading,{level:`2`,id:`online-quantization`,children:`Online Quantization`}),`\n`,_jsxs(_components.p,{children:[`To enable online quantization, you can simply specify `,_jsx(_components.code,{children:`--quantization`}),` in the command line. For example, you can launch the server with the following command to enable `,_jsx(_components.code,{children:`FP8`}),` quantization for model `,_jsx(_components.code,{children:`meta-llama/Meta-Llama-3.1-8B-Instruct`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python3`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` meta-llama/Meta-Llama-3.1-8B-Instruct`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` fp8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30000`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.0.0.0`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Our team is working on supporting more online quantization methods. SGLang will soon support methods including but not limited to `,_jsx(_components.code,{children:`[\"awq\", \"gptq\", \"marlin\", \"gptq_marlin\", \"awq_marlin\", \"bitsandbytes\", \"gguf\"]`}),`.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`nvfp4_online-online-quantization-method`,children:[_jsx(_components.code,{children:`nvfp4_online`}),` online quantization method`]}),`\n`,_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`--quantization nvfp4_online`}),` to convert eligible BF16, FP16, or FP8 MoE expert weights to NVFP4 at load time with per-token FP32 activation scales. Use `,_jsx(_components.code,{children:`modelopt_fp4`}),` for serialized NVFP4 checkpoints or the same load-time conversion with per-tensor FP32 activation scales.`]}),`\n`,_jsx(_components.p,{children:`The design separates weight quantization from activation scaling:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Weights:`}),` SGLang quantizes each eligible MoE expert weight tensor as it is loaded, using standard 2D NVFP4 weight quantization. The generated NVFP4 weights use static E4M3 block scales plus static per-tensor FP32 scales derived from the weight amax. For gated MoE experts, the w1/w3 pair shares one per-tensor FP32 scale.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Activations:`}),` FlashInfer computes and propagates one FP32 scale per token at runtime. Backends that accept one per-tensor FP32 activation scale must use `,_jsx(_components.code,{children:`modelopt_fp4`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`FP8 checkpoints:`}),` If an eligible expert weight is stored as FP8, SGLang first dequantizes that tensor with the checkpoint scale and then requantizes it to NVFP4 during loading.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Other layers:`}),` Dense linear layers stay in their source checkpoint precision or checkpoint quantization path.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Only `,_jsx(_components.code,{children:`--moe-runner-backend flashinfer_trtllm`}),` and `,_jsx(_components.code,{children:`--moe-runner-backend flashinfer_trtllm_routed`}),` are supported. If `,_jsx(_components.code,{children:`--moe-runner-backend`}),` is omitted, SGLang selects `,_jsx(_components.code,{children:`flashinfer_trtllm`}),`. Tensor parallelism is supported; activation per-token scales are computed locally on each TP rank, while online weight quantization still uses the loaded expert tensor’s per-tensor amax-derived FP32 scale.`]}),`\n`,_jsxs(_components.p,{children:[`FlashInfer TRTLLM MoE backends disable shared-expert fusion, so online quantization applies to routed MoE experts while shared experts stay in the checkpoint precision. Both online modes honor `,_jsx(_components.code,{children:`SGLANG_FP4_IGNORED_LAYERS`}),`; for FP8 source checkpoints, listed experts remain FP8 instead of being converted to NVFP4.`]}),`\n`,_jsx(CodeBlock,{filename:`Command`,numberOfLines:`6`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`python3`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sglang.launch_server`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Qwen/Qwen3-30B-A3B-Instruct-2507`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tp-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --ep-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` nvfp4_online`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --port`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30000`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --host`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.0.0.0`})]}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`3`,id:`quark_int4fp8_moe-online-quantization-method`,children:[_jsx(_components.code,{children:`quark_int4fp8_moe`}),` online quantization method`]}),`\n`,_jsxs(_components.p,{children:[`SGLang running on AMD GPUs (CDNA3 or CDNA4 architecture) supports the quantization method `,_jsx(_components.code,{children:`--quantization quark_int4fp8_moe`}),`, that will replace `,_jsx(_components.a,{href:`https://github.com/sgl-project/sglang/blob/v0.4.8/python/sglang/srt/layers/moe/fused_moe_triton/layer.py#L271`,children:`MoE layers`}),` originally in high precision (bfloat16, float16 or float32) to use weights dynamically quantized to int4, that are upcasted to float8 during inference to run compute in float8 precision with activations dynamically quantized on the fly to float8.`]}),`\n`,_jsx(_components.p,{children:`Other layers (e.g. projections in the attention layers) have their weights quantized online to float8 directly.`}),`\n`,_jsxs(Heading,{level:`3`,id:`quark_mxfp4-online-quantization-method`,children:[_jsx(_components.code,{children:`quark_mxfp4`}),` online quantization method`]}),`\n`,_jsxs(_components.p,{children:[`SGLang running on AMD GPUs with hardware FP4 support (CDNA4 architecture, e.g. MI355x) supports the quantization method `,_jsx(_components.code,{children:`--quantization quark_mxfp4`}),`, that will quantize BF16 or NVFP4 model weights to MXFP4 at load time, use dynamic MXFP4 quantization for activations and MXFP4 GEMMs instead of BF16 GEMMs.`]}),`\n`,_jsx(_components.p,{children:`Example (BF16 to MXFP4 requantization):`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`sglang`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` serve`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Qwen/Qwen3-30B-A3B`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tensor-parallel-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quark_mxfp4`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`online-nvfp4-to-mxfp4-requantization`,children:`Online NVFP4 to MXFP4 Requantization`}),`\n`,_jsxs(_components.p,{children:[`The option `,_jsx(_components.code,{children:`--quantization quark_mxfp4`}),` supports converting NVFP4 checkpoints (e.g. `,_jsx(_components.code,{children:`nvidia/Kimi-K2.6-NVFP4`}),`) to MXFP4 at load time to allow efficient inference using supported AMD hardware (gfx95x+):`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`The quantization metadata of the source NVFP4 checkpoint is read from either `,_jsx(_components.code,{children:`config.json`}),` (`,_jsx(_components.code,{children:`quantization_config`}),`) or a standalone `,_jsx(_components.code,{children:`hf_quant_config.json`}),`;`]}),`\n`,_jsx(_components.li,{children:`Producer-declared excluded modules will remain in higher precision;`}),`\n`,_jsxs(_components.li,{children:[`NVFP4 checkpoints with mixed precision (`,_jsx(_components.code,{children:`\"quant_algo\": \"MIXED_PRECISION\"`}),`, e.g. `,_jsx(_components.code,{children:`nvidia/Qwen3.5-397B-A17B-NVFP4-V2`}),`) are also supported.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Example (NVFP4 to MXFP4 requantization):`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`sglang`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` serve`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` nvidia/Kimi-K2.6-NVFP4`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tensor-parallel-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quark_mxfp4`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`online-fp8-to-mxfp4-requantization`,children:`Online FP8 to MXFP4 Requantization`}),`\n`,_jsxs(_components.p,{children:[`The option `,_jsx(_components.code,{children:`--quantization quark_mxfp4`}),` supports converting FP8 dense and MOE models to MXFP4, following this logic:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Load an FP8 weight tensor,`}),`\n`,_jsx(_components.li,{children:`Dequantize it to BF16,`}),`\n`,_jsx(_components.li,{children:`Requantize it to MXFP4`}),`\n`]}),`\n`,_jsx(_components.p,{children:`progressively during weight loading.`}),`\n`,_jsx(_components.p,{children:`Example (FP8 to MXFP4 requantization):`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`sglang`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` serve`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Qwen/Qwen3-30B-A3B-Instruct-2507-FP8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --tensor-parallel-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` quark_mxfp4`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`intel-neural-compressor-online-quantization-method`,children:`Intel® Neural Compressor online quantization method`}),`\n`,_jsxs(_components.p,{children:[`SGLang supports quantization methods based on the advanced algorithm `,_jsx(_components.a,{href:`https://github.com/intel/auto-round`,children:`auto-round`}),` in `,_jsx(_components.a,{href:`https://github.com/intel/neural-compressor`,children:`Intel® Neural Compressor`}),`. You can simply specify `,_jsx(_components.code,{children:`--quantization auto-round-int8`}),` to use this feature. It will quantize the model on the fly to target format. More online quantization methods are on the way.`]}),`\n`,_jsx(_components.h5,{children:`Available Quantization Methods`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{style:{textAlign:`left`},children:`Quantization Method`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Schemes`}),_jsx(_components.th,{style:{textAlign:`left`},children:`Validated Hardware Environment`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{style:{textAlign:`left`},children:`auto-round-int8`}),_jsxs(_components.td,{style:{textAlign:`left`},children:[`INT8 per-channel quantized weight `,_jsx(`br`,{}),` INT8 per-token dynamic quantized activation`]}),_jsxs(_components.td,{style:{textAlign:`left`},children:[`Intel Xeon Scalable processor `,_jsx(`br`,{}),` Nvidia A100 GPU`]})]})})]}),`\n`,_jsx(Heading,{level:`2`,id:`diffusion-model-quantization-on-ascend-npu`,children:`Diffusion Model Quantization on Ascend NPU`}),`\n`,_jsxs(_components.p,{children:[`SGLang-Diffusion supports MXFP8 quantization for diffusion models (such as Wan2.2) on Ascend 950PR/DT Series NPUs, in both online and offline (ModelSlim) modes. This is separate from the LLM serving path and uses the `,_jsx(_components.code,{children:`sglang serve`}),` / `,_jsx(_components.code,{children:`sglang generate`}),` CLI.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Requirements:`}),` Ascend 950PR/DT Series, CANN ≥ 8.0.RC3`]}),`\n`,_jsx(Heading,{level:`3`,id:`online-mxfp8`,children:`Online MXFP8`}),`\n`,_jsxs(_components.p,{children:[`Pass `,_jsx(_components.code,{children:`--quantization mxfp8`}),` to dynamically quantize FP16/BF16 transformer weights to MXFP8 at load time:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`sglang`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` serve`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Wan-AI/Wan2.2-T2V-A14B-Diffusers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quantization`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mxfp8`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --num-gpus`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`offline-mxfp8-modelslim`,children:`Offline MXFP8 (ModelSlim)`}),`\n`,_jsxs(_components.p,{children:[`Pre-quantize with `,_jsx(_components.a,{href:`https://gitcode.com/Ascend/msmodelslim`,children:`msModelSlim`}),` and load the checkpoint directly — the quantization scheme is auto-detected from `,_jsx(_components.code,{children:`quant_model_description.json`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`sglang`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` generate`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model-path`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` /path/to/wan2_2_mxfp8_diffusers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --prompt`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"a beautiful sunset\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --save-output`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`For the full quantization + format conversion workflow and a complete list of supported schemes, see `,_jsx(_components.a,{href:`/docs/hardware-platforms/ascend-npus/optimization/quantization#diffusion-model-quantization-on-ascend-npu`,children:`Diffusion Quantization on Ascend NPU`}),` and `,_jsx(_components.a,{href:`/docs/sglang-diffusion/quantization#modelslim`,children:`SGLang-Diffusion Quantization`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`reference`,children:`Reference`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://github.com/ModelCloud/GPTQModel`,children:`GPTQModel`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://github.com/vllm-project/llm-compressor/`,children:`LLM Compressor`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://github.com/NVIDIA/Model-Optimizer`,children:`NVIDIA Model Optimizer (ModelOpt)`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://github.com/NVIDIA/Model-Optimizer/tree/main/examples/llm_ptq`,children:`NVIDIA Model Optimizer LLM PTQ`})}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`https://github.com/causalflow-ai/petit-kernel`,children:`Petit: NVFP4 on ROCm`}),` — `,_jsx(_components.a,{href:`https://lmsys.org/blog/2025-09-21-petit-amdgpu/`,children:`LMSYS blog`}),`, `,_jsx(_components.a,{href:`https://rocm.blogs.amd.com/artificial-intelligence/fp4-mixed-precision/README.html`,children:`AMD ROCm blog`})]}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://docs.vllm.ai/en/latest/quantization/`,children:`vLLM Quantization`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://github.com/intel/auto-round`,children:`auto-round`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://gitcode.com/Ascend/msmodelslim`,children:`ModelSlim`})}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Quantization","metatags":{"description":"SGLang quantization: FP8, FP4, AWQ, GPTQ, ModelOpt. Offline and online quantization methods for efficient LLM inference."},"description":null,"href":"/docs/advanced_features/quantization"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Platform Compatibility","slug":"platform-compatibility","depth":2,"children":[]},{"title":"GEMM Backends for FP4/FP8 Quantization","slug":"gemm-backends-for-fp4/fp8-quantization","depth":2,"children":[{"title":"--fp8-gemm-backend (Blockwise FP8 GEMM)","slug":"fp8-gemm-backend-blockwise-fp8-gemm","depth":3,"children":[]},{"title":"--fp4-gemm-backend (NVFP4 GEMM)","slug":"fp4-gemm-backend-nvfp4-gemm","depth":3,"children":[]}]},{"title":"Offline Quantization","slug":"offline-quantization","depth":2,"children":[{"title":"Examples of Offline Model Quantization","slug":"examples-of-offline-model-quantization","depth":3,"children":[]},{"title":"Using Unsloth","slug":"using-unsloth","depth":4,"children":[]},{"title":"Using auto-round","slug":"using-auto-round","depth":4,"children":[]},{"title":"Using GPTQModel","slug":"using-gptqmodel","depth":4,"children":[]},{"title":"Using LLM Compressor","slug":"using-llm-compressor","depth":4,"children":[]},{"title":"Using NVIDIA ModelOpt","slug":"using-nvidia-modelopt","depth":4,"children":[]},{"title":"Using ModelSlim","slug":"using-modelslim","depth":4,"children":[]}]},{"title":"Online Quantization","slug":"online-quantization","depth":2,"children":[{"title":"nvfp4_online online quantization method","slug":"nvfp4_online-online-quantization-method","depth":3,"children":[]},{"title":"quark_int4fp8_moe online quantization method","slug":"quark_int4fp8_moe-online-quantization-method","depth":3,"children":[]},{"title":"quark_mxfp4 online quantization method","slug":"quark_mxfp4-online-quantization-method","depth":3,"children":[]},{"title":"Online NVFP4 to MXFP4 Requantization","slug":"online-nvfp4-to-mxfp4-requantization","depth":4,"children":[]},{"title":"Online FP8 to MXFP4 Requantization","slug":"online-fp8-to-mxfp4-requantization","depth":4,"children":[]},{"title":"Intel® Neural Compressor online quantization method","slug":"intel-neural-compressor-online-quantization-method","depth":3,"children":[]}]},{"title":"Diffusion Model Quantization on Ascend NPU","slug":"diffusion-model-quantization-on-ascend-npu","depth":2,"children":[{"title":"Online MXFP8","slug":"online-mxfp8","depth":3,"children":[]},{"title":"Offline MXFP8 (ModelSlim)","slug":"offline-mxfp8-modelslim","depth":3,"children":[]}]},{"title":"Reference","slug":"reference","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"lmsysorg","siteName":"SGLang Documentation","title":"Quantization - SGLang Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-28T18:03:31.833Z","originalFileLocation":"docs/advanced_features/quantization.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"SGLang Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Quantization - SGLang Documentation\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"SGLang Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.sglang.io/docs/advanced_features/quantization\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://lmsysorg.mintlify.app/_mintlify/api/og/v2?division=Advanced+Features\u0026amp;title=Quantization\u0026amp;theme=d4ae179b26802a19fb8b2ad1\u0026amp;signature=d378fcadc4f434f62d5574498a3de05df5d0e14e1a39e960ceac424e13bbf7a1\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Quantization - SGLang Documentation\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://lmsysorg.mintlify.app/_mintlify/api/og/v2?division=Advanced+Features\u0026amp;title=Quantization\u0026amp;theme=d4ae179b26802a19fb8b2ad1\u0026amp;signature=d378fcadc4f434f62d5574498a3de05df5d0e14e1a39e960ceac424e13bbf7a1\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/lmsysorg/HxNR9zohmNorO5Pc/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"SGLang Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#d55816\">\u003cmeta data-mint-head name=\"google-site-verification\" content=\"bX3ofyYQhraIpAYf4DpyZQXZO_G4xLR_RqeBAKnJA7g\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.sglang.io/docs/advanced_features/quantization\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/advanced_features/quantization.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.sglang.io/#organization\",\"name\":\"SGLang Documentation\",\"url\":\"https://docs.sglang.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/lmsysorg/iZdDMbLWP1BLEIzC/logo/logo.png?fit=max\u0026auto=format\u0026n=iZdDMbLWP1BLEIzC\u0026q=85\u0026s=b27d467947ee2167744cb07b69badf00\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.sglang.io#website\",\"name\":\"SGLang Documentation\",\"url\":\"https://docs.sglang.io\",\"publisher\":{\"@id\":\"https://docs.sglang.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.sglang.io/docs/advanced_features/quantization#webpage\",\"url\":\"https://docs.sglang.io/docs/advanced_features/quantization\",\"name\":\"Quantization\",\"dateModified\":\"2026-10-28T18:03:31.833Z\",\"isPartOf\":{\"@id\":\"https://docs.sglang.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.sglang.io/docs/advanced_features/quantization#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.sglang.io/docs/advanced_features/quantization#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Advanced Features\",\"item\":\"https://docs.sglang.io/docs/advanced_features/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Quantization\",\"item\":\"https://docs.sglang.io/docs/advanced_features/quantization\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.sglang.io/docs/advanced_features/quantization#article\",\"headline\":\"Quantization\",\"name\":\"Quantization\",\"url\":\"https://docs.sglang.io/docs/advanced_features/quantization\",\"mainEntityOfPage\":{\"@id\":\"https://docs.sglang.io/docs/advanced_features/quantization#webpage\"},\"dateModified\":\"2026-10-28T18:03:31.833Z\",\"publisher\":{\"@id\":\"https://docs.sglang.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.sglang.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"SGLang Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"SGLang Documentation","nav":{"global":{"anchors":[]},"tabs":[{"tab":"Get Started","pages":[{"title":"Get Started","href":""}]},{"tab":"User Guide","groups":[{"group":"Basic Usage","icon":"book-open","pages":[{"title":"Basic Usage","href":"/docs/basic_usage/overview"},{"title":"Tutorial: Sending a request","href":"/docs/basic_usage/send_request"},{"group":"OpenAI-Compatible APIs","pages":[{"title":"OpenAI-Compatible APIs","href":"/docs/basic_usage/openai_api"},{"title":"OpenAI APIs - Completions","href":"/docs/basic_usage/openai_api_completions"},{"title":"OpenAI APIs - Vision","href":"/docs/basic_usage/openai_api_vision"},{"title":"OpenAI APIs - Embedding","href":"/docs/basic_usage/openai_api_embeddings"}]},{"title":"Anthropic-Compatible API","href":"/docs/basic_usage/anthropic_api"},{"title":"Ollama-Compatible API","href":"/docs/basic_usage/ollama_api"},{"title":"Offline Engine API","href":"/docs/basic_usage/offline_engine_api"},{"title":"SGLang Native APIs","href":"/docs/basic_usage/native_api"},{"title":"Sampling Parameters","href":"/docs/basic_usage/sampling_params"}]},{"group":"Advanced Features","icon":"gears","pages":[{"title":"Advanced Features","href":"/docs/advanced_features/overview"},{"title":"Server Arguments","href":"/docs/advanced_features/server_arguments"},{"title":"Session-Aware Radix Cache","href":"/docs/advanced_features/session_radix_cache"},{"title":"Radix Cache Eviction Policies","href":"/docs/advanced_features/radix_eviction_policy"},{"title":"Hyperparameter Tuning","href":"/docs/advanced_features/hyperparameter_tuning"},{"title":"Text Watermarking","href":"/docs/advanced_features/text_watermarking"},{"title":"Attention Backend","href":"/docs/advanced_features/attention_backend"},{"title":"HiSparse: Hierarchical Sparse Attention","href":"/docs/advanced_features/hisparse_guide"},{"title":"Speculative Decoding","href":"/docs/advanced_features/speculative_decoding"},{"title":"Adaptive Speculative Decoding","href":"/docs/advanced_features/adaptive_speculative_decoding"},{"title":"Structured Outputs","href":"/docs/advanced_features/structured_outputs"},{"title":"Structured Outputs For Reasoning Models","href":"/docs/advanced_features/structured_outputs_for_reasoning_models"},{"title":"Tool Parser","href":"/docs/advanced_features/tool_parser"},{"title":"Reasoning Parser","href":"/docs/advanced_features/separate_reasoning"},{"title":"Thinking Budget","description":null,"href":"/docs/advanced_features/thinking_budget"},{"title":"Quantization","href":"/docs/advanced_features/quantization"},{"title":"Quantized KV Cache","description":null,"href":"/docs/advanced_features/quantized_kv_cache"},{"title":"Reasoning-Aware Compression","href":"/docs/advanced_features/reasoning_aware_compression"},{"title":"DP, DPA and SGLang DP Router","href":"/docs/advanced_features/dp_dpa_smg_guide"},{"title":"Prefill Context Parallelism","href":"/docs/advanced_features/prefill_cp"},{"title":"KV Cache Sharing","href":"/docs/advanced_features/kv_cache_sharing"},{"title":"Decode Context Parallelism","href":"/docs/advanced_features/dcp"},{"title":"Expert Parallelism","href":"/docs/advanced_features/expert_parallelism"},{"title":"Paged Experts","href":"/docs/advanced_features/paged_experts"},{"title":"Engram Tables","href":"/docs/advanced_features/engram"},{"title":"LoRA Serving","href":"/docs/advanced_features/lora"},{"title":"PD Disaggregation","href":"/docs/advanced_features/pd_disaggregation"},{"title":"EPD Disaggregation","href":"/docs/advanced_features/epd_disaggregation"},{"title":"Pipeline Parallelism for Long Context","href":"/docs/advanced_features/pipeline_parallelism"},{"group":"Hierarchical KV Caching (HiCache)","pages":[{"title":"Hierarchical KV Caching (HiCache)","href":"/docs/advanced_features/hicache"},{"title":"SGLang HiCache Best Practices","href":"/docs/advanced_features/hicache_best_practices"},{"title":"HiCache System Design and Optimization","href":"/docs/advanced_features/hicache_design"},{"title":"Runtime Attach/Detach HiCache Storage Backend (No Restart)","href":"/docs/advanced_features/hicache_storage_runtime_attach_detach"}]},{"title":"SGLang Simulator","href":"/docs/advanced_features/sglang_simulator"},{"title":"Query VLM with Offline Engine","href":"/docs/advanced_features/vlm_query"},{"title":"DP for Multi-Modal Encoder in SGLang","href":"/docs/advanced_features/dp_for_multi_modal_encoder"},{"title":"Cuda Graph for Multi-Modal Encoder in SGLang","href":"/docs/advanced_features/cuda_graph_for_multi_modal_encoder"},{"title":"Breakable CUDA Graph","href":"/docs/advanced_features/breakable_cuda_graph"},{"title":"SGLang Model Gateway","href":"/docs/advanced_features/sgl_model_gateway"},{"title":"llm-d","href":"/docs/advanced_features/llm-d"},{"title":"Deterministic Inference","href":"/docs/advanced_features/deterministic_inference"},{"title":"Observability","href":"/docs/advanced_features/observability"},{"title":"Model Loading","href":"/docs/advanced_features/model_loading"},{"title":"Loading Models from Object Storage","href":"/docs/advanced_features/object_storage"},{"title":"Checkpoint Engine Integration","href":"/docs/advanced_features/checkpoint_engine"},{"title":"SGLang for RL Systems","href":"/docs/advanced_features/sglang_for_rl"}]},{"group":"Supported Models","icon":"cubes","pages":[{"title":"Supported models","mode":"wide","href":"/docs/supported-models"},{"group":"Text Generation","pages":[{"title":"Large Language Models","href":"/docs/supported-models/generative_models"},{"title":"Multimodal Language Models","href":"/docs/supported-models/multimodal_language_models"},{"title":"Diffusion language models","href":"/docs/supported-models/diffusion_language_models"}]},{"group":"Retrieval and Ranking","pages":[{"title":"Embedding models","href":"/docs/supported-models/embedding_models"},{"title":"Rerank models","href":"/docs/supported-models/rerank_models"},{"title":"Classification Models","href":"/docs/supported-models/classify_models"}]},{"group":"Specialized Models","pages":[{"title":"Reward models","href":"/docs/supported-models/reward_models"},{"title":"Decision models","href":"/docs/supported-models/decision_models"}]},{"group":"Extending SGLang","pages":[{"title":"How to Support New Models","href":"/docs/supported-models/support_new_models"},{"title":"Transformers Fallback in SGLang","href":"/docs/supported-models/transformers_fallback"},{"title":"Use Models From ModelScope","href":"/docs/supported-models/modelscope"},{"title":"MindSpore Models","href":"/docs/supported-models/mindspore_models"}]}]},{"group":"Developer Guide","icon":"code","pages":[{"title":"Developer Guide","href":"/docs/developer_guide/overview"},{"title":"Contribution Guide","mode":"wide","href":"/docs/developer_guide/contribution_guide"},{"title":"Add an out-of-tree serve backend","href":"/docs/developer_guide/serve_backend_plugins"},{"group":"Development","pages":[{"title":"Development Guide Using Docker","sidebarTitle":"Using Docker","href":"/docs/developer_guide/development_guide_using_docker"},{"title":"Development Guide for JIT Kernels","sidebarTitle":"JIT Kernels","href":"/docs/developer_guide/development_jit_kernel_guide"},{"title":"Quantization Contribution Guide","href":"/docs/developer_guide/quantization_contribution_guide"},{"title":"Layer boundaries","href":"/docs/developer_guide/layer_boundary"}]},{"group":"Benchmarking","pages":[{"title":"Benchmark and Profiling","href":"/docs/developer_guide/benchmark_and_profiling"},{"title":"Bench Serving Guide","href":"/docs/developer_guide/bench_serving"}]},{"title":"Evaluating New Models with SGLang","href":"/docs/developer_guide/evaluating_new_models"},{"title":"MSProbe Debugging Guide","href":"/docs/developer_guide/msprobe_debugging_guide"}]},{"group":"References","icon":"bookmark","pages":[{"title":"References","href":"/docs/references/overview"},{"title":"Troubleshooting and Frequently Asked Questions","href":"/docs/references/faq"},{"title":"Environment Variables","href":"/docs/references/environment_variables"},{"title":"Production Metrics","href":"/docs/references/production_metrics"},{"title":"Production Request Tracing","href":"/docs/references/production_request_trace"},{"group":"Deployment","pages":[{"title":"Multi-Node Deployment","href":"/docs/references/multi_node_deployment/multi_node_index"},{"title":"Multi-Node Deployment","href":"/docs/references/multi_node_deployment/multi_node"},{"title":"Deploy On Kubernetes","href":"/docs/references/multi_node_deployment/deploy_on_k8s"},{"title":"LWS Based PD Deploy","href":"/docs/references/multi_node_deployment/lws_pd/lws_pd_deploy"},{"title":"DeepSeekV32-Exp RBG Based PD Deploy","href":"/docs/references/multi_node_deployment/rbg_pd/deepseekv32_pd"},{"title":"Amazon SageMaker AI","href":"/docs/basic_usage/aws_sagemaker"}]},{"title":"Custom Chat Template","href":"/docs/references/custom_chat_template"},{"group":"Frontend Language","pages":[{"title":"Frontend Language","href":"/docs/references/frontend/frontend_index"},{"title":"SGLang Frontend Language","href":"/docs/references/frontend/frontend_tutorial"},{"title":"Choices Methods in SGLang","href":"/docs/references/frontend/choices_methods"}]},{"group":"Cookbook","pages":[{"title":"Server Arguments","href":"/cookbook/base/reference/server_arguments"}]},{"title":"Post-Training Integration","href":"/docs/references/post_training_integration"},{"title":null,"href":"/docs/references/nightly_precision_regression"}]}]},{"tab":"Hardware","pages":[{"title":"Hardware","href":"/docs/hardware-platforms/overview"}]},{"tab":"Cookbook","pages":[{"title":"Cookbook","href":"/cookbook/intro"}]},{"tab":"SGLang Diffusion","pages":[{"title":"SGLang Diffusion","href":"/docs/sglang-diffusion"}]}]},"title":"Quantization - SGLang Documentation","buildId":"dpl_2xiSHD9XEvLsPGPcfoMtkLTB3dy9","deploymentId":"dpl_2xiSHD9XEvLsPGPcfoMtkLTB3dy9","dynamics":[],"chunks":[]}