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

研究语言模型在函数式编程语言中完成代码的性能:以 Haskell 为例

Investigating the Performance of Language Models for Completing Code in Functional Programming Languages: a Haskell Case Study

Delft University of Technology(代尔夫特理工大学)

Tim van Dam, Frank van der Heijden, Philippe de Bekker, Berend Nieuwschepen, Marc Otten, Maliheh Izadi

AI总结:

针对语言模型在 Haskell 等函数式编程语言上代码补全表现不佳的问题,该研究通过微调 CodeGPT 和 UniXcoder 并使用自建 HumanEval-Haskell 数据集进行评估,发现命令式语言预训练知识难以迁移,但仍具可行性,并公开了相关数据集与代码。

摘要:

基于语言模型的代码补全模型的使用迅速增长,帮助数千名开发者编写多种不同编程语言的代码。然而,关于代码补全模型的研究通常侧重于 Python 和 JavaScript 等命令式语言,这导致函数式编程语言的代表性不足。因此,这些模型在 Haskell 等函数式语言上通常表现不佳。为了研究是否可以缓解这一问题,我们评估了两种代码语言模型 CodeGPT 和 UniXcoder 在函数式编程语言 Haskell 上的性能。我们在来自 HuggingFace 上公开的 Haskell 数据集的函数上对模型进行微调和评估。此外,我们使用我们新颖的翻译版 HumanEval 数据集对模型进行人工评估。我们的自动评估表明,LLM 预训练中对命令式编程语言的知识可能无法很好地迁移到函数式语言,但在函数式语言上进行代码补全是可行的。因此,这表明需要更多高质量的 Haskell 数据集。在 HumanEval-Haskell 上的人工评估表明,CodeGPT 经常生成空预测和额外注释,而 UniXcoder 更经常产生不完整或不正确的预测。最后,我们发布了 HumanEval-Haskell,以及微调后的模型和在 GitHub 上重现我们实验所需的所有代码 (https://github.com/AISE-TUDelft/HaskellCCEval)。

英文摘要:

Language model-based code completion models have quickly grown in use, helping thousands of developers write code in many different programming languages. However, research on code completion models typically focuses on imperative languages such as Python and JavaScript, which results in a lack of representation for functional programming languages. Consequently, these models often perform poorly on functional languages such as Haskell. To investigate whether this can be alleviated, we evaluate the performance of two language models for code, CodeGPT and UniXcoder, on the functional programming language Haskell. We fine-tune and evaluate the models on Haskell functions sourced from a publicly accessible Haskell dataset on HuggingFace. Additionally, we manually evaluate the models using our novel translated HumanEval dataset. Our automatic evaluation shows that knowledge of imperative programming languages in the pre-training of LLMs may not transfer well to functional languages, but that code completion on functional languages is feasible. Consequently, this shows the need for more high-quality Haskell datasets. A manual evaluation on HumanEval-Haskell indicates CodeGPT frequently generates empty predictions and extra comments, while UniXcoder more often produces incomplete or incorrect predictions. Finally, we release HumanEval-Haskell, along with the fine-tuned models and all code required to reproduce our experiments on GitHub (https://github.com/AISE-TUDelft/HaskellCCEval).

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

↑