File size: 4,581 Bytes
8cd62c1 | 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 | # OpenAI Math Corpus Training Data Generation
## Overview
This directory contains training data generated from the OpenAI Math repository
(719 manuscripts across 372 result families, with ~200+ formally verified in Lean 4).
## Source Data
- **Math manuscript collection** (`math/`): 719 papers across 372 families
- **NavierStokesAndEuler** (`NavierStokesAndEuler/`): 42,000+ Lean formalization files
- **Reasoning traces**: 10 PDF documents with model's chain of thought
- **Lean formalizations**: ~200+ results with Comparator challenges and full library
## Training Data Files
| File | Size | Examples | Description |
|------|------|----------|-------------|
| `unified_training_corpus.jsonl` | 146.5 MB | 118,860 | **All examples unified** - the primary training corpus |
| `lean_problem_solution.jsonl` | 46.9 MB | 53,477 | Lean theorem/lemma declarations → proof terms |
| `lean_proof_granularity.jsonl` | 47.8 MB | 54,220 | Full proof granularity levels |
| `training_pretrain_chunk.jsonl` | 36.5 MB | 8,965 | Cleaned paper text chunks (~4000 chars each) |
| `training_multi_format.jsonl` | 11.0 MB | 1,672 | Cross-format: LaTeX ↔ natural language ↔ Lean |
| `latex_lean_parallel_improved.jsonl` | 1.0 MB | 242 | Paper LaTeX (theorems) ↔ Lean docs |
| `reasoning_trace_training.jsonl` | 0.8 MB | 112 | Model's reasoning trace excerpts |
## Schema (JSONL)
```json
{
"id": "unique_example_id",
"family_id": "001",
"title": "Paper title",
"source_type": "latex|lean|reasoning_trace|multi_format",
"format": "pretrain_chunk|problem_solution|proof_granularity|multi_format|latex_to_lean|reasoning_trace",
"input_text": "...",
"output_text": "...",
"metadata": {...}
}
```
## Data Variations
1. **Pretraining chunks** (8,965): Clean, chunked text from papers for continued pretraining
2. **Problem-solution pairs** (53,477): Lean theorem statements → proof terms for supervised fine-tuning
3. **Proof granularity** (54,220): Multi-level proof representations (statement → sketch → full proof)
4. **Cross-format** (1,672): Same content in LaTeX ↔ natural language ↔ Lean ↔ reasoning trace
5. **LaTeX↔Lean parallel** (242): Paper theorems paired with formalization docs
6. **Reasoning traces** (112): Model's chain-of-thought from 10 detailed results
## Generation Pipeline
1. **Extraction** (`extract_pipeline.py`):
- Extracted full text from all 719 PDFs using pdftotext
- Extracted LaTeX source from all build/ directories
- Parsed CONTENTS.md for family metadata
- Parsed formalization.yaml for Lean result mappings
2. **Lean extraction** (`extract_lean_improved.py`):
- Parsed 55,216 declarations from Comparator challenges, NavierStokesAndEuler, and 190+ referenced library files
- Generated problem-solution and proof-granularity training examples
3. **Reasoning trace extraction** (`extract_reasoning_traces.py`):
- Extracted and structured all 10 reasoning trace PDFs
4. **Training data generation** (`generate_training_data.py`):
- Chunked paper text into pretraining segments
- Created cross-format pairs
- Generated LaTeX↔Lean parallels
5. **Consolidation** (`consolidate_training_data.py`):
- Unified all examples into single corpus file
## Technical Details
- **Sources read**: PDFs (via pdftotext), LaTeX (.tex), Lean (.lean), YAML, Markdown
- **Encoding**: UTF-8 throughout
- **Total disk size**: ~144.6 MB
- **Robustness**: All text extraction used replace-mode for encoding errors
## Known Limitations
1. **PDF text extraction**: Used pdftotext (poppler) which may lose some LaTeX structure. Mathematical formulas appear as raw text.
2. **Lean parsing**: Custom Python parser, not using Lean's own preprocessing. May miss complex declarations or include partial matches.
3. **Formalization pairing**: Family IDs matched via CONTENTS.md directory names; some (~30 directory-to-family mismatches) may be incorrect.
4. **Reasoning traces**: Only 10 of 372 families have reasoning traces.
5. **No verification**: Generated Lean data was not verified with Lean compiler (files are too large for timely processing).
## Usage
For supervised fine-tuning on theorem proving:
```python
# Load problem-solution pairs
import json
with open("lean_problem_solution.jsonl") as f:
examples = [json.loads(line) for line in f]
# Each: {"input_text": "theorem foo : T", "output_text": "by ..."}
```
For continued pretraining:
```python
with open("training_pretrain_chunk.jsonl") as f:
chunks = [json.loads(line) for line in f]
# Each: {"input_text": "cleaned paper text..."}
```
|