Distributed Data Classification
NVIDIA NeMo Curator provides a module for performing distributed classification on large text datasets using GPU acceleration. This enables the categorization and filtering of text documents based on multiple dimensions such as domain, quality, safety, educational value, content type, and more. These classifications can enhance the quality of training data for large language models by identifying high-value content and removing problematic material.
How It Works
The distributed data classification in NeMo Curator works by:
- Parallel Processing: Chunking datasets across multiple computing nodes and GPUs to accelerate classification
- Pre-trained Models: Using specialized models for different classification tasks
- Batched Inference: Optimizing throughput with intelligent batching
- Consistent API: Providing a unified interface through the
DistributedDataClassifierbase class
The DistributedDataClassifier is designed to run on GPU clusters with minimal code changes regardless of which specific classifier you’re using. All classifiers support filtering based on classification results and storing prediction scores as metadata.
Distributed classification requires GPU acceleration and is not supported for CPU-only processing. As long as GPU resources are available and NeMo Curator is correctly installed, GPU acceleration is handled automatically.
Running the tutorial notebooks: The classification tutorial notebooks require the text_cuda12 or all installation extra to include all relevant dependencies. If you encounter ModuleNotFoundError, reinstall with the appropriate extra:
uv pip install “nemo-curator[text_cuda12]”
When using classifiers that download from Hugging Face (such as Aegis and InstructionDataGuard), set your HF_TOKEN environment variable to avoid rate limiting:
export HF_TOKEN=“your_token_here”
Usage
NVIDIA NeMo Curator provides a base class DistributedDataClassifier that can be extended to fit your specific model. The only requirement is that the model can fit on a single GPU. This module operates on the GPU and works within the pipeline framework using DocumentBatch processing.
Classifier Comparison
Domain Classifier
The Domain Classifier categorizes English text documents into specific domains or subject areas.
Multilingual Domain Classifier
Functionally similar to the Domain Classifier, but supports 52 languages.
Quality Classifier
The Quality Classifier assesses document quality using the NVIDIA Quality Classifier DeBERTa model.
The exact label categories returned by the Quality Classifier depend on the model configuration. Check the prediction column in your results to see the available labels for filtering with the filter_by parameter.
AEGIS Safety Classifier
The AEGIS classifier detects unsafe content across 13 critical risk categories. It requires a HuggingFace token for access to Llama Guard.
The classifier adds a column with labels: “safe,” “O1” through “O13” (each representing specific safety risks), or “unknown.” For raw LLM output, use:
Instruction Data Guard
Detects LLM poisoning attacks in instruction-response datasets. Requires HuggingFace token access.
The output includes two columns: a float score instruction_data_guard_poisoning_score and a Boolean is_poisoned.
FineWeb Educational Content Classifier
Scores documents on educational value from 0–5. This helps prioritize content for knowledge-intensive tasks.
Score Ranges and Meanings
FineWeb Mixtral and Nemotron Edu Classifiers
Similar to the FineWeb Edu Classifier but trained with different annotation sources:
- FineWebMixtralEduClassifier: Uses annotations from Mixtral 8x22B-Instruct
- FineWebNemotronEduClassifier: Uses annotations from Nemotron-4-340B-Instruct
Both provide a quality label column marking scores above 2.5 as “high_quality”:
Quality Label Mapping
Content Type Classifier
Categorizes documents into 11 distinct speech types.
Prompt Task and Complexity Classifier
Classifies prompts by task type and complexity dimensions.
Custom Model Integration
You can integrate your own classification models by extending DistributedDataClassifier. Refer to the Text Classifiers README for implementation details and examples.
Performance Optimization
NVIDIA NeMo Curator’s distributed classifiers are optimized for high-throughput processing through several key features:
Intelligent Batching and Sequence Handling
The classifiers optimize throughput through:
- Length-based sorting: Input sequences are sorted by length when
sort_by_length=True(default) - Efficient batching: Similar-length sequences are grouped together to minimize padding overhead
- GPU memory optimization: Batches are sized to maximize GPU utilization based on available memory