Cross-lingual code generation is critical in enterprise environments where multiple programming languages coexist. However, fine-tuning large language models (LLMs) individually for each language is computationally prohibitive. This paper investigates whether parameter-efficient fine-tuning methods and optimizer enhancements can improve cross-lingual transfer from Python to languages like Java. We fine-tune the Code Llama 7B model using low-rank adaptation (LoRA) to optimize a small subset of parameters and compare Adam and Sophia optimizers, while exploring a novel Fourier-based regularization technique. Our contributions include: (1)demonstrating that LoRA fine-tuning on a small, high-quality dataset (MBPP) can exceed the pass@1 performance of the more broadly fine-tuned Code Llama-Python-7B model (40.1% vs. 38.4%); (2) showing that while Sophia achieves faster convergence than Adam, final pass@1 scores show marginal differences; and (3) presenting evidence that Fourier-based regularization during fine-tuning significantly improves cross-lingual transfer, achieving 42.1% pass@1 on Java tasks compared to the 34.2% baseline. These findings suggest that combining LoRA, optimized training methods, and frequency-domain regularization can efficiently adapt single-language LLMs to perform well across multiple programming languages.


翻译:跨语言代码生成在多种编程语言并存的企业环境中至关重要。然而,为每种语言单独微调大语言模型(LLM)在计算上成本高昂。本文探究了参数高效微调方法与优化器增强技术能否提升从Python到Java等语言的跨语言迁移能力。我们采用低秩自适应(LoRA)方法微调Code Llama 7B模型以优化少量参数,对比了Adam和Sophia优化器,并探索了一种基于傅里叶的新型正则化技术。本文的贡献包括:(1)证明在小型高质量数据集(MBPP)上进行LoRA微调,其pass@1性能(40.1%)可超越更广泛微调的Code Llama-Python-7B模型(38.4%);(2)表明尽管Sophia的收敛速度快于Adam,但最终pass@1分数差异微小;(3)提供证据表明微调过程中基于傅里叶的正则化能显著提升跨语言迁移能力,在Java任务上达到42.1%的pass@1,而基线仅为34.2%。这些发现表明,结合LoRA、优化训练方法与频域正则化,可高效适配单语言大语言模型,使其在多种编程语言上表现优异。

0
下载
关闭预览

相关内容

【ICLR2025】大型语言模型的动态低秩稀疏适应
专知会员服务
14+阅读 · 2025年2月21日
大型语言模型对齐技术综述:RLHF、RLAIF、PPO、DPO 等
专知会员服务
55+阅读 · 2024年7月24日
大模型如何迭代?北大等《大型语言模型自我进化》综述
一文看懂自然语言处理中迁移学习的现状
AI前线
10+阅读 · 2019年8月27日
基于R语言进行Box-Cox变换
R语言中文社区
45+阅读 · 2018年11月19日
简述多种降维算法
算法与数学之美
11+阅读 · 2018年9月23日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
7+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
8+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
6+阅读 · 6月17日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员