|
1 | 1 | # Reproducible real-dataset benchmark |
2 | 2 |
|
3 | | -This benchmark downloads fixed stratified slices from `fancyzhx/ag_news` and |
4 | | -`stanfordnlp/imdb`, generates disclosed dirty variants, applies BuffData's local |
5 | | -validation/task-detection/exact-deduplication stages, and trains identical PyTorch |
6 | | -classifiers across three fixed seeds. |
| 3 | +## Non-classification matrix |
| 4 | + |
| 5 | +The generative matrix complements the label-classification suites with six large, |
| 6 | +real Hugging Face datasets covering instruction/SFT, multi-turn chat, preference/DPO, |
| 7 | +extractive QA, summarization, and raw language-modeling text. It compares every |
| 8 | +unmodified source slice with BuffData's output, then appends 40% exact duplicates and |
| 9 | +10% invalid records and repeats the comparison at 10,000 and 30,000 source rows. |
| 10 | + |
| 11 | +```bash |
| 12 | +python benchmarks/benchmark_generative_matrix.py \ |
| 13 | + --scales 10000 30000 \ |
| 14 | + --output-dir benchmarks/results-generative |
| 15 | +``` |
| 16 | + |
| 17 | +The generated `REPORT.md` and `results.json` include rows retained/deleted, source |
| 18 | +rows lost or changed, exact duplicates found and removed, invalid rows removed, |
| 19 | +defect leakage, cleaning-decision accuracy, deletion precision/recall/F1, exact |
| 20 | +output-content accuracy, clean-vs-dirty output parity, character preservation, |
| 21 | +per-stage rejections, and throughput. Because these datasets are open-ended rather |
| 22 | +than class-labeled, accuracy is defined against the clean optimized control instead |
| 23 | +of inventing an inapplicable classifier label. LLM quality scoring and classification |
| 24 | +are disabled, and provider token usage must remain zero. |
| 25 | + |
| 26 | +For downstream before → after movement on disjoint held-out rows, run: |
| 27 | + |
| 28 | +```bash |
| 29 | +python benchmarks/benchmark_generative_utility.py \ |
| 30 | + --scales 10000 30000 --eval-rows 250 \ |
| 31 | + --output-dir benchmarks/results-generative |
| 32 | +``` |
| 33 | + |
| 34 | +This writes `UTILITY_REPORT.md` and `utility_results.json`. Metrics are task-specific: |
| 35 | +response token-F1 for instruction/chat, preference accuracy for DPO, answer exact |
| 36 | +match/F1 for QA, ROUGE-L for summarization, and next-token accuracy/perplexity for |
| 37 | +raw text. Each report shows clean raw → clean optimized and dirty raw → dirty optimized. |
| 38 | + |
| 39 | +This benchmark downloads fixed stratified slices from **19 Hugging Face datasets**, |
| 40 | +generates disclosed dirty variants, applies BuffData's local validation/task-detection/ |
| 41 | +exact-deduplication stages, and trains identical PyTorch classifiers across three fixed |
| 42 | +seeds. The catalog spans sentiment, topic, emotion, hate/irony, question type, and |
| 43 | +subjectivity tasks with 2 to 20 classes. |
| 44 | + |
| 45 | +| Family | Datasets | |
| 46 | +|---|---| |
| 47 | +| Binary | `imdb`, `yelp_polarity`, `amazon_polarity`, `rotten_tomatoes`, `sst2`, `subj`, `tweet_eval_irony`, `tweet_eval_hate`, `cr`, `amazon_counterfactual` | |
| 48 | +| Multi-class | `ag_news`, `dbpedia_14`, `emotion`, `tweet_eval_sentiment`, `yahoo_answers_topics`, `tweet_eval_emotion`, `newsgroups_20`, `trec_coarse`, `tweet_sentiment_extraction` | |
7 | 49 |
|
8 | 50 | ```bash |
9 | 51 | cd ~/projects/buffdata |
10 | 52 | source .venv/bin/activate |
11 | 53 | python benchmarks/benchmark_buffdata.py |
12 | 54 | ``` |
13 | 55 |
|
| 56 | +The default run is local after the Hugging Face downloads complete; it makes no LLM |
| 57 | +API calls. To run a smaller slice while developing: |
| 58 | + |
| 59 | +```bash |
| 60 | +python benchmarks/benchmark_buffdata.py \ |
| 61 | + --datasets ag_news imdb tweet_eval_sentiment \ |
| 62 | + --train-rows 1000 --test-rows 500 --epochs 2 |
| 63 | +``` |
| 64 | + |
14 | 65 | Outputs are written to `benchmarks/results/`, including the exact JSONL inputs, |
15 | | -per-seed metrics in `results.json`, and a concise `REPORT.md`. |
| 66 | +per-seed metrics in `results.json`, and a concise `REPORT.md`. The report and JSON now |
| 67 | +include both model-quality metrics and explicit data-hygiene accounting: |
| 68 | + |
| 69 | +- input, retained, and deleted row counts plus deletion rate; |
| 70 | +- duplicate rows and duplicate groups present in the pipeline input; |
| 71 | +- conflicting-label duplicate rows/groups; |
| 72 | +- invalid rows deleted by validation and duplicates deleted by exact dedup; |
| 73 | +- clean source rows accidentally deleted; |
| 74 | +- injected defects removed versus retained, with a per-category/per-stage cross-tab; |
| 75 | +- unique-content and empty-text counts, plus exact rejection-reason totals. |
| 76 | + |
| 77 | +`duplicate_rows_in_input` follows BuffData's own exact-dedup equivalence rule: trimmed |
| 78 | +classification text, independent of label. `duplicate_rows_deleted` is the observed |
| 79 | +dedup-stage result, so the report distinguishes duplicates that exist from rows that |
| 80 | +were actually removed. |
16 | 81 |
|
17 | 82 | For the larger Gemini-audited suite (12,000 training records per dataset): |
18 | 83 |
|
19 | 84 | ```bash |
20 | 85 | python benchmarks/benchmark_buffdata.py \ |
21 | 86 | --datasets dbpedia_14 yelp_polarity emotion \ |
22 | 87 | --train-rows 12000 --test-rows 2000 --epochs 6 \ |
23 | | - --gemini-audit-rows 20 --output-dir benchmarks/results-large |
| 88 | + --gemini-audit-rows 20 --audit-provider gemini \ |
| 89 | + --output-dir benchmarks/results-large |
24 | 90 | ``` |
25 | 91 |
|
26 | 92 | `--gemini-audit-rows` uses BuffData's scalable batched-sample quality mode. Validation, |
27 | 93 | deduplication, and task detection still process every row; Gemini judges only a |
28 | 94 | deterministic representative sample (20 rows per structured request) and its token |
29 | 95 | usage is recorded in the report. |
30 | 96 |
|
31 | | -The local benchmark does not require an API key. After `GEMINI_API_KEY` is set, |
32 | | -the provider-backed optimizer can be tested separately on generative datasets; |
33 | | -it is deliberately not mixed into this classification benchmark because LLM |
34 | | -scoring/refinement and deterministic validation/deduplication test different claims. |
| 97 | +The local benchmark does not require an API key. Setting `--gemini-audit-rows` above |
| 98 | +zero enables the optional provider-backed quality audit and requires the corresponding |
| 99 | +provider credential. Audit scoring is informational: deterministic validation and |
| 100 | +deduplication remain the only stages deciding the row-retention numbers. |
35 | 101 |
|
36 | 102 | ## Accuracy regression gate |
37 | 103 |
|
|
0 commit comments