Text Generation
MLX
Safetensors
gemma4
quantized
mixed-precision
4bit
8bit
optiq
apple-silicon
gemma-4
conversational
4-bit precision
Instructions to use mlx-community/gemma-4-e2b-it-OptiQ-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/gemma-4-e2b-it-OptiQ-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("mlx-community/gemma-4-e2b-it-OptiQ-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 mlx-community/gemma-4-e2b-it-OptiQ-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 "mlx-community/gemma-4-e2b-it-OptiQ-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": "mlx-community/gemma-4-e2b-it-OptiQ-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use mlx-community/gemma-4-e2b-it-OptiQ-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 "mlx-community/gemma-4-e2b-it-OptiQ-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/gemma-4-e2b-it-OptiQ-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/gemma-4-e2b-it-OptiQ-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use mlx-community/gemma-4-e2b-it-OptiQ-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 "mlx-community/gemma-4-e2b-it-OptiQ-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 mlx-community/gemma-4-e2b-it-OptiQ-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/gemma-4-e2b-it-OptiQ-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 "mlx-community/gemma-4-e2b-it-OptiQ-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 "mlx-community/gemma-4-e2b-it-OptiQ-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"
Commit History
9 days ago
-
Move the vision sidecar to the repo root and add the processor files (LM Studio flattens optiq/; mlx-vlm, oMLX and LM Studio load it from the root)
Verified signature977e9a6
-
Point base_model at the upstream model and mark this repo as a quantization
Verified signatureffcf5c0
-
Sync chat template from google/gemma-4-e4b-it (Google canonical, published 2026-07-09)
Verified signatureFixes vs the previous template: - null argument values rendered as Python `None` instead of `null` - OpenAI-wire `image_url` / `input_audio` content parts were dropped - consecutive assistant messages closed the turn then continued without reopening it - `reasoning` without `tool_calls` was dropped entirely - an empty `messages` list raised UndefinedError - the thought channel was not opened after a tool response when thinking was enabled Tool-call `arguments` must now be a mapping, per upstream. OptiQ normalizes this in the serving layer (optiq.runtime.tool_args); clients calling the template directly should deserialize arguments first.0f3495e
-
index: register the bf16 vision tower so stock VLM loaders (mlx-vlm, oMLX, LM Studio) can find it
Verified signature9e4a814 -
Correct BFCL + Capability: the AST checker could not match array-typed arguments
Verified signature5976480 -
Correct BFCL + Capability: the AST checker could not match array-typed arguments
Verified signaturefc9e087
-
Move OptiQ sidecars under optiq/ so *.safetensors loaders (mlx-vlm, LM Studio) skip them
Verified signaturef8a9740
-
fix: audio_tower conv weights to MLX channel-last layout (full-VLM loader compat)
Verified signaturec4e1ff6
-
docs: OptiQ brand spelling
Verified signature01e7120
-
card: remove em-dashes, ensure funnel
Verified signature783acd4 -
card: add mlx-optiq funnel banner + CTA
Verified signaturebf59eb5
-
Restore vision_config + optiq_vision marker for image input
Verified signature67a3510 -
Add OptIQ vision sidecar (image+text support, v0.2.0)
Verified signature0cc9c65
-
Add kv_config.json (per-layer mixed-precision KV cache, 5.0 BPW target from OptiQ kv-cache sensitivity analysis). Requires optiq>=0.1.3 runtime for the RotatingQuantizedKVCache shim.
Verified signatureea98602
-
v0.1.0: 6-metric Capability Score + OptIQ vs U4 deltas
Verified signatureb6bf820
-
weights re-quant for mlx-lm 0.31 KV-shared Gemma-4 arch: optiq_metadata.json
Verified signature78038ba -
weights re-quant for mlx-lm 0.31 KV-shared Gemma-4 arch: config.json
Verified signature175ca16 -
weights re-quant for mlx-lm 0.31 KV-shared Gemma-4 arch: model.safetensors.index.json
Verified signature68c3e4f -
weights re-quant for mlx-lm 0.31 KV-shared Gemma-4 arch: model.safetensors
Verified signature027c711
-
Fix chat template: emit multimodal placeholders in tool messages
Verified signatureMirrors the upstream google/gemma-4-*-it commit fcf2302 - adds emission of <|image|>, <|audio|>, and <|video|> placeholders for tool-message content parts so multimodal tool responses are not silently dropped.3ff3b74
-
card: link blog post for calibration mix instead of bare optiq.jsonl reference
Verified signature789c018
-
card: drop loose IFEval row, keep strict only
Verified signaturef22677b
-
refresh model card: drop release-specific section, simpler benchmark heading
Verified signature0850913
-
v0.1.0: re-quantize at 4-bit mixed-precision · refreshed Tier-2 results
Verified signature58b0b84
-
Update Article link to https://x.com/latent_node/status/2028412948167942334
Verified signaturec64e28e -
Normalize model card: remove twitter ref, lowercase 'optiq', add multimodal stripping note
Verified signature1b900c0
-
Clean codelion/source refs from model card
Verified signature9bb24aa -
v0.0.9: fix quant weight round-trip (eager-eval), route to gemma4_text, updated model card
Verified signatureff0739c -
Strip vision/audio metadata (text-only OptIQ variant cleanup)
Verified signaturead6e6e4
-
Upload folder using huggingface_hub
Verified signaturebf932ef -
initial commit
Verified signature52392b0