arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2604.17182cs.SEcs.AI
收藏

层间MoE路由局部性在共享前缀代码生成中的研究:令牌身份分解与编译等效分支冗余

Layer-wise MoE Routing Locality under Shared-Prefix Code Generation: Token-Identity Decomposition and Compile-Equivalent Fork Redundancy

Shun-ichiro Hayashi(Hayashi 馃一郎);Daichi Mukunoki(Mukunoki 大地);Tetsuya Hoshino(Hoshino 艾田);Takahiro Katagiri(Katagiri 谷田)

Shun-ichiro Hayashi, Daichi Mukunoki, Tetsuya Hoshino, Takahiro Katagiri

AI总结:

研究探讨了在共享前缀代码生成中,MoE专家路由的层间局部性,通过令牌身份分解和编译等效分支冗余分析,揭示了路由重叠模式及优化搜索效率的潜力。

摘要:

在基于LLM的代码生成中,多个代码候选通常从同一提示并行生成,例如最佳-N采样或多候选代码完成。这些请求可通过共同前缀共享KV缓存,但其MoE专家路由重叠程度及各层间变化仍不明确。本文通过基于树搜索的分支生成,分析Qwen3.5-35B-A3B-FP8(256路由专家,前8名)的结果,发现令牌相同位置的Jaccard相似度达0.649(40倍随机),即使令牌不同也保持0.175(11倍随机)。层间分解显示,相同令牌路由相似度在所有层均高于不同令牌,但在中间层(L14-20)下降,而不同令牌相似度在中间层达到峰值(14倍随机)。在树搜索代码生成中,67%成功编译的代码集中在前三个汇编等效组,组内差异仅包含注释和空行。研究发现,top-P搜索中的多样性对LLM代码生成的搜索效率改进提出了重大挑战。这些结果通过层间分解修正了先前工作的

英文摘要:

In LLM-based code generation, multiple code candidates are often generated in parallel from the same prompt -- for example, in best-of-N sampling or multi-candidate code completion. These requests can share KV caches through a common prefix, yet the extent to which their Mixture-of-Experts (MoE) expert routing overlaps, and how this overlap varies across layers, remains insufficiently understood. We study Qwen3.5-35B-A3B-FP8 (256 routed experts, top-8) by performing tree-search-based branching generation from a shared prefix (851 completed codes, temperature 0.7) and analyzing the results with a compiler-output-based alignment (gcc -S -O0 assembly) that controls for token-identity confounds. Our findings are threefold: (1) At positions where both sequences generated the same token, Jaccard similarity reaches 0.649 (40x random), while even at positions with different tokens it remains 0.175 (11x random). (2) A layer-wise decomposition reveals a crossing pattern: same-token routing similarity exceeds different-token similarity across all layers, but dips in the middle layers (L14-20), while different-token similarity peaks in the middle layers at 14x random. (3) In tree-search code generation, 67% of successfully compiled codes concentrate in the top three assembly-equivalent groups, and 99.6% of within-group differences consist of comments and blank lines. We show that diversity in top-P search, including beam search, poses a significant challenge. These results refine the "context-independent routing" claim of prior work through layer-wise decomposition and suggest opportunities for improving search efficiency in LLM code generation.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