4-bit MLX conversion of facebook/opt-125m optimized for Apple Silicon native GPU inference.
Converted by: SirSahOl
Source Model: facebook/opt-125m
Framework: MLX by Apple
Quantization: 4-bit (Average 4.50 bits per weight)
Format: safetensors
License: other
pip install mlx-lm# Chat interactively
mlx_lm.chat --model SirSahOl/opt-125m-chat-mlx-4bit
# Generate text
mlx_lm.generate --model SirSahOl/opt-125m-chat-mlx-4bit --prompt "Write a short poem about artificial intelligence."from mlx_lm import load, generate
model, tokenizer = load("SirSahOl/opt-125m-chat-mlx-4bit")
messages = [
{"role": "user", "content": "Explain quantum superposition in simple terms."}
]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
response = generate(model, tokenizer, prompt=prompt, verbose=True)
print(response)| Metric | 4-bit | 8-bit | 16-bit |
|---|---|---|---|
| Tokens/sec | 360.69 | 264.13 | 60.9 |
| TTFT | 2.79 ms | 3.8 ms | 16.44 ms |
| Peak Memory | 234.4 MB | 335.8 MB | 316.7 MB |
Benchmarked on Apple M1 with 8GB unified memory. Average over 5 runs with 256 max tokens.
Evaluate your hardware budget and choose the optimal precision:
| Variant | Disk Size | VRAM Footprint | Target Apple Silicon Hardware | Key Advantage |
|---|---|---|---|---|
| 4-bit MLX (This Repository) | ~79 MB | ~119 MB | M1 / M2 / M3 / M4 (8GB+ Unified Memory) | Ultra-compact footprint, maximum generation speed; negligible memory pressure. |
| 8-bit MLX | ~146 MB | ~191 MB | M1 / M2 / M3 / M4 (8GB+ Unified Memory) | Near-lossless precision with an extremely lightweight footprint. |
| 16-bit MLX | ~270 MB | ~340 MB | M1 / M2 / M3 / M4 (8GB+ Unified Memory) | Full unquantized precision; zero perplexity penalty for reference evaluation. |
| Your Hardware | Recommended Quantization |
|---|---|
| M1/M2/M3/M4 (8GB – 16GB) | 4-bit — Best balance of speed, low memory, and multitasking capability |
| M1/M2/M3/M4 Pro/Max (18GB – 36GB) | 8-bit — Higher quality reasoning with comfortable memory headroom |
| M1/M2/M3/M4 Max/Ultra (36GB – 192GB) | 16-bit — Unquantized full precision, zero quality degradation |
General guidance:
| Variant | Link |
|---|---|
| 4-bit | SirSahOl/opt-125m-chat-mlx-4bit |
| 8-bit | SirSahOl/opt-125m-chat-mlx-8bit |
| 16-bit | SirSahOl/opt-125m-chat-mlx-16bit |
To prevent runaway loops and ensure correct conversational turn-taking, configure custom stop tokens in your local inference runtime:
<|im_start|><|im_end|><|endoftext|><|im_start|>system\n<|im_end|>\n<|im_start|>user\n<|im_end|>\n<|im_start|>assistant\nFROM SirSahOl/opt-125m-chat-mlx-4bit
PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"
PARAMETER stop "<|endoftext|>"
PARAMETER temperature 0.7ollama create opt-125m-chat-mlx-4bit -f Modelfile
ollama run opt-125m-chat-mlx-4bitThis model conversion inherits the license of the source model: other.
See the original model card for full license details.
| Version | Date | Changes |
|---|---|---|
| v1.0 | N/A | Initial conversion |
Converted with MLX Foundry — a professional pipeline for converting models to Apple MLX format.