What is AI data quality filtering?
Data quality filtering removes low-quality, duplicated, harmful or off-target-language records from a model's training data or from documents indexed for retrieval, using rules and classifiers. Large language model performance depends heavily on pre-training data quality and size.
Unlike deduplication, which only removes repeated content, quality filtering also covers language, length, format, harmful content and personal data; it often includes deduplication as a step.
- Topic
- Infrastructure and runtime
- Also known as
- Data filtering, quality filtering
- Origin
- Web-scale pre-training corpora; 2019, the C4 corpus
How AI data quality filtering works
- Language identification removes off-target pages; one corpus dropped pages with below 0.99 probability of being English.
- Rule-based filters drop pages under three sentences, lines without terminal punctuation, placeholder text and pages containing code.
- Exact substring matching finds repeated content; hash-based matching finds near-duplicate documents.
- Classifiers score content on criteria such as quality or educational value; personal data such as email and IP addresses is anonymised.
In more detail
Filtered versus unfiltered data
After filtering, the C4 corpus held about 750 GB of clean English text while its unfiltered version was 6.1 TB; the model trained on the unfiltered version performed worst on every task. In the FineWeb study each filtering step also gave a relative performance boost on benchmark tasks. More data is not always better; a smaller cleaned corpus can produce a better model.
Commonly confused terms
| Term | How it differs |
|---|---|
| Data contamination | Data contamination is when evaluation examples leak into training data. Quality filtering and deduplication help reduce this overlap; in one study train-test overlap affected over 4% of the validation sets of standard datasets. |
Why AI data quality filtering matters for on-premises AI
In the C4 study, removing heuristic filters degraded performance on every task. A deduplication study found that over 1% of models' unprompted output was copied verbatim from training data and that deduplication cut memorised output tenfold. For retrieval, injecting five malicious texts per target question into a knowledge base of millions achieved a 90% attack success rate. Retrieval-Augmented Generation documents are therefore filtered before indexing too.
This page gives general information and is not legal advice.
Before loading internal documents into an in-house RAG system, a bank filters them: duplicates are removed, customer ID numbers masked and documents from unverified sources quarantined. Rejected records and reasons are logged; data is not sent to an external AI service.
Common questions
Is data quality filtering only needed for pre-training?
No. The same principle applies to fine-tuning data and to documents indexed for RAG. Even a few malicious texts in retrieval data can steer a model's answers.
Can filtering introduce bias?
Yes. A study of the C4 corpus showed that a blocklist filter disproportionately removed text in dialects associated with minority identities and text discussing those identities. Removed data is therefore sampled and reviewed too.
Is there a legal requirement on data quality for high-risk systems?
Yes. The EU AI Act requires training, validation and testing data sets of high-risk systems to be relevant, sufficiently representative and as free of errors as possible; data preparation such as cleaning is part of data governance.
Related terms
- Training data
- Training data deduplication
- AI data governance
- Retrieval-augmented generation (RAG) poisoning
- AI document ingestion
Sources
- Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer, arXiv, 2019
- Deduplicating Training Data Makes Language Models Better, ACL, 2022
- Documenting Large Webtext Corpora: A Case Study on the Colossal Clean Crawled Corpus, EMNLP, 2021
- The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scale, arXiv, 2024
In the glossary: Glossary, A to D