Instructions to use inferencerlabs/gemma-4-31B-MLX-9bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use inferencerlabs/gemma-4-31B-MLX-9bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("inferencerlabs/gemma-4-31B-MLX-9bit") config = load_config("inferencerlabs/gemma-4-31B-MLX-9bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- LM Studio
- Pi new
How to use inferencerlabs/gemma-4-31B-MLX-9bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "inferencerlabs/gemma-4-31B-MLX-9bit"
Configure the model in Pi
# 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": "inferencerlabs/gemma-4-31B-MLX-9bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use inferencerlabs/gemma-4-31B-MLX-9bit 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 "inferencerlabs/gemma-4-31B-MLX-9bit"
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 inferencerlabs/gemma-4-31B-MLX-9bit
Run Hermes
hermes
See gemma-4-31B-30b MLX in action - demonstration video
Tested on a M3 Ultra 512GB RAM using Inferencer app v1.10.10
- Single inference ~17.1 tokens/s @ 1000 tokens (measured in debug mode)
- Vision inference ~ tokens/s (available from v1.11.0)
- Batched inference ~ total tokens/s across five inferences
- Memory usage: ~33.1 GiB
9bpw quant typically achieves near lossless accuracy in our coding test
| Quantization (bpw) | Perplexity | Token Accuracy | Missed Divergence |
|---|---|---|---|
| q4.5 | 1.32812 | 90.5% | 26.44% |
| q5.5 | 1.23437 | 95.4% | 16.03% |
| q6.5 | 1.21875 | 96.85% | 12.55% |
| q8.5 | 1.21875 | 97.65% | 9.92% |
| q9 | 1.21093 | 97.95% | 9.61% |
| Base | 1.20312 | 100.0% | 0.000% |
- Perplexity: Measures the confidence for predicting base tokens (lower is better)
- Token Accuracy: The percentage of correctly generated base tokens
- Missed Divergence: Measures severity of misses; how much the token was missed by
Quantized with a modified version of MLX
For more details see demonstration video or visit google/gemma-4-31B-it.
Disclaimer
We are not the creator, originator, or owner of any model listed. Each model is created and provided by third parties. Models may not always be accurate or contextually appropriate. You are responsible for verifying the information before making important decisions. We are not liable for any damages, losses, or issues arising from its use, including data loss or inaccuracies in AI-generated content.
- Downloads last month
- 908
Model size
10B params
Tensor type
BF16
·
U32 ·
Hardware compatibility
Log In to add your hardware
8-bit