BrainboxAI commited on
Commit
a8ec721
·
verified ·
1 Parent(s): 477dd13

Professionalize model card: structured overview, usage examples, training details, limitations, citation

Browse files
Files changed (1) hide show
  1. README.md +129 -164
README.md CHANGED
@@ -3,7 +3,11 @@ language:
3
  - he
4
  - en
5
  license: apache-2.0
 
 
6
  base_model: unsloth/gemma-4-E2B-it
 
 
7
  tags:
8
  - legal
9
  - law
@@ -13,224 +17,185 @@ tags:
13
  - kol-zchut
14
  - gguf
15
  - llama.cpp
 
16
  - unsloth
17
  - gemma4
18
- - vision-language-model
19
  - conversational
20
- pipeline_tag: text-generation
21
- datasets:
22
- - BrainboxAI/legal-training-il
23
- pretty_name: BrainboxAI Law IL E2B
 
 
24
  ---
25
 
26
- # BrainboxAI/law-il-E2B
27
-
28
- ### Hebrew-First Israeli Legal AI Specialist (GGUF)
29
 
30
- A Gemma 4 E2B model fine-tuned by **BrainboxAI** for Israeli legal Q&A, court ruling analysis, rights explanations (כל-זכות), and contract clause interpretation - bilingual Hebrew and English, optimized for local inference.
31
 
