TL;DR
Mixture-of-Experts (MoE) language models pack massive capacity into lean computational budgets, making them tempting engines for generating sentence embeddings without any extra training. However, their internal routing mechanisms are surprisingly jittery—meaning two nearly identical sentences can get bounced to completely different experts, resulting in wildly different vector representations. This paper introduces SAME, a training-free, zero-overhead framework that tames this internal chaos to extract clean, reliable embeddings from off-the-shelf MoE models.
What Problem Does This Paper Address?
Sentence embeddings—compressing the meaning of a sentence into a single fixed-length vector—are the invisible backbone of modern search, semantic matching, and retrieval-augmented generation (RAG). Recently, researchers discovered a clever shortcut: instead of spending a fortune training dedicated embedding models, you can coax a general-purpose Large Language Model (LLM) into summarizing a sentence into its final token using a simple prompt (like “This sentence: ‘[TEXT]’ means in one word:”), and just grab that final token's hidden state.
Applying this trick to Mixture-of-Experts (MoE) models is an obvious next step. Instead of firing every parameter for every word like a dense model, MoEs use a "router" at each layer to send tokens to a small handful of specialized sub-networks ("routed experts"), alongside a few "shared experts" that process everything.
Here is the catch: MoEs were built to predict the next word, not to form stable geometric spaces. A good embedding space requires stability—semantically similar sentences must land near each other. When the authors poked under the hood of popular MoE models by injecting tiny amounts of Gaussian noise, they found two major sources of instability:
- Jittery Routers: In certain layers, tiny input nudges cause the router to pick a substantially different set of experts.
- Volatile Routed Experts: Even when given perturbed inputs directly, routed experts produce much more divergent outputs than the steady, reliable shared experts.
If similar sentences get routed down different neural pathways, their final representations drift apart, degrading embedding quality.
Methods
To fix this without fine-tuning the model or slowing down inference, the authors propose SAME (Stability-Aware MoE Embedding extraction). While standard methods run a normal forward pass and pull the vector from the very end of the network, SAME modifies the extraction pipeline in three clever ways:
- Routed Expert Budget Reallocation (Pre-computed): Using a small calibration set, the authors inject Gaussian noise into each layer's router inputs and measure how much the chosen experts overlap before and after the noise. Layers with high overlap get a high "stability score." SAME keeps the model's total expert budget strictly fixed, but redistributes it: jittery layers get fewer experts, and stable layers get more. This happens once offline.
- Routed-Shared Fusion Reweighting: Because routed experts are noisier than shared experts, SAME turns down the volume on routed experts—multiply their output by a scaling factor $\beta \in (0, 1]$. Crucially, it only does this for the very last token (where the embedding lives), leaving all preceding context tokens untouched so the sentence's internal context isn't degraded.
- Final Attention Extraction: Standard Transformer blocks pass data through an Attention sub-layer, followed by the MoE sub-layer. Because the final MoE sub-layer injects one last burst of routing noise, SAME simply bypasses it, extracting the final sentence embedding directly after the last layer's Attention sub-layer. Better yet, because that final MoE sub-layer is now unused, its entire expert budget is scooped up and redistributed to earlier, more useful layers!
Datasets
Because SAME is training-free, no training datasets are used.
- Calibration & Validation: The STS-B validation set is used once to precompute layer-wise routing stability scores and perform a grid search for the two hyperparameters ($\alpha$ for budget disparity across layers, and $\beta$ for expert scaling), ensuring zero overlap with test sets.
- Evaluation: Seven standard Semantic Textual Similarity (STS) benchmarks—STS 2012–2016, STS-B, and SICK-R—where human annotators scored sentence pairs from 0 to 5. No new benchmarks were introduced.
Key Insights and Ideas
- More capacity makes unstable layers worse, not better: You might assume an unstable layer needs more experts to average out the noise. An ablation flipping the allocation strategy proved the exact opposite: giving extra experts to jittery routers amplifies variance and actively hurts performance.
- Context tokens need full MoE power: When the authors tried scaling down routed experts across all tokens—or simply activating fewer experts on the final token—performance dropped. The model needs full nonlinear MoE capacity to build rich context across the sentence, requiring surgical dampening only at the final aggregation step.
- Implicit routing beats explicit routing: A prior MoE method (MoEE) explicitly glues router weights onto hidden states to boost embeddings. Surprisingly, plain hidden states paired with SAME outperformed MoEE paired with SAME. By baking routing stability directly into the forward pass, explicit router signals become redundant.
Key Results
Tested across three distinct MoE architectures (DeepSeekMoE-16B, Qwen1.5-MoE-A2.7B, and OLMoE-1B-7B) using Spearman’s rank correlation ($\times 100$):
- Consistent Gains: Applied to standard PromptEOL hidden states (HS), SAME boosted average scores across all seven STS tasks by +11.38 points on DeepSeekMoE-16B (61.72 to 73.10), +6.04 points on Qwen1.5-MoE (68.27 to 74.31), and +3.72 points on OLMoE (72.88 to 76.60).
- Plug-and-Play Superiority: SAME consistently outperformed existing training-free LLM embedding boosters like Echo (repeating the input twice) and TP, while incurring zero additional inference overhead.
- Complementary Design: Ablations on OLMoE showed that while skipping the final MoE layer gives the biggest solo boost (+3.87), combining all three components yields the highest jump (+5.94 on STS-B validation).
Limitations and Future Work
Not discussed in the paper. (Though observant readers may note that the framework relies on a small labeled validation set like STS-B to tune its two scaling hyperparameters, $\alpha$ and $\beta$, for each new model backbone, and its evaluation focuses exclusively on semantic textual similarity rather than broader retrieval tasks.)
Summary updated