FPMoE:稀疏混合专家模型攻克函数式代码生成难题

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

精选理由

函数式编程开发者终于有了专属的代码生成模型——FPMoE用稀疏MoE解决了跨语言干扰和抽象丢失两大痛点,且3B参数就能达到14B模型的效果,值得Haskell/OCaml/Scala用户直接上手测试。

AI 摘要

现有大模型在函数式编程语言(如Haskell、OCaml、Scala)上表现远逊于命令式语言。研究者发现,单独微调每种语言无法共享函数式抽象,而多语言混合微调又会导致跨语言干扰。为此,他们提出FPMoE,一个基于稀疏混合专家架构的轻量级开源代码生成模型,包含三个语言专用专家和一个共享专家,后者捕捉单子推理、类型导向编程等跨语言模式。在FPEval基准上,FPMoE仅用3B活跃参数就超越了微调基线,性能匹敌DeepSeek-Coder-6.7B、Qwen2.5-Coder-14B-Instruct等更大模型。

原文 · arXiv: DeepSeek

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

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.