Feature Extraction
Transformers
Safetensors
Hebrew
Official Aramaic (700-300 BCE)
bert
hebrew
abbreviations
roshei-tevot
sefaria
text-embeddings-inference
Instructions to use Sefaria/BeRTevot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sefaria/BeRTevot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Sefaria/BeRTevot")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Sefaria/BeRTevot") model = AutoModel.from_pretrained("Sefaria/BeRTevot", device_map="auto") - Notebooks
- Google Colab
- Kaggle
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- README.md +33 -26
- model.safetensors +1 -1
- roshei_tevot_config.json +4 -2
- 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.
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
-
|
| 14 |
-
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
| 23 |
-
|
|
| 24 |
-
|
|
| 25 |
-
|
| 26 |
-
test_unseen_keys
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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:
|
| 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-
|
| 7 |
"min_candidates": 2,
|
|
|
|
|
|
|
| 8 |
"candidate_source": "dataset",
|
| 9 |
"pooling": "span",
|
| 10 |
-
"logit_scale": 21.
|
| 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-
|
| 4 |
-
"started_at": "2026-11-
|
| 5 |
-
"finished_at": "2026-11-
|
| 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-
|
| 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":
|
| 33 |
-
"rows_kept":
|
| 34 |
-
"dropped_below_min_candidates":
|
| 35 |
-
"gold_not_in_lexicon_lookup":
|
| 36 |
"candidate_source": "dataset",
|
| 37 |
-
"target_is_sense_class":
|
| 38 |
-
"dropped_and_right_by_default":
|
| 39 |
},
|
| 40 |
"val": {
|
| 41 |
-
"rows_in":
|
| 42 |
-
"rows_kept":
|
| 43 |
-
"dropped_below_min_candidates":
|
| 44 |
-
"gold_not_in_lexicon_lookup":
|
| 45 |
"candidate_source": "dataset",
|
| 46 |
-
"target_is_sense_class":
|
| 47 |
-
"dropped_and_right_by_default":
|
| 48 |
},
|
| 49 |
"ranking": {
|
| 50 |
-
"rows_in":
|
| 51 |
-
"rows_kept":
|
| 52 |
-
"dropped_below_min_candidates":
|
| 53 |
-
"gold_not_in_lexicon_lookup":
|
| 54 |
"candidate_source": "dataset",
|
| 55 |
-
"target_is_sense_class":
|
| 56 |
-
"dropped_and_right_by_default":
|
| 57 |
}
|
| 58 |
},
|
| 59 |
"train_metrics": {
|
| 60 |
-
"train_runtime":
|
| 61 |
-
"train_samples_per_second":
|
| 62 |
-
"train_steps_per_second": 2.
|
| 63 |
-
"train_loss": 0.
|
| 64 |
"epoch": 0.9997866894197952
|
| 65 |
},
|
| 66 |
"final_eval": {
|
| 67 |
-
"eval_loss": 0.
|
| 68 |
-
"eval_runtime": 3.
|
| 69 |
-
"eval_samples_per_second":
|
| 70 |
-
"eval_steps_per_second": 6.
|
| 71 |
"epoch": 0.9997866894197952,
|
| 72 |
-
"eval_top1": 0.
|
| 73 |
-
"eval_frequency_top1": 0.
|
| 74 |
-
"eval_mrr": 0.
|
| 75 |
},
|
| 76 |
"best_validation_top1": {
|
| 77 |
-
"step":
|
| 78 |
-
"top1": 0.
|
| 79 |
-
"frequency_top1": 0.
|
| 80 |
-
"mrr": 0.
|
| 81 |
},
|
| 82 |
-
"mean_tokens_per_second":
|
| 83 |
-
"final_model_dir": "/tmp/roshei-tevot-
|
| 84 |
-
"cuda_peak_memory_bytes":
|
| 85 |
},
|
| 86 |
-
"model_uri": "gs://sefaria-ml-models/roshei-tevot/runs/rt-
|
| 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 |
}
|