[feat] Add data cleaning in `fast-llm prepare`
@bigximik ci sta già lavorando.
Dal 23/3/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
🎯 Goal (What & Why)
Add a comprehensive data cleaning stage to the fast-llm prepare command.
fast-llm prepare currently downloads and tokenizes HuggingFace datasets into Fast-LLM's .bin / .idx format using a distributed torchrun setup. However, it performs no data cleaning, which limits training quality and poses risks around PII and malicious content.
This ticket adds a required data cleaning phase that is configurable, fast, and integrated into the distributed preprocessing loop. The goal is to improve model quality, reduce noise, follow best practices (see OLMo-2), and meet responsible AI standards by removing PII and malware from the training corpus.
🚀 Execution Plan
Step 1: What is the smallest working version?
- Extend
fast-llm prepareto apply a modular and configurable cleaning pipeline during preprocessing. - All cleaning steps must be integrated into the existing
torchrunCPU-only distributed setup, preserving parallelism.
Step 2: Required cleaning filters (all must be implemented):
- Length filtering
- Remove documents exceeding a configurable max length (in characters or tokens).
- n-gram repetition
- Remove documents with ≥N repeated n-grams (default: 32), as in OLMo-2.
- Frequency-based filtering
- Remove documents where:
- The most frequent word exceeds X% of total tokens (default: 30%).
- The top-2 most frequent words together exceed Y% of total tokens (default: 50%).
- Remove documents where:
- Binary content filtering
- Remove documents that contain mostly binary data.
- Numerical content filtering
- Remove documents with a high percentage of numeric tokens (default: configurable threshold, e.g., 50%).
- PII redaction
- Integrate Microsoft Presidio for detection and redaction or removal of documents containing sensitive personal information.
- Malware removal
- Integrate ClamAV to scan documents and remove any that trigger detections.
All thresholds and filter behaviors must be exposed via the CLI and config files. Document-level logs or counters should be maintained for each filter to aid debugging and analysis.
📌 Acceptance Criteria
- All listed filters are implemented and integrated into
fast-llm prepare. - Cleaning is fully configurable, both via CLI and YAML config files.
- The implementation works with the existing distributed CPU setup (torchrun + Gloo).
- Performance remains acceptable.
- Logs report how many documents are removed by each filter.
- Code is tested and documented.
- PR includes a performance/impact summary and example CLI usage.
🛠️ Project Management
- Assign the project to the Fast-LLM project.
- Set the
Estimatefield (in days) in the GitHub project. - Use the
Sizefield to categorize the PR size (Small/Medium/Large). - Assign an owner when opening the issue.
- Lingua principale
- Python
- Stelle
- 337
- Fork
- 52
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ServiceNow/Fast-LLM
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
ServiceNow/Fast-LLM#556 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
ServiceNow/Fast-LLM#538 ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 12/100
ServiceNow/Fast-LLM#533 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
ServiceNow/Fast-LLM#510 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 12/100
ServiceNow/Fast-LLM#507 ·
Tutte le issue di ServiceNow/Fast-LLM
Issue simili
-
question
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
conda-forge/vc-feedstock#132 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
limitlessprojects/Go-Hybrid#3342 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
UKGovernmentBEIS/inspect_ai#6268 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
LSSTDESC/rail_sompz#42 ·
-
All tests fail with 'EXITED with status 3' on pytest 9.2.0 (TestReport._id is not marshallable)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
pytest-dev/pytest-forked#113 ·