In this article
The configured filtering unit can change the document text; metadata averages are not a complete record of every acceptance decision.
Keep and remove express different policies
DataTrove’s FastTextClassifierFilter accepts keep-label thresholds or remove-label thresholds. Its implementation rejects supplying both modes together. With no selection labels, the component can annotate scores without imposing a label-based exclusion policy.
Specify which label means useful material for the actual collection. A classifier trained to identify a domain does not automatically estimate general document quality. Retaining a mathematical label, for example, selects a subject distribution; it does not establish factual correctness or suitability for every training objective.
The unit may be smaller than a document
The filter supports document, paragraph and sentence processing. In the inspected implementation, accepted units are joined back into the document text. A record can therefore survive after some of its content has been removed.
This matters for citations, definitions and code explanations that depend on surrounding material. Review the resulting text rather than checking only retained record counts. A successful Boolean result does not promise that the output is an unchanged original document.
Saved scores summarize processed units
The implementation predicts labels for each processed unit and can save label scores in metadata. Where several units contribute, it stores a mean for each collected label. That summary is different from a per-unit decision log.
A mean score should not be read as proof that every paragraph passed the threshold. Preserve additional unit-level evidence if later reviewers must reconstruct removals. Also record newline replacement and splitting behavior, because these transformations affect the actual strings supplied to the classifier.
Exclusion handling needs an explicit output contract
DataTrove’s base filter supports an optional exclusion writer for dropped documents. This is useful for reviewing rejected records, but the classifier filter also mutates accepted document text. A dropped-document archive alone does not reconstruct all removed spans from surviving records.
Define whether the pipeline needs original payloads, transformed payloads or both. The choice should match the intended review process and access policy. Do not assume that one optional writer provides a complete reversible history of every filtering transformation.
Validate transfer to the target domain
The fastText classification tutorial separates training and evaluation data. Apply the same discipline when moving a classifier to technical manuals, multilingual pages or another source distribution. Review acceptance errors and retained topic balance rather than reporting a threshold value as a quality guarantee.
Keep the model artifact, source revision, unit policy and thresholds with the derived dataset. This makes classifier filtering an inspectable selection process and avoids confusing score annotation, whole-record exclusion and partial text rewriting.
Primary references
DataTrove FastTextClassifierFilter source.
fastText classification tutorial.
Related explanations: Dataset split leakage; Data provenance.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.