# v0.5.0 classifier CE-only smoke — dual-loss removal experiment.
#
# Bisect 3 of the v0.5.0 divergence campaign. The first two bisects ruled out
# hidden_size (h384 → h256) and phrase-prior conditioning (PR #128 input layer).
# A gradient-norm ratio probe on diverged checkpoints then revealed CRF gradient
# dominates CE gradient by 8-20× — not the dual-loss collapse the original
# DeepSeek synthesis predicted but the opposite: CRF as aggressor.
#
# Cooperative-vs-conflict regime model: above loss ~0.41 CE + CRF agree
# directionally. below, they conflict and CRF's larger gradient wins. The
# model is dragged off its CE-preferred basin toward a CRF-preferred attractor.
#
# Repair: drop CRF NLL from training entirely. CRF stays at inference via the
# frozen transition mask + Viterbi (structural validity preserved, opposing-
# curvature problem gone). One-line model.py change blocked on
# crf_loss_weight > 0 — backward-compatible.
#
# Diffs from v0_5_0-classifier-phrase-off-smoke.yaml:
#   - crf_loss_weight: 0.05 → 0.0  (skips CRF forward entirely via the new check)
#   - max_steps: 1500 → 2000        (DeepSeek's promotion bar: pass step 2000)
#   - eval_every_steps: 500 → 500   (unchanged. one extra eval @ 2000)
#   - save_every_steps: 1500 → 2000 (single save at the check)
#   - log_every_steps: 50 → 50      (unchanged. per-tag F1 logging unchanged)
#   - output_dir: -phrase-off-smoke → -ce-only-smoke
#
# Recipe history of the campaign:
#   v1   h384 §1+§3 on  LR=1.5e-4 priors=on  crf_w=1.0   → diverged step ~700
#   v2   h384 §1+§3 on  LR=1e-4   priors=on  crf_w=1.0   → diverged step ~1100
#   v3   h384 §1+§3 off LR=1.5e-4 priors=on  crf_w=0.05  → diverged step ~800
#   bsk  h256 §1+§3 off LR=1.5e-4 priors=on  crf_w=0.05  → diverged step ~1050
#   p_off h256 §1+§3 off LR=1.5e-4 priors=off crf_w=0.05 → diverged step ~1100
#   this h256 §1+§3 off LR=1.5e-4 priors=off crf_w=0.00 → ?
#
# Promotion bar (per DeepSeek round-2 conversation):
#   - pass: train_loss stable past step 2000 (no climb >20% from basin minimum)
#     and val_macro_F1 ≥ 0.35 at step 2000
#     and per-tag F1 trajectory shows no single-tag collapse.
#   - fail: any of the above — diagnose tokenizer/corpus next rather than recipe.
#
# See docs/articles/concepts/dual-loss-curvature-conflict.md for the full
# technical write-up of the diagnostic + the cooperative-vs-conflict model.

data:
  corpus_dir: /data/corpus/versioned/v0.4.0/corpus-v0.4.0
  tokenizer_dir: /data/models/tokenizer/v0.5.0-a1
  max_length: 128
  country_weights:
    US: 1.0
    FR: 1.0
  source_weights:
    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
  train_rows_per_epoch: 1000000
  val_rows: 256
  coarse_filter: true

model:
  hidden_size: 256
  num_hidden_layers: 6
  num_attention_heads: 4
  intermediate_size: 1024
  max_position_embeddings: 128
  type_vocab_size: 1
  hidden_dropout_prob: 0.1
  attention_probs_dropout_prob: 0.1
  use_crf: true # CRF stays for inference Viterbi (frozen mask); training skips it via the check
  label_smoothing: 0.0
  crf_normalization: per_sequence
  crf_loss_weight: 0.0 # new: triggers the crf_loss_weight > 0 check to skip CRF forward
  # class_weights omitted → uniform 1.0 per tag (v0.4.0-shipped configuration)
  use_phrase_priors: false
  phrase_feature_dim: 10

train:
  output_dir: /data/models/checkpoints/v0_5_0-classifier-ce-only-smoke
  seed: 42
  batch_size: 16
  eval_batch_size: 16
  grad_accum_steps: 8
  learning_rate: 1.5e-4
  weight_decay: 0.01
  warmup_steps: 500
  grad_clip_norm: 1.0
  max_steps: 2000
  eval_every_steps: 500
  save_every_steps: 2000
  log_every_steps: 50
  precision: bf16
  num_workers: 0
  csv_log_path: "{output_dir}/train_log.csv"
  lr_schedule: constant

eval:
  golden_dir: ""
  val_jsonl: ""
