The integration of dynamic, sparse structures like Mixture-of-Experts (MoE) with parameter-efficient adapters (e.g., LoRA) is a powerful technique for enhancing Large Language Models (LLMs). However, this architectural enhancement comes at a steep cost: despite minimal increases in computational load, the inference latency often skyrockets, leading to decoding speeds slowing by over 2.5 times. Through a fine-grained performance analysis, we pinpoint the primary bottleneck not in the computation itself, but in the severe overhead from fragmented, sequential CUDA kernel launches required for conventional dynamic routing. To address this challenge, we introduce AdaFuse, a framework built on a tight co-design between the algorithm and the underlying hardware system to enable efficient dynamic adapter execution. Departing from conventional layer-wise or block-wise routing, AdaFuse employs a token-level pre-gating strategy, which makes a single, global routing decision for all adapter layers before a token is processed. This "decide-once, apply-everywhere" approach effectively staticizes the execution path for each token, creating an opportunity for holistic optimization. We capitalize on this by developing a custom CUDA kernel that performs a fused switching operation, merging the parameters of all selected LoRA adapters into the backbone model in a single, efficient pass. Experimental results on popular open-source LLMs show that AdaFuse achieves accuracy on par with state-of-the-art dynamic adapters while drastically cutting decoding latency by a factor of over 2.4x, thereby bridging the gap between model capability and inference efficiency.
Figures & tables
Method
Decoding latency (ms/token)
Parameter size (B)
FLOPS (G)
Llama2-7B
2.4
6.74
6.61
MOLA ( Gao et al. 2024 )
25.3 (+954%)
7.07 (+4.89%)
6.65 (+0.61%)
PESC ( Wu et al. 2024a )
8.5 (+254%)
6.97 (+3.41%)
6.64 (+0.45%)
MoRAL ( Yang et al. 2024 )
8.6 (+258%)
6.97 (+3.41%)
6.67 (+0.91%)
Table 1: Inference cost of different dynamic adapters.
Figure 1: Decoding phase execution time profiling of one dynamic adapter layer in MoRAL. The execution time results were preceded by a warm-up of 100 executions and are obtained on the average of 300 executions.
Figure 2: Latency breakdown of one dynamic adapter layer under different settings.
Figure 3: Overview of AdaFuse.
Method
ARC
HellaSwag
MMLU
TruthfulQA
Winogrande
Avg
Llama2-7B (base)
51.71
77.74
48.30
45.31
72.45
59.10
LoRA
51.79
77.02
50.46
45.13
73.80
59.64
MoRAL (layer-wise)
52.13
77.57
51.10
45.93
74.35
60.22
PESC (block-wise)
53.58
77.27
51.07
46.04
74.27
60.45
AdaFuse (ours)
52.39
77.60
51.15
46.15
73.32
60.12
Table 2: Accuracy of incremental training achieved with different dynamic adapters.
Methods
ScienceQA
CommonsenseQA
OpenbookQA
Avg
Llama2-7B (base)
53.19
47.82
45.80
48.94
Full-Parameter
93.12
77.48
80.40
83.67
LoRA
91.01
75.51
77.00
81.17
MoLA (layer-wise)
91.91
77.89
82.80
84.20
MoRAL (layer-wise)
90.74
76.41
76.60
81.25
PESC (block-wise)
90.02
76.00
78.40
81.47
Table 3: Accuracy of domain-specific fine-tuning achieved with different dynamic adapters on Llama2-7B.
Methods
ScienceQA
CommonsenseQA
OpenbookQA
Avg
Mistral-7B (base)
62.24
58.93
57.8
59.66
LoRA
94.15
79.85
84.2
86.06
MoRAL (layer-wise)
93.79
81.57
85.8
87.05
PESC (block-wise)
94.33
80.46
86.4
87.06
AdaFuse (ours)
93.82
81.29
86.6
87.24
Table 4: Accuracy of domain-specific fine-tuning achieved with different dynamic adapters on Mistral-7B.
Method
Latency (ms/token)
Memory (GiB)
Llama2-7B
2.4
12.9
MOLA (layer-wise)
25.3 (+954%)
26.3 (+104%)
PESC (block-wise)
8.5 (+254%)
13.1 (+2%)
MoRAL (layer-wise)
8.6 (+258%)
13.3 (+3%)
AdaFuse (ours)
3.1 (+29%)
13.8 (+7%)
Table 5: Decoding latency and peak memory overhead of different dynamic adapters.
Method
Latency (ms/token)
Llama2-7B
2.4
MoRAL
8.5 (+254%)
MoRAL (Simple merge)
4.5 (+88%)
AdaFuse (Simple merge)
4.2 (+ 75%)
AdaFuse
3.1 (+29%)
Table 6: Ablation study for runtime decoding latency of AdaFuse.
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.