Solving Data-centric Tasks using Large Language Models

Shraddha Barke, Christian Pölitz, Carina Suzana Negreanu, Benjamin G. Zorn, José Cambronero, Andrew D. Gordon, Vu Le, Elnaz Nouri, Nadia Polikarpova, Advait Sarkar, Brian Slininger, Neil Toronto, Jack Williams

TL;DR

This paper tackles the challenge of using Large Language Models (LLMs) for data-centric tasks, like data wrangling in spreadsheets, by developing a novel "cluster-then-select" prompting technique. This method intelligently selects representative rows from input data to improve LLM performance, outperforming random selection and demonstrating LLMs' sensitivity to data context.

What Problem Does This Paper Address?

End-users and non-professional programmers often need to perform data manipulation tasks, such as cleaning and transforming tabular data. While LLMs are increasingly capable of generating code from natural language descriptions, these tasks are difficult to solve accurately when the LLM only receives a textual query without any actual data. The core problem is determining how much data and which specific rows from a potentially large dataset should be included in the LLM's prompt to maximize the chances of generating correct code. Simply providing all data is often impractical due to size and cost, while providing too little or unrepresentative data can lead to incorrect or non-generalizable code.

Methods

The paper introduces a two-pronged approach:

  1. SOFSET Dataset Creation: They mined StackOverflow to create a new dataset of real-world, complex data-centric tasks. These tasks involve multi-step data manipulation and are annotated with natural language queries and small input tables.
  2. Cluster-then-Select Prompting Technique: This is the core novel contribution. Instead of randomly selecting rows or providing all data, this technique first clusters the input data rows based on their syntactic structure (e.g., different name formats). Then, it selects a small, representative set of rows, picking a few from each identified cluster. This ensures that the prompt captures the diversity of the data, especially for tasks with significant syntactic variation.

Datasets

  • SOFSET (StackOverflow For Spreadsheet Tasks): A newly created dataset of 201 data-centric tasks, mined from StackOverflow. These tasks are categorized as data-independent (IND), data-dependent (DEP), and external-dependent (EXT).
  • Kaggle-augmented Dataset: For evaluating the cluster-then-select technique on larger inputs, 44 data-dependent tasks from SOFSET were augmented with rows from Kaggle datasets, resulting in tables of up to 1000 rows.

Key Insights and Ideas

  • Data is Crucial for Data-Centric Tasks: LLM performance drops significantly for data-dependent tasks when no data or only a single row is provided, highlighting the critical role of context.
  • Not All Data is Equal: Simply providing more data doesn't always guarantee better results, especially if the data is not representative of the task's complexity.
  • Syntactic Variation Matters: For tasks with diverse data formats (e.g., names with or without middle names), intelligently selecting representative rows is more effective than random sampling.
  • Positional Bias is Real: The order of data rows in the prompt can influence LLM performance, even with large context windows.

Key Results

  • Performance Boost with Data: Providing even a single row of data significantly improves LLM performance compared to a no-data baseline, especially for DEP and EXT tasks. For DEP tasks, the performance gap between first-row and no-data regimes was 33.8% (pass@5).
  • Cluster-then-Select Outperforms Random: The cluster-then-select technique consistently outperformed random row selection, particularly for tasks with high syntactic variation. For example, selecting 10 representative rows (represent-10) achieved a pass@5 of 0.32, outperforming random selection by 8-6%.
  • Sensitivity to Data Quantity: Performance generally improves with more representative data, with 10 representative rows yielding the best results in many experiments.
  • CODELLAMA Performance: The paper also presents results for CODELLAMA, showing similar trends of performance improvement with data, though with a larger drop for smaller models.

Limitations and Future Work

  • Dataset Limitations: The SOFSET dataset was collected from English StackOverflow posts, so its generalizability to other languages is not guaranteed. The queries are also summaries of original posts, which might simplify some nuances.
  • Clustering Algorithm: The cluster-then-select technique relies on a specific regex synthesis algorithm for clustering. Using a different clustering method could yield different results.
  • Model Dependence: Conclusions are drawn from experiments with GPT-4. Future LLMs might behave differently.
  • Future Work: The authors suggest exploring broader problem spaces, such as multi-table inputs and hierarchical table inputs, and investigating how data bias in prompts might influence code generation. They also acknowledge the need for explainability in LLM-generated code for real-world applications.

Summary updated

BibTeX
@inproceedings{barke2024solving,
  author = {Shraddha Barke and Christian Pölitz and Carina Suzana Negreanu and Benjamin G. Zorn and José Cambronero and Andrew D. Gordon and Vu Le and Elnaz Nouri and Nadia Polikarpova and Advait Sarkar and Brian Slininger and Neil Toronto and Jack Williams},
  title = {{Solving Data-centric Tasks using Large Language Models}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-naacl.41},
}
Figure