NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

BioCoder: a benchmark for bioinformatics code generation with large language models

Xiangru Tang, Bill Qian, Rick Gao, Jiakang Chen, Xinyun Chen, Mark B. Gerstein · DOI

TL;DR

Large language models (LLMs) are getting better at generating code, but they struggle with specialized domains like bioinformatics. This paper introduces BioCoder, a new benchmark and framework to evaluate LLMs on complex, real-world bioinformatics coding tasks, including cross-file dependencies and global variables. The results show that LLMs perform best when they have access to extensive context and possess domain-specific knowledge, with GPT-3.5 and GPT-4 leading the pack.

What Problem Does This Paper Address?

The rapid advancement of LLMs has led to impressive code generation capabilities. However, existing benchmarks often focus on simple, standalone functions, failing to capture the complexity of real-world software development. This is particularly true for specialized domains like bioinformatics, which involve intricate algorithms, diverse data formats, and extensive dependencies. The paper addresses this gap by creating BioCoder, a benchmark designed to test LLMs on the more challenging, domain-specific coding tasks encountered by bioinformaticians. This includes handling cross-file dependencies, class declarations, and global variables, which are common in bioinformatics projects but often overlooked in general code generation benchmarks.

Methods

The BioCoder benchmark was constructed through a multi-stage process. First, a large corpus of bioinformatics code was collected from over 1,700 GitHub repositories. This data was then meticulously filtered and processed, involving keyword filtering, GPT-3.5 assessment for bioinformatics relevance, and manual sorting to ensure high-quality, domain-specific functions. The benchmark includes 1,026 Python functions and 1,243 Java methods, along with 253 examples from the Rosalind Project.

A key innovation is BioCoder's fuzz-testing framework. This framework allows for robust evaluation by generating numerous test cases and running them in a Dockerized environment, ensuring realistic project scenarios and scalability. The evaluation metric used is Pass@K, which measures the probability of generating at least one correct solution out of K attempts. The authors also explored various prompt engineering strategies, including "Summary Only," "Uncommented," "Summary at Bottom," "Summary at Top," and "Necessary Only," to understand how prompt structure affects LLM performance.

Datasets

The BioCoder benchmark itself is a newly introduced dataset for evaluating LLMs in bioinformatics code generation. It comprises:

  • 1,026 Python functions and 1,243 Java methods extracted from GitHub repositories.
  • 253 examples from the Rosalind Project, a bioinformatics training website.

These datasets are designed to cover a wide spectrum of bioinformatics calculations, including cross-file dependencies, class declarations, and global variables. The benchmark is divided into "public," "hidden," and "similar" sets to cater to different evaluation needs and future LLM advancements.

Key Insights and Ideas

  • Domain-specific knowledge is crucial: LLMs that possess a deeper understanding of bioinformatics concepts and libraries significantly outperform those relying solely on general coding abilities.
  • Context is king: LLMs perform better when provided with extensive context, including functional dependencies and relevant imports, especially for complex tasks.
  • Prompt engineering matters: The way a prompt is structured can significantly impact an LLM's performance. Shorter, more focused prompts ("Summary Only," "Necessary Only") often yield better results, especially for models with limited context windows.
  • Fine-tuning can boost performance: Even limited fine-tuning on a domain-specific dataset (like StarCoder on BioCoder) can lead to substantial improvements in performance.
  • Java remains a challenge: Many LLMs struggle with Java code generation, likely due to less exposure during training compared to Python.

Key Results

  • GPT-3.5 and GPT-4 demonstrated superior performance, achieving up to 50% accuracy on the BioCoder benchmark, significantly outperforming smaller models.
  • StarCoder (fine-tuned) showed a performance increase of over 15% in Pass@K under certain prompt configurations and always over 3% compared to its non-fine-tuned version.
  • Models with larger context windows (like GPT-3.5/4) generally performed better, especially with longer prompts.
  • Prompt structure significantly impacts results: "Summary Only" and "Necessary Only" prompts generally led to better performance across many models.
  • Java performance lagged: Most publicly available LLMs achieved near 0% Pass@K for Java tasks, indicating a need for more Java-focused training data.

Limitations and Future Work

The authors acknowledge several limitations:

  • Potential for circularity: The use of GPT-3.5 for dataset curation might introduce bias, potentially favoring OpenAI models. Future work could explore alternative curation methods.
  • Reproducibility concerns: The closed-source nature of some LLMs makes exact replication challenging. The authors encourage the use of versioned, open-source models and standardized protocols.
  • Limited fine-tuning: Due to computational constraints, only StarCoder was fine-tuned. Future work could explore fine-tuning other models.

The authors suggest future work could expand the benchmark to include more niche sub-domains, additional programming languages, and more complex, multi-step workflows that better simulate real-world bioinformatics tasks. They also welcome community contributions to the BioCoder benchmark.

Summary updated

BibTeX
@article{tang2024biocoder,
  author = {Xiangru Tang and Bill Qian and Rick Gao and Jiakang Chen and Xinyun Chen and Mark B. Gerstein},
  title = {{BioCoder: a benchmark for bioinformatics code generation with large language models}},
  journal = {Bioinformatics},
  year = {2024},
  doi = {10.1093/bioinformatics/btae230},
}
Figure