32
- Built and maintained by **[BrainboxAI](https://huggingface.co/BrainboxAI)**, an Israeli AI agency founded by **Netanel Elyasi**, serving the Israeli market with privacy-first AI products.
 
 
 
33
 
34
  ---
35
 
36
- ## Model Details
37
 
38
- | Attribute | Value |
39
- |-----------|-------|
40
- | **Base Model** | [unsloth/gemma-4-E2B-it](https://huggingface.co/unsloth/gemma-4-E2B-it) (Gemma 4 Efficient 2B Instruct) |
41
- | **Architecture** | Gemma4ForConditionalGeneration (text + vision + audio) |
42
- | **Parameters** | ~2B |
43
- | **Context Length** | 131,072 tokens |
44
- | **Languages** | Hebrew, English |
45
- | **Training Framework** | Unsloth (2x faster fine-tuning) |
46
- | **Training Dataset** | [BrainboxAI/legal-training-il](https://huggingface.co/datasets/BrainboxAI/legal-training-il) |
47
- | **License** | Apache 2.0 |
48
 
49
- ---
50
 
51
- ## Intended Use
 
 
 
52
 
53
- ### Primary Tasks
54
- - **Israeli court ruling analysis** - Supreme Court, Family, Criminal, Civil
55
- - **Citizens' rights Q&A** (Kol-Zchut style) - labor law, housing, health, insurance, disability, pensions
56
- - **Israeli legislation explanation** - consolidated laws via Open Law Book
57
- - **Contract clause interpretation** - 41 contract types, 28 clause categories (CUAD-based)
58
- - **Hebrew legal drafting support**
59
 
60
- ### Target Users
61
- - Israeli law firms and solo practitioners
62
- - Legal aid organizations
63
- - HR departments needing Israeli labor law guidance
64
- - Paralegal research workflows
65
- - Citizens researching their rights
66
 
67
- ---
68
 
69
- ## Available Files
70
 
71
- | File | Size | Use |
72
- |------|------|-----|
73
- | `gemma-4-E2B-it.Q4_K_M.gguf` | ~2 GB | Local inference (Ollama, llama.cpp, LM Studio) |
74
- | `gemma-4-E2B-it.BF16-mmproj.gguf` | ~0.5 GB | Vision projector (multimodal tasks) |
75
- | `Modelfile` | Small | Ollama configuration |
76
 
77
- ---
 
 
 
 
 
 
 
 
 
 
 
78
 
79
- ## Quick Start
80
 
81
- ### With Ollama
82
 
83
  ```bash
84
- ollama create brainbox-law -f ./Modelfile
85
- ollama run brainbox-law
86
  ```
87
 
88
- ### With llama.cpp
89
 
90
  ```bash
91
- llama-cli -hf BrainboxAI/law-il-E2B --jinja
 
 
92
  ```
93
 
94
- ### Example prompts
95
 
96
- ```
97
- מה הזכויות שלי בנושא פיצויי פיטורים?
98
- נתח את פסק הדין הבא: [טקסט פסק הדין]
99
- הסבר את חוק הגנת הפרטיות בצורה מובנת.
100
- What are the key legal implications of this clause? [clause text]
 
 
 
 
 
 
 
 
 
 
 
101
  ```
102
 
103
- ---
104
 
105
- ## Recommended System Prompt
 
 
 
 
 
106
 
107
- ```
108
- DEFINITIONS:
109
- role: BrainboxAI Legal Assistant - an AI specialist trained by BrainboxAI (founded by Netanel Elyasi) for Israeli law Q&A, court ruling analysis, citizens' rights, and contract interpretation. Bilingual Hebrew + English.
110
- success: Provide accurate, source-grounded legal information in the user's language, with clear caveats that the output is informational and not a substitute for licensed legal counsel.
111
- scope_in:
112
- - Israeli law (civil, criminal, labor, family, administrative, constitutional)
113
- - Citizens' rights under Israeli law
114
- - Contract clause interpretation
115
- - Court ruling analysis and summarization
116
- - Cross-references between laws, regulations, and rulings
117
- scope_out:
118
- - Legal advice tied to specific real cases or persons
119
- - Predictions of court outcomes
120
- - Advice on foreign (non-Israeli) law unless explicitly asked
121
- - Any content that facilitates illegal activity
122
-
123
- PREMISES:
124
- - Input may be a legal question, statute citation, court ruling text, or contract clause.
125
- - Input language may be Hebrew, English, or mixed.
126
- - Statute and ruling citations stay in original form (e.g. ע"א 1234/20, חוק יסוד: כבוד האדם וחירותו).
127
- - Training cutoff: 2025. For newer rulings or legislation, rely on user-provided context.
128
-
129
- REQUIREMENTS:
130
- 1. Respond in the same primary language as the user's prompt.
131
- 2. Cite statutes and court rulings using their canonical Israeli form.
132
- 3. Every substantive claim should trace back to a specific statute, regulation, or ruling.
133
- 4. Use plain language unless the user requests technical legal Hebrew.
134
- 5. Add the disclaimer: "זהו מידע כללי ואינו מהווה ייעוץ משפטי" (Hebrew) or "This is general information and not legal advice" (English) at the end of every substantive response.
135
- 6. Never fabricate statute numbers, ruling citations, or case facts.
136
- 7. For contract clauses, identify the clause type, the parties' obligations, and potential risks.
137
- 8. For rights Q&A, structure the answer as: eligibility, how to claim, relevant authority, references.
138
- 9. Decline out-of-scope requests and redirect to the nearest in-scope task.
139
-
140
- EDGE_CASES:
141
- - Empty or vague question -> Ask a clarifying question in the user's language.
142
- - Request for legal advice on a specific real case -> Provide general principles only; add a strong disclaimer.
143
- - Conflicting statutes or rulings -> Present both, note the hierarchy (constitutional > statute > regulation).
144
- - Request in a third language -> Respond in English and note fallback.
145
- - Non-Israeli jurisdiction question -> Clarify scope and offer to answer from the Israeli perspective only.
146
-
147
- OUTPUT_FORMAT:
148
- format: Markdown. Bulleted lists for enumerations, numbered steps for procedures.
149
- default_structure: |
150
- **הנושא / Topic:** <topic>
151
- **תשובה / Answer:** <answer body>
152
- **מקורות / Sources:**
153
- - <statute or ruling citation>
154
- - <additional reference>
155
- **הערה:** זהו מידע כללי ואינו מהווה ייעוץ משפטי.
156
- language: Match user's input language.
157
- length: Short questions 100-250 words / Analyses 300-700 words.
158
-
159
- VERIFICATION:
160
- - Is the response in the user's language?
161
- - Are statute and ruling citations in canonical Israeli form?
162
- - Is every substantive claim sourced?
163
- - Is the legal-advice disclaimer present?
164
- - No fabricated citations or case facts?
165
- ```
166
 
167
- ---
 
 
 
 
 
 
 
 
 
 
168
 
169
- ## Training Details
170
 
171
- - **Method:** QLoRA (LoRA adapters with 4-bit quantized base)
172
- - **Framework:** Unsloth
173
- - **Dataset:** 17,613 bilingual legal instruction pairs
174
- - **Composition:**
175
- - 7,960 Israeli court rulings (Hebrew)
176
- - 2,353 Kol-Zchut rights articles (Hebrew)
177
- - 300 Open Law Book statutes (Hebrew)
178
- - 7,000 CUAD-based contract clauses (English)
179
- - **Language split:** ~60% Hebrew, ~40% English
180
 
181
- Full training dataset: [BrainboxAI/legal-training-il](https://huggingface.co/datasets/BrainboxAI/legal-training-il)
182
 
183
- ---
184
 
185
- ## Limitations & Ethical Considerations
186
 
187
- - **Not a licensed lawyer.** This model provides general legal information, not advice. Always consult a licensed attorney for case-specific guidance.
188
- - **Training cutoff.** Data coverage ends in 2025. Newer rulings or legislation may not be reflected.
189
- - **Citation hygiene.** The model attempts to cite sources but may occasionally misquote; always verify with official sources (Nevo, Supreme Court website, Kol-Zchut).
190
- - **Hebrew variance.** Archaic legal Hebrew and regional dialect may occasionally degrade output quality.
191
- - **Dual-use caution.** Legal information can be misused to manipulate or harm. Deployments should include acceptable-use policies.
192
 
193
- ---
194
 
195
- ## Sibling Repositories
196
 
197
- | Repo | Purpose |
198
- |------|---------|
199
- | [BrainboxAI/law-il-E2B](https://huggingface.co/BrainboxAI/law-il-E2B) | **This repo** - GGUF for local inference |
200
- | [BrainboxAI/law-il-E2B-safetensors](https://huggingface.co/BrainboxAI/law-il-E2B-safetensors) | Training-ready safetensors |
201
- | [BrainboxAI/legal-training-il](https://huggingface.co/datasets/BrainboxAI/legal-training-il) | Training dataset (17,613 examples) |
202
 
203
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
204
 
205
  ## Citation
206
 
207
  ```bibtex
208
- @misc{brainboxai_law_il_e2b_2026,
209
- author = {Elyasi, Netanel and BrainboxAI},
210
- title = {BrainboxAI Law IL E2B: A Hebrew-First Israeli Legal LLM},
211
- year = {2026},
212
- url = {https://huggingface.co/BrainboxAI/law-il-E2B},
213
- publisher = {Hugging Face}
 
214
  }
215
  ```
216
 
217
- ---
218
-
219
- ## About BrainboxAI
220
-
221
- **BrainboxAI** is an Israeli AI agency founded by **Netanel Elyasi**, specializing in:
222
-
223
- - Custom LLM training (Hebrew-native and bilingual models)
224
- - AI automation and agentic workflows
225
- - Cybersecurity AI products (scanning, triage, reporting)
226
- - Enterprise AI deployment (on-premise, privacy-first)
227
 
228
- **Related models and datasets:**
229
- - [BrainboxAI/cyber-analyst-4B](https://huggingface.co/BrainboxAI/cyber-analyst-4B) - Cyber analyst (GGUF)
230
- - [BrainboxAI/brainboxai_cyber_train](https://huggingface.co/datasets/BrainboxAI/brainboxai_cyber_train) - Cyber training dataset
231
 
232
- Contact: via Hugging Face or BrainboxAI.
233
 
234
  ---
235
 
236
- Trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth).
 
3
  - he
4
  - en
5
  license: apache-2.0
6
+ library_name: transformers
7
+ pipeline_tag: text-generation
8
  base_model: unsloth/gemma-4-E2B-it
9
+ datasets:
10
+ - BrainboxAI/legal-training-il
11
  tags:
12
  - legal
13
  - law
 
17
  - kol-zchut
18
  - gguf
19
  - llama.cpp
20
+ - ollama
21
  - unsloth
22
  - gemma4
23
+ - qlora
24
  - conversational
25
+ - text-generation
26
+ - on-device
27
+ pretty_name: Law-IL E2B (Israeli Legal AI)
28
+ model-index:
29
+ - name: law-il-E2B
30
+ results: []
31
  ---
32
 
33
+ # Law-IL E2B
 
 
34
 
35
+ **A 2B-parameter Israeli legal reasoning model, fine-tuned to cite statute, apply precedent, and respond in fluent Hebrew runs entirely on a laptop.**
36
 
37
+ [![HF Model](https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace-Model-yellow)](https://huggingface.co/BrainboxAI/law-il-E2B)
38
+ [![Dataset](https://img.shields.io/badge/%F0%9F%A4%97%20HuggingFace-Dataset-blue)](https://huggingface.co/datasets/BrainboxAI/legal-training-il)
39
+ [![Safetensors](https://img.shields.io/badge/Format-Safetensors-green)](https://huggingface.co/BrainboxAI/law-il-E2B-safetensors)
40
+ [![License](https://img.shields.io/badge/License-Apache_2.0-lightgrey)](https://www.apache.org/licenses/LICENSE-2.0)
41
 
42
  ---
43
 
44
+ ## Model overview
45
 
46
+ `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.
 
 
 
 
 
 
 
 
 
47
 
48
+ Unlike general-purpose models, `law-il-E2B` was trained to follow a structured reasoning pattern tailored to Israeli legal practice:
49
 
50
+ 1. **Identify the statute** — which law, which section, which year.
51
+ 2. **Explain in plain language** — accessible to non-lawyers.
52
+ 3. **Apply precedent** — cite a relevant Supreme Court or district ruling.
53
+ 4. **Add a "שים לב" (heads-up)** — the subtle point most lawyers miss.
54
 
55
+ The model runs locally on a laptop or single consumer GPU. No internet connection, no API call, no data leaves the device.
 
 
 
 
 
56
 
57
+ ## Why this exists
 
 
 
 
 
58
 
59
+ 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.
60
 
61
+ 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.
62
 
63
+ ## Intended use
 
 
 
 
64
 
65
+ **Primary use cases:**
66
+ - Legal Q&A for Israeli citizens (labor, tenancy, family, consumer rights)
67
+ - First-pass research assistance for junior associates
68
+ - Contract clause interpretation and comparison
69
+ - Rights-page (כל-זכות) explanations for social-sector organizations
70
+ - On-device deployment in law firms handling privileged data
71
+
72
+ **Out-of-scope uses:**
73
+ - Legal advice without human attorney review
74
+ - Jurisdictions other than Israel (the model is not trained on US, EU, or UK law)
75
+ - Criminal defense strategy (training data is predominantly civil/labor/family)
76
+ - Real-time courtroom use (the model does not verify its citations against live databases)
77
 
78
+ ## How to use
79
 
80
+ ### Ollama (recommended for local use)
81
 
82
  ```bash
83
+ ollama pull hf.co/BrainboxAI/law-il-E2B:Q4_K_M
84
+ ollama run hf.co/BrainboxAI/law-il-E2B:Q4_K_M
85
  ```
86
 
87
+ ### llama.cpp
88
 
89
  ```bash
90
+ ./llama-cli -m law-il-E2B.Q4_K_M.gguf \
91
+ -p "מהן זכויות העובד בפיטורים ללא הודעה מוקדמת?" \
92
+ --temp 0.3 --top-p 0.9 -n 512
93
  ```
94
 
95
+ ### Python (transformers, via safetensors variant)
96
 
97
+ ```python
98
+ from transformers import AutoTokenizer, AutoModelForCausalLM
99
+
100
+ tokenizer = AutoTokenizer.from_pretrained("BrainboxAI/law-il-E2B-safetensors")
101
+ model = AutoModelForCausalLM.from_pretrained(
102
+ "BrainboxAI/law-il-E2B-safetensors",
103
+ torch_dtype="auto",
104
+ device_map="auto",
105
+ )
106
+
107
+ messages = [
108
+ {"role": "user", "content": "פיטרו אותי בלי הודעה מוקדמת. מה מגיע לי?"},
109
+ ]
110
+ inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
111
+ outputs = model.generate(inputs, max_new_tokens=512, temperature=0.3, top_p=0.9)
112
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
113
  ```
114
 
115
+ ### Recommended generation parameters
116
 
117
+ | Parameter | Value | Rationale |
118
+ |-----------|-------|-----------|
119
+ | `temperature` | 0.3 | Low creativity, high factuality for legal work |
120
+ | `top_p` | 0.9 | Standard nucleus sampling |
121
+ | `max_new_tokens` | 512 | Enough for full structured response with citations |
122
+ | `repetition_penalty` | 1.05 | Prevents repeated citation loops |
123
 
124
+ ## Training details
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
+ | Attribute | Value |
127
+ |-----------|-------|
128
+ | **Base model** | [unsloth/gemma-4-E2B-it](https://huggingface.co/unsloth/gemma-4-E2B-it) |
129
+ | **Method** | QLoRA (4-bit quantization during training) |
130
+ | **LoRA rank (r)** | 64 |
131
+ | **LoRA alpha** | 128 |
132
+ | **Epochs** | 20 |
133
+ | **Training steps** | 500 |
134
+ | **Hardware** | NVIDIA RTX 5090 (RunPod) |
135
+ | **Framework** | Unsloth Studio |
136
+ | **Languages** | Hebrew (60%) and English (40%) |
137
 
138
+ ### Dataset composition (17,613 examples)
139
 
140
+ | Source | Count | Content |
141
+ |--------|-------|---------|
142
+ | Israeli court rulings | 7,960 | Supreme Court, family court, criminal, civil |
143
+ | Kol-Zchut (rights pages) | 2,353 | Labor, housing, insurance, disability, pension |
144
+ | Open Law Book (Wikisource) | 300 | Full-text Israeli statutes |
145
+ | Contract clauses | 7,000 | 41 clause categories, hand-classified |
 
 
 
146
 
147
+ All data was hand-filtered to meet quality criteria: verifiable citation, well-formed Hebrew, no personal identifying information.
148
 
149
+ See the [dataset card](https://huggingface.co/datasets/BrainboxAI/legal-training-il) for full composition details.
150
 
151
+ ## Evaluation
152
 
153
+ `law-il-E2B` has been evaluated qualitatively on:
154
+ - Accurate statute citation (law name, section number, year)
155
+ - Correct application of precedent
156
+ - Fluent, idiomatic Hebrew output
157
+ - Appropriate hedging on unsettled legal questions
158
 
159
+ 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.
160
 
161
+ ## Limitations
162
 
163
+ This is a 2B-parameter model fine-tuned on a domain-specific corpus. Important limitations:
 
 
 
 
164
 
165
+ - **Not a substitute for a licensed attorney.** Outputs should be reviewed by a human before being relied upon.
166
+ - **Training cutoff.** The Kol-Zchut pages were scraped in early 2026. Law changes will not be reflected until retraining.
167
+ - **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).
168
+ - **Narrow jurisdiction.** The model knows Israeli law. It does not know foreign law, international law, or comparative law.
169
+ - **Bias in training data.** Court rulings overrepresent labor and family law; criminal and administrative law are thinner.
170
+
171
+ ## Formats available
172
+
173
+ - [**GGUF Q4_K_M** (1.5 GB)](https://huggingface.co/BrainboxAI/law-il-E2B) — for Ollama, llama.cpp, LM Studio
174
+ - [**Safetensors 16-bit**](https://huggingface.co/BrainboxAI/law-il-E2B-safetensors) — for further fine-tuning, HF transformers, ONNX conversion
175
+
176
+ ## License
177
+
178
+ Apache 2.0. You may use, modify, distribute, and sell derivatives — including commercial legal-tech products — with attribution.
179
 
180
  ## Citation
181
 
182
  ```bibtex
183
+ @misc{elyasi2026lawil,
184
+ title = {Law-IL E2B: A Small, On-Device Legal Reasoning Model for Israeli Law},
185
+ author = {Elyasi, Netanel},
186
+ year = {2026},
187
+ publisher = {BrainboxAI},
188
+ howpublished = {\url{https://huggingface.co/BrainboxAI/law-il-E2B}},
189
+ note = {Fine-tuned from unsloth/gemma-4-E2B-it}
190
  }
191
  ```
192
 
193
+ ## Author
 
 
 
 
 
 
 
 
 
194
 
195
+ Built by [**Netanel Elyasi**](https://huggingface.co/BrainboxAI), founder of [BrainboxAI](https://brainboxai.io) — an Israeli applied-AI studio specializing in small, private, domain-specialized models.
 
 
196
 
197
+ For custom training, fine-tuning, or on-prem deployment for law firms, contact: **netanele@brainboxai.io**.
198
 
199
  ---
200
 
201
+ *Part of the BrainboxAI family of on-device Hebrew models — see also [`code-il-E4B`](https://huggingface.co/BrainboxAI/code-il-E4B) (coding) and [`cyber-analyst-4B`](https://huggingface.co/BrainboxAI/cyber-analyst-4B) (security).*