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



of our routing is 2.5e-4 seconds, which is also negligible            References

compared to the single forward-backward pass taking 3.5

                                                                      Artetxe, M., Bhosale, S., Goyal, N., Mihaylov, T., Ott, M.,

seconds.

                                                                        Shleifer, S., Lin, X. V., Du, J., Iyer, S., Pasunuru, R.,

                                                                        Anantharaman, G., Li, X., Chen, S., Akin, H., Baines, M.,

5.4. Expert Prediction-based Optimization                               Martin, L., Zhou, X., Koura, P. S., O’Horo, B., Wang, J.,

The Oracle-MoE has significantly diminished the neces-                  Zettlemoyer, L., Diab, M., Kozareva, Z., and Stoyanov,

sity for expert swapping, thereby fundamentally reducing                V. Efficient large scale language modeling with mixtures

latency. However, the load-on-demand strategy still inher-              of experts. In Goldberg, Y., Kozareva, Z., and Zhang, Y.

ently suffers from another limitation: it cannot decide which           (eds.), Proceedings of the 2022 Conference on Empirical

expert to load for a layer before that layer is reached. Conse-         Methods in Natural Language Processing, pp. 11699–

quently, we propose to predict deep layers’ expert activation           11732, Abu Dhabi, United Arab Emirates, December

at shallower layers, enabling inferring current tokens and              2022. Association for Computational Linguistics. doi:

loading experts synchronously. Specifically, we use the em-             10.18653/v1/2022.emnlp-main.804. URL https://

beddings of the first layer to predict the expert activation in         aclanthology.org/2022.emnlp-main.804.

the following layers. Experimental results show that Oracle-

                                                                      Beltagy, I., Lo, K., and Cohan, A. Scibert: Pretrained

MoE reaches an expert prediction accuracy of 85% to 95%,

                                                                        language model for scientific text. In EMNLP, 2019.

whereas Switch-Transformer-like token-level routing struc-

ture only has an accuracy of 40% to 60%. Employing this               Cai, W., Jiang, J., Wang, F., Tang, J., Kim, S., and Huang, J.

can further reduce the expert loading latency of Oracle-MoE             A survey on mixture of experts. ArXiv, abs/2407.06204,

by 10% to 15%. The underlying reasons for this expert pre-              2024. URL https://api.semanticscholar.

dictability will be left for future investigation.                      org/CorpusID:271064424.



                                                                      Chen, T., Zhang, Z., JAISWAL, A. K., Liu, S., , and Wang,

6. Conclusion

                                                                        Z. Sparse moe as the new dropout: Scaling dense and self-

This paper introduces Oracle-MoE, an innovative MoE ar-                 slimmable transformers. In The Eleventh International

chitecture designed to optimize edge deployment by ad-                  Conference on Learning Representations, 2023.

dressing latency issues inherent in token-level routing. By

incorporating an Oracle-Space-Based routing mechanism,                Cheng, H., Zhang, M., and Shi, J. Q. A survey on deep

Oracle-MoE reduces expert activation variation and mini-                neural network pruning: Taxonomy, comparison, anal-

mizes memory swapping overhead. Extensive experiments                   ysis, and recommendations. IEEE Transactions on Pat-

validate that Oracle-MoE achieves lower latency without in-             tern Analysis and Machine Intelligence, 46:10558–10578,

troducing any drawback on downstream tasks or pretraining               2023. URL https://api.semanticscholar.

computation, which is vital for the on-device deployments               org/CorpusID:260887757.

of LLMs. Future work could extend this approach to other              Chi, Z., Dong, L., Huang, S., Dai, D., Ma, S., Patra, B., Sing-

conditional computation frameworks and explore its appli-               hal, S., Bajaj, P., Song, X., Mao, X.-L., Huang, H., and

cability across diverse hardware environments.                          Wei, F. On the representation collapse of sparse mixture

                                                                        of experts. Advances in Neural Information Processing

Impact Statement                                                        Systems, 2022.



This work aims to deliver insights to the Machine Learning            Clark, A., De Las Casas, D., Guy, A., Mensch, A., Paganini,

community and will not lead to any direct societal conse-               M., Hoffmann, J., Damoc, B., Hechtman, B., Cai, T.,

quences. While it is associated with LLMs that may output               Borgeaud, S., Van Den Driessche, G. B., Rutherford,

misleading or harmful content, such issues are outside the              E., Hennigan, T., Johnson, M. J., Cassirer, A., Jones,

scope of this work and will not be particularly specified               C., Buchatskaya, E., Budden, D., Sifre, L., Osindero, S.,

here.                                                                   Vinyals, O., Ranzato, M., Rae, J., Elsen, E., Kavukcuoglu,

                                                                        K., , and Simonyan, K. Unified scaling laws for routed

Acknowledgements                                                        language models. Proceedings of the 39th International

                                                                        Conference on Machine Learning, 2022.

Yujiang Wang was supported by a Basic Research Program

of Jiangsu (BK20240414) and a Leadership Talent Pro-                  Clark, K., Khandelwal, U., Levy, O., and Man-

gram (Science and Education) of Suzhou Industrial Park                  ning, C. D. What does bert look at? an anal-

(KJQ2024204).                                                           ysis of bert’s attention. In BlackboxNLP@ACL,

                                                                        2019. URL https://api.semanticscholar.

                                                                        org/CorpusID:184486746.



                                                                  9

