Skip to content

vllm.model_executor.layers.quantization.compressed_tensors.schemes

Modules:

Classes:

CompressedTensorsScheme

Bases: ABC

Abstract class used to describe the weight creation and forward pass of different quantization schemes supported by CompressedTensors.

Methods:

apply_weights(layer, x, bias) abstractmethod

Run the forward pass for the particular scheme. This is where scheme-specific dequant/quant steps/kernels should be applied.

Parameters:

  • layer

    (Module) –

    torch.nn.Module with the registered weights and other parameters relevant to the particular scheme.

  • x

    (Tensor) –

    input to the layer

  • bias

    (Tensor | None) –

    bias parameter

create_weights(*args, **kwargs) abstractmethod

Weight creation for the particular scheme. Inputs to this function.

get_min_capability() abstractmethod classmethod

Get minimum device capability.

process_weights_after_loading(layer) abstractmethod

Called after weight loading is complete for any cleanup that needs to occur.

CompressedTensorsW4A4Mxfp4

Bases: CompressedTensorsScheme

Compressed tensors scheme for MXFP4.

Supports models quantized with the compressed-tensors mxfp4-pack-quantized format.

MXFP4 format: - 4-bit float weights (E2M1) packed into uint8 - Per-group E8M0 scales with group_size=32 - No global scale (unlike NVFP4)

On SM100+ with FlashInfer: true W4A4 (activations dynamically quantized). Otherwise: W4A16 weight-only via Marlin.

CompressedTensorsW4A8Mxfp4

Bases: CompressedTensorsW4A4Mxfp4

MXFP4 weights with dynamic FP8 activations in compressed-tensors format.

The weight layout matches W4A4; only the activation quantization differs. The checkpoint's FP8 activations are used when a kernel supports them, otherwise this falls back to the W4A4 activation format.

CompressedTensorsW6A8Mxfp6

Bases: CompressedTensorsScheme

Compressed tensors scheme for the mxfp6-pack-quantized format.

MXFP6 (E2M3) weights pack four values into three bytes, with per-group E8M0 scales (group_size=32). Activations are dynamically quantized to MXFP8, or kept in 16-bit for weight-only checkpoints.

CompressedTensorsW8A8Mxfp8

Bases: CompressedTensorsScheme

Compressed tensors scheme for MXFP8 quantization (W8A8).

Loads pre-quantized MXFP8 weights from compressed-tensors checkpoints. Activations are dynamically quantized to MXFP8 at runtime.

MXFP8 format: - 8-bit float weights (E4M3) stored as float8_e4m3fn - Per-group E8M0 scales (uint8) with group_size=32 - Activations dynamically quantized to MXFP8 during inference

CompressedTensorsWNA4Int

Bases: CompressedTensorsScheme

_build_input_quant_config()

Build the config dict that BaseInputSchema.from_config expects.

CompressedTensorsWNA8Int

Bases: CompressedTensorsScheme

_build_input_quant_config()

Build the config dict that BaseInputSchema.from_config expects.

CompressedTensorsWNA8O8Int

Bases: CompressedTensorsScheme

_pack_int_quantized_weight(layer)

Normalize an int-quantized (plain int8) weight to the canonical weight_packed int32 + weight_shape layout the MP kernels expect.