Instructions to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit 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("SirSahOl/K2-Horizon-7B-chat-mlx-4bit") 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) - Transformers
How to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SirSahOl/K2-Horizon-7B-chat-mlx-4bit", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("SirSahOl/K2-Horizon-7B-chat-mlx-4bit", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SirSahOl/K2-Horizon-7B-chat-mlx-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SirSahOl/K2-Horizon-7B-chat-mlx-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SirSahOl/K2-Horizon-7B-chat-mlx-4bit
- SGLang
How to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "SirSahOl/K2-Horizon-7B-chat-mlx-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SirSahOl/K2-Horizon-7B-chat-mlx-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "SirSahOl/K2-Horizon-7B-chat-mlx-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SirSahOl/K2-Horizon-7B-chat-mlx-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Pi
How to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "SirSahOl/K2-Horizon-7B-chat-mlx-4bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "SirSahOl/K2-Horizon-7B-chat-mlx-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "SirSahOl/K2-Horizon-7B-chat-mlx-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "SirSahOl/K2-Horizon-7B-chat-mlx-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SirSahOl/K2-Horizon-7B-chat-mlx-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit with Docker Model Runner:
docker model run hf.co/SirSahOl/K2-Horizon-7B-chat-mlx-4bit
- Hermes Agent
How to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit 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 "SirSahOl/K2-Horizon-7B-chat-mlx-4bit"
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 SirSahOl/K2-Horizon-7B-chat-mlx-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use SirSahOl/K2-Horizon-7B-chat-mlx-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "SirSahOl/K2-Horizon-7B-chat-mlx-4bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "SirSahOl/K2-Horizon-7B-chat-mlx-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
K2-Horizon-7B-mlx-4bit
4-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: 4-bit (Average 4.50 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: 4-bit (Average 4.50 bits per weight)
- Active VRAM Footprint: ~4.2 GB (Minimum recommended: 8 GB Unified Memory)
Quick Start
Installation
pip install mlx-lm
CLI Usage
# Chat interactively
mlx_lm.chat --model SirSahOl/K2-Horizon-7B-chat-mlx-4bit
# Generate text
mlx_lm.generate --model SirSahOl/K2-Horizon-7B-chat-mlx-4bit --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-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)
Performance Benchmarks
Apple Silicon Hardware Sizing Matrix
Estimated decoding throughput, time-to-first-token (TTFT), and active unified memory footprint across Apple Silicon tiers:
| Apple Silicon Tier | Unified Memory | Active VRAM | Estimated Speed | Est. TTFT | Recommended Use Case |
|---|---|---|---|---|---|
| M1 / M2 / M3 / M4 (Base) | 8 GB – 16 GB | ~4.2 GB | ~35 tokens/sec | ~110 ms | Fast everyday local assistant, coding sidecar, single-agent interactions |
| M1 / M2 / M3 / M4 Pro | 18 GB – 36 GB | ~4.2 GB | ~52 tokens/sec | ~75 ms | High-throughput agentic workflows, complex tool use, long contexts |
| M1 / M2 / M3 / M4 Max | 36 GB – 128 GB | ~4.2 GB | ~75 tokens/sec | ~45 ms | Ultra-low-latency generation, parallel multi-turn evaluation, RAG pipelines |
| M1 / M2 / M3 Ultra | 64 GB – 192 GB | ~4.2 GB | ~105 tokens/sec | ~30 ms | Enterprise local serving, multi-user concurrency, batch document synthesis |
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:
| Variant | Disk Size | VRAM Footprint | Target Apple Silicon Hardware | Key Advantage |
|---|---|---|---|---|
| 4-bit MLX (This Repository) | ~4.3 GB | ~4.2 GB | M1 / M2 / M3 / M4 (8GB+ Unified Memory) | Maximum generation speed, lowest memory pressure; ideal for multitasking and everyday local chat alongside IDEs. |
| 8-bit MLX | ~8.1 GB | ~7.8 GB | M1 / M2 / M3 / M4 Pro/Max (16GB+ Unified Memory) | Near-lossless precision, high-fidelity reasoning, and stable complex instruction following. |
| 16-bit MLX | ~15.2 GB | ~15.2 GB | M2 / M3 / M4 Max/Ultra (32GB+ Unified Memory) | Full unquantized bfloat16 precision; zero perplexity loss, ideal for evaluation and reference output. |
Who Should Use This?
| 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:
- 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
| Variant | Link |
|---|---|
| 4-bit | SirSahOl/K2-Horizon-7B-chat-mlx-4bit |
| 8-bit | SirSahOl/K2-Horizon-7B-chat-mlx-8bit |
| 16-bit | SirSahOl/K2-Horizon-7B-chat-mlx-16bit |
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-4bit, and select "ChatML" from the Prompt Template dropdown.
Option B: Manual LM Studio Configuration
- Load SirSahOl/K2-Horizon-7B-chat-mlx-4bit 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
- Stop Strings (antiprompt / stopStrings): Add
Option C: Ollama Modelfile Setup
Create a Modelfile to run this model in Ollama:
FROM SirSahOl/K2-Horizon-7B-chat-mlx-4bit
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-4bit -f Modelfile
ollama run k2-horizon-7b-chat-mlx-4bit
Conversion Details
| Property | Value |
|---|---|
| Source Model | IFM/K2-Horizon-7B |
| Quantization | 4-bit |
| mlx-lm Version | 0.31.3 |
| Conversion Time | 100.04s |
| Output Size | 4.7 GB |
| Date | 2026-09-15T00:19:59.940301+00:00 |
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-4bit -q --q-bits 4
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
| Version | Date | Changes |
|---|---|---|
| v1.0 | 2026-09-15 | Initial conversion |
Converted with MLX Foundry — a professional pipeline for converting models to Apple MLX format.
- Downloads last month
- -
4-bit
Model tree for SirSahOl/K2-Horizon-7B-chat-mlx-4bit
Base model
IFM/K2-Horizon-7B