arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.11411cs.SE
收藏

通过扰动数据微调提升大语言模型在代码任务中的鲁棒性

Improving the Robustness of Large Language Models for Code Tasks via Fine-tuning with Perturbed Data

Polytechnique Montréal(蒙特利尔理工大学)

Yang Liu, Armstrong Foundjem, Xingfang Wu, Heng Li, Foutse Khomh

AI总结:

通过扰动数据微调提升大语言模型在代码任务中的鲁棒性,以增强其对对抗性输入的防御能力,同时注意性能的平衡。

摘要:

在软件开发快速演变的背景下,大语言模型(LLMs)已成为代码生成、完成、分析和修复等任务中不可或缺的工具。确保这些模型在处理多样化输入时的鲁棒性至关重要,因为输入的差异可能导致错误或不安全的代码输出。本工作旨在通过扰动数据集微调LLMs,以提高其在编码相关任务中对潜在对抗性输入的鲁棒性。具体而言,我们研究了通过扰动数据集微调LLMs对模型对抗性输入鲁棒性的影响。我们通过在字符级、词级和句子级扰动数据集上微调模型,系统评估了LLM的鲁棒性,将结果与基础模型和未扰动数据集微调的模型进行比较。结果表明,使用扰动数据集微调LLMs显著提高了模型的鲁棒性(RD通常下降约4% - 6%),尤其是对于鲁棒性相对较弱的模型。然而,这一微调过程通常会导致轻微的性能下降(pass@1通常下降约1% - 3%),尽管偶尔会观察到性能提升。结论与意义:通过扰动数据集微调编码任务的LLMs有效提高了其鲁棒性,但以轻微的性能下降为代价,强调了在编码应用中平衡LLMs的鲁棒性和性能的重要性。

英文摘要:

Context: In the fast-paced evolution of software development, Large Language Models (LLMs) have become indispensable tools for tasks such as code generation, completion, analysis, and bug fixing. Ensuring the robustness of these models against potential vulnerabilities from handling diverse inputs is critical, as variations in input can lead to incorrect or insecure code outputs. Objective: This work aims to improve the robustness of LLMs for coding-related tasks against potential adversarial inputs. Specifically, we investigate how fine-tuning LLMs with perturbed datasets impacts their robustness against input perturbations. Method: We systematically evaluated LLM robustness by fine-tuning models using datasets perturbed at character-level, word-level, and sentence-level, comparing results against base models and models fine-tuned on unperturbed datasets. Results: Fine-tuning LLMs with perturbed datasets significantly improves model robustness (RD usually drops around 4\% - 6\%), especially for models with relatively weak robustness. However, this fine-tuning process typically results in a slight performance decrease (pass@1 usually drops around 1\% - 3\%) compared to fine-tuning with unperturbed datasets, although occasional performance improvements are observed. Conclusion \& Implications: Fine-tuning LLMs for coding tasks with perturbed data effectively enhances their robustness at the cost of a minor performance reduction, emphasizing the importance of balancing the robustness and performance of LLMs for coding applications.

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

↑