Gemma-4-31B-it MLX
Collection
MLX (Apple Silicon) quantizations of google/gemma-4-31B-it: 4/5/6/8-bit. Text-only. • 4 items • Updated
How to use pipenetwork/Gemma-4-31B-it-MLX-6bit 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("pipenetwork/Gemma-4-31B-it-MLX-6bit")
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)How to use pipenetwork/Gemma-4-31B-it-MLX-6bit with Pi:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "pipenetwork/Gemma-4-31B-it-MLX-6bit"
# Install Pi:
npm install -g @mariozechner/pi-coding-agent
# Add to ~/.pi/agent/models.json:
{
"providers": {
"mlx-lm": {
"baseUrl": "http://localhost:8080/v1",
"api": "openai-completions",
"apiKey": "none",
"models": [
{
"id": "pipenetwork/Gemma-4-31B-it-MLX-6bit"
}
]
}
}
}# Start Pi in your project directory: pi
How to use pipenetwork/Gemma-4-31B-it-MLX-6bit with Hermes Agent:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "pipenetwork/Gemma-4-31B-it-MLX-6bit"
# 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 pipenetwork/Gemma-4-31B-it-MLX-6bit
hermes
How to use pipenetwork/Gemma-4-31B-it-MLX-6bit with MLX LM:
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "pipenetwork/Gemma-4-31B-it-MLX-6bit"
# Install MLX LM
uv tool install mlx-lm
# Start the server
mlx_lm.server --model "pipenetwork/Gemma-4-31B-it-MLX-6bit"
# Calling the OpenAI-compatible server with curl
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "pipenetwork/Gemma-4-31B-it-MLX-6bit",
"messages": [
{"role": "user", "content": "Hello"}
]
}'MLX (Apple Silicon) conversion of google/gemma-4-31B-it, quantized to 6-bit · high quality.
Text-only build of the Gemma-4 31B backbone (the multimodal vision components are not included).
Part of the Gemma-4-31B-it MLX collection.
| Variant | Notes |
|---|---|
| 8-bit | 8-bit · near-lossless |
| 6-bit (this repo) | 6-bit · high quality |
| 5-bit | 5-bit |
| 4-bit | 4-bit · balanced default |
pip install mlx-lm
python -m mlx_lm generate --model pipenetwork/Gemma-4-31B-it-MLX-6bit --prompt "Explain attention in transformers." -m 256
Smoke-tested locally: loads and generates coherent text.
Apache 2.0 (inherited from the base model). Quantization config: {"group_size": 64, "bits": 6, "mode": "affine"}.
6-bit