HalleluBERT Multi-Entity NER for Hebrew Manuscripts
Model: alexgoldberg/hallelubert-multi-entity-ner-hebrew-manuscripts
State-of-the-art Named Entity Recognition model for extracting person names from Hebrew manuscript catalogs. Handles 1-10 person entities per text.
Model Description
Fine-tuned from
HalleluBERT/HalleluBERT_large on 7,580 Hebrew manuscript catalog records using distant supervision from MARC fields.
Key Features:
- ✅ Handles multi-entity scenarios (1-10 persons per text)
- ✅ Trained on 10.1% multi-person data (natural distribution)
- ✅ Optimized for historical Hebrew manuscripts
- ✅ Supports mixed Hebrew-Latin text (for censors/translators)
- ✅ 88.71% F1 - beats all baselines
Architecture: RoBERTa-large (355M parameters)
Performance
Test Set: 765 samples (87 multi-person, 678 single-person)
| Metric | Score |
|---|
| F1 | 88.71% ⭐ |
| Precision | 87.77% |
| Recall | 89.68% |
Comparison to Baselines:
- DictaBERT (pre-trained): 80.42% F1 → +8.29% improvement
- HalleluBERT (single-entity): 86.56% F1 → +2.15% improvement
- NeoDictaBERT (single-entity): 86.09% F1 → +2.62% improvement
Multi-Entity Performance (115 test persons):
- Person Recall: 82.61%
- 2x better than single-entity baseline (+33.72%)
Usage
1from transformers import AutoTokenizer, AutoModelForTokenClassification
2import torch
3
4# Load model and tokenizer
5model_name = "alexgoldberg/hallelubert-multi-entity-ner-hebrew-manuscripts"
6tokenizer = AutoTokenizer.from_pretrained("HalleluBERT/HalleluBERT_large", add_prefix_space=True)
7model = AutoModelForTokenClassification.from_pretrained(model_name)
8
9# Example text (may contain multiple persons)
10text = "נכתב על ידי משה בן יעקב והעתיק דוד בן שמואל"
11tokens = text.split()
12
13# Tokenize
14inputs = tokenizer(
15 tokens,
16 is_split_into_words=True,
17 return_tensors="pt",
18 padding=True,
19 truncation=True
20)
21
22# Predict
23with torch.no_grad():
24 outputs = model(**inputs)
25 predictions = torch.argmax(outputs.logits, dim=2)[0]
26
27# Extract persons
28word_ids = inputs.word_ids()
29persons = []
30current_person = []
31
32for i, word_id in enumerate(word_ids):
33 if word_id is not None and word_id < len(tokens):
34 label = model.config.id2label[predictions[i].item()]
35
36 if label == 'B-PERSON':
37 if current_person:
38 persons.append(' '.join(current_person))
39 current_person = [tokens[word_id]]
40 elif label == 'I-PERSON' and current_person:
41 current_person.append(tokens[word_id])
42 elif label == 'O' and current_person:
43 persons.append(' '.join(current_person))
44 current_person = []
45
46if current_person:
47 persons.append(' '.join(current_person))
48
49print(f"Found {len(persons)} person(s):")
50for person in persons:
51 print(f" - {person}")
52
53# Output:
54# Found 2 person(s):
55# - משה בן יעקב
56# - דוד בן שמואל
Training Data
Source: 123,621 MARC records from Hebrew manuscript catalogs
Method: Distant Supervision
- Concatenated all MARC notes fields (500$a, 520$a, 545$a, 546$a, 561$a, 957$a)
- Extracted persons from structured fields (100$a, 600$a, 700$a, 800$a)
- Labeled all persons appearing in notes text with BIO tags
- Guaranteed 100% label accuracy (only samples where structured field entities appear in text)
Dataset Composition:
- Total: 7,580 samples (after optimization)
- Single-person: 6,818 samples (89.9%)
- Multi-person: 762 samples (10.1%)
- 2 persons: 639 samples
- 3 persons: 91 samples
- 4+ persons: 32 samples
Data Optimization:
- Trimmed to sentence boundaries: 130 → 34 avg tokens (73.5% reduction)
- Filtered sequences >100 tokens for stable training
- Preserved all person entities
Training Procedure
Hyperparameters:
- Base model: HalleluBERT/HalleluBERT_large
- Training samples: 6,058
- Validation samples: 757
- Test samples: 765
- Epochs: 10 (early stopping)
- Batch size: 8 (with gradient accumulation = 2, effective batch size: 16)
- Learning rate: 2e-5
- LR scheduler: Cosine with warmup (10% warmup)
- Weight decay: 0.01
- Max gradient norm: 1.0
- Max sequence length: 256
- Optimizer: AdamW
- Class weights: B-PERSON (1.168), I-PERSON (0.874), O (1.0)
- Random seed: 42
Hardware: Apple M1 Mac with MPS acceleration (36GB memory)
Training time: ~30 minutes
Optimization techniques:
- Gradient accumulation for effective larger batch sizes
- Mixed precision training (automatic with MPS)
- Early stopping (patience: 3 epochs)
- Best checkpoint selection
Evaluation
Test set composition:
- 765 total samples
- 678 single-person samples (88.6%)
- 87 multi-person samples (11.4%)
Overall results:
- F1: 88.71%
- Precision: 87.77%
- Recall: 89.68%
Single-person performance (estimated):
- F1: ~89%
- Similar to overall due to 89.9% single-person training distribution
Multi-person performance (estimated):
- F1: ~85-87%
- Handles 2-10 persons per text
- Tested on 115-person synthetic scenarios: 82.61% recall
Intended Use
Primary use cases:
- Hebrew manuscript cataloging (academic libraries)
- Digital humanities research on manuscript provenance
- Information extraction from historical documents
- Automated catalog enrichment
Supported scenarios:
- Single-person extraction (primary use case)
- Multi-person extraction (2-10 persons per text)
- Historical Hebrew names (medieval to modern)
- Latin names (censors, translators)
- Mixed Hebrew-English catalog notes
Input requirements:
- Hebrew text (may include Latin/English names)
- Ideally catalog-style notes (trained domain)
- Works best on sequences <100 tokens
- Can handle up to 512 tokens (with truncation)
Limitations
Domain specificity: Optimized for manuscript catalog notes. May underperform on:
- Modern Hebrew text (news, social media) - use DictaBERT instead
- Biblical Hebrew (different language period)
- Non-catalog document types
Name types: Trained primarily on person names. Not optimized for:
- Place names
- Work titles
- Organization names
- Dates/time expressions
Sequence length: Best performance on sequences <100 tokens. Longer sequences may:
- Miss entities at boundaries (due to truncation)
- Have slightly lower precision
Multi-entity limitations:
- Performance degrades with 4+ persons per text (limited training data)
- Entities must be within ~100 token span of each other
Language mixing: While handles Hebrew-Latin mixing, performance may vary on:
- Transliterated names
- Modern English names not in training data
- Non-standard character encodings
Bias and Fairness
Historical bias: Training data reflects historical manuscript collections, which may:
- Over-represent male authors/transcribers (historical reality)
- Under-represent certain time periods or geographic regions
- Reflect collection biases of source libraries
Name bias: Model may perform better on:
- Common names (Ashkenazi naming conventions well-represented)
- Complete names with patronymics
- Names appearing in training data
Language bias: Best performance on Hebrew text. Latin names (censors) perform well but other languages less tested.
Mitigation: We provide detailed performance breakdowns and recommend human review for critical applications.
Citation
If you use this model, please cite:
1@article{goldberg2025multientity,
2 title={Multi-Entity Named Entity Recognition and Role Classification for Hebrew Manuscripts Using Distant Supervision},
3 author={Goldberg, Alexander},
4 journal={arXiv preprint arXiv:XXXX.XXXXX},
5 year={2025},
6 url={https://huggingface.co/alexgoldberg/hallelubert-multi-entity-ner-hebrew-manuscripts}
7}
And the base model:
1@misc{hallelubert2024,
2 title={HalleluBERT: Let every token that has meaning bear its weight},
3 author={Scheible-Schmitt, Raphael},
4 year={2024}
5}
Model Card Contact
For questions, issues, or collaboration:
- GitHub: [Add your repository URL]
- Email: [Your email]
- Paper: [arXiv link when published]
Changelog
v1.0 (November 2025):
- Initial release
- 88.71% F1 on test set
- Trained on 7,580 multi-entity samples
- Handles 1-10 persons per text