Text Generation
MLX
Safetensors
English
qwen2
swift
swiftui
code
lora
conversational
4-bit precision
Instructions to use viperdevAI/Viperfish-Sunlight-1.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use viperdevAI/Viperfish-Sunlight-1.5B 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("viperdevAI/Viperfish-Sunlight-1.5B") 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) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use viperdevAI/Viperfish-Sunlight-1.5B with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "viperdevAI/Viperfish-Sunlight-1.5B"
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": "viperdevAI/Viperfish-Sunlight-1.5B" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use viperdevAI/Viperfish-Sunlight-1.5B with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "viperdevAI/Viperfish-Sunlight-1.5B"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "viperdevAI/Viperfish-Sunlight-1.5B" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "viperdevAI/Viperfish-Sunlight-1.5B", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use viperdevAI/Viperfish-Sunlight-1.5B 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 "viperdevAI/Viperfish-Sunlight-1.5B"
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 viperdevAI/Viperfish-Sunlight-1.5B
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use viperdevAI/Viperfish-Sunlight-1.5B with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "viperdevAI/Viperfish-Sunlight-1.5B"
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 "viperdevAI/Viperfish-Sunlight-1.5B" \ --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"
File size: 2,877 Bytes
d8218dc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | ---
license: apache-2.0
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
library_name: mlx
pipeline_tag: text-generation
language:
- en
tags:
- mlx
- swift
- swiftui
- code
- lora
---
# Viperfish Sunlight 1.5B
Sunlight is the smallest model in the Viperfish family of open-weight models. It is a Swift / SwiftUI-focused fine-tune of Qwen2.5-Coder-1.5B-Instruct, small enough to run on an 8 GB Mac.
**This repo is the MLX 4-bit build** (about 840 MB): the LoRA adapter fused into the 4-bit base. It runs with [mlx-lm](https://github.com/ml-explore/mlx-lm) on Apple Silicon.
## Quick start
```bash
pip install mlx-lm
```
```python
from mlx_lm import load, generate
model, tokenizer = load("viperdevAI/Viperfish-Sunlight-1.5B")
messages = [{"role": "user", "content": "Write a SwiftUI view with a counter and an increment button."}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
print(generate(model, tokenizer, prompt=prompt, max_tokens=512))
```
## Details
- **Base model:** [Qwen/Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) (Apache-2.0), 4-bit MLX quantization. All credit for the base model goes to the Qwen team.
- **Method:** LoRA (rank 8, scale 20, 16 layers), 6,164 steps at batch size 1, sequence length 1024, learning rate 5e-5 with cosine decay.
- **Training data:** 6,164 Swift / SwiftUI source files from [The Stack v1 (dedup)](https://huggingface.co/datasets/bigcode/the-stack). The dataset is not redistributed here; upstream licenses apply to the original files.
- **License:** Apache-2.0.
## Results
Compared with the base model on my own benchmarks. Swift answers are scored by whether the generated code compiles with `swiftc`; HumanEval is the standard Python benchmark.
| Model | SwiftUI (60 prompts) | Plain Swift (33 prompts) | HumanEval (164) |
|---|---|---|---|
| Qwen2.5-Coder-1.5B-Instruct (4-bit) | 16 | 13 | 67.7% (111) |
| **Viperfish Sunlight 1.5B** | **31** | **14** | 56.1% (92) |
SwiftUI roughly doubles. Plain Swift barely moves. **Python gets worse.**
## Limitations
- **Python regression:** HumanEval drops from 67.7% to 56.1%. If you want a general-purpose coding model, use the base model; Sunlight trades general ability for SwiftUI.
- **Training data was raw source code, not chat.** The model often stops without closing its final code fence, and long answers may run on.
- It is a 1.5B model: expect mistakes, invented APIs and outdated SwiftUI idioms. Always compile and review generated code.
- Trained only on Swift / SwiftUI; it may not generalize to other languages.
- The benchmark prompt sets are my own and small; treat the numbers as indicative, not definitive.
## The Viperfish family
Sunlight 1.5B, Twilight 3B, Midnight 7B and Hadal 14B, named after the ocean's depth zones. More at [viperfish.dev](https://viperfish.dev).
|