# === v4.3.3-cooldown46k — WSD-style decay branch of the v4.3.3 step-040000 checkpoint ===
#
# hypothesis (2026-08-10 recipe review, change 11): every graded v4.3.3 checkpoint sat mid-cosine
# at 26-93% of peak LR. the schedule literature (Chinchilla schedule-matching. Hagele 2024
# arXiv:2405.18392. MiniCPM arXiv:2404.06395) reports that such reads understate the finished model,
# and that decaying a mid-run checkpoint's LR to zero over a short branch recovers approximately the
# matched-schedule endpoint. This branch reads out the 40k checkpoint's finished-schedule score.
#
# mechanics: resume /data/output-v433-suffix-boundary-base-s42/checkpoints/step-040000 (model +
# optimizer + scheduler) under this config: learning_rate = the parent's exact 40k tail LR
# (5e-4 x 0.5 x (1+cos(pi x 39000/59000)) = 1.288623e-4), lr_schedule linear_cooldown holding
# multiplier 1.0 at the branch point then decaying linearly to zero at 46k. The schedule-aware
# LR restamp (2026-08-09 training-loader repair) makes the first branch step continue the parent
# exactly — no spike in either direction.
#
# everything else is v4.3.3 verbatim — same corpus (v0.18.1), same v1 affix lexicon (the label
# contradiction is deliberately retained: this branch isolates the schedule variable. the
# corrected v2-lexicon feed belongs to the next fresh base rather than here). The loader is the
# repaired loader (stationary sampler, clean val) — noted, unavoidable, and strictly
# better-defined than the parent's non-stationary epochs.
#
# launch exactly once:
#   node packages/mailwoman/tools/training/launch/launch.run.ts start \
#     --config v4.3.3-cooldown46k.yaml \
#     --branch-from /data/output-v433-suffix-boundary-base-s42/checkpoints/step-040000
#
# The Python trainer wrote that step-040000 checkpoint, with `optimizer.pt` and no `optimizer.json`. The Rust
# trainer refuses to resume it, and this branch needs the parent's optimizer and scheduler state, so a fresh
# optimizer would change the experiment. A rerun first retrains v4.3.3 to step 40000 on the Rust trainer.
#
# checks (fp32, unchanged): B1 >=116/128, B2 >=34/48, B4 tokens >=3/7. B3 only after all three.
# Grade the final 46k checkpoint (decay complete); 42k/44k saves are curve receipts only.
# If 46k still sits in the 72-85 B1 band, the plateau was not a schedule artifact and the
# data-contradiction fix is the only remaining explanation. No recipe iteration on this branch.

data:
  corpus_dir: /data/corpus/versioned/v0.18.1-suffix-boundary/corpus-v0.18.1-suffix-boundary
  tokenizer_dir: /data/models/tokenizer/v0.9.0-multisplice
  max_length: 128
  country_weights:
    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
    MX: 1.0
  source_weights:
    synth-house-venue: 2.0
    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-nad: 1.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
    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
    synth-gb: 6.0
    synth-sub-venue: 12.0
    synth-suffix-boundary: 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
  augment_punct_drop_prob: 0.3
  anchor_lookup_path: /data/anchor/pilot-anchor-lookup-v2-2026-08-05.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

model:
  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:
  output_dir: /data/output-v433-cooldown46k-s42/checkpoints
  seed: 42
  batch_size: 128
  eval_batch_size: 128
  grad_accum_steps: 1
  learning_rate: 1.288623e-4
  weight_decay: 0.01
  warmup_steps: 0
  grad_clip_norm: 1.0
  max_steps: 46000
  eval_every_steps: 2000
  save_every_steps: 2000
  log_every_steps: 100
  precision: bf16
  num_workers: 0
  csv_log_path: "{output_dir}/../train_log.csv"
  lr_schedule: linear_cooldown
  cooldown_start_step: 40000
  gazetteer_curriculum: true
  evidence_curriculum: true
  evidence_noise_prob: 0.15
  fisher_capture: false
  fisher_capture_last_n_steps: 2000
  trackio_project: mailwoman
  trackio_run_name: v433-cooldown46k-s42

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