# v7.7.0 trains on the v0.7.7-no-ppd corpus: v0.7.2-address-systems, the corpus the published v7.2.0 model trained
# on, with every row built from HM Land Registry Price Paid Data replaced (#2635). Price Paid Data's address fields
# (Postcode, PAON, SAON, Street, Locality, Town/City, District, County) are Royal Mail and Ordnance Survey data
# licensed for personal or non-commercial use only, and every field the corpus took from the file is one of them.
#
# The differences from v7.2.0-address-systems-60k.yaml are:
#
# 1. `data.corpus_dir` points to v0.7.7-no-ppd, an overlay on v0.7.2-address-systems that replaces two sources:
#
#      source              v0.7.2 rows (train / val / test)   GB rows from Price Paid Data    replacement
#      rendered-gb         788,972 / 5,508 / 5,520            every row                       rendered-gb-os-open
#      spliced-sub-venue   116,519 / 1,766 / 1,715            31,440 / 187 / 173              spliced-sub-venue
#
#    `rendered-gb-os-open` is the `locale` recipe's GB part reading the `gb-os-open` adapter's rows. Each Code-Point
#    Open postcode joins its nearest OS Open Roads link. OS Open Names supplies the street and locality fields.
#    All three datasets use OGL v3.0, and the adapter draws a house number. `spliced-sub-venue` keeps its name. Its GB
#    rows are replaced by GB rows rendered over house-venue-tuples-v4.jsonl. The GB tuples come from the same adapter
#    rows. Each new GB row takes an old GB row's position in the file. Its other 88,200 rows are v0.7.2's, in
#    their original order, so the GB rows stay in the first 50,000-row group. No other source in the corpus
#    holds a Price Paid Data row: `invented-house-venue` holds no GB row, and `fragment-assay`'s 907 GB rows are
#    locality names harvested from the base corpus's WOF spans.
#
# 2. `source_weights` names `rendered-gb-os-open` at rendered-gb's 6.0, and a receipt requires 1,000 of its GB rows in
#    the audited epoch. `spliced-sub-venue` keeps 12.0. Its file holds three 50,000-row groups, and v7.2.0's audited
#    epoch read the two without GB rows, so a GB receipt on it would measure the row-group shuffle rather than the
#    corpus and is left out.
#
# 3. `train.output_dir` and `train.trackio_run_name` name the v770 run.
#
# 4. Two sources are declined at 0.0, because the loader refuses a corpus source the weights do not name.
#    `state-tx-notaries` (v7.2.0's 1.5) reads us-professional-licensing-3. Its register decision is unchecked because
#    no Texas Secretary of State terms were found. `reviewed-postcode-tail` (v7.2.0's 0.05) reads four facts cited to
#    the UPU addressing guide for Venezuela and the Anzoátegui state government. The UPU grant identifies no adaptation.
#    The Anzoátegui decision is refused. The `ve-locality-postcode-region` receipt that required its rows is removed
#    with the source.
#
# Every other key is v7.2.0's, so the comparison against the published model measures the source replacement and
# the two declined sources of point 4.
#
# Building the corpus, in order, from the repository root:
#
#   mailwoman corpus fetch gb-os-open
#   mailwoman corpus run gb-os-open --input $MAILWOMAN_DATA_ROOT/corpus/sources/gb-os-open \
#     --out $MAILWOMAN_DATA_ROOT/corpus/staging/gb-os-open
#   mailwoman corpus recipe locale --country GB --count 800000 --seed 42 --intl-fraction 0.0664 \
#     --out <dir>/rendered-gb-os-open.jsonl
#   node packages/corpus/lib/tools/house-venue-tuples.run.ts
#   mailwoman corpus recipe sub-venue --count 120000 --seed 42 --out <dir>/spliced-sub-venue-v4.jsonl
#   mailwoman corpus migrate-recipe-outputs --files <dir>/spliced-sub-venue-v4.jsonl
#   for each recipe output: `mailwoman corpus align-recipe --corpus-version 0.7.7-no-ppd`, then
#     `mailwoman dev jsonl-to-parquet`, then `mailwoman corpus split-overlay`
#   per split, write `spliced-sub-venue-gbswap.<split>.parquet`: v0.7.0-de-holdout's
#     `part-sub-venue.<split>.parquet` with its GB rows dropped, and the split's GB rows of
#     `spliced-sub-venue-v4.<split>.parquet` placed, in file order, at the dropped rows' positions. A split with more
#     new GB rows than old appends the extra rows, and one with fewer drops the unused positions. Every row takes the
#     v4 rows' `license` text. v0.7.2's text listed Price Paid Data among the skeleton sources of every sub-venue row,
#     the non-GB rows included, and those rows' skeletons came from OpenAddresses, BAN and US situs data.
#   register the per-split files with `mailwoman corpus overlay-manifest --base <v0.7.2-address-systems MANIFEST.json>
#     --replace-source rendered-gb,spliced-sub-venue --corpus-version 0.7.7-no-ppd --split …`. The call is recorded
#     in OVERLAY_PLAN.json beside the corpus's MANIFEST.json under the data root.
#
# Keeping v0.7.2's non-GB sub-venue rows isolates the change to the Price Paid Data rows. The sub-venue recipe at
# 0b92c6fe4 writes different non-GB rows from v0.7.2's: 5,740 of 33,600 en-US rows and none of the es-ES or ca-ES
# rows match v0.7.2's text.
#
# `--intl-fraction 0.0664` keeps v0.7.2's order mix: 53,096 of its 800,000 rendered-gb rows were international order
# and included a region span. The recipe's default of 0.4 would put a region span on about 318,000 GB rows, so the
# comparison would measure that change as well as the source replacement. `migrate-recipe-outputs` writes the
# `recipe`, `register` and `surface` columns the sub-venue recipe leaves out, as v0.7.2's overlay migration did.
#
# Measured on 2026-10-17, the adapter wrote 1,523,456 rows from 1,749,109 Code-Point Open rows: 327,007 distinct
# street names, 15,698 localities and 1,523,456 postcodes in 120 postcode areas, 135,148 of them Scottish. The Price
# Paid Data CSV it replaces held 25,674,048 rows over 301,904 street names, 1,067,267 postcodes in 106 areas, and
# 7,497 Scottish rows.
#
# The run is from scratch with `--fresh`: 60,000 steps on an A100-40GB, about 4.3 hours and $9 at the
# training-arc protocol's from-scratch figures.

