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



A. Proof of Analysis                                                       where ∥M ∥ denotes the operator norm (spectral norm) of

                                                                                   T

                                                                           matrix MQ MK This bound reflects how the transformations

A.1. Property of semantic element                                          MQ and MK affect the original inner product ⟨X, Y ⟩.

In this section, we delve into the detailed analysis of the                Furthermore, although the above discussion is based on

approximate attention mechanism, specifically focusing on                  an approximate attention mechanism and focuses on the

the impact of the inner product between query (WQ ) and                    properties of token components in the HS space, Figure 2

key (WK ) matrices.                                                        shows that tokens with the same identity (i.e., semantically

                                                                           similar tokens) tend to cluster together in low-dimensional

                                                                           representations that preserve relative distances. But this

                                                                           clustering behavior also suggests that tokens with the same

                                                                           high-level semantic meaning have small relative distances

                                                                           in the semantic component space. Therefore, for tokens

                                                                           within the same subgraph or semantic context, we make the

                                                                           following assumption:

                                                                           Assumption 2. For tokens ti in the same subgraph, or

                                                                           Semantic Group Sj , their components in semantic space

                                                                           HS si , there exist r, s.t. si ∈ BHS (ci , r)

Figure 9. Effective rank of matrices WQ and WK in different lay-

                                                                           Assumption 3 (Uniform Distribution in Semantic Space).

ers’ self-attention and their subspaces angle. The space determined

by WQ and WK is very similar.

                                                                           Tokens in the same semantic group sj are uniformly dis-

                                                                           tributed in the semantic space with an expected value at the

The attention score computation can be viewed as a mapping

                                                                           center:

from two token representations to a scalar value:

                                                                                              E[si ] = cj , ∀i ∈ sj .

                       A : H × H → R,

                                                                           A.2. The advantage of mean embedding of subgraph

In Figure 9, WQ and WK exhibit similar ranks and mini-

mal angles between their subspaces. Combined with the                      Given the definition of semantic groups, we now make an

empirical success of shared QK matrices in transformers                    assumption about the distribution of token identity infor-

(e.g., Kowsher et al. (2024)), we propose that WQ and WK                   mation ui , which refers to the unique characteristics within

can be decomposed into a shared projection followed by                     each subgraph, distinguishing one token from another be-

subspace-specific transformations. We therefore propose:                   yond their shared high-level semantics:

               WQ = MQ P,         WK = MK P,                               Assumption 4 (Normal Distribution in Token Identity

                                                                           Space). Token identical information follows a normal dis-

where P : H → HS is a shared projection matrix mapping                     tribution within each subgraph Sj :

tokens to a common subspace HS of dimension r (with

r ≤ dim(H)), and MQ , MK : HS → HS are full-rank                                          ui ∼ N (µj , Σj ),             ∀i ∈ Sj .

linear transformations within HS .

Given this understanding:                                                  Then we have The variance of the semantic representation

Assumption 1 (Semantic Subspace). The token represen-                      of token ti is defined as:

tation space H can be decomposed into a low-dimensional

                                                                                                                1    X

semantic subspace Hs and its orthogonal complement HS⊥ :                                 Var(ztt ) = Var(              t)

                                                                                                              |S(t)|

                                                                                                                           t∈S(t)

                       H = HS ⊕ HS⊥ .



Followed by the analysis and the experiment results in Sec-                Let the neighborhood size be n = |S(t)|, then:

tion 2.2, although we recognize that WQ ̸= WK , meaning

                                                                                              1 X      1 X

MQ ̸= MK , under our analysis, where both MQ and MK                                 zS(t) =       ti =     (si + ui )                            (2)

                                                                                              n        n

are different full-rank linear mappings from HS to HS ,                                          i∈S(t)              i∈S(t)

we can derive a relatively symmetric bound for the inner

products involving these mappings. Specifically, for any                   It can be decomposed into two parts:

non-zero, unit vectors X, Y ∈ HS , we have:

                                                                                                1 X                        1 X

                                                                                   zS(t) =               si          +              ui           (3)

            |⟨MQ X, MK Y ⟩| ≤ ∥M ∥ · |⟨X, Y ⟩|,                                                 n                          n

                                                                                                  i∈S(t)                     i∈S(t)

            |⟨MQ Y, MK X⟩| ≤ ∥M ∥ · |⟨Y, X⟩|.                                                   | {z }                     | {z }

                                                                                             Mean of semantic part       Mean of identity part





                                                                      13

