# === v4.0.0-base-60k — the from-scratch base retrain (v8.3.0 Arc 1, Phase 2. model 7.0.0 candidate). ===
# (Claude-owned. ROAD_TO_MAILWOMAN_V8_3_0 + the three merged Phase-0 memos are the pre-registration:
# recipe-assembly D1-D3, Fisher-capture D4, operator sign-off = the #1348 merge, 2026-07-29.)
#
# What this run is: the golden master — every shipped capability from one recipe with one
# provenance, zero open watch items at ship. The base the B11 fine-tune template starts every
# engagement from. the run where the Fisher artifact is captured at the only cheap point.
#
# composition (D2, deltas vs the shipped v3.24.0-bundle-ordinal recipe):
#   1. from scratch — no init_from. 60k steps, cosine anneal, warmup 1000, lr 5e-4, seed 42 (D1).
#   2. locality-surface lexicon v6 -> v7 (the DE country fold, #1355. city-state law-4 exception).
#   3. synth-po-box-cedex 3.0 -> 1.5 (revert the replay boost — fine-tune medicine. the base
#      re-learns the class natively at the v385 share).
#   4. fisher_capture: true — diagonal empirical Fisher over the final 2k steps, artifact beside
#      the final checkpoint (#1354).
#   5. gazetteer_curriculum: true — the fresh gazetteer channel trains its absence-robustness from
#      step 0 (the v0.9.13 receipt: an always-on clue over-relies. the shipped base lineage trained
#      with it — from-scratch re-runs that decision, it doesn't inherit it).
#   6. classifier_learning_rate: none — everything is fresh. the hot-LR carveouts are fine-tune
#      implementation for fresh-heads-on-frozen-bases.
#   Everything else verbatim from v3.24: feed weights (deploc passengers stay out), augmentations incl.
#   ordinal 0.3 + punct_drop 0.3, both bundle channels + digit-guard street v3, evidence curriculum
#   + 0.15 false-evidence noise, country softener 0.5, class weights, phrase priors.
#
# #1349 context (the addendum in the recipe memo): this run is the locality channel's first actual
# training — every prior "trained" locality receipt was a frozen random marker (trainer fix #1350).
# G1's locality bars are therefore floors against the marker's own measured readings rather than against a
# trained channel. a G1 miss is read against the addendum before any iteration.
#
# PRE-registered checks (graded per save from 40k on. the ladder wording inherits v3.23/v3.24):
#   G1 fragment bars (P0 grid, --lexicon locality-surface-lexicon-v7.json
#      --street-lexicon street-type-lexicon-v3.json): homonym on-off >= +0.050 asis and >= +0.25
#      lower+heal (the marker's number to beat); house-number classes >= -0.020 asis raw;
#      lowercase-heal all >= +0.015. bare-locality damage class ~0 (the curriculum now
#      reaches the channel — its first real test).
#   G2 ablation vs the shipped 6.7.0 same-grader reference.
#   G3 invariance (int8, --baseline 6.7.0): zero new classes.
#   G4 gauntlet x3 layers.
#   G5 golden ablated: **match-or-beat 6.7.0 with zero waivers** — including fr.cedex against the
#      unwaived 85.6-class shipped-same-harness reading (the entire point of from-scratch. the
#      82.2 waived floor is dead for this run). Floors rebuilt noise-calibrated (max(1.0pp, 2xSE)) from
#      the candidate's own readings at promote. G5b golden fed recorded (misroute-cost input).
#   G6 canary zero-flip, formatted mode.
#   G7 the full pre-ship gauntlet on the dev-linked flip (the 8.2.0 instrument): Fifth-Ave
#      INV/band clears natively (ordinal augmentation is in the base), world-city fixtures clear
#      under the street-context check.
#   G8 DE legs (new — the v7 fold's value check): DE golden at the current de.native_locality floor
#      + the DE fragment leg. instrument prerequisite: the DE P0-style fragment board must exist
#      before the 40k grading window opens. if the fold shows no gain, the shipped lexicon reverts to v6
#      (per-ingredient D-rule) without indicting the run.
#   fisher sanity (mechanical): fisher-diag-v1.npz written beside the final checkpoint, loads, and
#      covers every trainable parameter. sidecar provenance complete.
#   stop rules (D1): this is run 1 of a 2-run envelope. Any G-miss => the pre-registered single-delta
#      contingency and one re-run. a second miss is an operator conversation, never a third launch.
#      No knob iteration inside the run.
#
# Launch checklist: locality-surface-lexicon-v7.json synced to the volume (R2 gazetteer/ -> /data/
# gazetteer/); all other artifacts persist from the v3.24 run. Then:
#   node packages/mailwoman/tools/training/launch/launch.run.ts start --config v4.0.0-base-60k.yaml --fresh
#
data:
  corpus_dir: /data/corpus/versioned/v0.13.0-latam/corpus-v0.13.0-latam
  tokenizer_dir: /data/models/tokenizer/v0.9.0-multisplice
  max_length: 128
  country_weights: # Verbatim from v2.4.1.
    US: 1.0
    FR: 1.0
    DE: 1.0
    ES: 1.0
    IT: 1.0
    NL: 1.0
    PT: 1.0
    BE: 1.0
    PL: 1.0
    AT: 1.0
    CH: 1.0
    CZ: 1.0
    DK: 1.0
    "NO": 1.0
    SE: 1.0
    FI: 1.0
    IE: 1.0
    GB: 1.0
    SK: 1.0
    SI: 1.0
    HR: 1.0
    HU: 1.0
    AU: 1.0
    CA: 1.0 # Overture — live locality.
    MX: 1.0 # Overture — BR stays out (0% OA-lineage + SN-garbage numbers).
  source_weights: # Verbatim from v3.24 except synth-po-box-cedex (the D2 revert).
    overture-latam: 6.0
    wof-admin: 2.0
    wof-postalcode: 2.0
    ban: 3.0
    tiger: 4.0
    usgov-nppes: 2.0
    usgov-hrsa-fqhc: 2.0
    usgov-imls-pls: 2.0
    usgov-nad: 1.0
    state-ia-contractors: 2.0
    state-tx-notaries: 1.5
    state-ny-notaries: 2.0
    deepseek-kryptonite: 3.0
    synth-intersection: 1.0
    synth-german: 6.0
    synth-fr-order: 3.0
    synth-fr-admin-split: 6.0
    synth-unit: 1.5
    synth-po-box-cedex: 1.5 # D2 REVERT (3.0 -> 1.5, the v385 share): the boost was fine-tune replay medicine. the base learns the class natively.
    synth-affix: 2.0
    synth-country: 2.0
    overture: 3.0
    gnaf: 6.0
    synth-anchor-absorption: 6.0
    synth-fr-bare-street: 12.0
    synth-si-bare-village: 12.0
    synth-no-street-led: 0.0
    synth-cz-pcfirst-preposition: 12.0
    synth-nl-postcode: 6.0
    synth-fragment: 6.0
    synth-fr-fragment: 12.0
    synth-no-fragment: 12.0
  train_rows_per_epoch: 1000000
  val_rows: 4096
  coarse_filter: true
  augment_directional_prob: 0.3
  augment_region_prob: 0.3
  augment_glue_prob: 0.25
  augment_ordinal_prob: 0.3 # The num-ordinal invariant, native from step 0 (v3.24's proven value).
  augment_punct_drop_prob: 0.3
  anchor_lookup_path: /data/anchor/pilot-anchor-lookup.json
  gazetteer_lexicon_path: /data/gazetteer/anchor-lexicon-v1.json
  country_lexicon_path: /data/gazetteer/country-surface-lexicon-v1.json
  gazetteer_choreography: true
  affix_relabel_lexicon_path: /data/gazetteer/affix-relabel-lexicon-v1.json
  anchor_paint_mode: shaped
  anchor_value_mode: posterior_latlon
  street_type_lexicon_path: /data/gazetteer/street-type-lexicon-v3.json
  locality_surface_lexicon_path: /data/gazetteer/locality-surface-lexicon-v7.json # D2: the DE fold (#1355).
