|
Download README.md from MikeDd2025/ProseOnlyRepair_Codes: direct link, hf CLI and curl.
- Browser
- Download file 5.65 kB
-
https://huggingface.co/datasets/MikeDd2025/ProseOnlyRepair_Codes/resolve/main/README.md
- Command line
-
hf download hf://datasets/MikeDd2025/ProseOnlyRepair_Codes/README.md
-
curl -L -o README.md https://huggingface.co/datasets/MikeDd2025/ProseOnlyRepair_Codes/resolve/main/README.md
5.65 kB
| license: apache-2.0 | |
| language: | |
| - en | |
| tags: | |
| - pretraining | |
| - data-curation | |
| - evaluation | |
| - llm | |
| - common-crawl | |
| pretty_name: ProseOnlyRepair — Evaluation Analysis Scripts | |
| # ProseOnlyRepair — Evaluation Analysis Scripts | |
| Anonymized evaluation/analysis scripts that reproduce the tables and | |
| figures in the *Repair-First* paper (under double-blind review), the | |
| per-task results behind them (`data/`), and the implementation of the | |
| ten-stage repair pipeline (`repair_pipeline_package/`). | |
| ## Contents | |
| | File | Purpose | | |
| |------|---------| | |
| | `build_paper_tables.py` | Headline tables (per-task accuracy, Paloma BPB, repair deltas) | | |
| | `build_8variant_analysis.py` | 8-variant repair-effect-by-tier analysis (POST-only excluded) | | |
| | `build_12variant_analysis.py` | 12-variant superset including POST-only (used in appendix) | | |
| | `make_paper_figures.py` | Regenerates Figures 1 and 2 from eval JSONs | | |
| | `requirements.txt` | Python dependencies (lm-evaluation-harness 0.4.12, datasets <4.0, etc.) | | |
| | `data/results.py` | Per-task results: 27 downstream tasks and 11 Paloma corpora for each tier (HQ, MQ, LQ) and configuration (V1: surface repair; V2: surface + linguistic repair) against Raw (mean over three pre-training seeds), with noise bands, deltas and z-scores; corpus statistics, recovery yield and repair-operation shares | | |
| | `data/make_tables.py` | Writes the appendix LaTeX tables (`appendix_tables.tex`, `table_anatomy.tex`, `table_summary.tex`, `appendix_analysis_tables.tex`) from `data/results.py` | | |
| | `data/make_figures.py` | Writes the result figures (`figures/fig1_teaser*.pdf`, `fig3_heatmaps*.pdf`, `fig4_paloma_split.pdf`, `fig5_ops.pdf`) from `data/results.py` | | |
| | `repair_pipeline_package/` | Implementation of the ten-stage repair pipeline (see below) | | |
| ## Variant naming | |
| Each evaluation result directory follows | |
| `{cluster}_{tier}_new[_repaired[_upsampled]]_results`: | |
| | Token | Meaning | | |
| |---|---| | |
| | `clusterA_` | Pretrained on Cluster A (anonymous identifier) | | |
| | `clusterB_` | Pretrained on Cluster B (anonymous identifier) | | |
| | `_lq` / `_mq` / `_hq` | Low / Medium / High quality CommonCrawl tier | | |
| | `_new` | PRE: pre-repair baseline | | |
| | `_new_repaired` | POST: post-repair, token budget held by truncation | | |
| | `_new_repaired_upsampled` | POST+UP: post-repair + upsampled to original token budget | | |
| ## How to use | |
| ```bash | |
| pip install -r requirements.txt | |
| # Place evaluation result JSONs under ./eval_results/{prose,paloma}/ | |
| python3 build_paper_tables.py | |
| python3 build_8variant_analysis.py | |
| python3 build_12variant_analysis.py | |
| python3 make_paper_figures.py | |
| ``` | |
| The scripts in `data/` need no evaluation JSONs (the per-task results are in | |
| `data/results.py`); run them from the repository root, and they write to it: | |
| ```bash | |
| python3 data/results.py # win/loss tallies per tier and configuration | |
| python3 data/make_tables.py # ./appendix_tables.tex, ./table_anatomy.tex, ./table_summary.tex, ./appendix_analysis_tables.tex | |
| python3 data/make_figures.py # ./figures/*.pdf | |
| ``` | |
| The accompanying evaluation result JSONs (12 variants × prose + paloma | |
| suites) are released in the paper's supplementary materials zip. | |
| ## Repair pipeline (`repair_pipeline_package/`) | |
| The ten-stage repair pipeline in its masking-first form: mixed-content | |
| masking runs before the ftfy repair. | |
| | Path | Role | | |
| |---|---| | |
| | `pipeline.py` | `RepairPipeline`: runs the stages in order and keeps an audit trail of every change | | |
| | `stages/stage01_encoding.py` … `stage10_restore.py` | encoding detection, masking, ftfy repair, artifact removal, line-level repair, character normalization, whitespace, OCR repair, quality validation, restoring the masked segments | | |
| | `masking/` | masking of non-prose segments (DOM path, plain-text path, sentinels) | | |
| | `typed_repair/` | type-specific repair of the masked code, math and structured segments | | |
| | `quality/ensemble.py` | the six-tool quality ensemble | | |
| | `config.py` | model paths (under `$REPAIR_MODELS_ROOT`, default `/data/models`) and thresholds | | |
| | `document.py`, `run.py` | the document and audit data model; the command-line entry point | | |
| From the repository root: | |
| ```bash | |
| python -m repair_pipeline_package.run input.html -o out.jsonl # one file | |
| python -m repair_pipeline_package.run ./corpus_dir -o out.jsonl # every file under a directory | |
| python -m repair_pipeline_package.run scan.txt --source-hint ocr --http-charset utf-8 | |
| ``` | |
| ```python | |
| from repair_pipeline_package import RepairPipeline | |
| doc = RepairPipeline().run(raw_bytes) # doc.text, doc.quality_passed, doc.audit, ... | |
| ``` | |
| Output is JSONL, one document per line: `path`, `encoding`, `quality_passed`, | |
| `quality_score`, `discarded`, `discard_reason`, `n_segments`, `audit`, `text`. | |
| Every model and library a stage uses (fastText, LanguageTool, NLTK, SymSpell, | |
| ByT5, KenLM, Magika, the masking classifiers, BeautifulSoup, ftfy) is optional: | |
| when one is missing, the stage logs a warning and falls back to a heuristic or | |
| skips that step. Model files go under `$REPAIR_MODELS_ROOT` at the paths in | |
| `config.py`. The docstrings call the package `repair_pipeline`; use the folder | |
| name as above, or rename the folder. | |
| ## Notes | |
| - The analysis scripts are CPU-only Python and require no GPU. | |
| - Scripts are deterministic: identical inputs → identical outputs. | |
| - The 28-task prose suite + 11-corpus Paloma BPB panel are evaluated | |
| with `lm-evaluation-harness==0.4.12` (vLLM backend). | |
| - Decoding: greedy, max-len 256 except CoQA/SQuADv2 (512). | |
| This release is anonymous for double-blind review and will be | |
| re-released with author and affiliation metadata after the review | |
| period. | |