| extends: configs/base.yaml | |
| phase: phase6 | |
| # Phase 6 reopens the corpus. Phase 5 concluded that this closed corpus was near | |
| # an entropy floor because two single-lever moves (data 2.5x, model 2.1x) both | |
| # bought ~3.5% BPB. reports/phase6_rejection_review.json shows that conclusion | |
| # rested on a corpus that was never exhausted: 141,521 of the frozen pool's | |
| # 241,430 candidates (58.6%) were dropped as short_document, and the filter | |
| # responsible was measuring domain novelty rather than OCR corruption -- its | |
| # reference 3-gram set came from the Aozora literary corpus alone (2.88M | |
| # 3-grams). Re-scoring 300 re-downloaded quarantined documents against a | |
| # reference that also includes accepted NDL text recovers 63% of them, worth an | |
| # estimated +1.08B prose tokens (train 2.742B -> 3.818B). | |
| # | |
| # 6.2 (this config's acquisition stage) only re-downloads. Cleaning waits for | |
| # the 6.1 filter redesign, so raw ZIPs are NOT pruned in between -- pruning | |
| # before the new filter exists would force a second five-day re-download. | |
| data: | |
| ndl_metadata_dir: data/raw/ndl/metadata | |
| ndl_metadata_glob: data/raw/ndl/metadata/books_*.zip | |
| ndl_metadata_urls: | |
| - https://dl.ndl.go.jp/static/files/dataset/dataset_202602_t_internet_01.zip | |
| - https://dl.ndl.go.jp/static/files/dataset/dataset_202602_t_internet_02.zip | |
| - https://dl.ndl.go.jp/static/files/dataset/dataset_202602_t_internet_03.zip | |
| - https://dl.ndl.go.jp/static/files/dataset/dataset_202602_t_internet_04.zip | |
| - https://dl.ndl.go.jp/static/files/dataset/dataset_202602_t_internet_05.zip | |
| # The frozen pool stays the source of truth for order and rights evidence. | |
| ndl_selection_pool_manifest: data/processed/ndl/selection.jsonl | |
| # ndl-download walks ndl_selection_manifest, so phase 6 points it at the | |
| # quarantined-only subset (in pool order) built by | |
| # scripts/build_phase6_selection.py. Existing ZIPs are skipped by checksum, so | |
| # the run stays idempotent and resumable. Do NOT run ndl-select against this | |
| # config: the pool is frozen and ndl-select would overwrite this subset. | |
| ndl_selection_manifest: data/processed/phase6/selection_quarantined.jsonl | |
| ndl_download_manifest: data/processed/phase6/ndl_downloads.jsonl | |
| ndl_raw_dir: data/raw/ndl/books | |
| ndl_clean_dir: data/clean/ndl | |
| ndl_clean_manifest: data/processed/phase6/ndl_clean.jsonl | |
| # Phase-5's manifest is already a superset carrying phases 1-4 forward. | |
| ndl_clean_reuse_manifest: data/processed/phase5/ndl_clean.jsonl | |
| ndl_clean_report: phase6_ndl_cleaning.json | |
| ndl_quality_sample_report: phase6_ndl_quality_sample.jsonl | |
| ndl_quality_exclude_manifest: data/processed/phase5/ndl_clean.jsonl | |
| ndl_target_documents: 241430 | |
| ndl_download_delay_seconds: 0.2 | |
| ndl_download_retries: 3 | |
| ndl_max_download_seconds: 600 | |
| # 6.3 froze phase-6 splits, so this now points at them (phase-4's manifest stays | |
| # on disk untouched). The fixed 24-work phase-1 test set carries over unchanged. | |
| split_manifest: data/processed/phase6/splits.jsonl | |
| ndl_max_abnormal_ngram_rate: 0.38 | |
| ndl_max_latin_rate: 0.005 | |
| # 6.1 filter redesign. The abnormal-ngram reference was built from the Aozora | |
| # literary corpus alone (2,879,238 3-grams), which made that filter a | |
| # domain-novelty detector rather than an OCR-corruption one: re-scoring 300 | |
| # re-downloaded quarantined documents against a reference that also includes | |
| # accepted NDL text recovers 63% of them (reports/phase6_rejection_review.json). | |
| # Order is fixed and each manifest is capped, so the reference itself is | |
| # reproducible and can be frozen alongside the thresholds. | |
| ndl_reference_manifests: | |
| - data/processed/aozora/clean.jsonl | |
| - data/processed/phase5/ndl_clean.jsonl | |
| ndl_reference_max_chars: 200000000 | |
| # Widening the reference lets statistics tables and directories through, since | |
| # abnormal_ngram_rate had been rejecting them as a side effect. Calibrated in | |
| # reports/phase6_filter_calibration.json: a 0.18 numeral-run ratio fires on | |
| # 0.071% of already-accepted characters (inside 6.1's 0.5% shrink gate) and | |
| # catches 100% of the pages the audit triaged as tables. | |
| # | |
| # No kana-run rule ships. The draft "garbled" detector was measured against the | |
| # same two sets and no run length separates ruby-contaminated OCR from ordinary | |
| # 文語体 (run>=8 at ratio>0.05 flags 54% of accepted characters; run>=20 at | |
| # ratio>0.20 still flags 8% while recall falls to 41%). 文語体 simply contains | |
| # long kana runs. mojibake_page continues to handle genuine corruption. | |
| ndl_max_digit_run_rate: 0.18 | |
| # 6.3 の phase6-merge が書き出す、ページ規則適用後のcleanテキスト。 | |
| # data/clean/ndl を直接書き換えない: 記録済み clean_sha256 と公開済み v1/v2 の | |
| # 基礎が変わるため(reports/phase6_cleaning_plan.json で却下した案)。 | |
| ndl_filtered_dir: data/clean/ndl_phase6 | |
| # 仮名3-gram参照(青空文庫のみ、凍結)。kana_soup の判定に使う。 | |
| # 生成: uv run python scripts/calibrate_phase6_kana_soup.py | |
| ndl_kana_reference: artifacts/phase6/kana_reference.txt | |
| # アプリの接地検索が引く母集団。ndl_clean_manifest(ページ規則適用前の | |
| # data/clean/ndl を指す)ではなく、モデルが実際に学習した ndl_phase6 側を | |
| # 向ける。書名索引に必要な項目(ndl_pid/title/ndc/publication_year/ | |
| # clean_path/clean_chars)はsplit manifestが全て持っている。 | |
| ndl_grounding_manifest: data/processed/phase6/splits.jsonl | |
| tokenizer: | |
| # Retrained in 6.3 over the expanded corpus. BPB is per byte, so changing the | |
| # tokenizer does not break comparability with phases 1-5. | |
| vocab_size: 16384 | |
| directory: artifacts/phase6/tokenizer | |
| max_train_chars: 200000000 | |
| tokenized: | |
| directory: data/processed/phase6/tokenized | |
| model: | |
| # 6.4 co-scaling. フェーズ5は730M(36層/20head/1280)でデータ据え置き、 | |
| # フェーズ4は345Mでデータ2.5倍。単独レバーの改善率がほぼ一致した | |
| # (+3.46% / +3.53%)ことがフェーズ6の出発点なので、ここは初めて両方を同時に | |
| # 動かす: データ 2.742B → 実測3.8B級、モデル 730M → 約1.05B。 | |
| # head_dim = 1536/24 = 64 でフェーズ3〜5と同じ比を保つ。 | |
| # 実数は `tcja --config configs/phase6.yaml parameter-count --vocab-size 16384` | |
| # で確認し reports/runs/parameter-count.json へ残す。 | |
| n_layer: 36 | |
| n_head: 24 | |
| n_embd: 1536 | |
| block_size: 1024 | |
| dropout: 0.0 | |
| training: | |
| device: cuda | |
| dtype: bfloat16 | |
| # ユーザー判断(2026-07-30)で batch16 x accum16。tokens_per_step は 262,144 で | |
| # 変わらないので max_iters もそのまま。 | |
| # 当初は batch8 x accum32 を第一候補にしていたが、accumulation回数が半分になる | |
| # 分こちらが速いはずで、本学習163時間に対しては数%でも十数時間効く。 | |
| # フェーズ5は同じ形(batch16 x accum16)を730Mで走らせて peak 43.8GB・余裕48.4% | |
| # だった。パラメータは1.43倍だが、支配的なoptimizer stateでも +9GB程度の見込み。 | |
| # **6.5のflightで実測する。VRAM余裕が10%未満なら batch8 x accum32 へ戻す。** | |
| batch_size: 16 | |
| gradient_accumulation_steps: 16 | |
| # FINALIZED (2026-07-30、reports/phase6_tokenization.json): train実測 | |
| # 3,953,739,596 tokens × 3ep = 11,861,218,788 処理トークン ÷ 262,144 tok/step | |
| # = 45,254.9 → 45,300 iters(3.003ep、処理 11,875,123,200)。 | |
| # tokens/param 11.35 は フェーズ5の11.3とほぼ同じで、データとモデルを同率で | |
| # 伸ばした結果になっている。 | |
| max_iters: 45300 | |
| learning_rate: 0.00025 | |
| min_lr: 0.000025 | |
| warmup_iters: 300 | |
| lr_decay_iters: 45300 | |
| eval_interval: 500 | |
| eval_iters: 50 | |
| checkpoint_interval: 500 | |
| grad_clip: 1.0 | |
| out_dir: artifacts/phase6 | |
| budget: | |
| # フェーズ5実測 9.065 s/step(730M・A100 80GB・262,144 tok/step)= 104.1M tok/h。 | |
| # FLOPsはパラメータ数にほぼ比例するので 1.05B では約72M tok/h。 | |
| # 3ep(約11.4B処理)で約158h・$220($1.39/h)。上限は余裕を見て置く。 | |
| minimum_train_tokens: 3500000000 | |
| maximum_hours: 190 | |
| maximum_usd: 270 | |
| gpu_hourly_usd: 1.39 | |