CoolFace
Modelpublic

SirSahOl/SmolLM2-135M-Instruct-chat-mlx-16bit

sourceHugging Faceapache-2.0updated 3d agoView on Hugging Face
0likes501downloads
Model Card

SmolLM2-135M-Instruct-mlx-16bit

16-bit MLX conversion of HuggingFaceTB/SmolLM2-135M-Instruct optimized for Apple Silicon native GPU inference.

Converted by: SirSahOl Source Model: HuggingFaceTB/SmolLM2-135M-Instruct Framework: MLX by Apple Quantization: 16-bit (Average 16.00 (unquantized bfloat16) bits per weight) Format: safetensors License: apache-2.0


Model Details

  • —Architecture: LlamaForCausalLM
  • —Parameters: 135M
  • —Context Length: 8,192 tokens
  • —Format: MLX (Apple Silicon native GPU format)
  • —Quantization: 16-bit (Average 16.00 (unquantized bfloat16) bits per weight)
  • —Active VRAM Footprint: ~410 MB (Minimum recommended: 8 GB Unified Memory)

Quick Start

Installation

bash
pip install mlx-lm

Usage

CLI
bash
# Chat interactively
mlx_lm.chat --model SirSahOl/SmolLM2-135M-Instruct-chat-mlx-16bit

# Generate text
mlx_lm.generate --model SirSahOl/SmolLM2-135M-Instruct-chat-mlx-16bit --prompt "Write a short poem about artificial intelligence."
Python API (with Chat Template)
python
from mlx_lm import load, generate

model, tokenizer = load("SirSahOl/SmolLM2-135M-Instruct-chat-mlx-16bit")

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)

Performance Benchmarks

Measured Benchmarks (Apple M1)

Metric4-bit8-bit16-bit
Tokens/sec252.81229.82146.1
TTFT3.96 ms4.35 ms6.84 ms
Peak Memory152.0 MB204.8 MB240.0 MB
Benchmarked on Apple M1 with 8GB unified memory. Average over 5 runs with 256 max tokens.

Multi-Quantization Comparison

Evaluate your hardware budget and choose the optimal precision:

VariantDisk SizeVRAM FootprintTarget Apple Silicon HardwareKey Advantage
[4-bit MLX](https://huggingface.co/SirSahOl/SmolLM2-135M-Instruct-chat-mlx-4bit)~84 MB~124 MBM1 / M2 / M3 / M4 (8GB+ Unified Memory)Ultra-compact footprint, maximum generation speed; negligible memory pressure.
[8-bit MLX](https://huggingface.co/SirSahOl/SmolLM2-135M-Instruct-chat-mlx-8bit)~157 MB~202 MBM1 / M2 / M3 / M4 (8GB+ Unified Memory)Near-lossless precision with an extremely lightweight footprint.
16-bit MLX (This Repository)~290 MB~360 MBM1 / M2 / M3 / M4 (8GB+ Unified Memory)Full unquantized precision; zero perplexity penalty for reference evaluation.

Who Should Use This?

Your HardwareRecommended 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:

  • —Use 4-bit if you want to run this model alongside IDEs, browsers, and background development tools.
  • —Use 8-bit if you have 16GB+ unified memory and require superior reasoning and code accuracy.
  • —Use 16-bit for research, benchmarking, evaluation, or high-end workstation deployments.

Other Quantization Variants


LM Studio & Local Inference Setup Guide

To prevent runaway loops and ensure correct conversational turn-taking, configure custom stop tokens in your local inference runtime:

  1. 1.<|im_start|>
  2. 2.<|im_end|>
  3. 3.<|endoftext|>

Prompt Template Formatting

  • —System Prefix: <|im_start|>system\n
  • —System Suffix: <|im_end|>\n
  • —User Prefix: <|im_start|>user\n
  • —Assistant Suffix: <|im_end|>\n<|im_start|>assistant\n

Ollama Quickstart

dockerfile
FROM SirSahOl/SmolLM2-135M-Instruct-chat-mlx-16bit
PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"
PARAMETER stop "<|endoftext|>"
PARAMETER temperature 0.7
bash
ollama create smollm2-135m-instruct-chat-mlx-16bit -f Modelfile
ollama run smollm2-135m-instruct-chat-mlx-16bit

Conversion Details

PropertyValue
Source ModelHuggingFaceTB/SmolLM2-135M-Instruct
Quantization16-bit
mlx-lm Version0.31.3
Conversion Time1.55s
Output Size260.0 MB
Date2026-09-22T03:03:00.023160+00:00

Reproduction

To reproduce this conversion:

bash
pip install mlx-lm==0.31.3
python3 -m mlx_lm.convert --hf-path /Users/z4/.cache/huggingface/hub/models--HuggingFaceTB--SmolLM2-135M-Instruct/snapshots/12fd25f77366fa6b3b4b768ec3050bf629380bac --mlx-path output/SmolLM2-135M-Instruct-mlx-16bit

Limitations & Known Issues

  • —4-bit group-wise quantization introduces minor precision loss compared to unquantized weights; for deep mathematical derivations or precision-critical reasoning, test the 8-bit or 16-bit variants.
  • —High context sequences (>32K tokens) require sufficient unified memory headroom; ensure unified memory is not overcommitted.
  • —This is a weight-only MLX conversion designed specifically for Apple Silicon GPUs (M1/M2/M3/M4 series).

License

This model conversion inherits the license of the source model: apache-2.0.

See the original model card for full license details.


Changelog

VersionDateChanges
v1.02026-09-22Initial conversion

Converted with [MLX Foundry](https://github.com/SirSahOl/mlx-foundry) — a professional pipeline for converting models to Apple MLX format.