queefwath commited on
Commit
b58f293
·
verified ·
1 Parent(s): c304a59

Upload K-12 math and coding dataset (1.0B math tokens, 1.02B code tokens)

Browse files
Files changed (6) hide show
  1. .gitattributes +2 -0
  2. README.md +95 -0
  3. code/final.jsonl +3 -0
  4. final_audit.md +116 -0
  5. final_report.md +237 -0
  6. math/final.jsonl +3 -0
.gitattributes CHANGED
@@ -58,3 +58,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ code/final.jsonl filter=lfs diff=lfs merge=lfs -text
62
+ math/final.jsonl filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: odc-by
3
+ task_categories:
4
+ - text-generation
5
+ language:
6
+ - en
7
+ tags:
8
+ - math
9
+ - code
10
+ - education
11
+ - k12
12
+ size_categories:
13
+ - 1M<n<10M
14
+ ---
15
+
16
+ # K-12 Math & Coding Dataset
17
+
18
+ A ~2 billion token dataset built for K-12 math and coding education use
19
+ cases: **1,004,991,667 tokens** of math content and **1,020,505,114 tokens**
20
+ of code content, both comfortably over the 1B-token target for each
21
+ category.
22
+
23
+ ## Dataset Summary
24
+
25
+ | Category | Tokens | Rows | File |
26
+ |----------|-------:|-----:|------|
27
+ | Math | 1,004,991,667 | 676,018 | `math/final.jsonl` |
28
+ | Code | 1,020,505,114 | 937,248 | `code/final.jsonl` |
29
+
30
+ Built via a 6-phase pipeline: source collection → cleaning (PII redaction,
31
+ boilerplate/spam removal, encoding fixes) → deduplication (exact SHA-256 +
32
+ fuzzy MinHash LSH) → heuristic quality filtering → budget-controlled final
33
+ sampling → manual quality audit. Full methodology, per-source breakdowns,
34
+ and known limitations are in `final_report.md`.
35
+
36
+ ## Schema
37
+
38
+ Each line is a JSON object:
39
+
40
+ ```json
41
+ {
42
+ "text": "...",
43
+ "source": "finemath4plus",
44
+ "category": "math",
45
+ "quality_score": 4.3,
46
+ "token_count": 512,
47
+ "language": "en",
48
+ "metadata": {}
49
+ }
50
+ ```
51
+
52
+ - `quality_score`: populated only for `finemath4plus` (has an upstream
53
+ classifier score); `null` for all other sources.
54
+ - `language`: natural-language code (all records verified predominantly
55
+ English). For code records, the actual programming language is under
56
+ `metadata.programming_language`.
57
+ - `metadata`: source-specific extra fields (URL, license, file path, repo
58
+ name, exercise name, difficulty, etc. — varies by source).
59
+
60
+ ## Sources
61
+
62
+ **Math**: FineMath 4+, OpenWebMath, GSM8K, MATH (hendrycks_math).
63
+ **Code**: GitHub Code (Python/JavaScript/Java/HTML/CSS via
64
+ `codeparrot/github-code-clean`), freeCodeCamp, Exercism, APPS, CodeContests.
65
+
66
+ ## Token Counting
67
+
68
+ All token counts use the `tiktoken` `cl100k_base` tokenizer, computed via
69
+ exact `encode_ordinary()` calls (not estimates) at every pipeline stage.
70
+
71
+ ## Quality Audit
72
+
73
+ Both categories were manually spot-checked twice (once pre-assembly, once
74
+ on the final sampled corpus). Code passed cleanly at every check (~90-94%
75
+ good, 0-2% bad). Math's final spot-check found a 15% "bad" rate (above the
76
+ 10% target threshold) driven by several low-frequency, hard-to-cheaply-filter
77
+ patterns (AI-generated SEO filler, off-topic forum comment dumps, one
78
+ essay-mill advertisement, thin template pages) — documented as an accepted
79
+ residual limitation rather than silently delivered. **See `final_audit.md`
80
+ and `final_report.md` Section 8 for full detail before using this dataset
81
+ for anything quality-sensitive.**
82
+
83
+ ## Known Limitations
84
+
85
+ See `final_report.md` Section 8 for the complete list, including:
86
+ math corpus residual bad-rate, AMPS/OpenStax not sourced, The Stack v2
87
+ substituted with GitHub Code due to gating, freeCodeCamp/Exercism volume
88
+ shortfall, and HTML's residual auto-generated-doc contamination.
89
+
90
+ ## License
91
+
92
+ Source licenses vary per record — see `metadata.license` for code records
93
+ where available. FineMath 4+ and OpenWebMath are ODC-By. Aggregate dataset
94
+ provided as-is for research/educational use; verify individual source
95
+ licenses before redistribution.
code/final.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4274d16123a3352a1633ce95d3fe0130e75645af0119f45c36202ff12975a1a
3
+ size 4684965188
final_audit.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Phase 5, Step 5.4 — Final Quality Spot-Check
2
+
3
+ Samples drawn from the ASSEMBLED FINAL corpora (`data/final/{category}/final.jsonl`),
4
+ seed=42, via `scripts/assemble/sample_final_audit.py` — distinct from Step 4.4's
5
+ audit, which sampled from the pre-assembly `filtered.jsonl` files. This is the
6
+ last line of defense before delivery.
7
+
8
+ ## Math (200-record sample, seed=42, from `data/final/math/final.jsonl`)
9
+
10
+ Read 40 of 200 sampled records in full detail.
11
+
12
+ ### Ratings
13
+ - ✅ Good: 29/40 (72.5%) — genuine, on-target K-12 through advanced math and
14
+ applied-STEM content: worked physics/EE/thermodynamics problems, forum
15
+ Q&A (PhysicsForums, MathHelpForum, MathOverflow, StackExchange), exam
16
+ content (CBSE, board exams, GMAT/GRE quant), logic puzzles, real analysis
17
+ and number theory, MATLAB/R applied-math code, K-12 arithmetic word
18
+ problems. Several records use a listicle/FAQ blog format but contain
19
+ factually correct, pedagogically useful content (e.g. "What is the
20
+ difference between real numbers and integers?", "How to calculate 2/3 of a
21
+ number") — style alone was not treated as disqualifying.
22
+ - ⚠️ Borderline: 5/40 (12.5%) — legitimate but low-value: a bare index page
23
+ of NRICH problem titles/links with no actual problem content, a
24
+ commercial worksheet product page with a genuine explanatory tail, a
25
+ CourseHero paywall preview truncated mid-content, a WikiAnswers page with
26
+ messy comment-thread residue attached to an otherwise-fine answer.
27
+ - ❌ Bad: 6/40 (15%) — **above pipeline.md's <10% threshold.** Specific
28
+ findings, each a distinct pattern:
29
+ 1. **AI-generated clickbait filler** (2 instances, e.g. "Mind-Blowing
30
+ Result: You Won't Believe What Happens When You Divide 70 By 5!") —
31
+ sensationalized SEO content with no real mathematical depth. Already
32
+ documented as a known residual limitation in `quality_audit.md` (Step
33
+ 4.4 found the same pattern, sample #25).
34
+ 2. **Off-topic forum comment-thread dump** — a robot-automation/UBI/
35
+ politics discussion thread (source: i-am-bored.com) containing a couple
36
+ of incidental dollar-figure calculations, which was enough to pass
37
+ finemath4plus's classifier-trust shortcut (density/language checks are
38
+ skipped for this source per the Step 4.1 AMC-8 fix) despite having
39
+ almost no real educational math content. A new pattern — similar in
40
+ spirit to the Reddit-dump issue already fixed, but from a different
41
+ domain/format with no shared detectable signature.
42
+ 3. **Content-aggregator dump** — a Q&A-farm page splicing together several
43
+ unrelated questions under an irrelevant title, including one entirely
44
+ off-topic, non-English question (Tagalog, about a typhoon's landfall).
45
+ 4. **Thin SEO template page** — a "NCERT Solutions for Class X Maths"
46
+ listing that only describes chapter topics in generic boilerplate,
47
+ repeated near-verbatim across chapter headers, with no actual worked
48
+ content.
49
+ 5. **Scraping artifact** — a factoring-trinomials page with unrelated
50
+ sidebar/related-links text (from completely different topics — pop
51
+ culture quotes, gaming guides, unrelated products) spliced into the
52
+ main text field, a scraper capturing page chrome alongside content.
53
+ 6. **Essay-mill / homework-cheating-service advertisement** — a legitimate
54
+ econometrics/regression homework problem wrapped in explicit marketing
55
+ copy for a paid paper-writing service ("Zero-plagiarism guarantee",
56
+ "Money-back guarantee", "Free-revision policy"). The most concerning
57
+ individual finding: this doesn't just lower quality, it embeds
58
+ promotional content for an academic-dishonesty service inside an
59
+ educational corpus.
60
+
61
+ ### Conclusion and decision
62
+ This sample's bad rate (15%, n=40) exceeds pipeline.md's 10% threshold and is
63
+ higher than the earlier Step 4.4 pre-assembly audit (7.5%, n=40) — a real
64
+ signal, not just sampling noise, though also not enormous in absolute terms.
65
+ All six bad findings are DIFFERENT patterns from each other and from the
66
+ already-fixed Reddit-dump issue; none has a cheap, low-false-positive
67
+ detection signature the way the Reddit vote-marker did. Flagged to the user
68
+ with the tradeoff (accept as a documented limitation vs. build one more
69
+ targeted fix vs. broadly re-tighten finemath4plus's skipped density/language
70
+ checks, at the cost of reintroducing the AMC-8 false-positive problem that
71
+ motivated skipping them in the first place). **User decision: accept and
72
+ proceed to delivery** — the corpus is still ~85% good+borderline (72.5%
73
+ cleanly good), token targets are comfortably met (1.005B, 0.5% over target),
74
+ and further tightening risks re-losing the legitimate terse/notation-heavy
75
+ content the AMC-8 fix was specifically designed to recover. Documented here
76
+ as a known, accepted residual limitation rather than silently ignored.
77
+
78
+ ## Code (200-record sample, seed=42, from `data/final/code/final.jsonl`)
79
+
80
+ Read 46 of 200 sampled records in full detail, spanning all 9 sources
81
+ (githubcode x5 across python/javascript/java/html/css, freecodecamp,
82
+ exercism, apps, codecontests).
83
+
84
+ ### Ratings
85
+ - ✅ Good: 43/46 (93.5%) — real, functional, well-formed code across all
86
+ languages and sources: production libraries (urllib3, IntelliJ, Quarkus,
87
+ Apache Aries), application code (Django/Angular/Android), freeCodeCamp
88
+ lesson content with solutions, Exercism canonical solutions, and
89
+ competitive-programming problems with correct multi-language solutions
90
+ (Codeforces via CodeContests).
91
+ - ⚠️ Borderline: 2/46 (4.3%) — auto-generated artifacts that are real but
92
+ not educational: a Clover test-coverage-instrumentation JS file, a
93
+ Doxygen HTML search-index JS data file. Consistent with the same
94
+ "auto-generated docs slip through" gap already documented in
95
+ `quality_audit.md`'s code section (there found for Sphinx; here for
96
+ Clover/Doxygen — same category of gap, different tools).
97
+ - ❌ Bad: 1/46 (2.2%) — a near-empty JS build-artifact stub containing only
98
+ `"use strict"` boilerplate and a base64-encoded sourcemap comment, with
99
+ zero actual logic. A transpiler/bundler output file that neither the
100
+ `is_minified` nor `is_autogenerated` heuristics were designed to catch
101
+ (it's not minified — it's just empty — and carries no "auto-generated"
102
+ marker text).
103
+
104
+ ### Conclusion
105
+ Both thresholds (<10% bad, <30% borderline) are comfortably met — consistent
106
+ with Step 4.4's pre-assembly code audit (~90% good, ~10% borderline, 0% bad).
107
+ No further action needed for code; the two minor gaps found are the same
108
+ class of low-frequency, low-severity issue already accepted for the code
109
+ category.
110
+
111
+ ## Overall Step 5.4 conclusion
112
+ Code passes cleanly. Math has a real, above-threshold bad rate (15%) driven
113
+ by diffuse, low-frequency patterns with no cheap fix — flagged to the user,
114
+ who chose to accept it as a documented residual limitation given the corpus
115
+ is still ~85% good+borderline and both categories comfortably exceed their
116
+ 1B-token targets. Proceeding to Phase 6 (Documentation & Delivery).
final_report.md ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Final Report — K-12 Math & Coding Dataset
2
+
3
+ A 1B+ token, K-12-focused math corpus and a 1B+ token educational coding
4
+ corpus, built per `pipeline.md`'s 6-phase spec. Both categories comfortably
5
+ exceed the 1B-token target after cleaning, deduplication, quality filtering,
6
+ and budget-controlled final sampling.
7
+
8
+ ## 1. Total tokens per category (final deliverable)
9
+
10
+ | Category | Final Tokens | Final Rows | Target | Margin |
11
+ |----------|-------------:|-----------:|-------:|-------:|
12
+ | Math | 1,004,991,667 | 676,018 | 1,000,000,000 | +0.5% |
13
+ | Code | 1,020,505,114 | 937,248 | 1,000,000,000 | +2.1% |
14
+
15
+ Deliverables: `data/final/math/final.jsonl`, `data/final/code/final.jsonl`.
16
+ Schema per record: `{text, source, category, quality_score, token_count,
17
+ language, metadata}`. `quality_score` is populated only for finemath4plus
18
+ (the one source with an upstream classifier score) — `null` elsewhere, since
19
+ no equivalent score exists for structured benchmarks or code sources.
20
+ `language` is the natural-language code (`"en"` throughout, all sources
21
+ verified predominantly English); for code sources the programming language
22
+ is preserved under `metadata.programming_language` instead.
23
+
24
+ ## 2. Per-source breakdown (final corpus)
25
+
26
+ ### Math
27
+
28
+ | Source | Mode | Rows | Tokens | % of Category |
29
+ |--------|------|-----:|-------:|---------------:|
30
+ | finemath4plus | sampled to 700M | 508,357 | 700,003,574 | 69.7% |
31
+ | openwebmath | sampled to 300M | 146,473 | 300,001,270 | 29.9% |
32
+ | gsm8k | all | 8,792 | 1,417,863 | 0.14% |
33
+ | hendrycks_math | all | 12,396 | 3,568,960 | 0.36% |
34
+
35
+ ### Code
36
+
37
+ | Source | Mode | Rows | Tokens | % of Category |
38
+ |--------|------|-----:|-------:|---------------:|
39
+ | githubcode_python | all (under budget) | 236,531 | 287,901,844 | 28.2% |
40
+ | githubcode_javascript | sampled to 300M | 333,786 | 300,000,630 | 29.4% |
41
+ | githubcode_java | sampled to 240M | 236,242 | 240,000,466 | 23.5% |
42
+ | githubcode_html | sampled to 90M | 51,764 | 90,006,022 | 8.8% |
43
+ | githubcode_css | sampled to 60M | 50,152 | 60,000,074 | 5.9% |
44
+ | freecodecamp | all | 10,258 | 5,175,953 | 0.5% |
45
+ | exercism | all | 422 | 275,072 | 0.03% |
46
+ | apps | all | 4,959 | 16,080,052 | 1.6% |
47
+ | codecontests | all | 13,134 | 21,065,001 | 2.1% |
48
+
49
+ `githubcode_python` came in under its original 400M config target (Step 4.1's
50
+ `invalid_syntax` filter dropped 41,130 Python-2-syntax files — a deliberate,
51
+ verified-beneficial filter, not a bug) and was included in full rather than
52
+ backfilled by loosening quality thresholds. The shortfall was made up by
53
+ increasing javascript/java/html/css's sampled targets above pipeline.md's
54
+ original example percentages, since those sources had ample surplus.
55
+
56
+ ## 3. Pipeline stage summary — token counts
57
+
58
+ | Category | Raw | After Cleaning | After Dedup | After Filtering | Final |
59
+ |----------|----:|----------------:|------------:|-----------------:|------:|
60
+ | Math | 3,248,617,940 | 3,231,640,208 | 3,215,245,918 | ~3,059,148,111 | 1,004,991,667 |
61
+ | Code | 4,589,566,182 | 2,289,366,123 | 2,235,414,819 | ~2,109,766,319 | 1,020,505,114 |
62
+
63
+ (Code's raw→cleaned drop is large because Step 1.4's `githubcode` source was
64
+ deliberately over-downloaded well beyond the final target, per pipeline.md's
65
+ "download ~10x headroom" guidance, then filtered down at every stage.)
66
+
67
+ ## 4. Cleaning pipeline summary (Phase 2)
68
+
69
+ 5 rule groups applied across 4 cleaning scripts (`clean_web_math.py`,
70
+ `clean_structured_math.py`, `clean_code_stack.py`, `clean_code_educational.py`):
71
+ - **Group A** (web-crawled math): boilerplate/nav stripping, spam/warez
72
+ pattern removal, encoding normalization (ftfy), PII redaction.
73
+ - **Group B** (structured math): light validation only (already-clean
74
+ benchmark data).
75
+ - **Group C** (GitHub code): vendored-code exclusion, autogenerated-file
76
+ exclusion (javadoc-specific + generic), minified-code exclusion, excessive
77
+ encoded-content exclusion, trivial-test exclusion.
78
+ - **Group D** (educational code): freeCodeCamp non-coding block exclusion
79
+ (108 language-course superblocks removed via `freecodecamp_excluded_blocks.json`).
80
+ - **Group E** (PII): email/phone/IPv4/SSN/API-key redaction with extensive
81
+ context-aware false-positive suppression (math arithmetic, version
82
+ strings, ISBNs, DOIs, test262 spec identifiers — see `config/cleaning_rules.md`).
83
+
84
+ 22 real bugs were found and fixed during Phase 2/4 via direct spot-checking
85
+ of actual output (not just exit-code/summary-count trust), documented in full
86
+ chronological detail in `progress.md`'s Decisions Log. The single most
87
+ consequential: a math-density/language heuristic was wrongly rejecting
88
+ excellent K-12 content (41 official AMC 8 competition problems, geometry
89
+ "kite/rhombus" problems) because it lacked explicit math vocabulary or used
90
+ non-ASCII notation (Greek letters) — fixed by trusting FineMath's own
91
+ upstream quality classifier for that source instead of re-applying a cruder
92
+ heuristic on top of it.
93
+
94
+ ## 5. Deduplication statistics (Phase 3)
95
+
96
+ **Exact (SHA-256) dedup:**
97
+ | Category | Rows In | Rows Out | Duplicates Removed |
98
+ |----------|--------:|---------:|--------------------:|
99
+ | Math | 2,181,776 | 2,172,722 | 9,054 (0.4%) |
100
+ | Code | 1,974,655 | 1,973,991 | 664 (0.03%) |
101
+
102
+ **Fuzzy (MinHash LSH, Jaccard 0.8 math / 0.85 code) intra-source dedup:**
103
+ | Source | Kept | Removed |
104
+ |--------|-----:|--------:|
105
+ | finemath4plus | 1,878,340 | 5,128 |
106
+ | openwebmath | 267,941 | 21 |
107
+ | gsm8k | 8,792 | 0 |
108
+ | hendrycks_math | 12,484 | 16 |
109
+ | githubcode_python | 289,598 | 3,216 |
110
+ | githubcode_javascript | 410,580 | 5,542 |
111
+ | githubcode_java | 805,252 | 18,490 |
112
+ | githubcode_html | 327,796 | 18,692 |
113
+ | githubcode_css | 64,347 | 1,545 |
114
+ | freecodecamp | 10,262 | 113 |
115
+ | exercism | 422 | 2 |
116
+ | apps / codecontests | 5,000 / 13,134 | 0 / 0 |
117
+
118
+ **Fuzzy inter-source dedup:**
119
+ | Category | Total Seen | Total Kept | Removed |
120
+ |----------|-----------:|-----------:|--------:|
121
+ | Math | 2,167,557 | 2,166,099 | 1,458 |
122
+ | Code | 1,926,391 | 1,926,161 | 230 |
123
+
124
+ A performance bug was found and fixed during this phase: per-shingle
125
+ `MinHash.update()` cost scaled with document length (measured 13.6ms/doc,
126
+ would have taken ~6+ hours on the largest sources) — fixed by capping
127
+ shingles fed into MinHash to 150/doc via deterministic even-spacing
128
+ (not random sampling, to stay reproducible), achieving a 4.6x speedup with
129
+ `num_perm=128` kept unchanged per spec.
130
+
131
+ ## 6. Quality filter statistics (Phase 4, Step 4.1)
132
+
133
+ **Math** (`filter_math.py`) drop reasons:
134
+ | Source | Records In | Records Out | Top Drop Reasons |
135
+ |--------|-----------:|-------------:|-------------------|
136
+ | finemath4plus | 1,878,340 | 1,875,104 | reddit_comment_dump (1,108), length_out_of_bounds (1,716), repetition (401), encoding_quality (11) |
137
+ | openwebmath | 266,495 | 232,018 | low_math_density (29,603), length_out_of_bounds (3,047), non_english (1,680), repetition (83), reddit_comment_dump (62), encoding_quality (2) |
138
+ | gsm8k | 8,792 | 8,792 | none |
139
+ | hendrycks_math | 12,472 | 12,396 | length_out_of_bounds (76) |
140
+
141
+ **Code** (`filter_code.py`) drop reasons:
142
+ | Source | Records In | Records Out | Top Drop Reasons |
143
+ |--------|-----------:|-------------:|-------------------|
144
+ | githubcode_python | 289,598 | 236,531 | invalid_syntax (41,130), comment_ratio_out_of_bounds (10,198), poor_identifier_names (905), length_out_of_bounds (834) |
145
+ | githubcode_javascript | 410,571 | 400,453 | comment_ratio_out_of_bounds (6,703), poor_identifier_names (1,586), length_out_of_bounds (1,829) |
146
+ | githubcode_java | 805,105 | 771,600 | comment_ratio_out_of_bounds (30,344), length_out_of_bounds (2,409), poor_identifier_names (752) |
147
+ | githubcode_html | 327,765 | 324,900 | poor_identifier_names (943), length_out_of_bounds (1,002), comment_ratio_out_of_bounds (920) |
148
+ | githubcode_css | 64,304 | 62,405 | comment_ratio_out_of_bounds (1,367), length_out_of_bounds (493), poor_identifier_names (39) |
149
+ | freecodecamp / exercism / apps / codecontests | small, near-zero drops | | length_out_of_bounds only |
150
+
151
+ `invalid_syntax` for Python was investigated directly (14.2% of raw files) and
152
+ confirmed to be genuine Python 2 syntax (`print x`, `except X, e:`) — kept as
153
+ a deliberate filter since excluding legacy syntax benefits a modern coding
154
+ corpus. `comment_ratio` originally had a serious formula bug (a
155
+ double-normalized calculation that returned meaningless values, plus a
156
+ DOTALL regex bug that let one `#` comment "match" to end-of-file) — both
157
+ fixed and the check simplified to a single upper bound (0.8) uniform across
158
+ all 5 languages, after measuring that ~54% of real JavaScript files fall
159
+ below any reasonable lower bound despite being genuinely good code.
160
+
161
+ Step 4.2 (optional GPU classifier) was explicitly skipped per pipeline.md's
162
+ "optional" designation — not requested by the user, and unnecessary given
163
+ ample raw token surplus confirmed at every stage. Step 4.3 was effectively
164
+ completed by Step 4.1's scripts.
165
+
166
+ ## 7. Audit results summary (Step 4.4 + Step 5.4)
167
+
168
+ **Step 4.4 (pre-assembly filtered-data audit, sampled from `data/filtered/`):**
169
+ - Code: 39/100 read — ~90% good, ~10% borderline (Sphinx docs, license
170
+ pages), 0% bad. Thresholds met.
171
+ - Math: 40/100 read — ~80% good, ~12.5% borderline, 7.5% bad. Thresholds
172
+ met. Found and fixed the Reddit comment-dump content-appropriateness
173
+ issue (`is_reddit_comment_dump`, added despite low 0.065%/0.030% volume
174
+ on appropriateness grounds, not quality-volume grounds).
175
+
176
+ **Step 5.4 (final post-assembly audit, sampled from `data/final/`):**
177
+ - Code: 46/200 read — 93.5% good, 4.3% borderline, 2.2% bad. Thresholds met.
178
+ - Math: 40/200 read — 72.5% good, 12.5% borderline, **15% bad (above the
179
+ 10% threshold)**. Six distinct low-frequency patterns with no shared
180
+ cheap detection signature (AI-spam filler, off-topic forum dumps,
181
+ content-aggregator splicing, thin SEO templates, a scraping artifact, and
182
+ one essay-mill/homework-cheating-service ad). Flagged to the user with
183
+ three remediation options; **user decision: accept as a documented
184
+ residual limitation and proceed to delivery**, given the corpus is still
185
+ ~85% good+borderline and further tightening risks reintroducing the
186
+ AMC-8 false-positive problem. Full detail in `reports/final_audit.md`.
187
+
188
+ Full detail for both audit rounds: `reports/quality_audit.md` (Step 4.4),
189
+ `reports/final_audit.md` (Step 5.4).
190
+
191
+ ## 8. Known limitations and caveats
192
+
193
+ - **Math corpus bad-rate (15% at final n=40)**: see above — accepted by the
194
+ user as a residual limitation. Content is genuinely low-quality/off-topic
195
+ in these cases, not corrupted or unsafe at scale, but a downstream
196
+ consumer doing further quality-sensitive work may want to apply additional
197
+ filtering for AI-generated SEO filler, off-topic forum dumps, and
198
+ commercial/service advertisements.
199
+ - **AMPS and OpenStax** (pipeline.md's example math sources) were never
200
+ sourced — AMPS has no confirmed public HuggingFace dataset, and OpenStax
201
+ was not investigated given time constraints and ample surplus from the
202
+ sources actually used.
203
+ - **The Stack v2** (pipeline.md's primary code source) was gated/inaccessible
204
+ (403 GatedRepoError, confirmed 2026-08-22) and was replaced with
205
+ `codeparrot/github-code-clean` per user decision — a non-gated substitute
206
+ with a different (row-level, not pre-sharded) structure.
207
+ - **freeCodeCamp + Exercism combined (~5.5M final tokens)** fell well short
208
+ of pipeline.md's example ~150M "tutorial/educational" allocation — accepted
209
+ by the user, made up by drawing more from the primary GitHub code source
210
+ instead.
211
+ - **HTML quality**: flagged early (Step 1.6) as having real quality issues
212
+ (OCR garbage, non-javadoc auto-generated docs slipping through). Kept per
213
+ user decision, relying on Phase 4's heuristic filters — final audit found
214
+ the residual auto-generated-doc gap persists at low frequency (Sphinx,
215
+ Clover, Doxygen artifacts), consistent across both audit rounds.
216
+ - **quality_score is null for all non-finemath4plus sources** — no
217
+ equivalent upstream classifier score exists for those sources; this was a
218
+ deliberate choice over fabricating a placeholder value.
219
+ - **Duplicate-block detector (built, not deployed)**: a generic
220
+ internal-duplication heuristic was built and tested during the Step 4.4
221
+ math audit (catching 1.5% of finemath4plus) but rejected after inspection
222
+ showed most matches were legitimate forum-quoting structure, not junk
223
+ duplication — documented as a rejected approach rather than shipped.
224
+
225
+ ## 9. Pipeline runtime and process notes
226
+
227
+ The pipeline ran across 2026-08-22 through 2026-08-24. 22+ real bugs were
228
+ found and fixed via direct spot-checking of actual output at every stage
229
+ (never trusting exit codes or summary counts alone) — full chronological
230
+ detail in `progress.md`. One data-integrity incident occurred late in
231
+ Phase 5: two duplicate `filter_math.py --source finemath4plus` processes
232
+ were found running concurrently, both writing to the same output file in
233
+ `"w"` mode (a race condition from an unreconciled duplicate background
234
+ launch), corrupting the file mid-write. Caught during Phase 5 token-summing
235
+ (the file's row count changed between two consecutive reads), both
236
+ processes were killed, the corrupted output deleted, and a single clean
237
+ instance rerun and fully verified before any downstream work relied on it.
math/final.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f64b40cfd1df790e45c4b9cc8b491ae3614933e65a64e7f70099508d7448b7c
3
+ size 3931184848