noahsantacruz commited on
Commit
76edbae
·
verified ·
1 Parent(s): 2dc02f6

BEREL 3.0 roshei tevot model, Nov 22, 2026: numerals can be answered with their number (run rt-numbers-siamese-2026-11-22)

Browse files
Files changed (4) hide show
  1. README.md +33 -26
  2. model.safetensors +1 -1
  3. roshei_tevot_config.json +4 -2
  4. training_report.json +43 -41
README.md CHANGED
@@ -4,29 +4,36 @@ language: [he, arc]
4
  library_name: transformers
5
  tags: [hebrew, abbreviations, roshei-tevot, sefaria]
6
  ---
7
- # BEREL 3.0 roshei tevot expander (siamese)
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. The main model: the context and each candidate are embedded separately, so candidate embeddings can be precomputed.
10
-
11
- - Base: `dicta-il/BEREL_3.0`, 512 tokens, 200 words of context on each side of the abbreviation.
12
- - Data: `Sefaria/berel-roshei-tevot` (private), the Nov 19, 2026 build. Train: 235,729 gold, 256,553 LLM-labelled, 1,360 rechecked and 15,833 work-scoped labels, plus 512,311 synthetic (swapped) examples.
13
- - Training: one epoch, 600,000 sampled rows; sampling weight 1/count(key)^0.5, synthetic weight 0.5 (picked on val from 0, 0.5, 1), sense balancing β 0.5 (max boost 10). Spot A100, Nov 20, 2026. Training code: `train-roshei-tevot` in Sefaria/mlworkflows.
14
- - Candidates are the key's sense classes from train only; a class is represented by its most-trained reading. Ranking uses the model's scores alone: a train-frequency prior was tried and its weight λ chosen on balanced val top-1, which picked λ = 0.
15
-
16
- ## Results (scored once on test)
17
-
18
- Balanced top-1 is the mean of top-1 over the majority, common and rare sense bands (rare = under 10% of the key's train examples), so a rare sense counts as much as a frequent one. Top-1 is over rows with two or more candidate sense classes and the right one among them. "All rows" also counts rows with a single candidate (right by default) and rows the ranker cannot answer (no candidates, or the label is not a candidate) as wrong.
19
-
20
- | split | ranked rows | top-1 | balanced top-1 | most-frequent baseline | gold top-1 | LLM-label top-1 | rare-sense top-1 | MRR | all rows |
21
- |---|---|---|---|---|---|---|---|---|---|
22
- | val | 2,580 | 96.0 | 90.8 | 78.5 | 98.0 | 93.9 | 85.2 | 0.978 | 92.8 of 6,806 |
23
- | test_seen_keys | 3,535 | 96.2 | 90.4 | 74.4 | 97.6 | 94.6 | 79.4 | 0.980 | 93.9 of 10,558 |
24
- | test_unseen_keys | 302 | 94.9 | | 36.2 | 95.9 | 91.1 | | 0.973 | 8.6 of 8,058 |
25
-
26
- test_unseen_keys has no train-derived candidates; only 302 of its 8,058 rows have two or more candidates from independent sources (edition tables, kizur lists), so its all-rows figure measures candidate coverage, not the model. Unseen keys need generation, which this model does not do.
27
-
28
- LLM-labelled rows score lower than gold rows partly because LLM labels have errors of their own; a 500-example human check of LLM labels (D2) has been drawn and awaits review.
29
-
30
- The cross-encoder trained on the same data (`Sefaria/berel-roshei-tevot-cross`) scores within 1 point on top-1 on every split; this model is better on val and level on test. Combining the two (weighted sum, or a small stacker on both models' scores) did not beat this model alone on val.
31
-
32
- Full report: `gs://sefaria-ml-models/roshei-tevot/reports/final-balanced-2026-11-20.json`. 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 22 revision: numerals can be answered with their number
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 adds an answer the Nov 20 model did not have: a numeral-shaped token (two or more letters, value 11-999: `י"ד`, `קט"ו`, `תקצ"ו`) always has its number, spelled out in Hebrew (`ארבעה עשר`), as a candidate,
11
+ so `סימן קי"ב` is no longer forced into an abbreviation reading.
12
+
13
+ - 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.
14
+ - Data: `Sefaria/berel-roshei-tevot-numbers-2026-11-22` (private), rebuilt on the quality pipeline of Nov 20 plus: number rows (22,147 in train: pure numerals, numerals after a reference word, 3,000 contested tokens read by subagents, spelled-out numbers swapped back, Dicta's picks), 851 rows for the abbreviation side of the same choice, and 3,493 labels for readings the lexicon lacked (read from library occurrences by subagents). Train 1,047,871 rows. Every numeral row gains the number as a candidate.
15
+ - 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, 36 minutes, Nov 22, 2026. Training code: `train-roshei-tevot` in Sefaria/ML-Workflows (PR #20). Dataset build: Sefaria/translation-engine PR #16 (`experiments/expand_roshei_tevot/NUMBERS.md`).
16
+ - 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).
17
+
18
+ ## Results, scored with the repo's evaluation flow on the new dataset, next to the Nov 20 model on the same rows
19
+
20
+ Top-1 over rows with two or more candidates and the label among them ("answerable"); balanced top-1 is the mean over the majority, common and rare sense bands.
21
+
22
+ | split | answerable rows | this revision top-1 | Nov 20 top-1 | this balanced | Nov 20 balanced | most-frequent baseline |
23
+ |---|---|---|---|---|---|---|
24
+ | val | 2,524 | 95.2 | 95.2 | 88.8 | 89.1 | 78.5 |
25
+ | test_seen_keys | 3,446 | 95.7 | 95.4 | 89.6 | 88.5 | 73.8 |
26
+ | test_unseen_keys | 253 | 99.2 | 98.0 | | | 36.4 |
27
+ | number_val | 1,248 | 98.9 | 42.4 | 97.9 | 31.8 | 65.7 |
28
+ | number_test_seen_keys | 1,262 | 98.9 | 45.9 | 97.8 | 35.4 | 66.4 |
29
+ | number_test_dicta | 215 | 96.7 | 90.7 | 97.4 | 95.4 | 92.6 |
30
+ | abbr_val (numeral-shaped tokens read as abbreviations) | 86 | 96.5 | 96.5 | 98.2 | 98.8 | 66.3 |
31
+ | abbr_test_seen_keys | 93 | 91.4 | 95.7 | 92.3 | 94.5 | 66.7 |
32
+
33
+ Read these with care:
34
+ - On the standard splits the two models are within 0.4 points except `test_unseen_keys` (+1.2). `val` and `test_seen_keys` are not the same rows as in the Nov 20 model card: numeral rows now carry the number as a candidate and the build added labels, so the Nov 20 model's 96.0 / 96.2 there are not comparable with these figures.
35
+ - The `number_*` rows are labelled by rules (reference words before or after the token) and by subagents, and this model trained on the same kinds of labels, so 98.9 is optimistic. `number_test_dicta` (tokens where Dicta's own first answer is the number, chosen by a different labeller) is the fairer figure.
36
+ - Known weakness: citation forms whose letters are also a number, such as `פ"ב` (chapter 2), `ס"ד` after a siman number (seif 4), `מ"ג` (mishnah 3), `רפ"ב` (start of chapter 2), are sometimes called numbers. In a comparison with Dicta on 3,307 numeral tokens, at most about 100 are this family, against about 600 numerals the Nov 20 model got wrong.
37
+ - The Nov 20 revision is the previous commit of this repository.
38
+
39
+ Full report: `gs://sefaria-ml-models/roshei-tevot/reports/numbers-2026-11-22.json`. Expansion index for this model: `gs://sefaria-ml-models/roshei-tevot/index/rt-numbers-2026-11-22`. 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:bb2e7b0af59a3692cfbfea9c1dbfd2ee9dd51c31bc38bc73e643bee076c2bc0c
3
  size 735041208
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74c2d26cbc5bc256e4ee534f3bcd6e2bfd48280f857bffe08a2503c379878b70
3
  size 735041208
roshei_tevot_config.json CHANGED
@@ -3,9 +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-2026-11-19",
7
  "min_candidates": 2,
 
 
8
  "candidate_source": "dataset",
9
  "pooling": "span",
10
- "logit_scale": 21.222158432006836
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-2026-11-22",
7
  "min_candidates": 2,
8
+ "holdout_fold": null,
9
+ "n_folds": 5,
10
  "candidate_source": "dataset",
11
  "pooling": "span",
12
+ "logit_scale": 21.215147018432617
13
  }
training_report.json CHANGED
@@ -1,15 +1,17 @@
1
  {
2
  "status": "success",
3
- "run_name": "rt-final-siamese-2026-11-20",
4
- "started_at": "2026-11-19T22:42:55.793158+00:00",
5
- "finished_at": "2026-11-19T23:22:36.722657+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-2026-11-19",
9
  "synthetic_weight": 0.5,
10
  "sense_beta": 0.5,
11
  "sense_max_boost": 10.0,
12
  "gradient_checkpointing": false,
 
 
13
  "candidate_source": "dataset",
14
  "accelerator": {
15
  "device_count": 1,
@@ -29,59 +31,59 @@
29
  "resumed_from_checkpoint": null,
30
  "candidates": {
31
  "train": {
32
- "rows_in": 1021786,
33
- "rows_kept": 501829,
34
- "dropped_below_min_candidates": 519957,
35
- "gold_not_in_lexicon_lookup": 18745,
36
  "candidate_source": "dataset",
37
- "target_is_sense_class": 490472,
38
- "dropped_and_right_by_default": 510404
39
  },
40
  "val": {
41
- "rows_in": 6806,
42
- "rows_kept": 2693,
43
- "dropped_below_min_candidates": 4113,
44
- "gold_not_in_lexicon_lookup": 393,
45
  "candidate_source": "dataset",
46
- "target_is_sense_class": 2452,
47
- "dropped_and_right_by_default": 3933
48
  },
49
  "ranking": {
50
- "rows_in": 6806,
51
- "rows_kept": 2580,
52
- "dropped_below_min_candidates": 4226,
53
- "gold_not_in_lexicon_lookup": 393,
54
  "candidate_source": "dataset",
55
- "target_is_sense_class": 2452,
56
- "dropped_and_right_by_default": 3933
57
  }
58
  },
59
  "train_metrics": {
60
- "train_runtime": 2228.8499,
61
- "train_samples_per_second": 269.168,
62
- "train_steps_per_second": 2.103,
63
- "train_loss": 0.6474834975591977,
64
  "epoch": 0.9997866894197952
65
  },
66
  "final_eval": {
67
- "eval_loss": 0.4153856933116913,
68
- "eval_runtime": 3.6441,
69
- "eval_samples_per_second": 739.005,
70
- "eval_steps_per_second": 6.037,
71
  "epoch": 0.9997866894197952,
72
- "eval_top1": 0.9604838709677419,
73
- "eval_frequency_top1": 0.7846774193548387,
74
- "eval_mrr": 0.9777486559139784
75
  },
76
  "best_validation_top1": {
77
- "step": 4000,
78
- "top1": 0.9612903225806452,
79
- "frequency_top1": 0.7846774193548387,
80
- "mrr": 0.9783534946236558
81
  },
82
- "mean_tokens_per_second": 148889.4132012355,
83
- "final_model_dir": "/tmp/roshei-tevot-1yexngoj/output/final",
84
- "cuda_peak_memory_bytes": 31955410944
85
  },
86
- "model_uri": "gs://sefaria-ml-models/roshei-tevot/runs/rt-final-siamese-2026-11-20/final"
87
  }
 
1
  {
2
  "status": "success",
3
+ "run_name": "rt-numbers-siamese-2026-11-22",
4
+ "started_at": "2026-11-22T14:54:00.103188+00:00",
5
+ "finished_at": "2026-11-22T15:33:00.213315+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-2026-11-22",
9
  "synthetic_weight": 0.5,
10
  "sense_beta": 0.5,
11
  "sense_max_boost": 10.0,
12
  "gradient_checkpointing": false,
13
+ "holdout_fold": null,
14
+ "n_folds": 5,
15
  "candidate_source": "dataset",
16
  "accelerator": {
17
  "device_count": 1,
 
31
  "resumed_from_checkpoint": null,
32
  "candidates": {
33
  "train": {
34
+ "rows_in": 1047871,
35
+ "rows_kept": 527487,
36
+ "dropped_below_min_candidates": 520384,
37
+ "gold_not_in_lexicon_lookup": 21277,
38
  "candidate_source": "dataset",
39
+ "target_is_sense_class": 503053,
40
+ "dropped_and_right_by_default": 509438
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": 2185.4381,
63
+ "train_samples_per_second": 274.515,
64
+ "train_steps_per_second": 2.145,
65
+ "train_loss": 0.6570317936981311,
66
  "epoch": 0.9997866894197952
67
  },
68
  "final_eval": {
69
+ "eval_loss": 0.44452542066574097,
70
+ "eval_runtime": 3.5209,
71
+ "eval_samples_per_second": 781.056,
72
+ "eval_steps_per_second": 6.248,
73
  "epoch": 0.9997866894197952,
74
+ "eval_top1": 0.9524564183835182,
75
+ "eval_frequency_top1": 0.78486529318542,
76
+ "eval_mrr": 0.9740132820164514
77
  },
78
  "best_validation_top1": {
79
+ "step": 3500,
80
+ "top1": 0.9536450079239303,
81
+ "frequency_top1": 0.78486529318542,
82
+ "mrr": 0.9746604029884537
83
  },
84
+ "mean_tokens_per_second": 151551.98216172308,
85
+ "final_model_dir": "/tmp/roshei-tevot-64dw5z34/output/final",
86
+ "cuda_peak_memory_bytes": 31790878720
87
  },
88
+ "model_uri": "gs://sefaria-ml-models/roshei-tevot/runs/rt-numbers-siamese-2026-11-22/final"
89
  }