Skip to content

vllm.model_executor.models.bailing_moe_v3

vLLM implementation for BailingMoeV3ForCausalLM.

The HuggingFace reference model mixes MLA full-attention layers with Kimi Delta Attention linear layers and Bailing MoE blocks. This file keeps the V3 module/weight names aligned with the reference implementation while reusing vLLM's parallel linear layers, MLA kernel, KDA kernel and fused MoE loader.

Functions:

bailing_v3_kda_attention(q_proj_states, k_proj_states, v_proj_states, g1, beta, core_attn_out, layer_name)

Run Bailing V3's KDA state update outside the compiled graph.

Source code in vllm/model_executor/models/bailing_moe_v3.py
def bailing_v3_kda_attention(
    q_proj_states: torch.Tensor,
    k_proj_states: torch.Tensor,
    v_proj_states: torch.Tensor,
    g1: torch.Tensor,
    beta: torch.Tensor,
    core_attn_out: torch.Tensor,
    layer_name: str,
) -> None:
    """Run Bailing V3's KDA state update outside the compiled graph."""
    forward_context: ForwardContext = get_forward_context()
    layer = forward_context.no_compile_layers[layer_name]
    layer._forward(
        q_proj_states=q_proj_states,
        k_proj_states=k_proj_states,
        v_proj_states=v_proj_states,
        g1=g1,
        beta=beta,
        core_attn_out=core_attn_out,
    )