  Oracle-MoE: Locality-preserving Routing in the Oracle Space for Memory-constrained Large Language Model Inference



                                               ⊥

  zS(t) − zS(t−1) =         zS(t) − zS(t−1)

                                                  HS



                                                  

                        +     zS(t) − zS(t−1)

                                                      HS

                                                  ⊥

                                              

                    =       zS(t) − zS(t−1)            + 2r .

                                                  HS





           ∥(tt − tt−1 )|H⊥ S ∥ = ∥(tt − tt−1 )∥

Since (tt − tt−1 )|H⊥ S , (zS(t) − zS(t−1) )|⊥

                                             HS follows              Figure 10. UMAP visualization of embedding space in

Lemma5, so let 2r , C(Wg , k) to be m, K in Lemma 5,                 DeepSeekMoE-16B from layer 10 on Wizard-of-Wikipedia

with a existing d mentioned in lemma 5,                              datasets. Left: Tokens tend to cluster according to token-identity

                                                                     semantics. Right: Tokens from the same sequence are colored the

C(Wg , k)∥(tt −tt−1 )|H⊥ S ∥ > zS(t) − zS(t−1) )|⊥

                                                 HS + 2r             same. They share similar semantics and stay closer to each other

                                                                     in each token cluster.

Thus we have



      C(Wg , k)∥(tt − tt−1 )∥ > zS(t) − zS(t−1) )





B. Experiments

B.1. Pretraining Hyperparameters

Table 3 lists the hyperparameters used in our experiments.



B.2. Activation Inconsistency and Semantic Locality in

     Existing MoEs

                                                                     Figure 11. UMAP visualization of embedding space in

We propose temporal activation inconsistency, defined as             DeepSeekMoE-16B from layer 15 on Wizard-of-Wikipedia

the average number of inconsistent expert activations per            datasets. Left: Tokens tend to cluster according to token-identity

100 consecutive tokens per expert. Results over the entire           semantics. Right: Tokens from the same sequence are colored the

dataset and across different models and layers are listed in         same. They share similar semantics and stay closer to each other

Table 4. Existing MoEs show strong temporal activation               in each token cluster.

inconsistency within all layers, while Oracle-MoE reduces

this.

                                                                     90.54 times. This is because in human natural language,

Experiments with DeepSeekMoE-16B and Qwen1.5-MoE-                    it takes at least dozens of tokens to express a complete

A2.7B on real chat datasets(Wizard-of-Wikipedia and                  meaning, so our method still benefits from such ”abrupt”

Synthetic-Persona-Chat) are shown in Figure 10 and Fig-              semantic locality.

ure 11. Semantic locality appears across different mod-

els/layers/samples. Semantic groups can still be distin-             B.3. MoE with fine-grained experts

guished based on attention score and obtained by our

method, as shown in Figure 12 to Figure 15. It indicates the         We train a model following the setting of DeepSeekMoE-

potential of Oracle-MoE being a general-purpose solution.            16B but with fewer parameters(3B): 12 MoE layers with

                                                                     64 routed experts each as baseline, where hidden size is set

We tested scenarios where the topic changes frequently.              to 1536 and expert intermediate size is set to 1024. The

We randomly sample sentences from different datasets and             top 6 experts are selected for each token. Our method still

combine them into a whole sequence. We observed that                 achieved a 75% latency reduction at 2.5GB memory. Mean-

our proposed oracle space can still distinguish semantic             while, our model maintains the performance of downstream

groups efficiently, both in our models and public large MoE          tasks. On Trivia QA, our model achieves an F1 Score of

models, as shown in Figure 16 to Figure 19. We also tested           50.20, compared to the baseline of 50.75. On XSum, our

the expert activation variation of such highly diverse data          model attains a ROUGE-1 score of 21.74, while the baseline

with Oracle-MoE and switch-transformer. On average, in               score is 21.22.

every 100 consecutive token generations, Oracle-MoE only

changes 12.20 times while the switch transformer changes



                                                                16

