viperdevAI's picture
Viperfish Sunlight 1.5B (MLX 4-bit)
d8218dc verified
|
Raw History Blame Contribute Delete
2.88 kB
---
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).