SPADE: Synthesizing Data Quality Assertions for Large Language Model Pipelines

Shreya Shankar, Haotian Li, Parth Asawa, Madelon Hulsebos, Yiming Lin, J. D. Zamfirscu-Pereira, Harrison Chase, Will Fu-Hinthorn, Aditya G. Parameswaran, Eugene Wu

TL;DR

This paper introduces SPADE, a system that automatically generates data quality assertions for Large Language Model (LLM) pipelines. By analyzing prompt version histories and using an Integer Linear Program (ILP) formulation, SPADE efficiently synthesizes and filters assertions, significantly reducing the number of assertions needed and minimizing false failures, making LLM pipeline deployment more robust.

What Problem Does This Paper Address?

Large Language Models (LLMs) are increasingly used in complex pipelines for data processing and generation. However, LLMs are prone to errors and unpredictable outputs, posing a significant challenge for reliable deployment. While data quality assertions can help catch these errors, manually creating and selecting the right set of assertions is time-consuming, difficult, and requires significant expertise. Developers often struggle to predict all possible failure modes and manage a large number of assertions. This paper addresses the need for an automated method to synthesize and select effective data quality assertions for LLM pipelines with minimal developer effort.

Methods

SPADE employs a two-pronged approach:

  1. Candidate Assertion Generation: SPADE analyzes the "prompt version histories" of LLM pipelines. Developers often iterate on prompts, and the changes (deltas) between versions implicitly encode data quality requirements. SPADE categorizes these prompt deltas using a novel taxonomy and then uses LLMs to synthesize candidate assertion functions (Python code) that capture these requirements. This component has been released and used for over 2000 pipelines.
  2. Assertion Filtering: To address the issue of having too many, potentially redundant or inaccurate, candidate assertions, SPADE formulates the problem as an Integer Linear Program (ILP).
  3. SPADEcov: This version aims to select a minimal set of assertions that maximize coverage of actual failures and minimize false failure rates, given a set of labeled examples.
  4. SPADEsub: This version introduces "assertion subsumption" to handle data-scarce settings. If one assertion logically implies another, the subsumed assertion can be discarded. This approach leverages LLMs (specifically GPT-4) to identify subsumption relationships and incorporates them into the ILP to further reduce the number of selected assertions, especially when labeled data is limited.

Datasets

The evaluation was conducted on nine real-world LLM pipelines.

  • Eight pipelines were sourced from LangChain Hub, and one was a proprietary pipeline.
  • For each pipeline, approximately 75 examples (inputs and outputs) were collected or synthetically generated.
  • Six of these pipelines were used to develop the prompt delta taxonomy.
  • For some pipelines, data was sourced from Kaggle, while for others, datasets were synthetically generated using GPT-4 and manually reviewed.
  • The paper does not introduce a new benchmark dataset but rather uses existing LLM pipelines and their associated data for evaluation.

Key Insights and Ideas

  • Prompt Deltas as a Rich Source for Assertions: Analyzing the evolution of prompts (deltas) reveals implicit data quality requirements that developers embed over time. This is a more effective way to generate candidate assertions than directly asking an LLM to "write assertions."
  • Assertion Subsumption for Data Scarcity: In scenarios with limited labeled data, assertion subsumption is a crucial technique. It allows SPADE to select assertions that cover potentially unrepresented failure modes, even if they don't meet strict coverage thresholds on the limited available data.
  • ILP for Optimal Assertion Selection: Formulating the assertion selection problem as an ILP allows for a principled way to balance competing objectives like coverage, false failure rate, and the number of assertions.
  • LLMs for Subsumption Assessment: GPT-4 can be effectively used to identify subsumption relationships between candidate assertions, although precision is prioritized over recall due to the scale of the problem.

Key Results

  • SPADE efficiently reduces the number of assertions by 14% and decreases false failures by 21% compared to simpler baselines.
  • The ILP formulation for filtering assertions is computationally feasible, with average runtimes under one second for most pipelines.
  • SPADEsub, which incorporates subsumption, is particularly effective in data-scarce settings, selecting fewer assertions while maintaining good coverage and low false failure rates.
  • The candidate assertion generation component has been deployed and used to generate assertions for over 2000 pipelines across various industries.
  • GPT-4 achieved an F1 score of 0.8135 for categorizing prompt deltas.

Limitations and Future Work

  • LLM Limitations in Subsumption: While GPT-4 is used for identifying subsumption, it may not recall all possible subsumptions, potentially leading to duplicate assertions.
  • Threshold Sensitivity: The performance of SPADEcov is sensitive to the chosen coverage (α) and false failure rate (τ) thresholds, especially with small labeled datasets. Developers might need to adjust these values.
  • Human-in-the-Loop Interface: The authors suggest developing a human-in-the-loop interface to help developers understand tradeoffs between assertions and to facilitate on-the-fly labeling.
  • Active Learning for Labeling: Active learning could be explored to intelligently sample and label new data points to improve assertion coverage, especially in data-scarce scenarios.
  • Automated Assertion Updates: Developing mechanisms to automatically update assertion sets in deployed pipelines as new failure modes emerge is a promising future direction.

Summary updated

BibTeX
@article{shankar2024spade,
  author = {Shreya Shankar and Haotian Li and Parth Asawa and Madelon Hulsebos and Yiming Lin and J. D. Zamfirscu-Pereira and Harrison Chase and Will Fu-Hinthorn and Aditya G. Parameswaran and Eugene Wu},
  title = {{SPADE: Synthesizing Data Quality Assertions for Large Language Model Pipelines}},
  journal = {Proc. VLDB Endow.},
  year = {2024},
  doi = {10.14778/3685800.3685835},
}
Figure