Text Generation
MLX
Safetensors
English
qwen3
distill
distill-mini
cli
code
compression
qwen
expert-model
domain-specific
task-specialized
lora
qlora
conversational
4-bit precision
Instructions to use samuelfaj/distill2-0.6B-4bit-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use samuelfaj/distill2-0.6B-4bit-MLX 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("samuelfaj/distill2-0.6B-4bit-MLX") 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
- LM Studio
- Pi new
How to use samuelfaj/distill2-0.6B-4bit-MLX with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "samuelfaj/distill2-0.6B-4bit-MLX"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "samuelfaj/distill2-0.6B-4bit-MLX" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use samuelfaj/distill2-0.6B-4bit-MLX 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 "samuelfaj/distill2-0.6B-4bit-MLX"
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 samuelfaj/distill2-0.6B-4bit-MLX
Run Hermes
hermes
- MLX LM
How to use samuelfaj/distill2-0.6B-4bit-MLX with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "samuelfaj/distill2-0.6B-4bit-MLX"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "samuelfaj/distill2-0.6B-4bit-MLX" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "samuelfaj/distill2-0.6B-4bit-MLX", "messages": [ {"role": "user", "content": "Hello"} ] }'
File size: 4,368 Bytes
34d1618 3f24bde 34d1618 3f24bde 34d1618 3f24bde 34d1618 3f24bde | 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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | ---
license: apache-2.0
language:
- en
tags:
- mlx
- distill
- distill-mini
- cli
- code
- compression
- qwen
- qwen3
- expert-model
- domain-specific
- task-specialized
- lora
- qlora
pipeline_tag: text-generation
base_model: Qwen/Qwen3-0.6B
---
# distill2-0.6B — Expert Language Model for CLI Output (Mini)
**distill2-0.6B** is the second-generation **domain-specific Expert Language Model** for CLI output compression and classification. At just 0.6B parameters, it matches or exceeds the accuracy of its 1.7B predecessor while being 2.8x smaller and 20x faster at inference.
Built for the **[distill](https://github.com/samuelfaj/distill)** engine — an open-source CLI output compression tool.
## What is distill?
[distill](https://github.com/samuelfaj/distill) is a tool that takes arbitrary command-line output and reduces it to only what matters. Instead of scrolling through 500 lines of `npm install` logs, you get:
```
PASS
24 packages installed, 0 vulnerabilities
```
Instead of parsing a wall of Terraform plan output, you get:
```json
{"create": 3, "change": 12, "destroy": 0}
```
**distill2-0.6B is the brain behind distill** — it understands CLI output and knows what's signal vs noise.
## distill2 vs distill1
| Trait | distill-1.7B (v1) | distill2-0.6B (v2) |
|-------|-------------------|---------------------|
| **Size** | 1.7B params | 0.6B params (2.8x smaller) |
| **Accuracy** | 95.0% | **98.4%** |
| **Inference speed** | 8.2s/sample | **0.47s/sample** (17x faster) |
| **Training loss** | Val 0.12 | **Val 0.016** |
| **Training** | LoRA fp16 | **QLoRA 4-bit** |
| **Memory (train)** | 29.5 GB | 10.7 GB (2.8x lower) |
## 8 Specialized Tasks
| Task | What it does | Accuracy |
|------|-------------|----------|
| `pass_fail` | Did the command succeed or fail? | 100.0% |
| `safe_review` | Is this Terraform plan safe? | 100.0% |
| `json_extraction` | Pull JSON from noisy logs | 100.0% |
| `test_result` | Test suite pass/fail? | 100.0% |
| `typescript_check` | Extract TS compiler errors | 100.0% |
| `terraform_plan` | Count resources created/changed/destroyed | 98.4% |
| `security_audit` | Count vulns by severity | 96.6% |
| `generic` | Free-form summary of any CLI output | 93.1% |
## Performance
| Metric | Value |
|--------|-------|
| Overall accuracy | **98.4%** |
| Tasks at 100% | 5 of 8 |
| Tasks ≥95% | 7 of 8 |
| Base model | Qwen3-0.6B |
| Training | QLoRA 4-bit, rank 32, all layers |
| Iterations | 6,000 |
| Dataset | 100k synthetic CLI outputs |
| Training hardware | Apple Silicon (M-series) |
| Peak GPU memory | 10.7 GB |
## Available Formats
| Repo | Format | Size | Platform |
|------|--------|------|----------|
| **distill2-0.6B-4bit-MLX** | MLX 4-bit + QLoRA adapter | 404 MB | macOS (Apple Silicon) |
| [distill2-0.6B-4bit-GGUF](https://huggingface.co/samuelfaj/distill2-0.6B-4bit-GGUF) | GGUF Q4_K_M + fp16 | 378 MB / 1.2 GB | Cross-platform |
## Usage (MLX)
```python
from mlx_lm import load, generate
# Load base 4-bit model + QLoRA adapter together
model, tokenizer = load(
"samuelfaj/distill2-0.6B-4bit-MLX",
adapter_path="samuelfaj/distill2-0.6B-4bit-MLX"
)
messages = [
{"role": "system", "content": "You compress shell or command output for another model..."},
{"role": "user", "content": "Command output:\nnpm test\n4 tests passed, 0 failed"}
]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
result = generate(model, tokenizer, prompt=prompt, max_tokens=256)
print(result)
```
## Usage (MLX server)
```bash
mlx_lm.server \
--model samuelfaj/distill2-0.6B-4bit-MLX \
--adapter-path samuelfaj/distill2-0.6B-4bit-MLX
```
## Why QLoRA?
Unlike post-hoc quantization (which drops JSON extraction accuracy from 100% → 84.8%), QLoRA trains directly on the 4-bit quantized base model. The LoRA adapter learns to compensate for quantization artifacts, preserving full accuracy across all tasks.
| Method | Accuracy | JSON | Size |
|--------|----------|------|------|
| LoRA fp16 + post-hoc 4-bit | 97.2% | 84.8% | 384 MB |
| **QLoRA 4-bit (this model)** | **98.0%** | **100%** | **404 MB** |
## Project
This model powers [distill](https://github.com/samuelfaj/distill) — a CLI output compression engine.
[Full Distill Collection](https://huggingface.co/collections/samuelfaj/distill-6a0606f9b131c289025659fc)
|