← All questions
EvaluationMedium· Data Quality· Contamination· Evaluation

What is n-gram decontamination and when does it fail?

N-gram decontamination is a process used to prevent data leakage by identifying and removing overlapping text sequences between training and evaluation datasets. The standard practice is to use a 13-gram threshold with document-level removal. However, this method is not foolproof; it fails to detect contamination in scenarios involving near-duplicates that fall below the threshold, cross-lingual paraphrases that retain meaning but change wording, and indirect quotations that do not match the exact n-gram sequence.

Code playground (Python)