Skip to content

vllm.model_executor.layers.quantization.quark.schemes

Modules:

Classes:

QuarkNVFP4

Bases: QuarkScheme

Quark NVFP4 quantization scheme.

Supports loading NVFP4 checkpoints with the following structure: - weight: uint8, shape [out_features, in_features // 2] (packed FP4) - weight_scale: float8_e4m3fn, shape [out_features, in_features // group_size] - weight_scale_2: bfloat16/float32, scalar (global weight scale) - input_scale_2: bfloat16/float32, scalar (global input scale)

QuarkOCP_MX

Bases: QuarkScheme, InputHadamardFusable

_expanding_scale_loader(weight_loader)

Expand a 2-D block scale to one row per weight row.

A block_size=[R, 32] export carries one e8m0 value per R weight rows; the kernels want one per row. At R == 1 the layouts already coincide, so the loader is passed through untouched.

QuarkScheme

Bases: ABC

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

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.

QuarkW4A16Int4

Bases: QuarkScheme

Quark packed INT4 weight-only linear scheme via MPLinearKernel.

QuarkW4A8_MXFP4_FP8

Bases: QuarkScheme

  • Weights: MXFP4 with E8M0 scales per block of 32
  • Activations: FP8 E4M3 (static per-tensor quantization)

Uses the AITER Triton kernel and falls back to emulation if AITER not available.