File size: 5,645 Bytes
08326df | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | ---
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.
|