[lora][moe] Virtual experts for LoRA MoE (#22122)

Co-authored-by: Yusheng Su <yushengsu.thu@gmail.com>
This commit is contained in:
Kurt Shuster
2026-04-13 21:19:30 +00:00
committed by GitHub
co-authored by Yusheng Su
parent 6b2bf66cd9
commit ff13dfee45
10 changed files with 1148 additions and 106 deletions
+14
View File
@@ -475,6 +475,7 @@ class ServerArgs:
lora_backend: str = "csgmv"
max_lora_chunk_size: Optional[int] = 16
experts_shared_outer_loras: Optional[bool] = None
lora_use_virtual_experts: bool = False
lora_strict_loading: bool = False
# Kernel backend
@@ -4963,6 +4964,12 @@ class ServerArgs:
"(expert_dim=1). Use --no-experts-shared-outer-loras to force disable. "
"By default this is auto-detected from adapter weights.",
)
parser.add_argument(
"--lora-use-virtual-experts",
default=ServerArgs.lora_use_virtual_experts,
action="store_true",
help="Enable virtual expert computation for MoE models. When set, the model will use virtual expert computation.",
)
parser.add_argument(
"--lora-strict-loading",
default=ServerArgs.lora_strict_loading,
@@ -6715,6 +6722,13 @@ class ServerArgs:
and (self.max_lora_chunk_size & (self.max_lora_chunk_size - 1)) == 0
), "--max-lora-chunk-size must be a power of 2 between 16 and 128."
if self.lora_use_virtual_experts:
assert self.lora_backend == "triton", (
"--lora-use-virtual-experts requires --lora-backend triton. "
f"Got: {self.lora_backend}"
)
logger.info("Virtual expert computation enabled.")
def validate_buckets_rule(self, arg_name: str, buckets_rule: List[str]):
if not buckets_rule:
return