Skip to main content
QUICK REVIEW

[论文解读] BioCoder: A Benchmark for Bioinformatics Code Generation with Large Language Models

Xiangru Tang, Bill Qian|arXiv (Cornell University)|Aug 31, 2023
Genetics, Bioinformatics, and Biomedical Research被引用 4
一句话总结

BioCoder 引入了一项全面的基准测试,用于评估大型语言模型(LLMs)在生成生物信息学特定代码方面的能力,该基准测试基于 GitHub 上的 1,026 个 Python 函数和 1,243 个 Java 方法,以及来自 Rosalind 项目中的 253 个示例。该基准测试表明,需要长上下文(≥2600 个标记)并具备特定领域生物信息学知识的模型,其性能优于通用模型,其中 GPT-4 的 Pass@K 得分比小型模型最高高出 25%。

ABSTRACT

Pre-trained large language models (LLMs) have significantly improved code generation. As these models scale up, there is an increasing need for the output to handle more intricate tasks and to be appropriately specialized to particular domains. Here, we target bioinformatics due to the amount of domain knowledge, algorithms, and data operations this discipline requires. We present BioCoder, a benchmark developed to evaluate LLMs in generating bioinformatics-specific code. BioCoder spans much of the field, covering cross-file dependencies, class declarations, and global variables. It incorporates 1,026 Python functions and 1,243 Java methods extracted from GitHub, along with 253 examples from the Rosalind Project, all pertaining to bioinformatics. Using topic modeling, we show that the overall coverage of the included code is representative of the full spectrum of bioinformatics calculations. BioCoder incorporates a fuzz-testing framework for evaluation. We have applied it to evaluate various models including InCoder, CodeGen, CodeGen2, SantaCoder, StarCoder, StarCoder+, InstructCodeT5+, GPT-3.5, and GPT- 4. Furthermore, we fine-tuned one model (StarCoder), demonstrating that our training dataset can enhance the performance on our testing benchmark (by >15% in terms of Pass@K under certain prompt configurations and always >3%). The results highlight two key aspects of successful models: (1) Successful models accommodate a long prompt (> 2,600 tokens) with full context, including functional dependencies. (2) They contain domain-specific knowledge of bioinformatics, beyond just general coding capability. This is evident from the performance gain of GPT-3.5/4 compared to the smaller models on our benchmark (50% vs. up to 25%). Availability and implementation: Code is available at: https://github.com/gersteinlab/biocoder and https://biocoder-benchmark. github.io/.

研究动机与目标

  • 解决在生物信息学代码生成任务中缺乏全面、特定领域的基准测试的问题。
  • 从经过同行评审的论文中提取的 1,720 个生物信息学仓库中,创建一个高质量、具有代表性的真实世界生物信息学代码数据集,涵盖 GitHub 仓库和 Rosalind 项目。
  • 评估上下文长度和特定领域生物信息学知识对 LLM 在生物信息学任务中性能的影响。
  • 开发一个模糊测试框架,以确保对代码生成模型进行可靠且可扩展的评估。
  • 证明在 BioCoder 数据集上进行微调可显著提升 LLM 的性能,尤其是在处理复杂、多文件依赖关系和领域特定逻辑方面。

提出的方法

  • 从经过同行评审的论文中精选 1,720 个生物信息学仓库,提取出包含类声明和全局变量等完整上下文的 1,026 个 Python 函数和 1,243 个 Java 方法。
  • 整合来自 Rosalind 项目的 253 个生物信息学问题,重点关注 DNA/RNA 分析和序列处理等核心主题。
  • 设计一种解析工具,从大型代码库中提取函数规范、注释和依赖关系,同时保留跨文件和跨包的关系。
  • 构建一个模糊测试框架,通过自动、可扩展地执行生成的函数来评估代码的正确性。
  • 在 1,000 次迭代中应用 Pass@K 评估,以衡量生成代码的功能正确性和鲁棒性。
  • 进行消融研究,以区分记忆化与真正的代码生成能力,确保模型具备泛化能力。
Figure 1: Overview of our contribution in BioCoder .
Figure 1: Overview of our contribution in BioCoder .

实验结果

研究问题

  • RQ1在生成正确生物信息学代码方面,具有长上下文窗口(≥2600 个标记)的 LLM 相较于上下文较短的模型,其性能优势有多大?
  • RQ2与通用编程知识相比,生物信息学领域的特定知识在多大程度上影响 LLM 的性能?
  • RQ3在 BioCoder 数据集上进行微调是否能显著提升 LLM 在生物信息学任务中的代码生成准确性?
  • RQ4提示格式元素(如注释符号 #)在提升代码生成可靠性方面起到什么作用?
  • RQ5BioCoder 基准测试在多大程度上代表了生物信息学代码生成任务的完整范围?

主要发现

  • 具有长上下文(≥2600 个标记)的模型在处理跨文件依赖关系和复杂函数调用时,显著优于上下文较短的模型。
  • GPT-4 的 Pass@K 得分比 InCoder 和 CodeGen 等小型模型最高高出 25%,表明由于具备领域特定知识,性能差距明显。
  • 在 BioCoder 上对 StarCoder 进行微调后,在某些提示配置下 Pass@K 提升超过 15%,在所有配置下至少提升 3%。
  • 在提示中包含注释符号(#)可生成更整洁、可运行的代码输出,减少冗余文本和运行时错误。
  • 通过主题建模,该基准测试在生物信息学主题方面表现出高覆盖率,证实其在核心生物信息学工作流中的代表性。
  • 消融研究证实,模型并非简单地记忆解决方案,而是主动生成正确代码,验证了该基准测试在评估中的可靠性。
Figure 2: A diagram of the BioCoder construction process involving custom GitHub repository cleaning, parsing, and function selection, as well as context and test case creation and a massively dockerized testing framework.
Figure 2: A diagram of the BioCoder construction process involving custom GitHub repository cleaning, parsing, and function selection, as well as context and test case creation and a massively dockerized testing framework.

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。