Skip to content

vllm.model_executor.layers.quantization.utils.humming

Humming quantization integration.

Modules:

  • activation –

    MoE activation expressions for Humming input processing.

  • linear –

    Prepare and execute Humming linear layers.

  • moe –

    Configure, prepare weights for, and assemble Humming MoE kernels.

  • priority –

    Humming kernel selection priority.

  • schema –

    Map Humming schemas and handle shared checkpoint quantization settings.

Functions:

check_and_fallback_input_schema(weight_schema, input_schema, param_dtype=None, allow_fallback=True, allow_fp8_sm100=True, warn=True)

Resolve input_schema against weight_schema, falling back if needed.

Parameters:

  • weight_schema

    (BaseWeightSchema) –

    the weight schema the input must be compatible with.

  • input_schema

    (BaseInputSchema) –

    the requested input schema.

  • param_dtype

    (dtype | None, default: None ) –

    model compute dtype, used as the 16-bit fallback.

  • allow_fallback

    (bool, default: True ) –

    if False, return the requested schema as-is.

  • allow_fp8_sm100

    (bool, default: True ) –

    whether FP8 activations may be honored on SM100-SM119. Humming's dense FP8 UMMA path is fast there, but the MoE grouped-GEMM path is not (the tuner can emit invalid two-CTA configs), so the MoE call sites pass False.

  • warn

    (bool, default: True ) –

    whether to log fallbacks; False when only probing the result.

convert_linear_layer_to_humming_standard(layer, name_map)

Rename/reshape a linear layer's quantized params (the canonical MPLinear layout: weight_packed int32 + weight_scale) into the parameter names and layout humming's weight schema expects (weight / weight_scale).

convert_to_humming_moe_kernel_format(layer, quant_config=None, sublayer_configs=None, weight_schema=None, input_schema=None, force_weight_schema=None, allow_input_schema_fallback=True)

Convert MoE weights from checkpoint format to Humming kernel format.

This function processes weights for each sublayer (w13, w2) by: 1. Converting from checkpoint format to humming format if needed 2. Force requanting if a different quantization schema is specified 3. Preparing layer metadata for the Humming kernel 4. Transforming weights for inference

Parameters:

  • layer

    (RoutedExperts) –

    The RoutedExperts layer containing weights to process

  • quant_config

    (dict | None, default: None ) –

    Optional quantization config dict. Required if weight_schema or input_schema are None. Used to build schemas via BaseWeightSchema.from_config().

  • sublayer_configs

    (dict[str, Any] | None, default: None ) –

    Optional configuration dict for each sublayer (w13, w2). Each config must have "shape_n" and "shape_k" keys. If None, configs are built from layer.moe_config properties.

  • weight_schema

    (Any | None, default: None ) –

    Optional initial weight quantization schema. If None, built from quant_config.

  • input_schema

    (Any | None, default: None ) –

    Optional initial input quantization schema. If None, built from quant_config or env vars.

  • force_weight_schema

    (Any | None, default: None ) –

    Optional schema to force requantization to

  • allow_input_schema_fallback

    (bool, default: True ) –

    Whether incompatible input schemas may be replaced.

Side effects
  • Modifies layer parameters in place
  • Sets layer.weight_schemas and layer.input_schemas
  • Sets layer.humming_configs for quant config construction

humming_executed_input_quant_key(weight_quant_config, activation_key, allow_fallback=True)

The activation quantization Humming runs on this device for weights described by weight_quant_config when activation_key is requested. None if it runs unquantized activations or rejects the request.

prefers_humming(compute_capability=None)

Whether Humming outranks Marlin. A missing compute capability uses the current device.

prioritize_humming(kernels, compute_capability=None)

Move Humming directly ahead of Marlin where Humming is preferred.

Every other entry keeps its relative order and the input list is not modified. Match kernel class names or MoE backend enum names.

select_humming_moe_experts(config, weight_key, activation_key)

Select the primary Humming MoE Experts class Note: Shape-specific fallbacks may still occur at runtime.

stage_moe_weights_for_humming(layer, w13, w2, w13_scale, w2_scale, w13_input_scale=None, w2_input_scale=None)

Install canonical weights and scales for Humming's layer-based converter.

Returns the scale parameter name used, weight_scale or weight_scale_inv.