arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2605.27849cs.PLcs.AIcs.CL
收藏

FPMoE:一种用于函数式代码生成的稀疏混合专家方法

FPMoE: A Sparse Mixture-of-Experts Approach to Functional Code Generation

GreenNode AI;Hanoi University of Science and Technology(河内科学技术大学);Singapore University of Technology and Design(新加坡科技设计大学)

Loc Pham, Lang Hong Nguyet Anh, Thanh Le-Cong

AI总结:

针对LLM在函数式编程语言上性能差的问题,提出基于稀疏MoE架构的FPMoE模型,通过语言特定专家和共享专家分别消除干扰和捕获跨语言抽象,以3B活跃参数达到远超微调基线并匹配大模型的效果。

摘要:

尽管基于LLM的代码生成取得了快速进展,但现有模型主要针对命令式语言进行训练,导致函数式编程语言(FPLs)如Haskell、OCaml和Scala长期未被充分探索,即使是前沿模型在FPLs上的表现也明显较差。微调是一种自然的补救措施,但我们的实验表明,每种语言的微调无法捕获共享的函数式抽象,而合并的多语言微调则引入了跨语言干扰。为了解决这个问题,我们引入了FPMoE,这是一个轻量级的开源代码生成模型,基于稀疏混合专家(MoE)架构,包含三个语言特定的路由专家(分别对应Haskell、OCaml和Scala)和一个共享专家,用于捕获跨语言的函数式模式,如单子推理和类型导向编程。这种设计同时解决了两种失败模式:专用专家消除了干扰,而共享专家保留了单语言模型遗漏的抽象。在FPEval上,FPMoE显著优于微调基线,并且仅使用3B活跃参数,即可匹配包括DeepSeek-Coder-6.7B、Qwen2.5-Coder-14B-Instruct和Qwen3-Coder-30B-A3B在内的更大模型的性能。

英文摘要:

Despite rapid progress in LLM-based code generation, existing models are predominantly trained on imperative languages, leaving functional programming languages (FPLs) such as Haskell, OCaml, and Scala chronically underexplored, with even frontier models performing substantially worse on FPLs. Fine-tuning is a natural remedy, but our experiments show that per-language fine-tuning fails to capture shared functional abstractions, while merged multi-language fine-tuning introduces cross-language interference. To address this, we introduce FPMoE, a lightweight, open-source code generation model built on a sparse Mixture-of-Experts (MoE) architecture with three language-specific routed experts (one each for Haskell, OCaml, and Scala) and a shared expert that captures cross-language functional patterns such as monadic reasoning and type-directed programming. This design resolves both failure modes simultaneously: dedicated experts eliminate interference, while the shared expert preserves abstractions that per-language models miss. On FPEval, FPMoE substantially outperforms fine-tuned baselines and, with only 3B active parameters, matches the performance of much larger models including DeepSeek-Coder-6.7B, Qwen2.5-Coder-14B-Instruct, and Qwen3-Coder-30B-A3B.

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

↑