Can Large Language Models Replace Data Scientists in Clinical Research?

Zifeng Wang, Benjamin P. Danek, Ziwei Yang, Zheng Chen, Jimeng Sun · DOI

Introduction

Biomedical research is currently facing a significant "data science gap." The analysis of complex, multimodal datasets—ranging from genomics to clinical trials—requires a rare combination of deep domain expertise and advanced programming skills in languages like Python or R. While Large Language Models (LLMs) have demonstrated impressive capabilities in general coding tasks, their efficacy in the specialized, often "messy" world of clinical data science remains a subject of intense investigation. This paper explores whether LLMs can bridge this gap, acting as autonomous agents or sophisticated co-pilots for medical researchers.

The BioDSBench Framework

To rigorously evaluate LLM performance in this domain, researchers introduced BioDSBench, a benchmark consisting of 293 real-world coding tasks (128 in Python and 165 in R). Unlike synthetic benchmarks, BioDSBench was manually curated from 39 published medical studies, ensuring that the tasks reflect the actual challenges faced by researchers. The tasks utilize anonymized patient data from sources like cBioPortal and UCSC Xena, focusing on The Cancer Genome Atlas (TCGA) genomics and clinical datasets.

Tasks were categorized by complexity—Easy, Medium, and Hard—using a "semantic lines" metric. This metric counts unique logical operations rather than raw lines of code, providing a more accurate measure of the reasoning required to solve a problem.

Methodology and Adaptation Strategies

The study evaluated several adaptation strategies to enhance the performance of state-of-the-art models:

  1. Chain-of-Thought (CoT): This technique requires the model to generate a step-by-step logical plan before writing any code.
  2. Self-Reflection: An iterative debugging loop where the LLM is provided with error logs from a code sandbox and tasked with correcting its own mistakes.
  3. Retrieval-Augmented Generation (RAG): The model is equipped with a search tool to access external documentation and PubMed papers.
  4. AutoPrompt: Utilizing the DSPy framework to automatically optimize the instructions provided to the model.

Additionally, a custom human-AI platform was developed to observe how medical professionals interact with these models in real-time to solve data analysis tasks.

Key Findings

The research revealed several critical insights into the current state of AI in biomedical data science:

The Power of Reasoning

Standard "vanilla" prompting often failed because LLMs struggled to grasp complex data schemas without explicit guidance. However, Chain-of-Thought (CoT) emerged as the most effective adaptation, improving accuracy from 35.3% to 56.6%—a 21% boost. By forcing the model to "think" through the analysis logic first, the quality of the resulting code improved significantly.

Language Preferences: R vs. Python

Interestingly, LLMs performed better on tasks involving R than those involving Python. This is likely due to R’s extensive ecosystem of domain-specific packages, such as Bioconductor, which allow for more concise and direct solutions to bioinformatics problems compared to the more general-purpose nature of Python.

Surprisingly, RAG provided minimal benefits. The researchers suggest that models like GPT-4o are already sufficiently trained on public documentation, and adding external search results often introduced more "noise" than useful context.

Human-AI Synergy

In a user study involving five medical professionals, the LLMs proved to be highly effective assistants. While the models struggled to solve "Hard" tasks autonomously (dropping to 5-15% accuracy), they performed the "heavy lifting" in collaborative settings. Users were able to reuse an average of 80% of the AI-generated code, with some cases reaching up to 96% reuse. This suggests that LLMs can significantly accelerate the workflow of domain experts, even if they cannot yet replace them.

Limitations and Future Directions

Despite the promising results, several hurdles remain:

  • Data Realism: The study utilized standardized TCGA data. Real-world clinical data is often significantly less structured, which may pose a greater challenge for current models.
  • Scalability: The manual curation of BioDSBench limits its size. Future efforts must find ways to scale benchmark creation without sacrificing quality.
  • Privacy: A primary concern is the security of sensitive patient data when using proprietary LLMs. Future research must prioritize local, privacy-preserving architectures that allow models to reason about data schemas without accessing individual patient records.

Conclusion

While LLMs are not yet ready to replace data scientists in clinical research, they have matured into powerful co-pilots. Through strategic adaptations like Chain-of-Thought and iterative self-reflection, these models can handle a substantial portion of the coding burden, allowing medical professionals to focus on high-level scientific inquiry.

Summary updated

BibTeX
@misc{wang2024can,
  author = {Zifeng Wang and Benjamin P. Danek and Ziwei Yang and Zheng Chen and Jimeng Sun},
  title = {{Can Large Language Models Replace Data Scientists in Clinical Research?}},
  year = {2024},
  eprint = {2410.21591},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.21591},
}
Figure