Skip to main content
QUICK REVIEW

[Paper Review] LLMs for Science: Usage for Code Generation and Data Analysis

Mohamed Nejjar, Luca Zacharias|arXiv (Cornell University)|Nov 28, 2023
Scientific Computing and Data Management9 citations
TL;DR

This paper empirically evaluates several LLM-based tools for coding tasks in science, focusing on code generation, data analysis, and data visualization, and discusses strengths, weaknesses, and risks such as confabulation.

ABSTRACT

Large language models (LLMs) have been touted to enable increased productivity in many areas of today's work life. Scientific research as an area of work is no exception: the potential of LLM-based tools to assist in the daily work of scientists has become a highly discussed topic across disciplines. However, we are only at the very onset of this subject of study. It is still unclear how the potential of LLMs will materialise in research practice. With this study, we give first empirical evidence on the use of LLMs in the research process. We have investigated a set of use cases for LLM-based tools in scientific research, and conducted a first study to assess to which degree current tools are helpful. In this paper we report specifically on use cases related to software engineering, such as generating application code and developing scripts for data analytics. While we studied seemingly simple use cases, results across tools differ significantly. Our results highlight the promise of LLM-based tools in general, yet we also observe various issues, particularly regarding the integrity of the output these tools provide.

Motivation & Objective

  • Explore how current LLM-based tools support coding-related tasks in scientific work (code generation, data analysis, data visualization).
  • Assess the correctness, efficiency, and comprehensibility of generated code and analyses across multiple tools.
  • Identify cross-tool differences, limitations, and risks (e.g., output integrity and confabulation) in research workflows.

Proposed method

  • Select a range of LLM-based tools (ChatGPT GPT-3.5, ChatGPT GPT-4, Google Bard, Bing Chat, YouChat, GitHub Copilot, GitLab Duo).
  • Define three coding-related use cases: matrix multiplication in Java with multi-threading, data analysis in Python, and data visualization in R.
  • Use two prompt variants per use case and evaluate outputs against criteria including correctness, efficiency, and comprehensibility using an assessment rubric.
  • Conduct multiple runs to address non-determinism and provide a replication package with interaction logs.

Experimental results

Research questions

  • RQ1How well do current LLM tools generate correct and efficient code for typical scientific programming tasks?
  • RQ2To what extent can LLMs support data analysis and data visualization tasks in scientific workflows without human intervention?
  • RQ3 What are the qualitative differences in code quality, documentation, and user experience across tools for these use cases?
  • RQ4What risks (e.g., confabulation, data format mismatches) emerge when applying LLMs to scientific coding tasks?
  • RQ5How do results vary across tool types (GPT-based, PaLM-based, Claude-based) for the same tasks?

Key findings

  • Most tools produced correct executable code for matrix multiplication on first attempt, with Google Bard requiring human intervention and GitLab Duo delivering limited single-threaded output.
  • Data analysis and visualization tasks showed substantial variability; GPT-4 generally required less intervention and produced more accurate analyses and graphs, while Bing Chat and Google Bard often produced misleading results.
  • Non-determinism and data-format dependencies emerged as major challenges, with some tools failing to handle data structures or requiring post-hoc corrections.
  • Comprehensibility and documentation quality varied; some tools provided helpful comments and documentation, while others produced succinct or undocumented code.
  • GPT-4.0 tended to perform best overall across data analysis and visualization tasks, with notable strengths in running code and visual quality; other tools showed issues in accuracy and visualization alignment.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.