noahsantacruz commited on
Commit
5ecb691
·
verified ·
1 Parent(s): 49354f5

Nov 23 v4: geresh numerals, סק"X = סעיף קטן X and truncated words

Browse files
Files changed (4) hide show
  1. README.md +26 -25
  2. model.safetensors +1 -1
  3. roshei_tevot_config.json +2 -2
  4. training_report.json +39 -39
README.md CHANGED
@@ -4,38 +4,39 @@ language: [he, arc]
4
  library_name: transformers
5
  tags: [hebrew, abbreviations, roshei-tevot, sefaria]
6
  ---
7
- # BEREL 3.0 roshei tevot expander (siamese), Nov 22 v3 revision: numbers behind a prefix, and the chapter / seif / mishnah family
8
 
9
  Picks the meaning of a Hebrew or Aramaic abbreviation (roshei tevot, e.g. ר"ש, or a truncated word, e.g. אחרי') in context, by ranking the **sense classes** listed for it in the Sefaria roshei tevot lexicon.
10
- This revision builds on the Nov 22 revision (a numeral-shaped token of two or more letters, value 11-999, always has its number spelled out in Hebrew as a candidate) and adds two things the first number model got wrong in a comparison with Dicta over 2,506 held-out passages:
11
- - a numeral **behind a prefix** (`לי"ב חדשים`, `בכ"ה בכסליו`, `וקי"ד`) now has its number as a candidate, in training and when the model is used (`Lexicon.candidates` offers the number for every grammatical prefix split);
12
- - the **citation family** that is also a numeral (`פ"ב` = פרק ב' or 82, `ס"ד` = סעיף ד' or 64, `מ"ג` = משנה ג' or 43, `ר"פ`) has labelled number and abbreviation examples, so the model chooses between them by context.
 
13
 
14
  - Base: `dicta-il/BEREL_3.0`, 512 tokens, 200 words of context on each side. Siamese: the context vector (mean over the marked token's span) is compared by cosine with a vector for each candidate expansion.
15
- - Data: `berel-roshei-tevot-numbers-v3` (train 1,054,192 rows). On top of the Nov 22 data: 1,559 number rows read by subagents from 10,935 labelled occurrences of the two forms, about 3,600 abbreviation rows for the same tokens, and every prefixed numeral row gains the number as a candidate. Rows where a reference word (דף, סימן, שנת) precedes the token are labelled by rule, except prefixed tokens: after a reference word a token like למ"ד is the whole numeral (74), not ל + 44.
16
- - Training: one epoch, 600,000 sampled rows; sampling weight 1/count(key)^0.5, synthetic weight 0.5, sense balancing β 0.5 (max boost 10). Spot A100, 40 minutes, Nov 22, 2026. Code: `train-roshei-tevot` in Sefaria/ML-Workflows (PR #20, #21). Dataset build: Sefaria/translation-engine, `experiments/expand_roshei_tevot/NUMBERS.md`.
17
- - Candidates are the key's sense classes from train only, plus the number for a numeral; ranking uses the model's scores alone (prior weight 0).
18
 
19
- ## Evaluation on the v3 splits, the three revisions scored on the same rows
20
- Top-1 over rows with two or more candidates and the label among them ("answerable").
21
 
22
- | split | answerable | v3 top-1 | Nov 22 top-1 | Nov 20 top-1 | most-frequent baseline |
23
- |---|---|---|---|---|---|
24
- | val | 2,524 | 95.3 | 95.2 | 95.2 | 78.1 |
25
- | test_seen_keys | 3,446 | 95.8 | 95.7 | 95.4 | 73.4 |
26
- | test_unseen_keys | 253 | 98.4 | 99.2 | 98.0 | 36.4 |
27
- | number_val | 1,718 | 98.8 | 98.8 | 49.4 | 73.2 |
28
- | number_test_seen_keys | 1,721 | 98.7 | 98.8 | 51.0 | 73.5 |
29
- | number_test_dicta | 215 | 95.8 | 96.7 | 90.7 | 94.4 |
30
- | abbr_val (numeral-shaped tokens read as abbreviations) | 1,032 | 95.6 | 93.6 | 95.7 | 61.7 |
31
- | abbr_test_seen_keys | 964 | 95.4 | 93.3 | 95.3 | 60.8 |
32
 
33
- ## Against Dicta, over 2,506 held-out passages (2,507 labelled target tokens)
34
- Model 92.0% (v3) against Dicta 57.8%; the Nov 22 revision scored 91.4%. Of 5,774 numeral tokens, the model's top reading is the number on 2,998 and Dicta's on 1,224; Dicta has the number and the model does not on 26 tokens (42 for the Nov 22 revision). For the 3,160 tokens that are a prefix plus a numeral (mostly real abbreviations such as הר"ן), Dicta's first answer is the number on 20: the Nov 22 revision (with the prefix-aware candidates) had it on top for 8 of them, this revision for 10, and the revision without the prefix-aware candidates for none.
35
 
36
  Read these with care:
37
- - The dataset evaluation gives every revision the number as a candidate. `number_val` and the other `number_*` rows therefore do not separate v3 from the Nov 22 revision, and these labels come from the same rules and subagents the training used, so 98.8 is optimistic. The comparison with Dicta on real passages is the fairer test, and its improvements are small: +0.6 points on targets, 10 against 8 on the prefixed numerals Dicta reads as numbers.
38
- - Known gaps (from reviewers' notes on those passages): one-letter numerals with a geresh behind a prefix (`בז'`, `בג'`, `מד'`) have no number candidate (the letter checker rejects number words); `סק"X` is often read as `סעיף ק"X` instead of `סעיף קטן X`; truncated words with a geresh (`לכתחי'`) get no candidates; a single wrong candidate can get p near 1.0.
39
- - The Nov 22 and Nov 20 revisions are earlier commits of this repository.
40
 
41
- Full report: `gs://sefaria-ml-models/roshei-tevot/reports/numbers-v3-2026-11-22.json`. Expansion index for this model: `gs://sefaria-ml-models/roshei-tevot/index/rt-numbers-v3-2026-11-22`. Files: `roshei_tevot_config.json` (architecture, pooling, logit scale), `training_report.json`.
 
4
  library_name: transformers
5
  tags: [hebrew, abbreviations, roshei-tevot, sefaria]
6
  ---
7
+ # BEREL 3.0 roshei tevot expander (siamese), Nov 23 v4 revision: geresh numerals, סק"X and truncated words
8
 
9
  Picks the meaning of a Hebrew or Aramaic abbreviation (roshei tevot, e.g. ר"ש, or a truncated word, e.g. אחרי') in context, by ranking the **sense classes** listed for it in the Sefaria roshei tevot lexicon.
10
+ This revision builds on the Nov 22 v3 revision (numbers behind a prefix, the chapter / seif / mishnah family) and targets three gaps the reviewers of a comparison with Dicta over 2,506 held-out passages found most often:
11
+ - a **one-letter numeral with a geresh**, with or without a prefix (`ג'`, `בג'`, `מד'`, `וכ'`): the number (`שלשה`) is now a candidate, with training rows from library swaps (`בשלשה ימים` -> `בג' ימים`), tokens before a counted noun, and subagent-read examples;
12
+ - **`סק"X` = `סעיף קטן X`** (`סק"ח`, `סקי"ג`): the model read it as `סעיף ק"ח` or a number; the right reading is a candidate and has 2,720 labelled rows;
13
+ - **truncated words** (`לכתחי'`, `מפיקי'`): the candidates are the 8 most frequent library words that start with the token's letters (a vocabulary of 40,000 words in the index), with 758 subagent-labelled rows.
14
 
15
  - Base: `dicta-il/BEREL_3.0`, 512 tokens, 200 words of context on each side. Siamese: the context vector (mean over the marked token's span) is compared by cosine with a vector for each candidate expansion.
16
+ - Data: `Sefaria/berel-roshei-tevot` (private), v4: train 1,063,570 rows (v3 + 9,378: 4,691 geresh swaps, 1,209 counted-noun cues, 2,720 `סק"X`, 758 truncated words), and every existing row of a geresh-numeral, `סק` + numeral or truncated-word key has the new candidates too.
17
+ - Training: one epoch, 600,000 sampled rows; sampling weight 1/count(key)^0.5, synthetic weight 0.5, sense balancing β 0.5 (max boost 10). Spot A100, Nov 23, 2026. Code: `train-roshei-tevot` in Sefaria/ML-Workflows (PR #20, #21, #22). Dataset build and the rest: Sefaria/translation-engine, `experiments/expand_roshei_tevot/NUMBERS.md` (v4 section).
18
+ - Candidates are the key's sense classes from train only, plus the number for a numeral, `סעיף קטן X` for `סק"X` and vocabulary completions for a truncated token; ranking uses the model's scores alone (prior weight 0 in use; the evaluation picked 0.25).
19
 
20
+ ## Evaluation on the v4 splits, three revisions scored on the same rows
21
+ Top-1 over rows with two or more candidates and the label among them ("answerable"). The v4 splits have more answerable rows than the v3 ones because the new candidates make more rows contested.
22
 
23
+ | split | answerable | v4 top-1 | v3 top-1 | Nov 22 top-1 |
24
+ |---|---|---|---|---|
25
+ | val | 3,189 | 94.7 | 94.5 | 93.4 |
26
+ | test_seen_keys | 4,860 | 94.9 | 94.7 | 93.2 |
27
+ | test_unseen_keys | 331 | 89.1 | 88.5 | 89.4 |
28
+ | number_val (with geresh numerals) | 2,102 | 98.2 | 96.1 | 95.7 |
29
+ | number_test_seen_keys | 2,063 | 98.4 | 96.4 | 95.6 |
30
+ | number_test_dicta | 215 | 95.3 | 96.3 | 96.7 |
31
+ | abbr_val (numeral-shaped, `סק"X`, truncated words) | 1,408 | 89.6 | 88.4 | 84.1 |
32
+ | abbr_test_seen_keys | 1,409 | 89.9 | 83.9 | 78.9 |
33
 
34
+ ## Against Dicta, first 500 of the 2,506 held-out passages (500 labelled target tokens; the other shards were not re-scored: the vocabulary candidates make re-scoring on CPU slow)
35
+ Target accuracy: v4 91.0%, v3 90.4% (both with the v4 candidate code; v3 scored the same with its own), Dicta 58.0%. On the 86 human-reviewed gold targets of these passages: v4 89.5%, v3 91.9% (two targets). Dicta has the number and the model does not on 5 of 1,119 numeral tokens for both revisions. Of 651 tokens that are a prefix plus a numeral, the number is on top for 19 (v4) against 16 (v3).
36
 
37
  Read these with care:
38
+ - The `number_*` and `abbr_*` rows are labelled by rules and subagents that the training also used; the comparison with Dicta on real passages is the fairer test and its gain is small (+3 targets of 500).
39
+ - NOT in this revision: new lexicon readings (the 280 gap proposals), applied label fixes (a two-reader audit confirmed 66 label errors in 800 flagged rows; they are proposals in `label_fixes_v4.jsonl`), and 30 of the 38 truncated-word chunks. The geresh numerals have training rows but the held-out numbers are optimistic.
40
+ - Known gaps: a single wrong candidate can still get p near 1.0; truncated-word completions come from a 40,000-word vocabulary and the 8 most frequent matches.
41
 
42
+ Full report: `gs://sefaria-ml-models/roshei-tevot/reports/numbers-v4-2026-11-23.json`. Expansion index: `gs://sefaria-ml-models/roshei-tevot/index/rt-numbers-v4-2026-11-23`. Files: `roshei_tevot_config.json` (architecture, pooling, logit scale), `training_report.json`.
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f6803ebf461013049ce089d1454b12151e1413a62f81969a015d789e13ceb56e
3
  size 735041208
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:838ccd64a7b736ab3e70cb72751652c1541565690fc96342e3f94ee8e34d95fc
3
  size 735041208
roshei_tevot_config.json CHANGED
@@ -3,11 +3,11 @@
3
  "max_length": 512,
4
  "context_words": 200,
5
  "base_model": "/cache/huggingface/models/dicta-il__BEREL_3.0",
6
- "dataset_repo": "gs://sefaria-ml-models/roshei-tevot/data/berel-roshei-tevot-numbers-v3",
7
  "min_candidates": 2,
8
  "holdout_fold": null,
9
  "n_folds": 5,
10
  "candidate_source": "dataset",
11
  "pooling": "span",
12
- "logit_scale": 21.217119216918945
13
  }
 
3
  "max_length": 512,
4
  "context_words": 200,
5
  "base_model": "/cache/huggingface/models/dicta-il__BEREL_3.0",
6
+ "dataset_repo": "gs://sefaria-ml-models/roshei-tevot/data/berel-roshei-tevot-numbers-v4",
7
  "min_candidates": 2,
8
  "holdout_fold": null,
9
  "n_folds": 5,
10
  "candidate_source": "dataset",
11
  "pooling": "span",
12
+ "logit_scale": 21.192028045654297
13
  }
training_report.json CHANGED
@@ -1,11 +1,11 @@
1
  {
2
  "status": "success",
3
- "run_name": "rt-numbers-v3-siamese-2026-11-22",
4
- "started_at": "2026-11-22T18:06:36.011173+00:00",
5
- "finished_at": "2026-11-22T18:46:14.387515+00:00",
6
  "model_repo_id": "dicta-il/BEREL_3.0",
7
  "revision": null,
8
- "dataset_repo": "gs://sefaria-ml-models/roshei-tevot/data/berel-roshei-tevot-numbers-v3",
9
  "synthetic_weight": 0.5,
10
  "sense_beta": 0.5,
11
  "sense_max_boost": 10.0,
@@ -31,59 +31,59 @@
31
  "resumed_from_checkpoint": null,
32
  "candidates": {
33
  "train": {
34
- "rows_in": 1054192,
35
- "rows_kept": 533888,
36
- "dropped_below_min_candidates": 520304,
37
- "gold_not_in_lexicon_lookup": 21544,
38
  "candidate_source": "dataset",
39
- "target_is_sense_class": 508673,
40
- "dropped_and_right_by_default": 509382
41
  },
42
  "val": {
43
  "rows_in": 6871,
44
- "rows_kept": 2750,
45
- "dropped_below_min_candidates": 4121,
46
- "gold_not_in_lexicon_lookup": 409,
47
  "candidate_source": "dataset",
48
- "target_is_sense_class": 2470,
49
- "dropped_and_right_by_default": 3938
50
  },
51
  "ranking": {
52
  "rows_in": 6871,
53
- "rows_kept": 2631,
54
- "dropped_below_min_candidates": 4240,
55
- "gold_not_in_lexicon_lookup": 409,
56
  "candidate_source": "dataset",
57
- "target_is_sense_class": 2470,
58
- "dropped_and_right_by_default": 3938
59
  }
60
  },
61
  "train_metrics": {
62
- "train_runtime": 2219.1582,
63
- "train_samples_per_second": 270.344,
64
- "train_steps_per_second": 2.112,
65
- "train_loss": 0.6634553938957835,
66
  "epoch": 0.9997866894197952
67
  },
68
  "final_eval": {
69
- "eval_loss": 0.4535423517227173,
70
- "eval_runtime": 3.6318,
71
- "eval_samples_per_second": 757.208,
72
- "eval_steps_per_second": 6.058,
73
  "epoch": 0.9997866894197952,
74
- "eval_top1": 0.9528526148969889,
75
- "eval_frequency_top1": 0.7809033280507132,
76
- "eval_mrr": 0.9737189646064447
77
  },
78
  "best_validation_top1": {
79
- "step": 3000,
80
- "top1": 0.955229793977813,
81
- "frequency_top1": 0.7809033280507132,
82
- "mrr": 0.9748151082937138
83
  },
84
- "mean_tokens_per_second": 149484.90812575739,
85
- "final_model_dir": "/tmp/roshei-tevot-i_lu4uq2/output/final",
86
- "cuda_peak_memory_bytes": 31827713024
87
  },
88
- "model_uri": "gs://sefaria-ml-models/roshei-tevot/runs/rt-numbers-v3-siamese-2026-11-22/final"
89
  }
 
1
  {
2
  "status": "success",
3
+ "run_name": "rt-numbers-v4-siamese-2026-11-23",
4
+ "started_at": "2026-11-23T03:42:13.383646+00:00",
5
+ "finished_at": "2026-11-23T04:22:27.151625+00:00",
6
  "model_repo_id": "dicta-il/BEREL_3.0",
7
  "revision": null,
8
+ "dataset_repo": "gs://sefaria-ml-models/roshei-tevot/data/berel-roshei-tevot-numbers-v4",
9
  "synthetic_weight": 0.5,
10
  "sense_beta": 0.5,
11
  "sense_max_boost": 10.0,
 
31
  "resumed_from_checkpoint": null,
32
  "candidates": {
33
  "train": {
34
+ "rows_in": 1063570,
35
+ "rows_kept": 595179,
36
+ "dropped_below_min_candidates": 468391,
37
+ "gold_not_in_lexicon_lookup": 20219,
38
  "candidate_source": "dataset",
39
+ "target_is_sense_class": 558767,
40
+ "dropped_and_right_by_default": 458603
41
  },
42
  "val": {
43
  "rows_in": 6871,
44
+ "rows_kept": 3410,
45
+ "dropped_below_min_candidates": 3461,
46
+ "gold_not_in_lexicon_lookup": 396,
47
  "candidate_source": "dataset",
48
+ "target_is_sense_class": 3106,
49
+ "dropped_and_right_by_default": 3286
50
  },
51
  "ranking": {
52
  "rows_in": 6871,
53
+ "rows_kept": 3315,
54
+ "dropped_below_min_candidates": 3556,
55
+ "gold_not_in_lexicon_lookup": 396,
56
  "candidate_source": "dataset",
57
+ "target_is_sense_class": 3106,
58
+ "dropped_and_right_by_default": 3286
59
  }
60
  },
61
  "train_metrics": {
62
+ "train_runtime": 2245.6583,
63
+ "train_samples_per_second": 267.154,
64
+ "train_steps_per_second": 2.087,
65
+ "train_loss": 0.6692442751551376,
66
  "epoch": 0.9997866894197952
67
  },
68
  "final_eval": {
69
+ "eval_loss": 0.43112969398498535,
70
+ "eval_runtime": 4.2402,
71
+ "eval_samples_per_second": 804.207,
72
+ "eval_steps_per_second": 6.368,
73
  "epoch": 0.9997866894197952,
74
+ "eval_top1": 0.9363436814048292,
75
+ "eval_frequency_top1": 0.8196926936343681,
76
+ "eval_mrr": 0.9645003658409114
77
  },
78
  "best_validation_top1": {
79
+ "step": 4000,
80
+ "top1": 0.9369708372530574,
81
+ "frequency_top1": 0.8196926936343681,
82
+ "mrr": 0.9645160447371172
83
  },
84
+ "mean_tokens_per_second": 148686.4411490891,
85
+ "final_model_dir": "/tmp/roshei-tevot-pt3o6_m9/output/final",
86
+ "cuda_peak_memory_bytes": 31946108416
87
  },
88
+ "model_uri": "gs://sefaria-ml-models/roshei-tevot/runs/rt-numbers-v4-siamese-2026-11-23/final"
89
  }