CIBench: Evaluating Your LLMs with a Code Interpreter Plugin

Songyang Zhang, Chuyu Zhang, Yingfan Hu, Haowen Shen, Kuikun Liu, Zerun Ma, Fengzhe Zhou, Wenwei Zhang, Xuming He, Dahua Lin, Kai ChenarXiv 2024 · DOI

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities in code generation. However, existing benchmarks like HumanEval or MBPP primarily evaluate "one-and-done" tasks, such as writing a single function to pass a unit test. Real-world data science is fundamentally different; it is an iterative, multi-turn process involving data loading, cleaning, visualization, and modeling. To address this gap, we introduce CIBench, an interactive evaluation framework designed to measure how LLMs utilize code interpreters to solve complex, multi-step data science problems.

Overview of the CIBench framework, highlighting consecutive sessions, diverse tasks, and comprehensive evaluation metrics.

Methodology

CIBench employs the ReAct (Reason + Act) protocol, where the model generates a thought process, executes code in a Python environment, observes the output, and iterates. The framework supports two primary evaluation modes:

  1. End-to-End Mode: The model must autonomously solve a sequence of 10–15 progressive steps. Success at each step depends on the previous one, requiring the model to self-correct based on interpreter feedback.
  2. Oracle Mode: To isolate the cause of failure, this mode provides ground-truth code if a model fails a step. This distinguishes between a lack of domain knowledge and error propagation from earlier mistakes.

Evaluation is performed using both process-oriented metrics (e.g., execution rate) and output-oriented metrics (e.g., exact match for numeric values, structural similarity for visualizations).

Dataset Construction

The CIBench dataset comprises 234 tasks and over 1,900 questions, covering 10 essential Python libraries including Pandas, Matplotlib, PyTorch, and TensorFlow. The construction followed a hybrid LLM-human cooperative approach.

The CIBench dataset construction pipeline, involving automated generation and human refinement.

As shown in the pipeline, GPT-4 initially generated notebook templates based on diverse Python modules. These were then refined by human experts to ensure technical accuracy, diversity, and real-world relevance. Each task is structured as a Jupyter-style notebook with interconnected steps of increasing complexity.

Key Insights and Results

Evaluation of 24 LLMs revealed several critical findings:

  • The Modeling Gap: While models are proficient in data manipulation (Pandas), they struggle significantly with "Modeling" tasks (e.g., PyTorch). These tasks require high-level architectural reasoning that remains a challenge for even state-of-the-art models.
  • Reasoning as a Bottleneck: Analysis of GPT-4 failures showed that 40.4% were due to reasoning errors, whereas only 4.3% were attributed to API hallucinations. This suggests that models "know" the libraries but struggle with complex logical application.
  • Performance Hierarchy: GPT-4o and GPT-4-1106-preview lead the benchmark. Among open-source models, Llama-3-70B-Instruct performed best, though it trailed GPT-4 by approximately 10%.
  • Self-Correction and Human Assistance: Allowing models multiple attempts improved scores, particularly for syntax errors. Furthermore, the significant performance jump in Oracle mode indicates that models are better at following a guided path than maintaining long-term autonomous strategies.

Conclusion

CIBench provides a rigorous framework for evaluating LLMs in authentic data science workflows. Future work will expand the benchmark to include other languages like R and Julia and develop more robust metrics for stochastic tasks like neural network training. Improving the long-range reasoning and self-debugging capabilities of open-source models remains a primary objective for the field.

Summary updated

BibTeX
@misc{zhang2024cibench,
  author = {Songyang Zhang and Chuyu Zhang and Yingfan Hu and Haowen Shen and Kuikun Liu and Zerun Ma and Fengzhe Zhou and Wenwei Zhang and Xuming He and Dahua Lin and Kai Chen},
  title = {{CIBench: Evaluating Your LLMs with a Code Interpreter Plugin}},
  year = {2024},
  eprint = {2407.10499},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.10499},
}
Figure