ZeroED: Hybrid Zero-Shot Error Detection Through Large Language Model Reasoning

Wei Ni, Kaihang Zhang, Xiaoye Miao, Xiangyu Zhao, Yangyang Wu, Yaoshu Wang, Jianwei Yin

Abstract

Data cleaning remains a significant bottleneck in data science, with error detection (ED) being particularly labor-intensive. Traditional methods rely on either manual rule-writing or expensive human labeling, while direct Large Language Model (LLM) inference across large datasets is cost-prohibitive. This paper introduces ZeroED, a hybrid framework that combines the reasoning capabilities of LLMs with the efficiency of traditional machine learning. By using LLMs to generate executable Python-based error-checking rules and label representative data clusters, ZeroED eliminates the need for manual intervention. Experimental results across seven diverse datasets demonstrate that ZeroED outperforms state-of-the-art methods, achieving up to a 30% improvement in F1 score while reducing token costs by 90%.

1. Introduction

Error detection (ED) is the critical first step in data cleaning, identifying anomalies such as typos, missing values, outliers, and complex rule violations. Despite its importance, ED is notoriously difficult to automate. Traditional approaches generally fall into two categories: manual criteria, where experts hard-code integrity constraints, and manual labeling, where humans annotate "clean" versus "dirty" rows to train classifiers. Both methods are difficult to scale and often fail to capture the full spectrum of data errors.

While Large Language Models (LLMs) offer a promising zero-shot alternative, their application is limited by two factors: the high cost of row-by-row inference on large-scale databases and a lack of "global" context when examining individual records. ZeroED addresses these challenges by using LLMs as high-level reasoners and feature engineers rather than simple row-level classifiers.

2. The ZeroED Framework

ZeroED operates through a four-stage pipeline designed to maximize detection accuracy while minimizing computational and financial overhead.

2.1 Feature Representation with Criteria Reasoning

Instead of processing raw text directly, ZeroED prompts an LLM to analyze the dataset's schema and sample values to generate executable Python functions. These functions act as "criteria" for identifying potential errors. By running these functions across the entire dataset, ZeroED extracts "error-reason-aware" binary features. This approach leverages the LLM's domain knowledge to create a sophisticated feature set at a fraction of the cost of direct inference.

2.2 Representative Sampling and Holistic Labeling

To avoid the cost of labeling every row, ZeroED clusters the data based on its extracted features and selects representative "centroid" samples. The system then employs a two-step labeling process:

  1. Data Distribution Reporting: The LLM generates a report on the overall data distribution.
  2. Guideline Generation: Using this report, the LLM creates a detailed "Error Detection Guideline," which it then applies to label the sampled clusters. This "think-before-labeling" approach significantly improves accuracy.

2.3 Training Data Construction

Labels from the sampled clusters are propagated back to their respective groups. To address the inherent class imbalance in error detection—where errors are typically rare—ZeroED uses the LLM to synthesize realistic erroneous examples. This results in a balanced, high-quality training set.

2.4 Detector Training

The final stage involves training a simple Multilayer Perceptron (MLP) on the LLM-enhanced features and labels. This classifier can then be deployed to detect errors across the entire dataset with high speed and low cost.

3. Experimental Evaluation

ZeroED was evaluated on seven datasets featuring both real-world and synthetic errors, including Hospital, Flights, Beers, Rayyan, Movies, Billionaire, and Tax. These datasets cover a wide range of error types, from simple missing values to complex pattern and rule violations.

3.1 Key Results

  • Accuracy: ZeroED consistently outperformed state-of-the-art baselines such as Raha and HoloDetect, showing improvements in F1 scores by as much as 30%.
  • Cost Efficiency: By utilizing clustering and sampling, ZeroED achieved a 90% reduction in token costs compared to standard LLM-based detection methods.
  • Scalability: On the 200,000-row Tax dataset, ZeroED maintained high performance where traditional LLM methods became financially and computationally infeasible.
  • Model Flexibility: While the framework performed best with larger models like Qwen2.5-72B, it remained effective even when using smaller open-source models like Llama-3-8B.

4. Discussion and Insights

The success of ZeroED highlights the value of using LLMs as feature engineers. By generating code rather than just labels, the system captures complex reasoning in a format that traditional ML models can execute efficiently. Furthermore, the use of Normalized Mutual Information (NMI) to group correlated attributes (e.g., Zip Code and City) provides the necessary context for the model to identify relational errors.

To ensure the integrity of the training data, ZeroED includes a "mutual verification" step. If the LLM-generated criteria and the LLM-generated labels disagree significantly on a specific data point, that point is discarded, ensuring the final training set remains a "gold standard."

5. Limitations and Future Work

While ZeroED significantly reduces token costs, the end-to-end runtime is still influenced by LLM API latency. Additionally, extremely rare or domain-specific errors that do not appear in sampled clusters may still be missed. Future research will explore more advanced data augmentation techniques and extend the framework to handle multi-table relational databases and non-tabular data formats.

6. Conclusion

ZeroED represents a significant step forward in automated data cleaning. By bridging the gap between LLM reasoning and traditional machine learning, it provides a scalable, cost-effective, and highly accurate solution for error detection in modern data pipelines.

Summary updated

BibTeX
@inproceedings{ni2025zeroed,
  author = {Wei Ni and Kaihang Zhang and Xiaoye Miao and Xiangyu Zhao and Yangyang Wu and Yaoshu Wang and Jianwei Yin},
  title = {{ZeroED: Hybrid Zero-Shot Error Detection Through Large Language Model Reasoning}},
  booktitle = {ICDE},
  year = {2025},
  doi = {10.1109/icde65448.2025.00234},
}
Figure