SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.10814 · 2024

Your Mixture-of-Experts LLM Is Secretly an Embedding Model For Free

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 6 functions out of this paper's own repositories and ran 6 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
tianyi-lab/moe-embedding canonical 4 of 4
copy not recorded — 2 of 2
FunctionStatusWhere it lives
apply_rotary_pos_emb Ran this paper's copy was not recorded; identical code first harvested from fe1ixxu/ALMA
pointer only · get_code("bac65c3dafaec040")
get_gpus_max_memory Ran tianyi-lab/moe-embedding/eval_mteb.py
pointer only (licence: NONE) · get_code("aecadcaa2ac48b1b")
gritlm_instruction_format Ran tianyi-lab/moe-embedding/eval_mteb.py
pointer only (licence: NONE) · get_code("62866964865efbd3")
load_balancing_loss_func Ran tianyi-lab/moe-embedding/models/modeling_olmoe.py
pointer only (licence: NONE) · get_code("d0725ff0666ee959")
rotate_half Ran this paper's copy was not recorded; identical code first harvested from fe1ixxu/ALMA
pointer only · get_code("b99eea6376d1e212")
zephyr_instruction_format Ran tianyi-lab/moe-embedding/eval_mteb.py
pointer only (licence: NONE) · get_code("a591f38d473d9770")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

While large language models (LLMs) excel on generation tasks, their decoder-only architecture often limits their potential as embedding models if no further representation finetuning is applied. Does this contradict their claim of generalists? To answer the question, we take a closer look at Mixture-of-Experts (MoE) LLMs. Our study shows that the expert routers in MoE LLMs can serve as an off-the-shelf embedding model with promising performance on a diverse class of embedding-focused tasks, without requiring any finetuning. Moreover, our extensive analysis shows that the MoE routing weights (RW) is complementary to the hidden state (HS) of LLMs, a widely-used embedding. Compared to HS, we find that RW is more robust to the choice of prompts and focuses on high-level semantics. Motivated by the analysis, we propose MoEE combining RW and HS, which achieves better performance than using either separately. Our exploration of their combination and prompting strategy shed several novel insights, e.g., a weighted sum of RW and HS similarities outperforms the similarity on their concatenation. Our experiments are conducted on 6 embedding tasks with 20 datasets from the Massive Text Embedding Benchmark (MTEB). The results demonstrate the significant improvement brought by MoEE to LLM-based embedding without further finetuning.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2410.10814")
get_code_for_paper("2410.10814")
have("2410.10814")

Connect an agent — have() is free.