SirSahOl/K2-Horizon-7B-chat-mlx-16bit
K2-Horizon-7B-mlx-16bit
16-bit MLX conversion of IFM/K2-Horizon-7B optimized for Apple Silicon native GPU inference.
Converted by: SirSahOl Source Model: IFM/K2-Horizon-7B Framework: MLX by Apple Quantization: 16-bit (Average 16.00 (unquantized bfloat16) bits per weight) Format: safetensors License: apache-2.0
Model Details
- Architecture: K2HorizonForCausalLM
- Parameters: 7B
- Context Length: 524,288 tokens
- Format: MLX (Apple Silicon native GPU format)
- Quantization: 16-bit (Average 16.00 (unquantized bfloat16) bits per weight)
- Active VRAM Footprint: ~15.2 GB (Minimum recommended: 24 GB – 32 GB Unified Memory)
Quick Start
Installation
pip install mlx-lmCLI Usage
# Chat interactively
mlx_lm.chat --model SirSahOl/K2-Horizon-7B-chat-mlx-16bit
# Generate text
mlx_lm.generate --model SirSahOl/K2-Horizon-7B-chat-mlx-16bit --prompt "Write a short poem about artificial intelligence."Python API (with Chat Template)
from mlx_lm import load, generate
model, tokenizer = load("SirSahOl/K2-Horizon-7B-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
Apple Silicon Hardware Sizing Matrix
Estimated decoding throughput, time-to-first-token (TTFT), and active unified memory footprint across Apple Silicon tiers:
Estimates based on Apple Silicon unified memory bandwidth and active parameter footprint. Real-world speeds may vary with context length.
Multi-Quantization Comparison
Evaluate your hardware budget and choose the optimal precision:
Who Should Use This?
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 strings in your local inference runtime.
Custom Stop Strings Configuration
Ensure the following sequence tokens are configured as strict stop boundaries:
<|im_start|><|im_end|><|endoftext|>
Option A: Automatic Preset (Recommended for LM Studio)
Create a custom prompt preset JSON file named ChatML.json in your LM Studio config directory:
- macOS / Linux:
~/.lmstudio/config-presets/ChatML.json - Windows:
%USERPROFILE%\.lmstudio\config-presets\ChatML.json
{
"name": "ChatML",
"inference_params": {
"pre_prompt": "You are a helpful, respectful, and honest assistant.",
"input_prefix": "<|im_start|>user\n",
"input_suffix": "<|im_end|>\n",
"pre_prompt_prefix": "<|im_start|>system\n",
"pre_prompt_suffix": "<|im_end|>\n",
"antiprompt": [
"<|im_start|>",
"<|im_end|>",
"<|endoftext|>"
],
"stopStrings": [
"<|im_start|>",
"<|im_end|>",
"<|endoftext|>"
],
"temperature": 0.7,
"max_tokens": 2048
}
}Restart LM Studio, load SirSahOl/K2-Horizon-7B-chat-mlx-16bit, and select "ChatML" from the Prompt Template dropdown.
Option B: Manual LM Studio Configuration
- Load SirSahOl/K2-Horizon-7B-chat-mlx-16bit in LM Studio.
- In the right-hand Advanced Configuration / Inference Parameters panel:
- Stop Strings (antiprompt / stopStrings): Add
<|im_start|>,<|im_end|>,<|endoftext|> - 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
Option C: Ollama Modelfile Setup
Create a Modelfile to run this model in Ollama:
FROM SirSahOl/K2-Horizon-7B-chat-mlx-16bit
PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"
PARAMETER stop "<|endoftext|>"
PARAMETER temperature 0.7
TEMPLATE """{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
"""Create and run with Ollama:
ollama create k2-horizon-7b-chat-mlx-16bit -f Modelfile
ollama run k2-horizon-7b-chat-mlx-16bitConversion Details
Reproduction
To reproduce this conversion:
pip install mlx-lm==0.31.3
python3 -m mlx_lm.convert --hf-path /root/.cache/huggingface/hub/models--IFM--K2-Horizon-7B/snapshots/ff325e226270e05ea081a97fd0c9c62652472fe8 --mlx-path output/K2-Horizon-7B-mlx-16bitLimitations & 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
Converted with [MLX Foundry](https://github.com/SirSahOl/mlx-foundry) — a professional pipeline for converting models to Apple MLX format.
