Instructions to use ElyKok/hebrew-qa-retriever-e5-large-nofilter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use ElyKok/hebrew-qa-retriever-e5-large-nofilter with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("ElyKok/hebrew-qa-retriever-e5-large-nofilter") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Hebrew QA Retriever (fine-tuned multilingual-e5-large)
Retrieves the Hebrew paragraph that answers a Hebrew question. Fine-tuned from intfloat/multilingual-e5-large
on the 19,654 answerable training questions of HeQ.
This is the retriever of a three-stage Hebrew RAG system: hybrid search with this model and BM25, then a fine-tuned reranker, then an LLM that writes the answer. Full project, notebooks and demo: GitHub 路 Demo
Usage
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("ElyKok/hebrew-qa-retriever-e5-large-nofilter")
q = model.encode("query: 诪讬 谞讬住讞 讗转 诪讙讬诇转 讛注爪诪讗讜转?", normalize_embeddings=True)
p = model.encode(["passage: ..."], normalize_embeddings=True)
scores = p @ q
Use the query: and passage: prefixes, as with the base model. Works best on paragraphs of about 100-200 words.
Training
- Loss:
CachedMultipleNegativesRankingLoss: in-batch negatives plus 2 mined hard negatives per question, batch size 64, gradient caching on a single T4. - Hard negatives: for each question, the untrained base model retrieves the most similar training paragraphs, and 2 of the top 15 (other than the correct one) are chosen at random.
- One epoch, learning rate 1e-5, 10% warmup, no-duplicates batch sampler.
- "nofilter": unlike a common practice, no candidates were excluded as possible false negatives. In a controlled comparison (same data, seed and settings), excluding same-article and higher-ranked paragraphs lowered R@1 from 80.7 to 78.9.
Results
HeQ test set: 1,072 questions, each searched against all 4,930 paragraphs. Test articles are disjoint from training articles.
| Model | R@1 | R@5 | R@10 | MRR@10 | NDCG@10 |
|---|---|---|---|---|---|
| BM25 (keyword search) | 73.1 | 86.8 | 89.8 | 79.0 | 81.7 |
| multilingual-e5-large (base) | 72.4 | 87.8 | 91.2 | 79.0 | 82.0 |
| This model | 80.7 | 92.2 | 95.0 | 85.9 | 88.1 |
| Hybrid: BM25 + this model (RRF) | 83.3 | 93.4 | 95.5 | 87.6 | 89.5 |
| Hybrid + fine-tuned reranker | 93.9 | 97.2 | 97.4 | 95.4 | 95.9 |
Limitations
HeQ questions were written by annotators looking at the paragraph, so they share more wording with it than real user queries do. Training and test data come from Hebrew Wikipedia and Geektime, so gains on other kinds of Hebrew text (for example rabbinic or literary Hebrew) are likely smaller.
HeQ was created by Webiks for MAFAT and is released under CC BY 4.0.
- Downloads last month
- 33
Model tree for ElyKok/hebrew-qa-retriever-e5-large-nofilter
Base model
intfloat/multilingual-e5-large