Text Generation
Transformers
Safetensors
GGUF
Rust
English
gemma4
image-text-to-text
gemma
gemma-4-E2B
code
coding
code-generation
python
javascript
typescript
go
sql
bash
cpp
qlora
fine-tuned
instruct
edge
on-device
small-language-model
llm
mobile
quantization
cpu-inference
offline
conversational
Eval Results (legacy)
Instructions to use ArnavKewalram/gemma-4-E2B-coder-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ArnavKewalram/gemma-4-E2B-coder-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ArnavKewalram/gemma-4-E2B-coder-v1") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("ArnavKewalram/gemma-4-E2B-coder-v1") model = AutoModelForMultimodalLM.from_pretrained("ArnavKewalram/gemma-4-E2B-coder-v1", device_map="auto") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ArnavKewalram/gemma-4-E2B-coder-v1 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 ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M # Run inference directly in the terminal: llama cli -hf ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M # Run inference directly in the terminal: llama cli -hf ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
Use Docker
docker model run hf.co/ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use ArnavKewalram/gemma-4-E2B-coder-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ArnavKewalram/gemma-4-E2B-coder-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ArnavKewalram/gemma-4-E2B-coder-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
- SGLang
How to use ArnavKewalram/gemma-4-E2B-coder-v1 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 "ArnavKewalram/gemma-4-E2B-coder-v1" \ --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": "ArnavKewalram/gemma-4-E2B-coder-v1", "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 "ArnavKewalram/gemma-4-E2B-coder-v1" \ --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": "ArnavKewalram/gemma-4-E2B-coder-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use ArnavKewalram/gemma-4-E2B-coder-v1 with Ollama:
ollama run hf.co/ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
- Unsloth Desktop
- Pi
How to use ArnavKewalram/gemma-4-E2B-coder-v1 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
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:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use ArnavKewalram/gemma-4-E2B-coder-v1 with Docker Model Runner:
docker model run hf.co/ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
- Lemonade
How to use ArnavKewalram/gemma-4-E2B-coder-v1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
Run and chat with the model
lemonade run user.gemma-4-E2B-coder-v1-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use ArnavKewalram/gemma-4-E2B-coder-v1 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
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:9931/v1 hermes config set model.default ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use ArnavKewalram/gemma-4-E2B-coder-v1 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M
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:9931/v1 \ --custom-model-id "ArnavKewalram/gemma-4-E2B-coder-v1:Q4_K_M" \ --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"
Add HumanEval pass@1 benchmark: 34.1% (matches Code Llama 7B)
Browse files
README.md
CHANGED
|
@@ -41,7 +41,13 @@ model-index:
|
|
| 41 |
- task:
|
| 42 |
type: text-generation
|
| 43 |
name: Code Generation
|
|
|
|
|
|
|
|
|
|
| 44 |
metrics:
|
|
|
|
|
|
|
|
|
|
| 45 |
- type: keyword_score
|
| 46 |
value: 88.5
|
| 47 |
name: Keyword Score (8 coding tasks, Q4_K_M)
|
|
@@ -80,7 +86,7 @@ widget:
|
|
| 80 |
|
| 81 |
# gemma-4-E2B-coder-v1
|
| 82 |
|
| 83 |
-
**The first coding fine-tune of [google/gemma-4-E2B-it](https://huggingface.co/google/gemma-4-E2B-it)** — **
|
| 84 |
|
| 85 |
| | |
|
| 86 |
|--|--|
|
|
@@ -245,6 +251,22 @@ Trained with [TRL SFTTrainer](https://huggingface.co/docs/trl) + [PEFT LoRA](htt
|
|
| 245 |
|
| 246 |
## Evaluation
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
Keyword-based evaluation on 8 coding prompts using Q4_K_M GGUF (CPU inference, llama.cpp b9684, temperature 0.2):
|
| 249 |
|
| 250 |
| Prompt | Keywords checked | Score |
|
|
@@ -260,7 +282,7 @@ Keyword-based evaluation on 8 coding prompts using Q4_K_M GGUF (CPU inference, l
|
|
| 260 |
|
| 261 |
**Average keyword score: 88.5%** (8 prompts).
|
| 262 |
|
| 263 |
-
Keyword scoring checks that expected API/structural elements appear in the output — it is a proxy for code correctness, not a formal benchmark
|
| 264 |
|
| 265 |
---
|
| 266 |
|
|
|
|
| 41 |
- task:
|
| 42 |
type: text-generation
|
| 43 |
name: Code Generation
|
| 44 |
+
dataset:
|
| 45 |
+
name: openai_humaneval
|
| 46 |
+
type: openai/openai_humaneval
|
| 47 |
metrics:
|
| 48 |
+
- type: pass@1
|
| 49 |
+
value: 34.1
|
| 50 |
+
name: HumanEval pass@1 (Q4_K_M, temp=0.2, raw completion)
|
| 51 |
- type: keyword_score
|
| 52 |
value: 88.5
|
| 53 |
name: Keyword Score (8 coding tasks, Q4_K_M)
|
|
|
|
| 86 |
|
| 87 |
# gemma-4-E2B-coder-v1
|
| 88 |
|
| 89 |
+
**The first coding fine-tune of [google/gemma-4-E2B-it](https://huggingface.co/google/gemma-4-E2B-it)** — **34.1% HumanEval pass@1** · matches Code Llama 7B at half the size · runs fully offline on **4 GB RAM** · Apache 2.0.
|
| 90 |
|
| 91 |
| | |
|
| 92 |
|--|--|
|
|
|
|
| 251 |
|
| 252 |
## Evaluation
|
| 253 |
|
| 254 |
+
### HumanEval (pass@1)
|
| 255 |
+
|
| 256 |
+
Evaluated on the full [OpenAI HumanEval](https://github.com/openai/human-eval) benchmark (164 Python problems) using Q4_K_M GGUF via Ollama, raw completion mode (no chat template), temperature 0.2, 512 max tokens.
|
| 257 |
+
|
| 258 |
+
| Model | Size | HumanEval pass@1 |
|
| 259 |
+
|-------|------|-----------------|
|
| 260 |
+
| **gemma-4-E2B-coder-v1 (Q4_K_M)** | **3.9B** | **34.1%** |
|
| 261 |
+
| Code Llama | 7B | 33.5% |
|
| 262 |
+
| Qwen2.5-Coder | 1.5B | 37.2% |
|
| 263 |
+
| Llama 3.2 | 3B | 25.4% |
|
| 264 |
+
| Gemma 2 | 2B | 18.7% |
|
| 265 |
+
|
| 266 |
+
**34.1% pass@1** — competitive with Code Llama 7B at roughly half the parameter count. Notable given the model was fine-tuned on only 10,000 samples with a 384-token context window; longer-context problems are the primary failure mode.
|
| 267 |
+
|
| 268 |
+
### Keyword Score
|
| 269 |
+
|
| 270 |
Keyword-based evaluation on 8 coding prompts using Q4_K_M GGUF (CPU inference, llama.cpp b9684, temperature 0.2):
|
| 271 |
|
| 272 |
| Prompt | Keywords checked | Score |
|
|
|
|
| 282 |
|
| 283 |
**Average keyword score: 88.5%** (8 prompts).
|
| 284 |
|
| 285 |
+
Keyword scoring checks that expected API/structural elements appear in the output — it is a proxy for code correctness, not a formal benchmark. The Miller-Rabin score (33%) is low because the model wrote a functionally correct implementation using variable names `a` and `x` rather than the keyword-matched names `miller`/`witness`.
|
| 286 |
|
| 287 |
---
|
| 288 |
|