Instructions to use jorch/gemma-4-e4b-it-lm-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use jorch/gemma-4-e4b-it-lm-4bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("jorch/gemma-4-e4b-it-lm-4bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use jorch/gemma-4-e4b-it-lm-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "jorch/gemma-4-e4b-it-lm-4bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "jorch/gemma-4-e4b-it-lm-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use jorch/gemma-4-e4b-it-lm-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "jorch/gemma-4-e4b-it-lm-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "jorch/gemma-4-e4b-it-lm-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jorch/gemma-4-e4b-it-lm-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use jorch/gemma-4-e4b-it-lm-4bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "jorch/gemma-4-e4b-it-lm-4bit"
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 jorch/gemma-4-e4b-it-lm-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use jorch/gemma-4-e4b-it-lm-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "jorch/gemma-4-e4b-it-lm-4bit"
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 "jorch/gemma-4-e4b-it-lm-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Gemma 4 E4B — Text-Only MLX 4-bit
Text-only extraction of Google's Gemma 4 E4B instruction-tuned model, converted to MLX format with 4-bit quantization.
This is the language model component only (no vision/audio towers), suitable for text chat on Apple Silicon devices including iPhones (8 GB RAM) and Macs.
Model Details
| Spec | Value |
|---|---|
| Base model | google/gemma-4-e4b-it |
| Architecture | Gemma 4 with Per-Layer Embeddings (PLE) |
| Parameters | 8B total, 4.5B active |
| Hidden size | 2560 |
| Layers | 42 |
| Attention heads | 8 (2 KV heads) |
| Vocab size | 262,144 |
| Context window | 128K tokens |
| Quantization | 4-bit affine (group size 64) |
| Download size | 3.9 GB |
| License | Apache 2.0 |
Conversion
Converted from google/gemma-4-e4b-it using mlx-lm with Gemma 4 support from ml-explore/mlx-lm PR #1095:
python -m mlx_lm convert --hf-path google/gemma-4-e4b-it -q --q-bits 4 --mlx-path ./gemma-4-e4b-it-lm-4bit
Usage with mlx-lm (Python)
from mlx_lm import load, generate
model, tokenizer = load("jorch/gemma-4-e4b-it-lm-4bit")
response = generate(model, tokenizer, prompt="What is machine learning?", verbose=True, max_tokens=512)
Usage with mlx-swift-lm (iOS/macOS)
Requires Gemma 4 text model support in mlx-swift-lm:
import MLXLLM
import MLXLMCommon
let configuration = ModelConfiguration(id: "jorch/gemma-4-e4b-it-lm-4bit")
let container = try await LLMModelFactory.shared.loadContainer(configuration: configuration)
Why text-only?
The mlx-community/gemma-4-e4b-it-4bit model was converted with mlx-vlm and includes vision/audio towers. That conversion is missing critical text model weights (norm, per_layer_projection_norm, per_layer_model_projection), making it incompatible with text-only LLM loaders.
This conversion uses mlx-lm which properly extracts and preserves all text model weight keys.
E4B vs E2B
| E2B | E4B | |
|---|---|---|
| Active params | 2.3B | 4.5B |
| Download | 2.5 GB | 3.9 GB |
| Quality | Good for everyday chat | Noticeably better reasoning |
| Speed | Faster | Slightly slower |
| iPhone 8 GB | Comfortable | Fits with headroom |
Built for SoloAI
This model powers SoloAI — a privacy-first iOS chat app that runs Gemma 4 entirely on-device.
- Downloads last month
- 35
4-bit