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
Nov 23 v4: geresh numerals, סק"X = סעיף קטן X and truncated words
Browse files- README.md +26 -25
- model.safetensors +1 -1
- roshei_tevot_config.json +2 -2
- 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
|
| 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 (
|
| 11 |
-
- a numeral **
|
| 12 |
-
-
|
|
|
|
| 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
|
| 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,
|
| 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
|
| 20 |
-
Top-1 over rows with two or more candidates and the label among them ("answerable").
|
| 21 |
|
| 22 |
-
| split | answerable |
|
| 23 |
-
|---|---|---|---|---|
|
| 24 |
-
| val |
|
| 25 |
-
| test_seen_keys |
|
| 26 |
-
| test_unseen_keys |
|
| 27 |
-
| number_val
|
| 28 |
-
| number_test_seen_keys |
|
| 29 |
-
| number_test_dicta | 215 | 95.
|
| 30 |
-
| abbr_val (numeral-shaped
|
| 31 |
-
| abbr_test_seen_keys |
|
| 32 |
|
| 33 |
-
## Against Dicta,
|
| 34 |
-
|
| 35 |
|
| 36 |
Read these with care:
|
| 37 |
-
- The
|
| 38 |
-
-
|
| 39 |
-
-
|
| 40 |
|
| 41 |
-
Full report: `gs://sefaria-ml-models/roshei-tevot/reports/numbers-
|
|
|
|
| 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:
|
| 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-
|
| 7 |
"min_candidates": 2,
|
| 8 |
"holdout_fold": null,
|
| 9 |
"n_folds": 5,
|
| 10 |
"candidate_source": "dataset",
|
| 11 |
"pooling": "span",
|
| 12 |
-
"logit_scale": 21.
|
| 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-
|
| 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-numbers-
|
| 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":
|
| 35 |
-
"rows_kept":
|
| 36 |
-
"dropped_below_min_candidates":
|
| 37 |
-
"gold_not_in_lexicon_lookup":
|
| 38 |
"candidate_source": "dataset",
|
| 39 |
-
"target_is_sense_class":
|
| 40 |
-
"dropped_and_right_by_default":
|
| 41 |
},
|
| 42 |
"val": {
|
| 43 |
"rows_in": 6871,
|
| 44 |
-
"rows_kept":
|
| 45 |
-
"dropped_below_min_candidates":
|
| 46 |
-
"gold_not_in_lexicon_lookup":
|
| 47 |
"candidate_source": "dataset",
|
| 48 |
-
"target_is_sense_class":
|
| 49 |
-
"dropped_and_right_by_default":
|
| 50 |
},
|
| 51 |
"ranking": {
|
| 52 |
"rows_in": 6871,
|
| 53 |
-
"rows_kept":
|
| 54 |
-
"dropped_below_min_candidates":
|
| 55 |
-
"gold_not_in_lexicon_lookup":
|
| 56 |
"candidate_source": "dataset",
|
| 57 |
-
"target_is_sense_class":
|
| 58 |
-
"dropped_and_right_by_default":
|
| 59 |
}
|
| 60 |
},
|
| 61 |
"train_metrics": {
|
| 62 |
-
"train_runtime":
|
| 63 |
-
"train_samples_per_second":
|
| 64 |
-
"train_steps_per_second": 2.
|
| 65 |
-
"train_loss": 0.
|
| 66 |
"epoch": 0.9997866894197952
|
| 67 |
},
|
| 68 |
"final_eval": {
|
| 69 |
-
"eval_loss": 0.
|
| 70 |
-
"eval_runtime":
|
| 71 |
-
"eval_samples_per_second":
|
| 72 |
-
"eval_steps_per_second": 6.
|
| 73 |
"epoch": 0.9997866894197952,
|
| 74 |
-
"eval_top1": 0.
|
| 75 |
-
"eval_frequency_top1": 0.
|
| 76 |
-
"eval_mrr": 0.
|
| 77 |
},
|
| 78 |
"best_validation_top1": {
|
| 79 |
-
"step":
|
| 80 |
-
"top1": 0.
|
| 81 |
-
"frequency_top1": 0.
|
| 82 |
-
"mrr": 0.
|
| 83 |
},
|
| 84 |
-
"mean_tokens_per_second":
|
| 85 |
-
"final_model_dir": "/tmp/roshei-tevot-
|
| 86 |
-
"cuda_peak_memory_bytes":
|
| 87 |
},
|
| 88 |
-
"model_uri": "gs://sefaria-ml-models/roshei-tevot/runs/rt-numbers-
|
| 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 |
}
|