model: # Verbatim from v3.24 (v2.4.1 geometry + the shipped channel set).
  hidden_size: 384
  use_span_boundary_head: true
  span_boundary_loss_weight: 0.5
  num_hidden_layers: 6
  num_attention_heads: 6
  intermediate_size: 1536
  max_position_embeddings: 128
  type_vocab_size: 1
  hidden_dropout_prob: 0.1
  attention_probs_dropout_prob: 0.1
  use_crf: true
  crf_loss_weight: 0.0
  crf_normalization: per_sequence
  label_smoothing: 0.1
  use_locale_conditioning: true
  locale_loss_weight: 0.3
  use_postcode_anchor: true
  use_gazetteer_anchor: true
  gazetteer_feature_dim: 5
  use_country_anchor: true
  country_feature_dim: 2
  use_street_type_anchor: true
  street_type_feature_dim: 1
  use_locality_surface_anchor: true
  locality_surface_feature_dim: 2
  country_ambiguous_scale: 0.5
  class_weights:
    O: 0.5
    B-country: 3.5
    I-country: 3.5
    B-region: 1.5
    I-region: 1.5
    B-locality: 2.0
    I-locality: 2.0
    B-dependent_locality: 1.0
    I-dependent_locality: 1.0
    B-postcode: 1.5
    I-postcode: 1.5
    B-subregion: 0.3
    I-subregion: 0.3
    B-cedex: 1.0
    I-cedex: 1.0
    B-venue: 1.5
    I-venue: 1.5
    B-street: 2.0
    I-street: 2.0
    B-house_number: 1.5
    I-house_number: 1.5
    B-street_prefix: 1.5
    I-street_prefix: 1.5
    B-street_suffix: 1.5
    I-street_suffix: 1.5
    B-unit: 1.5
    I-unit: 1.5
    B-po_box: 1.5
    I-po_box: 1.5
    B-intersection_a: 1.0
    I-intersection_a: 1.0
    B-intersection_b: 1.0
    I-intersection_b: 1.0
  use_phrase_priors: true
  phrase_feature_dim: 10

train: # FROM SCRATCH (D1): no init_from, full-length cosine, one param group.
  output_dir: /data/output-v400-base-60k-s42/checkpoints
  seed: 42
  batch_size: 128
  eval_batch_size: 128
  grad_accum_steps: 1
  learning_rate: 5.0e-4
  weight_decay: 0.01
  warmup_steps: 1000
  grad_clip_norm: 1.0
  max_steps: 60000
  eval_every_steps: 2000
  save_every_steps: 5000 # D1: every 5k. the over-trust watch grades every save from 40k on.
  log_every_steps: 100
  precision: bf16
  num_workers: 0
  csv_log_path: "{output_dir}/../train_log.csv"
  lr_schedule: cosine
  gazetteer_curriculum: true # Fresh channel — absence-robustness from step 0 (see header note 5).
  evidence_curriculum: true
  evidence_noise_prob: 0.15
  fisher_capture: true # D4/#1354 — the B11 consolidation artifact, captured at the only cheap point.
  fisher_capture_last_n_steps: 2000
  trackio_project: mailwoman
  trackio_run_name: v4.0.0-base-60k-s42

eval:
  golden_dir: /data/eval/golden/v0.1.2
  val_jsonl: ""
