Work

LLM-Assisted Generation of Data Quality Constraints from Schema and Documentation

Year: 2026
Type: article
Abstract: Data quality constraints, executable assertions such as “fare_amount is non-negative” or “o_ orderstatus ∈ {O, F, P}”, are the backbone of production data pipelines, yet authoring them by hand is slow and requires both domain and engineering expertise. We ask whether large language models (LLMs) can draft such constraints directly from a table’s schema and natural-language documentation, and how the resulting suites compare to traditional baselines. We build an end-to-end, fully reproducible pipeline that (i) prompts an LLM to emit constraints restricted to a 21-type allowlist o Great Expectations assertions, (ii) parses and validates every candidate for executability, and (iii) measures row-level detection against a controlled error-injection benchmark spanning eight error types over four tables from the NYC Taxi and TPC-H datasets. With a parser that repairs the JSON mistakes these models actually make, executability is high for all three local models (0.90–0.99). What still tracks scale is the clean-data false-positive rate: the 32B code mode flags 9% of clean rows, while an 8B model flags 85%. On detection we keep the profiler’s per-column checks and add only the 32B model’s cross-column and format rules. The headline gain is family-level: the profiler scores 0 on cross-column logic and the ensemble scores 0.83, while keeping perfect recall on range and domain errors, at an 8.3% clean-row false-positive rate on the complementary slice. Aggregate detection on this temperature-0 suite is 0.76 against the profiler’s 0.73 (precision 0.82 vs. 0.79, recall 0.84 vs. 0.73). Adding documentation is the larges prompt lever on recall (0.56 → 0.70); a 10-row random sample reverses the gain. We release the code, prompts, injection benchmark, and the ensemble operator.
Language: English
Open Access status: gold
OpenAlex ID: W7238850949
FWCI:
Cites: 16
Cited by:
Related to: