File size: 3,393 Bytes
4f32433
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
extends: configs/base.yaml
phase: phase3
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
  ndl_selection_manifest: data/processed/ndl/selection.jsonl
  ndl_download_manifest: data/processed/phase3/ndl_downloads.jsonl
  ndl_raw_dir: data/raw/ndl/books
  ndl_clean_dir: data/clean/ndl
  ndl_clean_manifest: data/processed/phase3/ndl_clean.jsonl
  ndl_clean_reuse_manifest: data/processed/ndl/clean.jsonl
  ndl_clean_report: phase3_ndl_cleaning.json
  ndl_quality_sample_report: phase3_ndl_quality_sample.jsonl
  ndl_quality_exclude_manifest: data/processed/ndl/clean.jsonl
  # At the 10k checkpoint, later books averaged only 60.7k clean characters per
  # candidate. 50k projects about 3.24B NDL characters and preserves margin for
  # the 1.5B-token gate even if the 16k tokenizer lowers tokens/character.
  ndl_target_documents: 50000
  ndl_download_delay_seconds: 0.2
  ndl_download_retries: 3
  ndl_max_download_seconds: 600
  split_manifest: data/processed/phase3/splits.jsonl
  ndl_max_abnormal_ngram_rate: 0.38
  ndl_max_latin_rate: 0.005
tokenizer:
  vocab_size: 16384
  directory: artifacts/phase3/tokenizer
  # Train the BPE vocabulary on a deterministic seeded ~200M-character subset of
  # the 1.92B-character train split. The tokenizers BPE trainer with an unsplit
  # byte-level pre-tokenizer holds a per-character pair index (~110 bytes/char
  # peak here), so full-corpus training needs hundreds of GiB; 200M chars keeps
  # peak resident memory near ~23 GiB (no swap) while the 8k/16k vocabulary is
  # already fully converged. The subset is reproducible from project.seed and is
  # recorded in tokenizer metadata (training_sample_*).
  max_train_chars: 200000000
tokenized:
  directory: data/processed/phase3/tokenized
model:
  # 26 layers compensate for the smaller Japanese vocabulary embedding and
  # yield about 346M parameters with a 16,384-token vocabulary.
  n_layer: 26
  n_head: 16
  n_embd: 1024
  block_size: 1024
  dropout: 0.0
training:
  device: cuda
  dtype: bfloat16
  # A full measured optimizer step uses 41.58GB of 47.67GB (12.8% headroom)
  # and projects 3.0B processed tokens to 18.95h on the rented L40S.
  batch_size: 32
  gradient_accumulation_steps: 8
  max_iters: 11445
  learning_rate: 0.0003
  min_lr: 0.00003
  warmup_iters: 300
  lr_decay_iters: 11445
  eval_interval: 250
  eval_iters: 50
  checkpoint_interval: 250
  grad_clip: 1.0
  out_dir: artifacts/phase3
budget:
  # Measured train tokens fell below the original 1.5B target (PLAN 3.4 below-target
  # case): 1,244,686,991 at vocab 8192 and 1,103,005,885 at vocab 16384. Confirm the
  # measured corpus as the budget floor (1.1B) so training proceeds; the model-size
  # decision is recorded per vocab in reports/phase3_tokenization.json (8192 keeps
  # ~337M; 16384 at <1.2B triggers the 250M-class review).
  minimum_train_tokens: 1100000000
  maximum_hours: 30
  maximum_usd: 45
  gpu_hourly_usd: 0.99