PAT: Pattern-Perceptive Transformer for Error Detection in Relational Databases

Jian Fu, Xixian Han, Xiaolong Wan, Wenjian WangarXiv 2025 · DOI

Summary

PAT (Pattern-Perceptive Transformer) is a novel framework designed to detect errors in relational databases by interleaving data tokens with learned, attribute-specific "pattern tokens." By utilizing a custom-built, adaptive tokenizer called QTA, PAT achieves state-of-the-art accuracy across diverse datasets while significantly reducing the computational overhead typically associated with large-scale deep learning models.

Introduction

Maintaining data quality in relational databases is a massive, expensive challenge. Traditional error detection relies on rigid, rule-based systems or "multi-detector" machine learning approaches that require a separate model for every single column (attribute) in a database—a strategy that doesn't scale well.

Existing deep learning methods often borrow tokenizers directly from Natural Language Processing (NLP). However, database cells are distinct from natural language sentences; they consist of short codes, long descriptions, numbers, and specific formats. Standard NLP tokenizers fail to capture these morphological "patterns," leading to poor detection of typos, outliers, and domain violations. Furthermore, many deep learning models act as "black boxes," offering little insight into why a specific cell was flagged as an error.

Methodology

The authors introduce the PAttern-perceptive Transformer (PAT), which consists of three main innovations: the QTA tokenizer, a learned pattern module, and an interleaved Transformer architecture.

Quasi-Tokens Arrangement (QTA) Tokenizer

Instead of standard subword splitting, QTA adaptively divides cell sequences based on length and character types (numbers, words, punctuation). It uses a backtracking tree to decide whether to use "Full," "Rough," or "Mass" tokenization, ensuring that short sequences remain precise while ultra-long sequences are processed efficiently.

The QTA Tokenizer uses a tree-like backtracking mechanism to handle different data types and lengths.

Learned Pattern Module

PAT learns unique embeddings for each attribute in the database. These "pattern tokens" capture the expected distribution and format of a specific column (e.g., an "ID" column vs. an "Address" column).

Interleaved Transformer Architecture

The model feeds both data tokens and pattern tokens into a Transformer encoder in an alternating sequence. This allows the model to jointly learn shared features (like common typo patterns) and attribute-specific features (like valid ranges for a specific column).

The PAT architecture interleaves data tokens with learned pattern tokens before passing them through Transformer encoders.

The authors also propose PATC (Compact), a version with optimized hyperparameters that further slashes the number of parameters and floating-point operations (FLOPs) for high-speed inference.

Experimental Evaluation

The framework was evaluated on 12 diverse datasets, including real-world data (Adult, Beers, Flights, Food, Hospital, Movies, Rayyan, Restaurants, and Soccer) and synthetic data (Billionaire, HOSP-100K, and Tax). These datasets cover a wide range of issues, including typos, missing values, outliers, and complex attribute domain violations.

Key Results

  • Superior Accuracy: PAT and PATC consistently outperformed state-of-the-art (SOTA) methods like HoloDetect and ZeroED. For example, on the Beers dataset, PAT achieved a perfect 100% F1 score, while on the large-scale HOSP-100K dataset, it reached an F1 of 88.1%.
  • Efficiency Gains: PATC significantly reduced computational costs. Compared to ROTOM (a large-model approach using RoBERTa), PATC reduced FLOPs by orders of magnitude while maintaining or improving accuracy.
  • Robustness: The model maintained high performance even as error rates in the data increased from 10% to 90%, showing it is less sensitive to "noisy" training data than previous methods.

Discussion and Insights

The success of PAT highlights several key principles in database error detection. First, context is critical: by interleaving pattern tokens, the model evaluates values against the "learned personality" of specific columns. Second, morphology often outweighs semantics in structured data; the shape of the data (e.g., "6e-2" as an outlier) is frequently more informative than semantic meaning. Finally, the Transformer's attention mechanism provides a degree of interpretability, as high attention scores often correlate directly with erroneous characters or words within a cell.

Conclusion

While PAT is highly effective at detecting syntactic and some semantic errors, extremely complex semantic errors requiring deep external world knowledge remain a challenge. Future work aims to extend the framework from detection to automated repair, using localized error information from attention maps to suggest corrections.

Summary updated

BibTeX
@misc{fu2025pat,
  author = {Jian Fu and Xixian Han and Xiaolong Wan and Wenjian Wang},
  title = {{PAT: Pattern-Perceptive Transformer for Error Detection in Relational Databases}},
  year = {2025},
  eprint = {2509.25907},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.25907},
}
Figure