对比代码模型合并与数据混合,发现大模型用合并更优,小模型用混合更好。
Multi-task Code LLMs: Data Mix or Model Merge?
- 大模型用模型合并,小模型用数据混合来实现多任务能力
- 7B模型合并后代码生成性能保留96%,甚至超越单任务微调模型
- 适合资源受限场景,为智能体系统提供高效代码模型方案
近期研究提倡在智能体框架中部署小型专业化代码大模型,结合前沿模型以提升效率。本文对比了构建小型多任务代码大模型的两种策略:数据混合与模型合并。我们在两个模型家族(Qwen Coder 和 DeepSeek Coder)上,分别在20亿和70亿参数规模下,对代码生成与代码摘要任务进行微调。在HumanEval、MBPP和CodeXGlue基准上的评估显示,在更大规模下模型合并整体表现更优,能保留96%的专业模型代码生成性能,同时维持摘要能力。值得注意的是,合并模型甚至可超越单独微调的模型——最优配置的Qwen Coder 2.5 7B模型在HumanEval上达到92.7% Pass@1,优于其单任务微调版本的90.9%。在较小规模下,数据混合则更优。我们还引入权重分析技术,揭示不同任务对模型参数的影响及其对合并策略的意义。结果表明,合理设计的合并与混合策略可在不显著损失性能的前提下整合多任务能力,适用于资源受限的部署场景。
原文摘要 · Abstract (English)
Recent research advocates deploying smaller, specialized code LLMs in agentic frameworks alongside frontier models, sparking interest in efficient strategies for multi-task learning that balance performance, constraints, and costs. We compare two approaches for creating small, multi-task code LLMs: data mixing versus model merging. We conduct extensive experiments across two model families (Qwen Coder and DeepSeek Coder) at two scales (2B and 7B parameters), fine-tuning them for code generation and code summarization tasks. Our evaluation on HumanEval, MBPP, and CodeXGlue benchmarks reveals that model merging achieves the best overall performance at larger scale across model families, retaining 96% of specialized model performance on code generation tasks while maintaining summarization capabilities. Notably, merged models can even surpass individually fine-tuned models, with our best configuration of Qwen Coder 2.5 7B model achieving 92.7% Pass@1 on HumanEval compared to 90.9% for its task-specific fine-tuned equivalent. At a smaller scale we find instead data mixing to be a preferred strategy. We further introduce a weight analysis technique to understand how different tasks affect model parameters and their implications for merging strategies. The results suggest that careful merging and mixing strategies can effectively combine task-specific capabilities without significant performance degradation, making them ideal for resource-constrained deployment scenarios.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。