|
1 | | -# dsqusss |
| 1 | +# 🧩 Dataset Quality Scoring Engine — System Framework (Markdown) |
2 | 2 |
|
3 | | -Python package scaffold for the `dsqus` repository. |
| 3 | +#️⃣ 1. Overview |
4 | 4 |
|
5 | | -## Publish on every push |
| 5 | +The Dataset Quality Scoring Engine (DQS) evaluates the quality of any dataset using automated, model-agnostic metrics. |
| 6 | +The system processes user-uploaded datasets, computes embeddings, analyzes statistical and semantic properties, and outputs a standardized quality score (0–100) along with detailed submetrics. |
6 | 7 |
|
7 | | -This repository includes a GitHub Actions workflow that builds and publishes the package on every push. |
| 8 | +## 2. High-Level Workflow |
8 | 9 |
|
9 | | -Set this repository secret before pushing: |
| 10 | +User Upload → Preprocessing → Embedding → Metric Computation → Scoring → Report Generation → Cleanup |
10 | 11 |
|
11 | | -- `PYPI_API_TOKEN`: your PyPI token (`pypi-...`). |
| 12 | +## 3. Input Specifications |
| 13 | + |
| 14 | +The system accepts: |
| 15 | + |
| 16 | +jsonl |
| 17 | +json |
| 18 | +txt |
| 19 | +csv |
| 20 | +folder of text/code files |
| 21 | +PDFs (extracted into text) |
| 22 | + |
| 23 | +## 4. Preprocessing Pipeline |
| 24 | + |
| 25 | +Validate file format |
| 26 | +Convert to normalized internal format (list[str or dict]) |
| 27 | +Clean text: |
| 28 | +remove control chars |
| 29 | +normalize whitespace |
| 30 | +optional: strip HTML/markup |
| 31 | +Segment long documents into meaningful chunks |
| 32 | +Remove empty or invalid samples |
| 33 | + |
| 34 | +Output: clean, structured dataset |
| 35 | + |
| 36 | +## 5. Embedding Generation |
| 37 | + |
| 38 | +Two embedding flows: |
| 39 | + |
| 40 | +5.1 Local Embeddings (Per Upload) |
| 41 | + |
| 42 | +Used for: |
| 43 | + |
| 44 | +redundancy |
| 45 | +coherence |
| 46 | +diversity |
| 47 | +factual contradictions |
| 48 | +clustering/domain analysis |
| 49 | + |
| 50 | +These embeddings exist only for the request and are deleted afterward. |
| 51 | + |
| 52 | +5.2 Global Reference Embeddings (Static) |
| 53 | + |
| 54 | +Used only for novelty detection. |
| 55 | + |
| 56 | +Pre-built FAISS/Vector DB containing ~1M representative samples: |
| 57 | + |
| 58 | +Wikipedia |
| 59 | +Common Crawl samples |
| 60 | +C4 slices |
| 61 | +StackOverflow |
| 62 | +Books corpus |
| 63 | +Public domain corpora |
| 64 | + |
| 65 | +This is static, never modified by user uploads. |
| 66 | + |
| 67 | +## 6. Metric Computation |
| 68 | + |
| 69 | +DQS computes 10 core quality metrics: |
| 70 | + |
| 71 | +6.1 Redundancy Score |
| 72 | +compute embedding similarity within dataset |
| 73 | +clustering density = redundancy |
| 74 | +score = inverse redundancy |
| 75 | +6.2 Malware / Toxicity Score |
| 76 | +run samples through pre-trained toxicity classifier |
| 77 | +aggregate severity |
| 78 | +6.3 Diversity Score |
| 79 | +linguistic diversity (entropy, vocab richness) |
| 80 | +semantic diversity (embedding variance) |
| 81 | +6.4 Readability Score |
| 82 | +Flesch–Kincaid |
| 83 | +sentence complexity |
| 84 | +coherency heuristics |
| 85 | +6.5 Semantic Coherence |
| 86 | +embedding flow consistency |
| 87 | +perplexity using a small reference LLM |
| 88 | +6.6 Novelty Score |
| 89 | +compare against global reference corpus |
| 90 | +nearest neighbor distance = novelty measure |
| 91 | +6.7 Structure Quality |
| 92 | + |
| 93 | +Applicable to: |
| 94 | + |
| 95 | +JSON |
| 96 | +code |
| 97 | +SQL |
| 98 | +XML |
| 99 | +YAML |
| 100 | + |
| 101 | +Checks: |
| 102 | + |
| 103 | +syntax validity |
| 104 | +AST parsing success |
| 105 | +6.8 Factual Conflict Score |
| 106 | +sample random pairs |
| 107 | +pass to NLI contradiction model |
| 108 | +aggregate contradictions |
| 109 | +6.9 Domain Balance Score |
| 110 | +cluster dataset embeddings |
| 111 | +measure cluster distribution via entropy |
| 112 | +6.10 Length Distribution Score |
| 113 | +detect outliers |
| 114 | +analyze token distribution |
| 115 | + |
| 116 | +## 7. Composite Score Calculation |
| 117 | + |
| 118 | +All metrics normalized 0–100. |
| 119 | + |
| 120 | +Weighted aggregation formula: |
| 121 | + |
| 122 | +overall_score = |
| 123 | +0.15*redundancy + |
| 124 | +0.10*toxicity + |
| 125 | +0.10*diversity + |
| 126 | +0.10*readability + |
| 127 | +0.10*coherence + |
| 128 | +0.10*novelty + |
| 129 | +0.10*structure + |
| 130 | +0.10*factual_conflict + |
| 131 | +0.075*domain_balance + |
| 132 | +0.075*length_distribution |
| 133 | + |
| 134 | +## 8. Report Generation |
| 135 | + |
| 136 | +Output includes: |
| 137 | + |
| 138 | +8.1 JSON Report |
| 139 | + |
| 140 | +Contains: |
| 141 | + |
| 142 | +overall_score |
| 143 | +all sub-scores |
| 144 | +dataset metadata |
| 145 | +top detected issues |
| 146 | +summary of duplicates |
| 147 | +domain distribution histogram |
| 148 | +8.2 Human-Readable Text Report |
| 149 | +simple explanations |
| 150 | +listed issues |
| 151 | +recommendations |
| 152 | +optional PDF |
| 153 | + |
| 154 | +## 9. System Architecture |
| 155 | + |
| 156 | +Components |
| 157 | +API Layer |
| 158 | +file upload |
| 159 | +async processing |
| 160 | +report delivery |
| 161 | +Compute Engine |
| 162 | +embeddings |
| 163 | +scoring logic |
| 164 | +batching |
| 165 | +concurrency optimized |
| 166 | +Reference Store |
| 167 | +FAISS/Qdrant global novelty index |
| 168 | +static |
| 169 | +Models Folder |
| 170 | +toxicity classifier |
| 171 | +contradiction/NLI model |
| 172 | +small LLM for perplexity |
| 173 | + |
| 174 | +## 10. Execution Flow Diagram |
| 175 | + |
| 176 | +[Upload] |
| 177 | +↓ |
| 178 | +[Preprocess] |
| 179 | +↓ |
| 180 | +[Generate Local Embeddings] |
| 181 | +↓ |
| 182 | +[Compute All Self-Contained Metrics] |
| 183 | +↓ |
| 184 | +[Compare with Global Reference Embeddings] |
| 185 | +↓ |
| 186 | +[Aggregate Scores] |
| 187 | +↓ |
| 188 | +[Generate JSON + Text Report] |
| 189 | +↓ |
| 190 | +[Return to User] |
| 191 | +↓ |
| 192 | +[Delete all temp embeddings + data] |
| 193 | + |
| 194 | +## 11. Privacy Model |
| 195 | + |
| 196 | +No dataset stored after processing |
| 197 | +No embeddings stored |
| 198 | +Only the report is saved (optional) |
| 199 | +Global reference embeddings NEVER contain user data |
| 200 | +Fully GDPR-safe |
| 201 | + |
| 202 | +## 12. MVP Boundary (Important) |
| 203 | + |
| 204 | +Not included in v1: |
| 205 | + |
| 206 | +dataset cleaning |
| 207 | +dataset repair |
| 208 | +dataset marketplace |
| 209 | +collaborative annotation |
| 210 | +data augmentation |
| 211 | +agentic workflows |
| 212 | + |
| 213 | +You stay laser-focused on: |
| 214 | +analysis → scoring → reporting. |
0 commit comments