Upload folder using huggingface_hub
Browse files- README.md +104 -0
- train.jsonl +0 -0
README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Data Cleaning Pipeline
|
| 2 |
+
|
| 3 |
+
I filtered the [`mookiezi/Discord-Dialogues`](https://huggingface.co/datasets/mookiezi/Discord-Dialogues) dataset to obtain only high-quality english conversation examples for fine-tuning or other analytical tasks.
|
| 4 |
+
|
| 5 |
+
The total data set went from **7,303,464** rows to **2,208** rows after strict filtering to remove the following:
|
| 6 |
+
- Low conversation turns or short conversations
|
| 7 |
+
- Non-English conversations
|
| 8 |
+
- Duplicate conversations
|
| 9 |
+
- Spammy/Repetitive conversations
|
| 10 |
+
- Filler words
|
| 11 |
+
|
| 12 |
+
# Rules
|
| 13 |
+
## Phase 1 — Load, Parse & Size Filter
|
| 14 |
+
|
| 15 |
+
The raw dataset, containing **7,303,464** samples, is loaded and each conversation's `text` field is parsed into structured `messages`. Message counts (`turns`) and token counts (`tokens`, via `cl100k_base`) are recomputed so later stages can reason about conversation size.
|
| 16 |
+
|
| 17 |
+
Conversations are kept only if they meet **both** of the following:
|
| 18 |
+
|
| 19 |
+
- At least **4 turns**
|
| 20 |
+
- Between **128** and **2,048 tokens**
|
| 21 |
+
|
| 22 |
+
Rows removed: **7,301,008** (7,303,464 → 2,456) — *the vast majority of the raw dataset was filtered out here for being too short, too long, or unparseable.*
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## Phase 2 — Language Filter
|
| 27 |
+
|
| 28 |
+
Each conversation's joined text is passed through a fast language detector. Only conversations detected as English with sufficient confidence are retained.
|
| 29 |
+
|
| 30 |
+
A row is kept only when **both** hold:
|
| 31 |
+
|
| 32 |
+
- Detected language is `en`
|
| 33 |
+
- Detector confidence ≥ **0.80**
|
| 34 |
+
|
| 35 |
+
Rows removed: **211** (2,456 → 2,245)
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## Phase 3 — Near-Duplicate Removal (MinHash LSH)
|
| 40 |
+
|
| 41 |
+
Exact and near-duplicate conversations are identified using character-5-gram MinHash signatures (256 permutations, bucketed into 32 bands of 8 rows). A row is dropped if it shares a band bucket with an already-kept row whose estimated Jaccard similarity is ≥ **0.70**. Exact duplicates are also caught via SHA-256 digest in the same pass. When duplicates exist, the **longest** copy is kept.
|
| 42 |
+
|
| 43 |
+
Rows removed: **3** (2,245 → 2,242)
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## Phase 4 — Semantic Near-Duplicate Removal
|
| 48 |
+
|
| 49 |
+
Conversations that are paraphrases or rewordings of each other — but not necessarily string-similar — are removed using `all-MiniLM-L6-v2` embeddings and a 2048-bit random-hyperplane LSH (128 bands of 16 bits). A row is dropped when its exact cosine similarity to an already-kept row is ≥ **0.80**, gated by a Hamming pre-filter to cheaply prune unrelated candidates. As in Phase 3, the **longest** copy among duplicates is kept.
|
| 50 |
+
|
| 51 |
+
Rows removed: **0** (2,242 → 2,242)
|
| 52 |
+
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
## Phase 5 — Filler & Spam Filter
|
| 56 |
+
|
| 57 |
+
Conversations dominated by low-information or spammy content are removed, while noisy turns *inside* otherwise-good conversations are preserved. Each row is scored against the rules below, and any rule firing triggers a drop. Dropped rows are written to `dropped.jsonl` along with the triggering reasons.
|
| 58 |
+
|
| 59 |
+
| Rule | Threshold | What it catches |
|
| 60 |
+
|---|---|---|
|
| 61 |
+
| `too_short` | total words < **20** | conversations too thin to be useful |
|
| 62 |
+
| `high_filler` | filler words / total words ≥ **0.50** | small-talk / interjection chatter |
|
| 63 |
+
| `low_unique` | distinct words / total words < **0.25** | repetitive spam |
|
| 64 |
+
| `repetition` | most-frequent word / total words ≥ **0.55** | single-word spam |
|
| 65 |
+
| `punct_spam` | non-alphanumeric chars / total chars ≥ **0.20** | `.....` spam |
|
| 66 |
+
| `char_run` | chars inside 5+ char runs / total chars ≥ **0.20** | `PPPP...` / `EEEE...` spam |
|
| 67 |
+
| `dup_messages` | repeated message contents / total messages ≥ **0.50** | repeated turns |
|
| 68 |
+
| `single_word` | one-word turns / total turns ≥ **0.60** | `boop` / `blep` / `kk` spam |
|
| 69 |
+
| `short_turns` | median turn length < **6 chars** | ultra-short `ok` / `hm` chatter |
|
| 70 |
+
|
| 71 |
+
Rows removed: **34** (2,242 → 2,208)
|
| 72 |
+
|
| 73 |
+
### Phase 5 drop-reason breakdown
|
| 74 |
+
|
| 75 |
+
Of the 34 dropped rows (some triggered multiple rules):
|
| 76 |
+
|
| 77 |
+
```
|
| 78 |
+
5 char_run
|
| 79 |
+
5 low_unique + repetition
|
| 80 |
+
4 low_unique + dup_messages
|
| 81 |
+
4 too_short
|
| 82 |
+
4 too_short + char_run
|
| 83 |
+
3 low_unique
|
| 84 |
+
3 dup_messages
|
| 85 |
+
3 punct_spam
|
| 86 |
+
1 too_short + char_run + single_word
|
| 87 |
+
1 single_word + short_turns
|
| 88 |
+
1 dup_messages + single_word + short_turns
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
---
|
| 92 |
+
|
| 93 |
+
## Cumulative Summary
|
| 94 |
+
|
| 95 |
+
| Phase | Input | Output | Removed |
|
| 96 |
+
|---|---|---|---|
|
| 97 |
+
| 1 — Size filter | 7,303,464 | 2,456 | 7,301,008 |
|
| 98 |
+
| 2 — Language | 2,456 | 2,245 | 211 |
|
| 99 |
+
| 3 — Near-duplicate | 2,245 | 2,242 | 3 |
|
| 100 |
+
| 4 — Semantic dedupe | 2,242 | 2,242 | 0 |
|
| 101 |
+
| 5 — Filler / spam | 2,242 | 2,208 | 34 |
|
| 102 |
+
|
| 103 |
+
**Total removed: 7,301,256 rows (~99.97% of the raw dataset).**
|
| 104 |
+
**Final clean dataset: 2,208 high-quality conversations.**
|
train.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|