TL;DR
AdaFuse solves the massive inference latency overhead typically introduced by dynamic LLM adapters (like MoE-LoRA) through a novel system-algorithm co-design. By replacing layer-by-layer routing with a global, token-level "pre-gating" strategy and utilizing a custom fused CUDA kernel (SGMM), AdaFuse cuts decoding latency by over 2.4× while maintaining state-of-the-art accuracy.
What Problem Does This Paper Address?
Integrating dynamic, sparse structures like Mixture-of-Experts (MoE) with Parameter-Efficient Fine-Tuning (PEFT) methods like Low-Rank Adaptation (LoRA) is a highly effective way to scale an LLM's capacity for multi-task and multi-domain learning. Nominally, these dynamic adapters are computationally cheap, adding only 1–5% more parameters and less than 1% to the model's total FLOPs.
However, the authors uncover a glaring problem: in practice, these models suffer from catastrophic inference latency, slowing down token decoding by 250% to 950%.
Through rigorous profiling, the authors pinpoint the bottleneck: it isn't the math, but the hardware. Traditional dynamic adapters make routing decisions sequentially at every single block or layer. This architectural choice forces a barrage of fragmented, sequential CUDA kernel launches and frequent memory access swaps. The overhead of simply launching these kernels completely dwarfs the actual computation time.
Methods
AdaFuse tackles this bottleneck through a tight co-design of the routing algorithm and the underlying GPU execution system:
- Token-Level Pre-Gating: Instead of routing independently at every layer, AdaFuse employs a "decide-once, apply-everywhere" approach. A single Top-2 router at the very first layer determines the expert activation pattern for the token across all subsequent layers. This effectively staticizes the execution path for each token before it is processed.
- Fused Adapter Switching: Because the routing path is fixed upfront, the chosen LoRA adapters can be directly merged into the backbone model's weights.
- SGMM (Segmented Gather Matrix Multiplication) Kernel: To make weight merging practical during runtime, the authors developed a custom CUDA kernel. The SGMM kernel handles the concurrent merging of activated adapters and unmerging of inactivated adapters across all layers in a single, highly parallelized kernel call. It also utilizes a pre-fetch buffer mechanism to hide memory loading latencies.
Datasets
The authors evaluated AdaFuse across several standard configurations:
- General Capability Training: Finetuned on a mixture of SlimORCA, Magicoder, and MetaMathQA.
- General Benchmarks: Evaluated using
LM-Eval-Harnesson ARC, HellaSwag, MMLU, TruthfulQA, and WinoGrande. - Domain-Specific QA: Finetuned and tested on ScienceQA, CommonsenseQA, and OpenbookQA.
- Runtime Efficiency: Simulated using real-world user queries from the ShareGPT dataset.
Key Insights and Ideas
- The Kernel Launch Bottleneck: Latency in sparse, lightweight modules is dominated by GPU context operations and launch overhead, not FLOPs. As shown below, the latency of LoRA adapters consistently exceeds the backbone matrix time regardless of the rank size.
- Semantic Consistency Across Layers: The core algorithmic justification for pre-gating is that tokens with similar semantic properties tend to activate consistent expert patterns across different layers anyway. Exploiting this allows engineers to trade redundant routing calculations for massive hardware efficiency.
- In-Place Weight Mutation: Rather than computing separate LoRA paths alongside the backbone (which requires extra kernel calls), it is significantly faster to dynamically alter the backbone weights themselves—provided you can parallelize the weight switching into a single fused operation.
Key Results
- Decoding Speedup: AdaFuse delivers a 2.4× to 2.7× speedup in decoding latency compared to state-of-the-art dynamic adapter baselines like MoRAL, PESC, and MOLA.
- Overhead Reduction: It slashes the massive 250–950% decoding latency overhead of prior methods down to just 29% over the original un-adapted base model (Llama2-7B).
- Maintained Accuracy: On general capabilities, AdaFuse achieves an average accuracy of 60.12% (comparable to PESC's 60.45%). On domain-specific tasks, it scores an average of 83.60% on Llama2-7B and 87.24% on Mistral-7B, occasionally outperforming fully-parameterized or layer-wise baselines.
Limitations and Future Work
- Prefilling Phase: AdaFuse focuses its optimizations entirely on the decoding phase (where sequence length is 1). The authors did not implement specific optimizations for the prefilling phase, noting that decoding is the primary bottleneck in text generation.
- Router Complexity: The architecture relies on a simple Top-2 router at the first layer. Future work could investigate more sophisticated global routing mechanisms that capture deeper token semantics without re-introducing layer-wise hardware overhead.
Summary updated