data:
  corpus_dir: /data/corpus/versioned/v0.7.7-no-ppd/corpus-v0.7.7-no-ppd
  tokenizer_dir: /data/models/tokenizer/v0.9.0-multisplice
  max_length: 128
  # `NO` is quoted because YAML 1.1 reads a bare `NO` as false. A false key would match no Norwegian row.
  country_weights:
    {
      AD: 1.0, AE: 1.0, AF: 1.0, AG: 1.0, AI: 1.0, AL: 1.0, AM: 1.0, AO: 1.0, AR: 1.0, AS: 1.0, AT: 1.0, AU: 1.0,
      AW: 1.0, AX: 1.0, AZ: 1.0, BA: 1.0, BB: 1.0, BD: 1.0, BE: 1.0, BF: 1.0, BG: 1.0, BH: 1.0, BI: 1.0, BJ: 1.0,
      BL: 1.0, BM: 1.0, BN: 1.0, BQ: 1.0, BR: 1.0, BS: 1.0, BT: 1.0, BW: 1.0, BY: 1.0, BZ: 1.0, CA: 1.0, CD: 1.0,
      CF: 1.0, CG: 1.0, CH: 1.0, CI: 1.0, CK: 1.0, CL: 1.0, CN: 1.0, CO: 1.0, CR: 1.0, CU: 1.0, CV: 1.0, CW: 1.0,
      CY: 1.0, CZ: 1.0, DE: 1.0, DJ: 1.0, DK: 1.0, DM: 1.0, DO: 1.0, DZ: 1.0, EC: 1.0, EE: 1.0, EG: 1.0, ER: 1.0,
      ES: 1.0, ET: 1.0, FI: 1.0, FK: 1.0, FM: 1.0, FO: 1.0, FR: 1.0, GB: 1.0, GD: 1.0, GE: 1.0, GF: 1.0, GG: 1.0,
      GH: 1.0, GI: 1.0, GL: 1.0, GM: 1.0, GN: 1.0, GP: 1.0, GR: 1.0, GT: 1.0, GU: 1.0, GW: 1.0, HK: 1.0, HN: 1.0,
      HR: 1.0, HT: 1.0, HU: 1.0, ID: 1.0, IE: 1.0, IL: 1.0, IM: 1.0, IN: 1.0, IO: 1.0, IQ: 1.0, IR: 1.0, IS: 1.0,
      IT: 1.0, JE: 1.0, JM: 1.0, JO: 1.0, JP: 1.0, KE: 1.0, KG: 1.0, KH: 1.0, KM: 1.0, KN: 1.0, KR: 1.0, KW: 1.0,
      KY: 1.0, KZ: 1.0, LA: 1.0, LB: 1.0, LC: 1.0, LI: 1.0, LK: 1.0, LR: 1.0, LS: 1.0, LT: 1.0, LU: 1.0, LV: 1.0,
      MA: 1.0, MC: 1.0, MD: 1.0, ME: 1.0, MF: 1.0, MG: 1.0, MH: 1.0, MK: 1.0, ML: 1.0, MM: 1.0, MN: 1.0, MO: 1.0,
      MP: 1.0, MQ: 1.0, MS: 1.0, MT: 1.0, MU: 1.0, MV: 1.0, MW: 1.0, MX: 1.0, MY: 1.0, MZ: 1.0, NA: 1.0, NC: 1.0,
      NE: 1.0, NG: 1.0, NI: 1.0, NL: 1.0, "NO": 1.0, NP: 1.0, NZ: 1.0, OM: 1.0, PA: 1.0, PE: 1.0, PF: 1.0, PG: 1.0,
      PH: 1.0, PK: 1.0, PL: 1.0, PM: 1.0, PR: 1.0, PT: 1.0, PY: 1.0, QA: 1.0, RE: 1.0, RO: 1.0, RS: 1.0, RU: 1.0,
      RW: 1.0, SA: 1.0, SB: 1.0, SC: 1.0, SD: 1.0, SE: 1.0, SG: 1.0, SH: 1.0, SI: 1.0, SK: 1.0, SM: 1.0, SN: 1.0,
      SO: 1.0, SR: 1.0, ST: 1.0, SV: 1.0, SX: 1.0, SZ: 1.0, TC: 1.0, TH: 1.0, TJ: 1.0, TK: 1.0, TM: 1.0, TN: 1.0,
      TO: 1.0, TR: 1.0, TT: 1.0, TW: 1.0, TZ: 1.0, UA: 1.0, UG: 1.0, UM: 1.0, US: 1.0, UY: 1.0, UZ: 1.0, VA: 1.0,
      VC: 1.0, VE: 1.0, VG: 1.0, VI: 1.0, VN: 1.0, VU: 1.0, WF: 1.0, YT: 1.0, ZA: 1.0, ZM: 1.0, ZW: 1.0,
    }
  source_weights:
    invented-house-venue: 2.0
    # Declined: no reviewed fact's citation reaches a register row permitting training (header, point 4).
    reviewed-postcode-tail: 0.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
    # Declined: us-professional-licensing-3 reads unchecked because no terms were found (header, point 4).
    state-tx-notaries: 0.0
    state-ny-notaries: 2.0
    state-ia-contractors: 0.0
    usgov-imls-pls: 0.0
    deepseek-kryptonite: 3.0
    invented-intersection: 1.0
    rendered-de: 6.0
    rendered-fr-order: 3.0
    rendered-fr-admin-split: 6.0
    spliced-unit: 0.0 # Replaced by spliced-unit-v30.
    spliced-unit-v30: 1.5
    invented-po-box-cedex: 1.5
    spliced-affix: 2.0
    spliced-country: 2.0
    overture: 3.0
    gnaf: 6.0
    invented-anchor-absorption: 6.0
    fragment-fr-bare-street: 0.0 # Replaced by fragment-fr-bare-street-v22.
    fragment-fr-bare-street-v22: 12.0
    rendered-si-bare-village: 12.0
    rendered-no-street-led: 0.0
    rendered-cz-pcfirst-preposition: 0.0 # Replaced by rendered-cz-pcfirst-preposition-v21.
    rendered-cz-pcfirst-preposition-v21: 12.0
    rendered-nl-postcode: 6.0
    fragment-assay: 6.0
    fragment-fr: 12.0
    fragment-no: 12.0
    rendered-gb-os-open: 6.0
    rendered-pt: 6.0
    rendered-ch: 6.0
    rendered-hr: 6.0
    rendered-sk: 6.0
    rendered-lu: 6.0
    spliced-sub-venue: 12.0
    spliced-suffix-boundary: 2.5
    # Replaced by osm-pk, osm-vn and osm-bd, the 2026-10-02 refresh of the same extracts.
    osm: 0.0
    # Han-script rows for the CJK character family. v7.1.0's header, point 2, states why.
    osm-cn: 0.0
  source_reps:
    rendered-sg-register: 1.0
    rendered-pk-register: 1.0
    rendered-bd-register: 8.0
    spliced-trailing-region-es-v28: 8.0
    invented-po-box-military: 8.0
    codex-bare-postcode: 1.0
    spliced-trailing-region-us: 1.0
    spliced-trailing-region-ca-bare: 4.0
    osm-ru: 0.2
    osm-in: 2.0
    osm-id: 2.0
    osm-ng: 4.0
    osm-vn: 1.0
    osm-pk: 1.0
    osm-bd: 2.0
    ban-gp: 0.15
    ban-mq: 0.15
    ban-re: 0.08
    ban-gf: 0.3
    ban-yt: 0.3
    ban-nc: 0.3
    ban-pm: 2.0
    ban-bl: 1.0
    ban-mf: 1.0
    ban-pf: 1.0
    ro-retea-scolara: 2.0
    lv-varis: 0.1
    cordis: 1.0
    fr-finess-overseas: 4.0
    fr-annuaire-education-overseas: 4.0
    gleif-lei: 0.15
  required_corpus_receipts:
    # Each receipt stops the run when the epoch-mixture audit draws fewer matching rows than `min_draws`.
    - name: us-city-state-postcode
      min_draws: 500
      source: spliced-trailing-region-us
      country: US
      component_sequence:
        - locality
        - region
        - postcode
    - name: ca-region-code-tail
      min_draws: 1000
      source: spliced-trailing-region-ca-bare
      country: CA
    - name: us-secondary-unit-current-generation
      min_draws: 2000
      source: spliced-unit-v30
      country: US
    - name: bare-postcode-czech
      min_draws: 250
      source: codex-bare-postcode
      country: CZ
    - name: cz-postcode-first-current-generation
      min_draws: 1000
      source: rendered-cz-pcfirst-preposition-v21
      country: CZ
    - name: fr-bare-street-current-generation
      min_draws: 1000
      source: fragment-fr-bare-street-v22
      country: FR
    - name: sg-registers
      min_draws: 1000
      source: rendered-sg-register
      country: SG
    - name: pk-house-line
      min_draws: 1000
      source: rendered-pk-register
      country: PK
    - name: bd-trailing-postcode
      min_draws: 500
      source: rendered-bd-register
      country: BD
    - name: es-trailing-region-local-surfaces
      min_draws: 500
      source: spliced-trailing-region-es-v28
      country: ES
    - name: us-military-po-box
      min_draws: 500
      source: invented-po-box-military
      country: US
    # GB rows come from OS OpenData now. rendered-gb drew 24,314 of the 1,000,000 audited rows at weight 6.0, and this
    # floor sits at the same 1,000 as the other rendered locales.
    - name: gb-os-open-rows
      min_draws: 1000
      source: rendered-gb-os-open
      country: GB
    - name: pt-native-order
      min_draws: 1000
      source: rendered-pt
      country: PT
    - name: ch-native-order
      min_draws: 1000
      source: rendered-ch
      country: CH
    - name: hr-native-order
      min_draws: 1000
      source: rendered-hr
      country: HR
    - name: sk-native-order
      min_draws: 1000
      source: rendered-sk
      country: SK
    - name: lu-native-order
      min_draws: 1000
      source: rendered-lu
      country: LU
    - name: br-overture-rooftops
      min_draws: 1000
      source: overture-latam
      country: BR
    - name: mx-overture-rooftops
      min_draws: 1000
      source: overture-latam
      country: MX
    # The OSM receipts copied from v7.1.0.
    - name: osm-ru-exposure
      min_draws: 46780
      source: osm-ru
      country: RU
    - name: osm-in-exposure
      min_draws: 12070
      source: osm-in
      country: IN
    - name: osm-id-exposure
      min_draws: 12420
      source: osm-id
      country: ID
    - name: osm-ng-exposure
      min_draws: 3140
      source: osm-ng
      country: NG
    - name: osm-vn-exposure
      min_draws: 8020
      source: osm-vn
      country: VN
    - name: osm-pk-exposure
      min_draws: 9310
      source: osm-pk
      country: PK
    - name: osm-bd-exposure
      min_draws: 2600
      source: osm-bd
      country: BD
    # The address-system sources, each at 90% of its expected draws over the 1,000,000-row epoch.
    - name: ban-gp-exposure
      min_draws: 2610
      source: ban-gp
      country: GP
    - name: ban-mq-exposure
      min_draws: 2180
      source: ban-mq
      country: MQ
    - name: ban-re-exposure
      min_draws: 2900
      source: ban-re
      country: RE
    - name: ban-gf-exposure
      min_draws: 1880
      source: ban-gf
      country: GF
    - name: ban-yt-exposure
      min_draws: 1590
      source: ban-yt
      country: YT
    - name: ban-nc-exposure
      min_draws: 1700
      source: ban-nc
      country: NC
    - name: ban-pm-exposure
      min_draws: 630
      source: ban-pm
      country: PM
    - name: ban-bl-exposure
      min_draws: 650
      source: ban-bl
      country: BL
    - name: ban-mf-exposure
      min_draws: 860
      source: ban-mf
      country: MF
    - name: ban-pf-exposure
      min_draws: 610
      source: ban-pf
      country: PF
    - name: ro-retea-scolara-exposure
      min_draws: 3730
      source: ro-retea-scolara
      country: RO
    - name: lv-varis-exposure
      min_draws: 5800
      source: lv-varis
      country: LV
    - name: cordis-exposure
      min_draws: 6770
      source: cordis
    - name: fr-finess-overseas-exposure
      min_draws: 1120
      source: fr-finess-overseas
    - name: fr-annuaire-education-overseas-exposure
      min_draws: 1300
      source: fr-annuaire-education-overseas
    - name: gleif-lei-exposure
      min_draws: 23770
      source: gleif-lei
  required_validation_coverage:
    - country: GB
      min_rows: 1000
      min_street_rows: 1000
    - country: FR
      min_rows: 1000
      min_street_rows: 1000
    - country: DE
      min_rows: 1000
      min_street_rows: 1000
    - country: US
      min_rows: 1000
      min_street_rows: 1000
    - country: RU
      min_rows: 20
      min_street_rows: 10
    - country: CN
      min_rows: 20
      min_street_rows: 10
    - country: IN
      min_rows: 20
      min_street_rows: 10
    - country: ID
      min_rows: 20
      min_street_rows: 10
    - country: NG
      min_rows: 20
      min_street_rows: 10
    - country: PK
      min_rows: 20
      min_street_rows: 10
    - country: BD
      min_rows: 20
      min_street_rows: 10
    - country: VN
      min_rows: 20
      min_street_rows: 10
    # Presence floors for the address-system sources' countries, as the header's point 6 states.
    - country: RO
      min_rows: 20
      min_street_rows: 10
    - country: LV
      min_rows: 20
      min_street_rows: 10
    - country: GP
      min_rows: 20
      min_street_rows: 10
    - country: MQ
      min_rows: 20
      min_street_rows: 10
    - country: GF
      min_rows: 20
      min_street_rows: 10
    - country: RE
      min_rows: 20
      min_street_rows: 10
    - country: YT
      min_rows: 20
      min_street_rows: 10
    - country: NC
      min_rows: 20
      min_street_rows: 10
    - country: PF
      min_rows: 20
      min_street_rows: 10
    - country: PM
      min_rows: 20
      min_street_rows: 10
  augment_exclude_sources:
    - spliced-suffix-boundary
    # This source teaches a postcode with no other token, such as `119 00`, so augmentation would add tokens the row
    # mustn't contain.
    - codex-bare-postcode
  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-v2.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_address_system_head: true
  address_system_loss_weight: 0.3
  use_locale_hint: true
  locale_hint_drop_prob: 0.5
  locale_hint_noise_prob: 0.05
  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-v770-no-ppd-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
  log_every_steps: 100
  precision: bf16
  num_workers: 0
  csv_log_path: "{output_dir}/../train_log.csv"
  lr_schedule: cosine
  gazetteer_curriculum: true
  evidence_curriculum: true
  evidence_noise_prob: 0.15
  fisher_capture: true
  fisher_capture_last_n_steps: 2000
  trackio_project: mailwoman
  trackio_run_name: v770-no-ppd-60k-s42

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