cagataydev commited on
Commit
24fcf66
·
verified ·
1 Parent(s): de32efa

card: loopl 0.8B v1 (mlx) — train/cards.py

Browse files
Files changed (1) hide show
  1. README.md +106 -18
README.md CHANGED
@@ -1,39 +1,127 @@
1
  ---
2
  base_model: cagataydev/loopl-0.8b
 
3
  library_name: mlx
4
- license: apache-2.0
5
  pipeline_tag: image-text-to-text
 
 
 
 
 
 
6
  tags:
7
  - loopl
8
- - sft
9
  - on-device
 
 
 
10
  - qwen3_5
 
11
  - mlx
12
  - vision
13
  - image-text-to-text
14
- language:
15
- - en
16
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
- # cagataydev/loopl-0.8b-4bit
 
 
19
 
20
- MLX 4-bit (group 64) export of [cagataydev/loopl-0.8b](https://huggingface.co/cagataydev/loopl-0.8b) made with
21
- **mlx-vlm 0.7.6** (`mlx_vlm.convert -q`), the same converter and tensor layout as the `mlx-community/Qwen3.5-*-4bit` bases
22
- the loopl app ships with. **Vision is preserved**: 153 `vision_tower.*` tensors of 847, `vision_config`,
23
- `preprocessor_config.json` / `video_preprocessor_config.json` — this model reads images like its base.
24
- Weights: 625 MB. Tokenizer files are normalised from the base so swift-transformers loads them
25
- (`tokenizer_class: Qwen2Tokenizer`, `chat_template.jinja` with tools).
26
 
27
- Trained with [loopl-train](https://github.com/cagataycali/loopl-train) — the language model is fine-tuned, the vision tower
28
- is the base's, frozen. The GGUF sibling (`-GGUF`) is text-only (llama.cpp's Qwen3.5 converter).
 
 
 
29
 
30
- ## Use with mlx-vlm
31
 
32
  ```bash
33
- pip install mlx-vlm
34
- mlx_vlm.generate --model cagataydev/loopl-0.8b-4bit --image photo.jpg --prompt "Describe this image." --max-tokens 100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  ```
36
 
37
- ## Use in loopl
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
- Models › Mine (sign in with your Hugging Face token) → download. Images attach in the composer.
 
1
  ---
2
  base_model: cagataydev/loopl-0.8b
3
+ base_model_relation: quantized
4
  library_name: mlx
 
5
  pipeline_tag: image-text-to-text
6
+ license: apache-2.0
7
+ language:
8
+ - en
9
+ - tr
10
+ datasets:
11
+ - cagataydev/loopl-train
12
  tags:
13
  - loopl
 
14
  - on-device
15
+ - agent
16
+ - tool-calling
17
+ - qwen3.5
18
  - qwen3_5
19
+ - sft
20
  - mlx
21
  - vision
22
  - image-text-to-text
23
+ - 4-bit
 
24
  ---
25
+ # loopl 0.8B · v1
26
+
27
+ **loopl** is a Swift SDK and a free iOS app for agents that run *on the phone*: a local model, a small honest agent loop
28
+ (model → tools → model until it answers; errors go back to the model, approvals pause the loop) and the iPhone's own
29
+ abilities as tools — vision, voice, transcription, translation, torch, haptics, deep links, memory, HTTP. Site:
30
+ [loopl.dev](https://loopl.dev) · app: [TestFlight](https://testflight.apple.com/join/uUNjfzW9) · code: [github.com/cagataycali/loopl](https://github.com/cagataycali/loopl)
31
+ · every loopl repo: [the collection](https://huggingface.co/collections/cagataydev/loopl-on-device-agents-swift-6ac51395b13a9c41d4932eaf).
32
+
33
+ **This model** is [Qwen/Qwen3.5-0.8B](https://huggingface.co/Qwen/Qwen3.5-0.8B) fully fine-tuned by Cagatay Cali
34
+ ([@cagataycali](https://github.com/cagataycali)) on [cagataydev/loopl-train](https://huggingface.co/datasets/cagataydev/loopl-train): how an agent loop
35
+ works and how loopl's runtime behaves, tool calling in both dialects loopl speaks (the model's native template and
36
+ loopl's JSON prompt), recovering from tool errors instead of repeating the call, who it is and who built it, and honesty
37
+ about what it does not know. The **vision tower is the base's, frozen and kept** — the MLX export reads images like
38
+ Qwen3.5 does.
39
+
40
+ > **This repo is the MLX 4-bit export (group 64)** the loopl app downloads — 625 MB, 153 `vision_tower.*` tensors of 847 so it reads images, same layout as [mlx-community/Qwen3.5-0.8B-4bit](https://huggingface.co/mlx-community/Qwen3.5-0.8B-4bit). bf16 weights: [cagataydev/loopl-0.8b](https://huggingface.co/cagataydev/loopl-0.8b).
41
+
42
+ ## Scores
43
+
44
+ | probe | this model | previous (v1) | base Qwen3.5 4-bit |
45
+ |---|---:|---:|---:|
46
+ | agent-SDK knowledge quiz (first 472 questions, exact-answer) | **59** | — | 50 |
47
+ | tool calls, native template dialect | **7/9** | — | 6/9 |
48
+ | tool calls, loopl JSON dialect | **7/9** | — | 2/9 |
49
+ | identity (5 classic probes, with system prompt) | **4/5** | — | 4/5 |
50
+
51
+ Scored by `train/eval.py` on the 4-bit MLX export (greedy). The quiz asks for exact file-level facts about an agent SDK's source — hard for every small model; the delta over base is the point. Tool probes count a well-formed call with the right arguments. `identity_nosys` is the one that matters in the app: the system prompt there is the user's to edit.
52
+
53
+ ## Use it today
54
 
55
+ **In the loopl app (iPhone).** Install from [TestFlight](https://testflight.apple.com/join/uUNjfzW9) → Settings › Hugging Face › sign in with a token that
56
+ can read this repo → Models › **Mine** → download. The app picks the MLX export, sees the vision tower and shows the photo
57
+ button; GGUF rows run on llama.cpp (text only). A public repo also appears under Models › Browse with no token.
58
 
59
+ **On a Mac with MLX** (vision included):
 
 
 
 
 
60
 
61
+ ```bash
62
+ pip install -U mlx-vlm
63
+ python -m mlx_vlm.generate --model cagataydev/loopl-0.8b-4bit \
64
+ --image photo.jpg --prompt "What is in this picture? Then tell me who built you." --max-tokens 200
65
+ ```
66
 
67
+ **With llama.cpp** (text only — the GGUF has no vision encoder):
68
 
69
  ```bash
70
+ llama-cli -hf cagataydev/loopl-0.8b-GGUF:loopl-0.8b-Q4_K_M.gguf -p "Who built you, and what is 23 × 47?"
71
+ ```
72
+
73
+ **From Swift with the loopl SDK** (`https://github.com/cagataycali/loopl`, products `Loopl` + `LooplRuntimes`):
74
+
75
+ ```swift
76
+ import Loopl
77
+ import LooplRuntimes
78
+
79
+ let model = MLXModel() // or GGUFModel() for the -GGUF repo
80
+ try await model.load(spec, from: weightsDirectory) { _ in } // spec: the ModelSpec for cagataydev/loopl-0.8b-4bit; weights: the downloaded folder
81
+
82
+ let agent = Agent(model: model, tools: AppleTools.available)
83
+ for try await event in agent.stream("Torch on, then remember that I parked on level 3.") {
84
+ if case .text(let chunk) = event { print(chunk, terminator: "") }
85
+ }
86
  ```
87
 
88
+ The bf16 weights (`cagataydev/loopl-0.8b`) load with `transformers` ≥ 5 as `Qwen3_5ForConditionalGeneration`; export your own
89
+ quantisation with `mlx_vlm.convert -q` (keeps vision) — `mlx_lm.convert` silently drops the tower.
90
+
91
+ ## Recipe
92
+
93
+ | | |
94
+ |---|---|
95
+ | base | [Qwen/Qwen3.5-0.8B](https://huggingface.co/Qwen/Qwen3.5-0.8B) (vision tower frozen, `visual.*` never trained) |
96
+ | data | [cagataydev/loopl-train](https://huggingface.co/datasets/cagataydev/loopl-train) @ `e5c209dd` · 5126 rendered rows / 8,133,959 tokens · both tool dialects · oversample `c=2` |
97
+ | method | full fine-tune of the language model · lr 2e-05 · batch 2×8 · max_len 4096 · 2.0 epochs, best-epoch checkpoint kept |
98
+ | eval loss | ep1 2.410, ep2 2.463 → best 2.410 (eval split of the same dataset revision) |
99
+ | compute | a100-large (Hugging Face Jobs), 2081 s train · job `6ac47413404719ba3765bcda` |
100
+ | stack | transformers 5.18.0 · trl 1.14.1 · peft 0.21.2 |
101
+ | exports | MLX 4-bit via `mlx_vlm.convert -q` (153 vision tensors of 847, 625 MB) · GGUF Q4_K_M via llama.cpp `--no-mtp` (529 MB, text only) |
102
+
103
+ Script: [`train/loopl_sft.py`](https://github.com/cagataycali/loopl-train) — the same single file the loopl app launches when you
104
+ tap **Models › Train your own** on your own conversations. Assistant turns that *seed* a bad tool call carry `weight: 0`
105
+ so the model learns the recovery, not the mistake. Tokenizer files are normalised to the base's (`Qwen2Tokenizer`,
106
+ `chat_template.jinja` with tools) so Swift loaders accept them; `train/check_mlx_repo.py` gates every export on that
107
+ plus the vision triad (`vision_config` ⇔ `vision_tower.*` ⇔ `preprocessor_config.json`).
108
+
109
+ ## Limitations
110
+
111
+ - A 0.8B model: fluent and well-behaved in the loop, not an encyclopedia. It will get arithmetic and obscure
112
+ facts wrong; give it tools (`calculator`, `http`, `recall`) and it does better.
113
+ - Identity holds in most no-prompt probes (see the scores), not all; a one-line system prompt ("You are loopl…") makes it
114
+ consistent.
115
+ - The GGUF export is text-only. Vision needs the MLX export (or the bf16 weights).
116
+ - Trained on English plus a little Turkish; other languages are the base's.
117
+ - Knowledge about agent SDKs is file-level and dated to the dataset revision; it does not know your repo.
118
+
119
+ ## Data and privacy
120
+
121
+ Every training row is agent-synthesised from **public** sources (the owner's public GitHub repos and the agent-SDK source
122
+ they build on), critic-reviewed (score ≥ 4/5 kept) and filtered by a denylist for secrets, private names, phone numbers and
123
+ addresses — see the dataset card. No user conversations from the app are in this model.
124
+
125
+ ## License
126
 
127
+ Apache-2.0, inherited from the Qwen3.5 base. The fine-tune, exports and dataset are © Cagatay Cali, same license.