                               Learning Mixtures of Experts with EM: A Mirror Descent Perspective



Algorithm 2 Gradient EM for MOE

  Input: Initial θ 1 ∈ Ω, data: (X, Y ) ∼ p(x, y; θ ∗ )), step-size: γ1 , γ2 ∈ (0, ∞).

  for t = 1, . . . , T : do

    β-Update: Obtain β t+1 as

                                                                                             

                                      t+1    t                              ∂

                                    β     = β + γ1 EX,Y EZ|x,y;θt             log p(y|z, x; β) .

                                                                           ∂β



     w-Update: Obtain wt+1 as

                                                                                                     

                                           t+1        t                               ∂

                                       w         = w + γ2 EX,Y EZ|x,y;θt                log P (z|x; w) .

                                                                                     ∂w



  end for

  Output: θ T = (wT , β T )





D.3. Gradient Descent for MoE

Gradient Descent. Gradient descent is given as the global minimizer of the first order approximation of L(θ) at θ plus a

quadratic regularizer, i.e.,

                                                                     1

                                    L(θ t ) + ⟨∇L(θ t ), θ − θ t ⟩ + ∥θ − θ t ∥22 .

                                                                    2η

Differentiating, and solving for equality at 0 yields the well known gradient update.



Algorithm 3 Gradient Descent for MoE

  Input: Initial θ 1 ∈ Ω, data: (X, Y ) ∼ p(x, y; θ ∗ ), step-size: γ ∈ R+

  for t = 1 to T do

    θ-Update:

        θ t+1 := θ t − γ∇L(θ t )

  end for

  Output: θ T = (wT , β T )





D.4. EM for Deep and Sparse MoE

We begin by formalizing the concepts of Deep and Sparse Mixtures of Experts (MoE), extending the classical MoE

framework.

Deep MoE: A deep MoE is a composition of l ≥ 2 MoE blocks, denoted as MoE1 , MoE2 , . . . , MoEl , stacked sequentially.

Each block MoEi consists of a gating function gi (x; wi ) and a set of k experts {fi,j (x; βi,j )}kj=1 . The input x is processed

through each MoE block in sequence, producing intermediate representations h1 , h2 , . . . , hl , where:

                                           k

                                           X

                                   h1 =          g1 (x; w1 )j f1,j (x; β1,j ),

                                           j=1

                                           k

                                           X

                                   hi =          gi (hi−1 ; wi )j fi,j (hi−1 ; βi,j ) for i = 2, . . . , l.

                                           j=1



The final output is y = hl .

Sparse MoE: The Sparse MoE is a variant of the MoE that is popular in deep MoE applications where, at each MoE block,

only a small subset of experts (typically one or a few) are activated per input both during training and inference. This is

achieved via a deterministic or stochastic selection mechanism (e.g., top-k gating), resulting in a sparse latent variable

z = (z1 , z2 , . . . , zl ) ∈ [k]l that encodes the sequence of selected experts across the l blocks.



                                                                      36

