---
title: Patchwise Expert Routing in Vision
url: https://www.emergentmind.com/topics/patchwise-expert-routing
type: topic
---

# Patchwise Expert Routing in Vision

Patchwise expert routing is a class of Mixture-of-Experts (MoE) mechanisms in which routing decisions are made at the level of image patches or patch-like tokens rather than at the level of whole samples. Across contemporary vision systems, the method appears in several distinct forms: per-patch token-choice routing in robot learning, expert-choice routing in diffusion transformers, prioritized patch selection in convolutional MoE, and prototype-based token assignment in guided diffusion MoE. Despite these differences, the common objective is spatially adaptive computation: experts are activated for task-relevant, semantically salient, or class-discriminative regions while irrelevant or redundant regions receive reduced expert processing [2510.05213] [2410.02098] [2306.04073] [2510.24711].

## 1. Conceptual basis and problem setting

Patchwise expert routing is motivated by the observation that visual information is not uniformly informative across space. In the theoretical pMoE formulation, each example is decomposed into $n$ disjoint patches, and only one patch contains the class-discriminative pattern while the other $n-1$ patches are class-irrelevant noise patterns. Under that setting, routing only a small number $l \ll n$ of patches to each expert yields both computational and statistical advantages [2306.04073]. This suggests that patchwise routing is especially well matched to tasks in which the decisive signal is localized.

In transformer-based vision models, the same intuition is expressed in token form. EC-DIT begins from a $256\times256$ image, splits it into non-overlapping latent patch tokens after a frozen VAE, and replaces every even-numbered feed-forward layer with an MoE block. The routing objective is not merely sparsity; it is heterogeneous compute allocation aligned with varying text-image complexities, so that high-detail or text-relevant patches can receive disproportionately more expert capacity than flat background regions [2410.02098]. ProMoE makes a related but more explicit claim about visual tokens: compared with language tokens, they exhibit spatial redundancy and functional heterogeneity, which hinders expert specialization in vision MoE unless routing guidance is strengthened [2510.24711].

In robot learning, VER frames the issue differently. The motivating problem is that individual pretrained vision foundation models excel only in specific domains, while naïve distillation into a single policy representation can produce inflexible task-specific feature selection. VER therefore distills multiple VFMs into a vision expert library and then fine-tunes only a lightweight routing network to dynamically select task-relevant experts for downstream robot tasks. Patchwise Expert Routing with Curriculum Top-K Annealing is the mechanism used to make that selection spatially adaptive and dynamically sparse [2510.05213].

## 2. Architectural realizations

The architectural placement of patchwise routing differs substantially across frameworks, even though all of them operate over image patches or patch tokens.

In VER, the backbone is a ViT whose last $N$ transformer layers are converted into an MoE block, called the Vision Expert Library. Each MoE layer contains $L$ expert MLPs $\{E^n_l\}_{l=1\ldots L}$ and one lightweight Robot Router $R^n_{\text{robot}}$. During robot-policy fine-tuning, the backbone and experts are frozen; only the router, which is approximately $0.4\%$ of total parameters, and the policy head are trained. The routing module itself is a per-patch two-layer MLP, `Linear→GELU→Linear`, that takes the input token for patch $p$ at layer $n$ and outputs $L$ routing logits [2510.05213].

In EC-DIT, patchwise routing is inserted into the feed-forward path of a diffusion transformer. The base DiT block remains `LayerNorm → Self-Attention → (add skip) → Cross-Attention → (add skip) → Feed-Forward → (add skip)`, but every second block’s final FFN is replaced by an MoE block. Routing is computed from the sum of the self-attention output and the cross-attention output, so the dispatch decision incorporates both image and text context [2410.02098].

In pMoE for CNNs, the architecture is not transformer-based. Instead, there are $k$ parallel two-layer CNN experts, each with its own gating kernel $w_s \in \mathbb{R}^d$. For expert $s$, the router scores each patch $j$ by $g_{j,s}(x)=\langle w_s, x^{(j)}\rangle$, selects the top-$l$ patches, and forwards only those to the expert. The baseline single-expert CNN corresponds to the dense case $k=1$, $l=n$ [2306.04073].

In ProMoE, routing is explicitly decomposed into two sequential stages. Conditional routing first partitions incoming patch tokens into unconditional and conditional subsets according to classifier-free guidance status. Prototypical routing then assigns only the conditional subset to experts by comparing token embeddings with a bank of learnable prototypes, while shared experts contribute across tokens [2510.24711].

