resolve_moe_lora_route

Function resolve_moe_lora_route 

Source
pub fn resolve_moe_lora_route(
    adapter_slot: i32,
    active: i32,
    has_moe_lora: bool,
) -> MoeLoraRoute
Expand description

Resolve the Feature-1 MoE-LoRA fold decision for a single-request pass.

adapter_slot is the request’s SequenceState.adapter_slot (< 0 = no adapter / base); active is the installed pool’s active slot index (< 0 when no MoE adapter is installed); has_moe_lora is whether this layer actually installed an expert/router delta.

  • no MoE delta installed ⇒ Fold (the fold hook no-ops on self.lora == None, so the value is inert — kept Fold so nothing changes when off).
  • base request (adapter_slot < 0) ⇒ Skip — base tokens pay nothing.
  • request owns the active adapter (adapter_slot == active) ⇒ Fold.
  • request routes to a different, non-installed adapter ⇒ Refuse — phase-1 installs one active MoE adapter; folding the wrong one is silently wrong, so refuse loudly instead.