Law-IL E2B
A 2B-parameter Israeli legal reasoning model, fine-tuned to cite statute, apply precedent, and respond in fluent Hebrew — runs entirely on a laptop.
Model overview
law-il-E2B is an instruction-tuned small language model specialized for Israeli legal work. It is built on Google's Gemma-4 E2B (2 billion parameters) and adapted via QLoRA fine-tuning on a carefully curated corpus of Israeli rulings, statutes, rights guidance, and contract clauses.
Unlike general-purpose models, law-il-E2B was trained to follow a structured reasoning pattern tailored to Israeli legal practice:
- Identify the statute — which law, which section, which year.
- Explain in plain language — accessible to non-lawyers.
- Apply precedent — cite a relevant Supreme Court or district ruling.
- Add a "שים לב" (heads-up) — the subtle point most lawyers miss.
The model runs locally on a laptop or single consumer GPU. No internet connection, no API call, no data leaves the device.
Why this exists
Most Hebrew legal work today flows through cloud LLMs (GPT, Claude, Gemini). For law firms handling privileged client material, this raises real problems: data residency, attorney-client privilege, and the Israeli Protection of Privacy Law Amendment 13, which took effect with penalties up to ₪3.2M.
A small, on-device model sidesteps those problems entirely. The full weights live on the user's hardware. Nothing is transmitted. Nothing is logged remotely.
Intended use
Primary use cases:
- Legal Q&A for Israeli citizens (labor, tenancy, family, consumer rights)
- First-pass research assistance for junior associates
- Contract clause interpretation and comparison
- Rights-page (כל-זכות) explanations for social-sector organizations
- On-device deployment in law firms handling privileged data
Out-of-scope uses:
- Legal advice without human attorney review
- Jurisdictions other than Israel (the model is not trained on US, EU, or UK law)
- Criminal defense strategy (training data is predominantly civil/labor/family)
- Real-time courtroom use (the model does not verify its citations against live databases)
How to use
Ollama (recommended for local use)
ollama pull hf.co/BrainboxAI/law-il-E2B:Q4_K_M
ollama run hf.co/BrainboxAI/law-il-E2B:Q4_K_M
llama.cpp
./llama-cli -m law-il-E2B.Q4_K_M.gguf \
-p "מהן זכויות העובד בפיטורים ללא הודעה מוקדמת?" \
--temp 0.3 --top-p 0.9 -n 512
Python (transformers, via safetensors variant)
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("BrainboxAI/law-il-E2B-safetensors")
model = AutoModelForCausalLM.from_pretrained(
"BrainboxAI/law-il-E2B-safetensors",
torch_dtype="auto",
device_map="auto",
)
messages = [
{"role": "user", "content": "פיטרו אותי בלי הודעה מוקדמת. מה מגיע לי?"},
]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
outputs = model.generate(inputs, max_new_tokens=512, temperature=0.3, top_p=0.9)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Recommended generation parameters
| Parameter | Value | Rationale |
|---|---|---|
temperature |
0.3 | Low creativity, high factuality for legal work |
top_p |
0.9 | Standard nucleus sampling |
max_new_tokens |
512 | Enough for full structured response with citations |
repetition_penalty |
1.05 | Prevents repeated citation loops |
Recommended System Prompt: Semi-Formal Reasoning
This 2B model performs significantly better when given a structured reasoning template instead of a free-form prompt. We recommend a "semi-formal reasoning" approach that forces the model to think in 5 explicit steps before answering.
Why this matters: Small models (2B) are prone to hallucinations on open-ended legal questions. A structured prompt produces dramatically more reliable results - fewer fabricated section numbers, fewer invented case citations, and a mandatory disclaimer in every answer.
The System Prompt (copy as-is)
DEFINITIONS:
הצלחה: תשובה משפטית מובנית בכל 5 צעדי החשיבה, ללא המצאת חוקים, בשפה ברורה לאזרח לא-משפטן, עם סייג מפורש שזה אינו ייעוץ משפטי.
scope: in-scope - שאלות על דיני עבודה, נדל"ן, חוזים, נזיקין, משפחה, צרכנות, מסחר, וזכויות בסיסיות בישראל. out-of-scope - ייעוץ משפטי מחייב, ייצוג בבית משפט, שאלות פליליות מורכבות, מקרים ספציפיים שדורשים בדיקת מסמכים.
סעיף חוקי רלוונטי: ציטוט מדויק של מספר חוק, פרק וסעיף ספציפי. אם לא ידוע במדויק - אסור לציין מספר.
פסיקה רלוונטית: הפניה לפסק דין מוכר. אם לא ידוע במדויק - לכתוב "פסיקה רלוונטית קיימת בנושא, מומלץ לבדוק במאגר נבו".
PREMISES:
- המשתמש שואל שאלה משפטית בעברית, בדרך כלל בנוגע למצב חייו האישי.
- המודל אומן על 17,613 מסמכים: 7,960 פסקי דין ישראליים, 2,353 דפי כל-זכות, 300 חוקים, 7,000 סעיפי חוזים.
- המודל בגודל 2B פרמטרים, נוטה להזיות אם לא מוגבל במבנה תשובה.
- הקהל: עורכי דין מתחילים, יזמים, אזרחים. רובם לא יודעים לבדוק האם תשובה משפטית נכונה.
- חוסר ידע מסוכן יותר מ"אני לא יודע".
REQUIREMENTS:
1. כל תשובה חייבת להכיל בדיוק 5 צעדים, בסדר הזה: סעיף חוקי, הסבר פשוט, דוגמה, פסיקה, סייג.
2. אם לא ידוע סעיף ספציפי במאת האחוזים - חובה לכתוב "החוק הרלוונטי הוא [שם החוק] - לבדוק את הסעיף המדויק במאגר נבו". אסור לנחש מספר סעיף.
3. ההסבר הפשוט חייב להיות בשפה יומיומית, ללא ז'רגון משפטי. אם משתמשים במונח משפטי - חייב להופיע הסבר בסוגריים.
4. הדוגמה המעשית חייבת להיות סיטואציה ריאליסטית בישראל, לא היפותטית.
5. הסייג בסוף חייב להופיע בכל תשובה ללא יוצא מן הכלל, גם אם השאלה פשוטה.
6. אסור לתת המלצה ספציפית "מה לעשות" - רק להסביר מה החוק אומר ומה האפשרויות.
7. אסור להמציא פסקי דין. אם לא ידועה פסיקה ספציפית - לכתוב "פסיקה רלוונטית קיימת בנושא, מומלץ לבדוק במאגר נבו".
8. אסור לספק מספרים (סכומי פיצוי, ימי חופש, אחוזי מס) בלי לציין שהם נכונים נכון לתאריך מסוים ויכולים להשתנות.
9. אם השאלה אינה משפטית - להחזיר "אני מודל משפטי, השאלה הזו אינה בתחומי. אנא פנה למומחה רלוונטי."
10. אסור להשתמש במידע מחוץ ל-training data. אם השאלה דורשת חוק שנחקק אחרי 2026 - לציין זאת במפורש.
EDGE_CASES:
- שאלה פלילית מורכבת -> "מקרים פליליים דורשים ייעוץ משפטי מסונכן עם עורך דין פלילי. אני יכול להסביר את העקרונות הכלליים אם תרצה."
- שאלה על מקרה ספציפי עם פרטים אישיים -> "אני יכול להסביר את החוק באופן כללי, אך התאמה למקרה שלך דורשת פגישה עם עורך דין שיבחן את כל המסמכים."
- שאלה לא ברורה -> "כדי לתת לך תשובה מדויקת, אני צריך לדעת [שאלה ספציפית]. תוכל לפרט?"
- שאלה בשפה אחרת -> לענות בעברית: "אני מודל בעברית. אנא שאל את שאלתך בעברית."
- בקשה לחוות דעת אישית -> "אני מספק מידע משפטי, לא חוות דעת אישית. החוק אומר X."
- שאלה על דיני חוץ (לא ישראל) -> "אני מתמחה במשפט ישראלי. לשאלות על דין במדינה אחרת מומלץ לפנות למומחה מקומי."
- חוק שהשתנה לאחרונה -> "החוק עודכן לאחרונה ב[תאריך אם ידוע]. מומלץ לוודא במקור הרשמי."
OUTPUT_FORMAT:
format: טקסט מובנה עם כותרות ממוספרות
structure: |
1. הסעיף החוקי הרלוונטי:
[שם החוק המלא + פרק + סעיף אם ידוע במדויק. אחרת רק שם החוק עם הפניה לבדוק במאגר נבו]
2. הסבר פשוט:
[פסקה אחת בעברית יומיומית, מסבירה את העיקרון בלי ז'רגון]
3. דוגמה מעשית:
[סיטואציה ריאליסטית מיום-יום בישראל, 2-3 משפטים]
4. פסיקה רלוונטית:
[שם פסק דין + שנה אם ידוע. אחרת: "פסיקה רלוונטית קיימת בנושא, מומלץ לבדוק במאגר נבו."]
5. שים לב:
"המידע הזה הוא הסבר כללי בלבד ואינו מהווה ייעוץ משפטי. כל מקרה הוא ייחודי ודורש בחינה פרטנית. לפני קבלת החלטה משפטית, פנה לעורך דין מוסמך."
language: עברית
length: 200-400 מילים בסך הכל
VERIFICATION:
- האם כל 5 הצעדים קיימים בתשובה? (כן/לא)
- האם צוין מספר סעיף ספציפי? אם כן - האם הוא קיים בחוק האמיתי? (לא להמציא)
- האם הוזכר פסק דין? אם כן - האם הוא אמיתי?
- האם הסייג בסוף מופיע במלואו?
- האם נמנעה המלצה אישית "מה לעשות"?
- regression check: לא להחזיר תשובה ללא 5 הצעדים גם אם השאלה פשוטה.
Usage Example with the System Prompt
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("BrainboxAI/law-il-E2B-safetensors")
model = AutoModelForCausalLM.from_pretrained(
"BrainboxAI/law-il-E2B-safetensors",
torch_dtype="auto",
device_map="auto",
)
# Paste the full DEFINITIONS/PREMISES/REQUIREMENTS prompt above
SYSTEM_PROMPT = """[paste the full prompt from the code block above]"""
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": "כמה ימי חופשה מגיעים לעובד שמועסק 4 ימים בשבוע?"},
]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
outputs = model.generate(inputs, max_new_tokens=600, temperature=0.3, top_p=0.9)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Customization
- Want answers in Arabic or English? Modify rule #9 in the prompt.
- Need JSON output for an app? Replace the
OUTPUT_FORMATsection with your schema. - Building a chatbot for lawyers (not citizens)? Remove rule #6 to allow tactical recommendations.
Training details
| Attribute | Value |
|---|---|
| Base model | unsloth/gemma-4-E2B-it |
| Method | QLoRA (4-bit quantization during training) |
| LoRA rank (r) | 64 |
| LoRA alpha | 128 |
| Epochs | 20 |
| Training steps | 500 |
| Hardware | NVIDIA RTX 5090 (RunPod) |
| Framework | Unsloth Studio |
| Languages | Hebrew (60%) and English (40%) |
Dataset composition (17,613 examples)
| Source | Count | Content |
|---|---|---|
| Israeli court rulings | 7,960 | Supreme Court, family court, criminal, civil |
| Kol-Zchut (rights pages) | 2,353 | Labor, housing, insurance, disability, pension |
| Open Law Book (Wikisource) | 300 | Full-text Israeli statutes |
| Contract clauses | 7,000 | 41 clause categories, hand-classified |
All data was hand-filtered to meet quality criteria: verifiable citation, well-formed Hebrew, no personal identifying information.
See the dataset card for full composition details.
Evaluation
law-il-E2B has been evaluated qualitatively on:
- Accurate statute citation (law name, section number, year)
- Correct application of precedent
- Fluent, idiomatic Hebrew output
- Appropriate hedging on unsettled legal questions
Formal benchmarks on Israeli legal QA are an open research problem — no public Hebrew legal benchmark exists as of this release. BrainboxAI is working on an evaluation harness; results will be published when available.
Limitations
This is a 2B-parameter model fine-tuned on a domain-specific corpus. Important limitations:
- Not a substitute for a licensed attorney. Outputs should be reviewed by a human before being relied upon.
- Training cutoff. The Kol-Zchut pages were scraped in early 2026. Law changes will not be reflected until retraining.
- Citation risk. Like all LLMs, the model may occasionally produce a citation to a non-existent ruling. Always verify citations against an authoritative source (Nevo, Psakdin, Takdin).
- Narrow jurisdiction. The model knows Israeli law. It does not know foreign law, international law, or comparative law.
- Bias in training data. Court rulings overrepresent labor and family law; criminal and administrative law are thinner.
Formats available
- GGUF Q4_K_M (1.5 GB) — for Ollama, llama.cpp, LM Studio
- Safetensors 16-bit — for further fine-tuning, HF transformers, ONNX conversion
License
Apache 2.0. You may use, modify, distribute, and sell derivatives — including commercial legal-tech products — with attribution.
Citation
@misc{elyasi2026lawil,
title = {Law-IL E2B: A Small, On-Device Legal Reasoning Model for Israeli Law},
author = {Elyasi, Netanel},
year = {2026},
publisher = {BrainboxAI},
howpublished = {\url{https://huggingface.co/BrainboxAI/law-il-E2B}},
note = {Fine-tuned from unsloth/gemma-4-E2B-it}
}
Author
Built by Netanel Elyasi, founder of BrainboxAI — an Israeli applied-AI studio specializing in small, private, domain-specialized models.
For custom training, fine-tuning, or on-prem deployment for law firms, contact: netanele@brainboxai.io.
Part of the BrainboxAI family of on-device Hebrew models — see also code-il-E4B (coding) and cyber-analyst-4B (security).
- Downloads last month
- 1,625
4-bit