| Framework | Patchwise routing rule | Distinctive property |
|---|---|---|
| VER | Per-patch top-$K(s)$ token-choice gating | Curriculum Top-K Annealing |
| EC-DIT | Top-$C$ patches selected per expert | Perfect balance without auxiliary load-balance loss |
| pMoE | Top-$l$ patches selected per expert by gating kernel | Sample-complexity analysis for CNNs |
| ProMoE | Hard conditional split, then prototype-based top-$K$ routing | Explicit routing guidance via prototypes and contrastive loss |

## 3. Gating functions and expert aggregation

The defining mathematical object in patchwise expert routing is the patch–expert assignment map, but the form of that map varies across systems.

In VER, let $x_p$ be the embedding of patch $p$ entering an MoE layer. The router computes raw logits
$$
s_{p,e} = [W_g x_p + b_g]_e + \epsilon_{p,e},
$$
with optional exploration noise $\epsilon_{p,e} \sim \mathcal{N}(0,\sigma_g^2)$, and softmax scores
$$
g_{p,e} = \operatorname{softmax}(s_{p,1\ldots L}/\tau)_e.
$$
Curriculum Top-K Annealing restricts the active expert set through
$$
K(s)=\max\!\left(K_{\min}, \left\lfloor L-(L-K_{\min})(s/S)\right\rfloor\right),
$$
and a binary dispatch mask $M_{p,e}(s)$ that keeps only the top-$K(s)$ logits. The final routing coefficient is
$$
\alpha_{p,e}(s)=M_{p,e}(s)\cdot g_{p,e}.
$$
Each selected expert processes the same patch in parallel,
$$
y_{p,e}=E_e(x_p),
$$
and the routed output is the weighted sum
$$
y_p=\sum_{e=1}^L \alpha_{p,e}(s)\,y_{p,e}.
$$
Because experts outside the top-$K$ have $\alpha=0$, the mechanism is sparse at the patch level; because the router is per-patch, the active expert set can vary across spatial locations within the same image [2510.05213].

