Skip to content

vllm.lora.layers.custom_layer

LoRA implementations for specialized, model-specific layers.

Add LoRA support for custom layers that require specialized handling here.

Classes:

DeepseekV4CompressorKVScoreWithLoRA

Bases: MergedColumnParallelLinearWithLoRA

Adds the adapter delta to the compressor's FP32 wkv/wgate output.

DeepseekV4GroupedWoAWithLoRA

Bases: ColumnParallelLinearWithLoRA

Adds each head group's adapter delta to the grouped wo_a projection.

All groups share LoRA-A; group g uses LoRA-B rows g * o_lora_rank : (g + 1) * o_lora_rank, stored as its own buffer so the kernels get a contiguous LoRA-B at a fixed address.

Glm5NextIndexerWkWeightsWithLoRA

Bases: MergedColumnParallelLinearWithLoRA

Adds the adapter delta to the GLM-5.3-Flash indexer's k and FP32 head gate.

MLAKVBProjWithLoRA

Bases: ColumnParallelLinearWithLoRA

kv_b_proj of an MLAAttention layer, which marks it.

Absorbed MLA folds kv_b_proj into the cached W_UK/W_UV, so the attention layer adds the adapter after its BMMs instead of calling forward.

Methods:

apply_mla_absorbed_kv_b_lora(x, out, *, qk_nope_head_dim, is_query, gather_dcp=False)

Add the adapter to MLA's absorbed, head-major projection.

Parameters:

  • x

    (Tensor) –

    [num_heads, num_tokens, dim] input of the absorbed W_UK (query) or W_UV (value) BMM.

  • out

    (Tensor) –

    The token-major BMM output, updated in place.

  • qk_nope_head_dim

    (int) –

    Per-head rows of LoRA-B before the value rows.

  • is_query

    (bool) –

    Whether x is the query side.

  • gather_dcp

    (bool, default: False ) –

    Gather LoRA-B heads across decode context parallel ranks.

MLAKVBProjWithShardedLoRA

Bases: MLAKVBProjWithLoRA, ColumnParallelLinearWithShardedLoRA

Fully sharded variant: LoRA-A is sharded across TP ranks.