Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,31 +1,222 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
-
-
|
| 4 |
-
-
|
| 5 |
-
-
|
| 6 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
-
# code-il-E4B
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
-
**
|
| 14 |
-
|
| 15 |
-
- For multimodal models: `llama-mtmd-cli -hf BrainboxAI/code-il-E4B --jinja`
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
-
##
|
| 22 |
-
**Important:** Ollama currently does not support separate mmproj files for vision models.
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: unsloth/gemma-4-E4B-it
|
| 4 |
+
datasets:
|
| 5 |
+
- BrainboxAI/code-training-il
|
| 6 |
+
- nvidia/OpenCodeInstruct
|
| 7 |
+
- bleugreen/typescript-instruct
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
- he
|
| 11 |
tags:
|
| 12 |
+
- text-generation
|
| 13 |
+
- gguf
|
| 14 |
+
- code
|
| 15 |
+
- python
|
| 16 |
+
- typescript
|
| 17 |
+
- gemma4
|
| 18 |
+
- coding-assistant
|
| 19 |
+
- llama.cpp
|
| 20 |
+
- ollama
|
| 21 |
+
- unsloth
|
| 22 |
+
- qlora
|
| 23 |
+
- brainboxai
|
| 24 |
+
library_name: transformers
|
| 25 |
+
pipeline_tag: text-generation
|
| 26 |
---
|
| 27 |
|
| 28 |
+
# BrainboxAI/code-il-E4B
|
| 29 |
|
| 30 |
+
**Local-First Python & TypeScript Coding Assistant (GGUF)**
|
| 31 |
|
| 32 |
+
Built by [**BrainboxAI**](https://huggingface.co/BrainboxAI), founded by **Netanel Elyasi**.
|
| 33 |
+
Sister model of [BrainboxAI/law-il-E2B](https://huggingface.co/BrainboxAI/law-il-E2B).
|
|
|
|
| 34 |
|
| 35 |
+
A lightweight coding model, fine-tuned from Google's Gemma 4 E4B on ~40K Python and
|
| 36 |
+
TypeScript instruction pairs plus a hand-curated identity set. Designed to run locally
|
| 37 |
+
via Ollama or llama.cpp with no cloud API, no rate limits, and no data leaving the machine.
|
| 38 |
|
| 39 |
+
## Model Details
|
|
|
|
| 40 |
|
| 41 |
+
| Attribute | Value |
|
| 42 |
+
|-------------------|--------------------------------------------------------------------|
|
| 43 |
+
| **Base Model** | [unsloth/gemma-4-E4B-it](https://huggingface.co/unsloth/gemma-4-E4B-it) (4B params) |
|
| 44 |
+
| **Architecture** | Gemma4ForConditionalGeneration |
|
| 45 |
+
| **Context Length**| 128K tokens (inherited from base) |
|
| 46 |
+
| **Training** | QLoRA 4-bit with Unsloth (2x faster training) |
|
| 47 |
+
| **Dataset** | [BrainboxAI/code-training-il](https://huggingface.co/datasets/BrainboxAI/code-training-il) (~40K examples) |
|
| 48 |
+
| **Quantization** | Q4_K_M GGUF (~5.3 GB) |
|
| 49 |
+
| **License** | Apache 2.0 |
|
| 50 |
+
| **Author** | Netanel Elyasi ยท BrainboxAI |
|
| 51 |
|
| 52 |
+
## Intended Use
|
| 53 |
+
|
| 54 |
+
### Primary Tasks
|
| 55 |
+
|
| 56 |
+
- **Python code generation** โ functions, classes, algorithms, data structures.
|
| 57 |
+
- **TypeScript code generation** โ typed functions, React components, utilities.
|
| 58 |
+
- **Debugging** โ trace exceptions, explain errors, suggest fixes.
|
| 59 |
+
- **Code explanation** โ walk through existing snippets in English or Hebrew.
|
| 60 |
+
- **Test writing** โ pytest (Python), Jest/assertion-style (TypeScript).
|
| 61 |
+
- **Refactoring** โ simplify, extract helpers, improve readability.
|
| 62 |
+
|
| 63 |
+
### Target Users
|
| 64 |
+
|
| 65 |
+
- **Developers** who want local-first coding help without sending code to cloud APIs.
|
| 66 |
+
- **Privacy-sensitive teams** building products that can't leak internal code.
|
| 67 |
+
- **Offline workflows** โ on the train, on a plane, behind a restrictive firewall.
|
| 68 |
+
- **Hobbyists** running on modest hardware (6 GB+ VRAM or CPU-only).
|
| 69 |
+
|
| 70 |
+
## Available Files
|
| 71 |
+
|
| 72 |
+
| File | Size | Use |
|
| 73 |
+
|------------------------------------------|---------:|-----------------------------------------------------|
|
| 74 |
+
| `gemma-4-e4b-it.Q4_K_M.gguf` | 5.34 GB | Main model โ Ollama / llama.cpp local inference |
|
| 75 |
+
| `gemma-4-e4b-it.BF16-mmproj.gguf` | ~0.9 GB | Vision projector (optional โ base supports vision) |
|
| 76 |
+
|
| 77 |
+
## Quick Start
|
| 78 |
+
|
| 79 |
+
### With Ollama
|
| 80 |
+
|
| 81 |
+
```bash
|
| 82 |
+
ollama pull hf.co/BrainboxAI/code-il-E4B:Q4_K_M
|
| 83 |
+
ollama run hf.co/BrainboxAI/code-il-E4B:Q4_K_M
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
Optional โ tag it with a short name:
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
ollama cp hf.co/BrainboxAI/code-il-E4B:Q4_K_M brainbox-coder
|
| 90 |
+
ollama run brainbox-coder
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
### With llama.cpp
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
# Text-only
|
| 97 |
+
llama-cli -hf BrainboxAI/code-il-E4B --jinja
|
| 98 |
+
|
| 99 |
+
# With vision (if you also download the mmproj file)
|
| 100 |
+
llama-mtmd-cli -hf BrainboxAI/code-il-E4B --jinja
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
### Example Prompts
|
| 104 |
+
|
| 105 |
+
**Python:**
|
| 106 |
+
```
|
| 107 |
+
Write a Python function that returns the leftmost index of a target in a sorted
|
| 108 |
+
array with possible duplicates, or -1 if not found.
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
**TypeScript:**
|
| 112 |
+
```
|
| 113 |
+
Create a React hook useDebouncedValue<T>(value: T, ms: number): T that returns
|
| 114 |
+
the debounced value.
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
**Debugging:**
|
| 118 |
+
```
|
| 119 |
+
This pytest fails with AssertionError. What's wrong with my binary_search?
|
| 120 |
+
|
| 121 |
+
def binary_search(arr, target):
|
| 122 |
+
lo, hi = 0, len(arr)
|
| 123 |
+
while lo < hi:
|
| 124 |
+
mid = (lo + hi) // 2
|
| 125 |
+
if arr[mid] == target: return mid
|
| 126 |
+
elif arr[mid] < target: lo = mid + 1
|
| 127 |
+
else: hi = mid - 1
|
| 128 |
+
return -1
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
**Hebrew (identity):**
|
| 132 |
+
```
|
| 133 |
+
ืื ืื ื ืืืชื?
|
| 134 |
+
```
|
| 135 |
+
โ "ืืืชื ืื ืชื BrainboxAI ืืืืืืช ื ืชื ืื ืืืืืฉื. ืื ื ืขืืืจ ืชืื ืืช ืืคืืืชืื ืืืืคืืกืงืจืืคื."
|
| 136 |
+
|
| 137 |
+
## Recommended System Prompt
|
| 138 |
+
|
| 139 |
+
```
|
| 140 |
+
You are BrainboxAI Coder, a local coding assistant fine-tuned from Gemma 4 by
|
| 141 |
+
Netanel Elyasi at BrainboxAI. You specialize in Python and TypeScript.
|
| 142 |
+
|
| 143 |
+
Prefer concise, correct code over verbose explanations. Always:
|
| 144 |
+
- Include obvious imports in generated files.
|
| 145 |
+
- When writing tests, match the current implementation unless asked to change it.
|
| 146 |
+
- Return -1 / None / null honestly when a value is missing rather than raising.
|
| 147 |
+
- Flag when the user's request has multiple interpretations and ask a short clarifying question.
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
## Training Details
|
| 151 |
+
|
| 152 |
+
| Stage | Value |
|
| 153 |
+
|------------------------|----------------------------------------------------|
|
| 154 |
+
| **Method** | QLoRA 4-bit supervised fine-tuning (SFT) |
|
| 155 |
+
| **Framework** | Unsloth + TRL `SFTTrainer` |
|
| 156 |
+
| **Hardware** | NVIDIA RTX 5090 (32 GB VRAM) |
|
| 157 |
+
| **LoRA rank** | 16 (alpha 16, dropout 0) |
|
| 158 |
+
| **Target modules** | q_proj, k_proj, v_proj, o_proj, gate/up/down_proj |
|
| 159 |
+
| **Batch** | 2 ร 4 grad accum = 16 effective |
|
| 160 |
+
| **Learning rate** | 2e-4, linear decay, 10-step warmup |
|
| 161 |
+
| **Steps** | 500 |
|
| 162 |
+
| **Sequence length** | 2,048 tokens |
|
| 163 |
+
| **Final loss** | ~0.8 (from ~2.4 average at start) |
|
| 164 |
+
| **Gradient checkpointing** | `"unsloth"` (โ30% VRAM savings) |
|
| 165 |
+
| **Seed** | 3407 |
|
| 166 |
+
|
| 167 |
+
## Dataset
|
| 168 |
+
|
| 169 |
+
Trained on [BrainboxAI/code-training-il](https://huggingface.co/datasets/BrainboxAI/code-training-il):
|
| 170 |
+
|
| 171 |
+
| Source | Samples | Language |
|
| 172 |
+
|-------------------------------------|--------:|------------------|
|
| 173 |
+
| nvidia/OpenCodeInstruct (scoreโฅ0.5) | 20,000 | English / Python |
|
| 174 |
+
| bleugreen/typescript-instruct | 20,000 | English / TS |
|
| 175 |
+
| BrainboxAI identity examples | 330 | EN + HE |
|
| 176 |
+
|
| 177 |
+
Split 95/5 train/eval (seed 3407).
|
| 178 |
+
|
| 179 |
+
## Limitations & Ethical Considerations
|
| 180 |
+
|
| 181 |
+
- **4B parameters.** Competitive with larger models on everyday Python/TypeScript
|
| 182 |
+
tasks but will not match GPT-4 or Claude on novel algorithms, complex system
|
| 183 |
+
design, or long multi-file reasoning.
|
| 184 |
+
- **Two languages only.** Python and TypeScript. Generation quality on Rust, Go,
|
| 185 |
+
C++, Ruby, etc. will be noticeably weaker.
|
| 186 |
+
- **Identity is hard-coded.** The model will assert it is "BrainboxAI Coder,
|
| 187 |
+
trained by Netanel Elyasi at BrainboxAI" across sessions.
|
| 188 |
+
- **Cutoff.** Training data reflects code up to the dataset snapshot (2026).
|
| 189 |
+
Library APIs released afterwards may be missing.
|
| 190 |
+
- **Not a security auditor.** The model can be prompted to produce insecure code.
|
| 191 |
+
Always review generated code before running in production.
|
| 192 |
+
- **Hallucinations.** Like any LLM, it can fabricate imports, function signatures,
|
| 193 |
+
or test cases. Verify everything.
|
| 194 |
+
|
| 195 |
+
## Sibling Repositories
|
| 196 |
+
|
| 197 |
+
- [BrainboxAI/code-training-il](https://huggingface.co/datasets/BrainboxAI/code-training-il) โ training dataset (this model).
|
| 198 |
+
- [BrainboxAI/law-il-E2B](https://huggingface.co/BrainboxAI/law-il-E2B) โ Israeli legal assistant.
|
| 199 |
+
- [BrainboxAI/law-il-E2B-safetensors](https://huggingface.co/BrainboxAI/law-il-E2B-safetensors) โ safetensors variant.
|
| 200 |
+
- [BrainboxAI/legal-training-il](https://huggingface.co/datasets/BrainboxAI/legal-training-il) โ legal training dataset.
|
| 201 |
+
|
| 202 |
+
## Citation
|
| 203 |
+
|
| 204 |
+
```bibtex
|
| 205 |
+
@misc{brainboxai_code_il_e4b,
|
| 206 |
+
title = {BrainboxAI Coder (code-il-E4B)},
|
| 207 |
+
author = {Elyasi, Netanel and BrainboxAI},
|
| 208 |
+
year = {2026},
|
| 209 |
+
howpublished = {\url{https://huggingface.co/BrainboxAI/code-il-E4B}},
|
| 210 |
+
}
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
## About BrainboxAI
|
| 214 |
+
|
| 215 |
+
BrainboxAI is an Israeli AI company founded by **Netanel Elyasi**, building
|
| 216 |
+
specialized, local-first language models for specific domains:
|
| 217 |
+
|
| 218 |
+
- **law-il** โ Hebrew-first Israeli legal AI.
|
| 219 |
+
- **code-il** (this model) โ local Python + TypeScript coding assistant.
|
| 220 |
+
|
| 221 |
+
All BrainboxAI releases are permissively licensed (Apache 2.0) and published
|
| 222 |
+
openly on HuggingFace.
|