EC-DIT uses a different perspective. Instead of each token choosing experts, each expert chooses tokens. With router input
$$
x' = X_s + \operatorname{MHCA}(X_s),
$$
the model computes logits
$$
\operatorname{logits}_{b,s,i}=x'_{b,s,:}\cdot W_r[:,i],
$$
then affinities
$$
A_{b,s,i}=\frac{\exp(\operatorname{logits}_{b,s,i})}{\sum_{j=1}^E \exp(\operatorname{logits}_{b,s,j})}.
$$
Each expert has capacity
$$
C=\left\lceil \frac{B\times S \times f_c}{E}\right\rceil,
$$
and keeps its top-$C$ patches. The sparse gating tensor is
$$
G_{b,s,i}=
\begin{cases}
A_{b,s,i}, & s\in \operatorname{top}\text{-}C(A_{b,\cdot,i})\\
0, & \text{otherwise}.
\end{cases}
$$
Aggregation is then
$$
X^{\text{out}}_{b,s,:}=\sum_{i=1}^E G_{b,s,i}\cdot \operatorname{Expert}_i(x'_{b,s,:}).
$$
This routing rule is “patchwise” in the sense that dispatch is still defined over patch tokens, but control is exercised by expert capacity rather than token-local top-$K$ selection [2410.02098].

ProMoE introduces a two-step formulation. Conditional routing is deterministic:
$$
M_u(b,\ell)=\mathbf{1}\{\operatorname{cond}_b=\mathsf{empty}\},\qquad
M_c(b,\ell)=1-M_u(b,\ell).
$$
For the conditional subset $X_c$, prototypes $p_i \in \mathbb{R}^D$ define routing logits by cosine similarity,
$$
L_{j,i}=\alpha \frac{\langle x_{c,j},p_i\rangle}{\|x_{c,j}\|\|p_i\|},
$$
with identity activation $G_{j,i}=L_{j,i}$. A sparse top-$K$ vector $h_j$ is formed by keeping only the largest entries of $G_{j,:}$, and the conditional-token output is
$$
y_{c,j}=\sum_{i=1}^{N_E} h_{j,i}\,E_i(x_{c,j}),
$$
plus shared expert output. The full token output combines shared, unconditional, and conditional-expert paths [2510.24711].

The pMoE CNN formulation is simpler but structurally analogous. For expert $s$, $J_s(x)$ denotes the top-$l$ patches by gating score, and the overall model output is
$$
f_M(\theta;x)=\sum_{s=1}^k \sum_{r=1}^{m/k} a_{r,s}\cdot \frac{1}{l}\sum_{j\in J_s(x)} \operatorname{ReLU}(\langle w_{r,s},x^{(j)}\rangle)\cdot G_{j,s}(x).
$$
The common pattern across all four formulations is sparse patch dispatch followed by expert-local processing and weighted recombination [2306.04073].

## 4. Objectives, regularization, and training regimes

Patchwise expert routing does not imply a single optimization protocol. The role of auxiliary losses, balancing constraints, and parameter freezing differs sharply by application.

In VER’s robot-policy fine-tuning, the only loss is the downstream policy loss $L_{\text{policy}}$, such as imitation or reinforcement loss, applied after the policy head. PER does not use the mutual-information or load-balancing regularizers that appeared in pretraining. Exploration and balanced expert usage are instead induced by the router noise $\epsilon$ and the wide-to-narrow annealing of $K(s)$. In practice, $\tau$ is kept fixed, so the annealing schedule alone acts as an implicit regularizer: large $K$ early promotes exploration of many expert combinations, while small $K$ late yields sparse, stable routing [2510.05213].

EC-DIT is trained end-to-end with the same $L_2$ diffusion objective as dense DiT,
$$
L(\theta)=\mathbb{E}_{t\sim p(t),\,x_0\sim p_0,\,\epsilon\sim N(0,I)}
\left[\|v_\theta(x_t,t)-v(x_t,t)\|^2\right].
$$
No routing-specific loss is added. The reason is structural rather than heuristic: expert-choice routing gives each expert exactly $C$ tokens, so perfect balance is guaranteed by construction. The capacity factor $f_c$ then becomes the explicit knob controlling the trade-off between increased compute per expert and the risk that some tokens are dropped completely [2410.02098].

ProMoE takes the opposite view and adds explicit routing supervision. Its Routing Contrastive Loss defines, for each active expert, a positive centroid $c_i$ from the tokens routed to that expert and uses an InfoNCE-style objective
$$
\mathcal{L}_{\rm RCL}
= -\frac{1}{N_a}\sum_{i=1}^{N_a}
\log
\frac{\exp(\operatorname{sim}(p_i,c_i)/\tau)}
{\sum_{j=1}^{N_a}\exp(\operatorname{sim}(p_i,c_j)/\tau)}.
$$
With $\tau=0.07$, this pulls each prototype toward its own routed-token centroid and pushes it away from the centroids of other experts. The production model does not rely on manual labels, but the paper reports that both explicit routing supervision and implicit $k$-means clustering in preliminary experiments produced large gains over a naive MoE, motivating the semantic guidance strategy [2510.24711].

In pMoE, both separate-training and joint-training regimes are analyzed. Separate-training first learns the router weights on a router-only objective, fixes them, and then trains the experts by SGD on logistic loss
$$
L(\theta)=\frac{1}{N}\sum_{i=1}^N \log(1+e^{-y_i f_M(\theta;x_i)}).
$$
Joint-training instead learns router and expert weights simultaneously, with $G_{j,s}(x)$ given by a softmax over router scores. The distinction is important because the strongest theoretical guarantees are presented separately for the fixed-router and jointly trained settings [2306.04073].

## 5. Empirical and theoretical evidence

The empirical record shows that patchwise routing changes not only efficiency but also the spatial distribution of representation capacity.

For VER, Patchwise Expert Routing with Curriculum Top-K Annealing outperforms both Framewise/Layerwise Teacher Routing and PER without annealing, especially on tasks requiring fine spatial focus such as pen-in-cup and relocate. Feature-norm visualizations show that PER+CTA suppresses large-norm “outlier” activations in background patches and concentrates high norms on task-relevant regions such as the target pen shape or the bin mouth. Patchwise mutual-information analysis further shows reduced information in irrelevant patches while preserving it in relevant ones. Across 17 diverse robotic tasks, policies using PER+CTA achieve higher success rates with fewer spurious expert activations and less variance across random seeds, and ablations on $K_{\min}$ show a trade-off between computational cost and final success rate without retraining the backbone [2510.05213].

EC-DIT reports complementary evidence in diffusion transformers. Against a token-choice MoE baseline with the same activated parameters, expert-choice routing converges faster in training FID and CLIP Score and matches a 16-expert token-choice model with only 8 experts. Increasing the number of experts from $8\rightarrow16\rightarrow32\rightarrow64$ at fixed dense width yields consistent gains in GenEval/DSG alignment and FID without increasing per-token FLOPs. Routing visualizations show that later layers can route up to 44% of experts onto a single high-detail patch, while flat background patches may receive zero expert activations. The largest models achieve a GenEval score of 71.68%, and inference overhead is measured at 20–28% over the dense baseline, somewhat above the theoretical FLOP increase because of sparse-kernel and communication costs [2410.02098].

The most explicit theoretical support comes from pMoE. For separate-training, the required number of training samples satisfies
$$
N_S=\Omega(l^8 p^{12}\delta^6/\epsilon^{16}),
$$
whereas the corresponding single-expert CNN requires
$$
N_C=\Omega(n^8 p^{12}\delta^6/\epsilon^{16}),
$$
so that
$$
N_C/N_S=\Theta((n/l)^8).
$$
For hidden units, the ratio is
$$
M_C/M_S=\Theta((n/l)^{10}).
$$
The joint-training result gives a reduction factor in sample complexity of $\Theta(n^8/(k^4 l^6))$ compared to a single CNN, under the stated routing-lock-in assumption. Empirically, on synthetic MNIST-based data, pMoE reaches 95% test accuracy with approximately 60% of the samples required by the CNN baseline, and on CIFAR-10, CIFAR-Vehicles, and CelebA it is reported to be less prone to overfit spurious correlations such as the hair-color cue in CelebA [2306.04073].

ProMoE evaluates routing quality more directly. Intra-expert coherence is visualized with t-SNE, where assigned tokens form tight, well-separated clusters. Inter-expert diversity is quantified by principal-subspace similarity derived from SVD of expert FFN weights, and ProMoE with Routing Contrastive Loss achieves lower subspace similarity than baselines. These routing changes translate into improved FID and IS on ImageNet; at the same activated parameters, the reported gain includes up to approximately 30% FID reduction relative to prior MoE DiTs [2510.24711].

## 6. Design trade-offs, misconceptions, and broader significance

A recurring misconception is that patchwise expert routing is a single routing algorithm. The literature instead contains multiple incompatible routing paradigms. VER uses per-patch token-choice gating with curriculum-scheduled sparsification; EC-DIT uses expert-choice routing with fixed per-expert capacity; ProMoE uses a hard functional split followed by prototype-based top-$K$ dispatch; pMoE uses prioritized top-$l$ patch selection via expert-specific kernels. The shared object is the patch token, not the routing rule itself [2510.05213] [2410.02098] [2510.24711] [2306.04073].

A second misconception is that sparse vision MoE must rely on explicit load-balancing losses. EC-DIT demonstrates that expert-choice can enforce perfect balance structurally, so no auxiliary load-balance loss is needed. VER shows a different possibility: during robot-policy training, mutual-information and load-balancing regularizers can be omitted if exploration is induced by router noise and by wide-to-narrow annealing of the allowed expert set. ProMoE, by contrast, argues that explicit routing guidance is crucial for vision MoE, but its added loss is not a load-balancing term; it is a semantic coherence-and-diversity term implemented through Routing Contrastive Loss [2410.02098] [2510.05213] [2510.24711].

A third misconception is that every patch should always be assigned substantial expert computation. The evidence points in the opposite direction. In EC-DIT, background patches may receive zero expert activations. In VER, successful routing suppresses large-norm outliers in background regions and preserves concentration on task-critical regions. In pMoE theory, the benefit arises precisely because class-irrelevant patches are filtered away from experts that should focus on discriminative patterns [2410.02098] [2510.05213] [2306.04073].

The principal design trade-offs exposed by these works are sparsity versus stability, compute versus coverage, and semantic flexibility versus explicit guidance. In VER, $K_{\min}$ controls the trade-off between the number of experts per token and final success rate; in EC-DIT, the capacity factor $f_c$ controls the trade-off between increased compute per expert and token dropping; in ProMoE, the addition of prototype guidance and contrastive routing supervision is intended to improve expert specialization. A plausible implication is that patchwise expert routing is becoming a general abstraction for visual conditional computation across robotics, diffusion modeling, and supervised classification, but the optimal routing mechanism remains application-specific.

Source: https://www.emergentmind.com/topics/patchwise-expert-routing