Text Generation
Transformers
GGUF
Hebrew
English
gemma4
image-text-to-text
legal
law
israel
hebrew
court-rulings
kol-zchut
llama.cpp
ollama
unsloth
qlora
conversational
on-device
Instructions to use BrainboxAI/law-il-E2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BrainboxAI/law-il-E2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BrainboxAI/law-il-E2B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("BrainboxAI/law-il-E2B") model = AutoModelForMultimodalLM.from_pretrained("BrainboxAI/law-il-E2B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use BrainboxAI/law-il-E2B with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf BrainboxAI/law-il-E2B:BF16 # Run inference directly in the terminal: llama cli -hf BrainboxAI/law-il-E2B:BF16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf BrainboxAI/law-il-E2B:BF16 # Run inference directly in the terminal: llama cli -hf BrainboxAI/law-il-E2B:BF16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf BrainboxAI/law-il-E2B:BF16 # Run inference directly in the terminal: ./llama-cli -hf BrainboxAI/law-il-E2B:BF16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf BrainboxAI/law-il-E2B:BF16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf BrainboxAI/law-il-E2B:BF16
Use Docker
docker model run hf.co/BrainboxAI/law-il-E2B:BF16
- LM Studio
- Jan
- vLLM
How to use BrainboxAI/law-il-E2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BrainboxAI/law-il-E2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BrainboxAI/law-il-E2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/BrainboxAI/law-il-E2B:BF16
- SGLang
How to use BrainboxAI/law-il-E2B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "BrainboxAI/law-il-E2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BrainboxAI/law-il-E2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "BrainboxAI/law-il-E2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BrainboxAI/law-il-E2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use BrainboxAI/law-il-E2B with Ollama:
ollama run hf.co/BrainboxAI/law-il-E2B:BF16
- Unsloth Desktop
- Pi
How to use BrainboxAI/law-il-E2B with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf BrainboxAI/law-il-E2B:BF16
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "BrainboxAI/law-il-E2B:BF16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use BrainboxAI/law-il-E2B with Docker Model Runner:
docker model run hf.co/BrainboxAI/law-il-E2B:BF16
- Lemonade
How to use BrainboxAI/law-il-E2B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull BrainboxAI/law-il-E2B:BF16
Run and chat with the model
lemonade run user.law-il-E2B-BF16
List all available models
lemonade list
- Hermes Agent
How to use BrainboxAI/law-il-E2B with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf BrainboxAI/law-il-E2B:BF16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default BrainboxAI/law-il-E2B:BF16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use BrainboxAI/law-il-E2B with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf BrainboxAI/law-il-E2B:BF16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "BrainboxAI/law-il-E2B:BF16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Professionalize model card: structured overview, usage examples, training details, limitations, citation
Browse files
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 |
-
-
|
| 19 |
- conversational
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
---
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
|
| 28 |
-
### Hebrew-First Israeli Legal AI Specialist (GGUF)
|
| 29 |
|
| 30 |
-
A
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
---
|
| 35 |
|
| 36 |
-
## Model
|
| 37 |
|
| 38 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
| 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 |
-
##
|
| 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 |
-
|
| 70 |
|
| 71 |
-
|
| 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 |
-
##
|
| 80 |
|
| 81 |
-
###
|
| 82 |
|
| 83 |
```bash
|
| 84 |
-
ollama
|
| 85 |
-
ollama run
|
| 86 |
```
|
| 87 |
|
| 88 |
-
###
|
| 89 |
|
| 90 |
```bash
|
| 91 |
-
llama-cli -
|
|
|
|
|
|
|
| 92 |
```
|
| 93 |
|
| 94 |
-
###
|
| 95 |
|
| 96 |
-
```
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
```
|
| 102 |
|
| 103 |
-
|
| 104 |
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
##
|
| 170 |
|
| 171 |
-
|
| 172 |
-
-
|
| 173 |
-
|
| 174 |
-
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
- 300 Open Law Book statutes (Hebrew)
|
| 178 |
-
- 7,000 CUAD-based contract clauses (English)
|
| 179 |
-
- **Language split:** ~60% Hebrew, ~40% English
|
| 180 |
|
| 181 |
-
|
| 182 |
|
| 183 |
-
--
|
| 184 |
|
| 185 |
-
##
|
| 186 |
|
| 187 |
-
-
|
| 188 |
-
-
|
| 189 |
-
-
|
| 190 |
-
-
|
| 191 |
-
-
|
| 192 |
|
| 193 |
-
|
| 194 |
|
| 195 |
-
##
|
| 196 |
|
| 197 |
-
|
| 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{
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
year
|
| 212 |
-
|
| 213 |
-
|
|
|
|
| 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 |
-
**
|
| 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 |
-
|
| 233 |
|
| 234 |
---
|
| 235 |
|
| 236 |
-
|
|
|
|
| 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 |
+
[](https://huggingface.co/BrainboxAI/law-il-E2B)
|
| 38 |
+
[](https://huggingface.co/datasets/BrainboxAI/legal-training-il)
|
| 39 |
+
[](https://huggingface.co/BrainboxAI/law-il-E2B-safetensors)
|
| 40 |
+
[](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).*
|