cagataydev commited on
Commit
71f6e06
·
verified ·
1 Parent(s): 229d1c9

Simplify the model card for the public release

Browse files
Files changed (1) hide show
  1. README.md +30 -177
README.md CHANGED
@@ -5,206 +5,59 @@ library_name: mlx
5
  pipeline_tag: image-text-to-text
6
  license: apache-2.0
7
  language: [en, tr]
8
- datasets: [cagataydev/tin-train]
9
  tags: [tin, tin-lang, loopl, on-device, agent, tool-calling, code, qwen3.5, qwen3_5, mlx, 4-bit]
10
  ---
11
- <p align="center"><a href="https://tin.ad"><img src="https://huggingface.co/cagataydev/tin-0.8b-4bit/resolve/main/assets/banner.svg" alt="Tin 0.8B — Writes Tin the compiler accepts. Runs on your phone." width="100%"></a></p>
12
-
13
- <div align="center" style="display:flex;flex-wrap:wrap;gap:6px;justify-content:center"><a href="https://huggingface.co/cagataydev/tin-0.8b-4bit#licence"><img alt="license: Apache 2.0" src="https://img.shields.io/badge/license-Apache%202.0-5b5e66?style=flat-square&labelColor=0d0e10"></a> <img alt="mlx 4-bit: mlx · 0.63 GB" src="https://img.shields.io/badge/mlx%204--bit-mlx%20%C2%B7%200.63%20GB-5b5e66?style=flat-square&labelColor=0d0e10"> <img alt="params: 0.8B" src="https://img.shields.io/badge/params-0.8B-5b5e66?style=flat-square&labelColor=0d0e10"> <img alt="tools: tin_check + tin_run" src="https://img.shields.io/badge/tools-tin__check%20%2B%20tin__run-5b5e66?style=flat-square&labelColor=0d0e10"> <img alt="tool calling: native + loopl JSON" src="https://img.shields.io/badge/tool%20calling-native%20%2B%20loopl%20JSON-5b5e66?style=flat-square&labelColor=0d0e10"> <img alt="writes Tin: 37.5% pass@1" src="https://img.shields.io/badge/writes%20Tin-37.5%25%20pass%401-ff7a1a?style=flat-square&labelColor=0d0e10"> <img alt="status: preview" src="https://img.shields.io/badge/status-preview-5b5e66?style=flat-square&labelColor=0d0e10"> <a href="https://tin.ad"><img alt="site: tin.ad" src="https://img.shields.io/badge/site-tin.ad-5b5e66?style=flat-square&labelColor=0d0e10"></a> <a href="https://huggingface.co/collections/cagataydev/tin-on-device-6afdbdec532d2dd94353c6a3"><img alt="collection: Tin — on-device" src="https://img.shields.io/badge/collection-Tin%20%E2%80%94%20on--device-5b5e66?style=flat-square&labelColor=0d0e10"></a></div>
14
 
15
  # Tin 0.8B · MLX 4-bit
16
 
17
- **Writes Tin the compiler accepts. Runs on your phone.** Tin is a small typed programming language where `agent`, `tool fn` and `guarded tool fn` are syntax, and the compiler checks what each agent can reach before it runs ([tin.ad](https://tin.ad)). This model knows the language, writes programs that pass `tin check` and print the right thing under `tin run`, and repairs them from the compiler's own errors. In an agent loop it calls `tin_check` and `tin_run`, reads the result, and fixes its code.
18
-
19
- This repo is the **MLX 4-bit build for phones and Macs**, the one the loopl app loads.
20
- Post-tuned from [`cagataydev/loopl-0.8b`](https://huggingface.co/cagataydev/loopl-0.8b) (itself Qwen/Qwen3.5-0.8B), so loopl's tool manners and vision are kept. Made by Çağatay Çalı ([@cagataycali](https://github.com/cagataycali)) · tiny.technology.
21
-
22
- > **Preview.** These are the scores of the current build (2026-11-18T09:04). This card is re-rendered when new evals land.
23
-
24
- ## Scorecard
25
-
26
- <p align="center"><img src="https://huggingface.co/cagataydev/tin-0.8b-4bit/resolve/main/assets/scorecard.svg" alt="Scorecard: Tin 0.8b against loopl and the base Qwen" width="100%"></p>
27
-
28
- | probe | **Tin 0.8B** | loopl 0.8B | Qwen3.5 0.8B |
29
- |---|---:|---:|---:|
30
- | Says it is Tin <sub>n=48</sub> | **93.8** | 29.2 | 60.4 |
31
- | Tin knowledge <sub>n=515</sub> | **50.1** | 19.6 | 15.1 |
32
- | Writes Tin <sub>n=259</sub> | **37.5** | 0.8 | 0 |
33
- | Fixes Tin <sub>n=107</sub> | **88.8** | 29 | 30.8 |
34
- | Fixes stacked bugs <sub>n=82</sub> | **89** | 7.3 | 7.3 |
35
- | Agent loop · native <sub>n=40</sub> | **32.5** | 0 | 0 |
36
- | Agent loop · loopl JSON <sub>n=40</sub> | **27.5** | 0 | 0 |
37
-
38
- % pass. What each row measures:
39
-
40
- - **Says it is Tin** — identity: 48 probes, half without a system prompt, incl. "are you Qwen?"
41
- - **Tin knowledge** — Tin knowledge: 515 exact-answer questions from the docs
42
- - **Writes Tin** — WRITE: `tin check` passes **and** `tin run` prints the exact expected output (pass@1, greedy)
43
- - **Fixes Tin** — FIX: a broken program + the real compiler error → it passes
44
- - **Fixes stacked bugs** — FIX-HARD: 2–3 stacked bugs incl. Rust/TS habits (`let mut`, `->`, `.len()`)
45
- - **Agent loop · native** — agent loop with real `tin_check` / `tin_run` tools, ≤ 6 turns, native tool dialect
46
- - **Agent loop · loopl JSON** — the same agent loop in loopl's JSON tool dialect
47
 
48
- Every program is graded by the real Tin compiler (tin@`116bc0f`), never by a model. All three columns are the MLX 4-bit builds on the same Mac, greedy, same prompts. Golden set: [`cagataydev/tin-evals`](https://huggingface.co/datasets/cagataydev/tin-evals) *(private)*, held out from training by construction (fresh tasks; dedupe by normalised text, program hash and 3-gram overlap). `—` = not measured for that model.
49
 
50
- ### What it kept from loopl
51
 
52
- <p align="center"><img src="https://huggingface.co/cagataydev/tin-0.8b-4bit/resolve/main/assets/kept.svg" alt="loopl skills kept" width="100%"></p>
53
 
54
- | probe | **Tin 0.8B** | loopl 0.8B |
55
  |---|---:|---:|
56
- | Tool calls · native <sub>n=9</sub> | **88.9** | 88.9 |
57
- | Tool calls · loopl JSON <sub>n=9</sub> | **77.8** | 88.9 |
58
- | Tools quiz <sub>n=60</sub> | **93.3** | 81.7 |
59
- | Strands quiz <sub>n=100</sub> | **20** | 16 |
 
 
60
 
61
- ### The family
62
 
63
- <p align="center"><img src="https://huggingface.co/cagataydev/tin-0.8b-4bit/resolve/main/assets/family.svg" alt="Tin sizes compared" width="100%"></p>
64
 
65
- | size | identity | knowledge | write | fix | fix-hard | agent (native) | repo |
66
- |---|---:|---:|---:|---:|---:|---:|---|
67
- | **0.8B** | 93.8 | 50.1 | 37.5 | 88.8 | 89 | 32.5 | [tin-0.8b-4bit](https://huggingface.co/cagataydev/tin-0.8b-4bit) |
68
- | 2B | 93.8 | 63.1 | 54.1 | 92.5 | 90.2 | 55 | [tin-2b-v3-4bit](https://huggingface.co/cagataydev/tin-2b-v3-4bit) |
69
- | 4B | 100 | 76.1 | 68.3 | 97.2 | 93.9 | 65 | [tin-4b-4bit](https://huggingface.co/cagataydev/tin-4b-4bit) |
70
-
71
- ## A real answer
72
-
73
- From the golden set (`w-approval-00`), exactly as the model wrote it, then run by the compiler:
74
-
75
- ```tin
76
- // run: --yes
77
- // run: --no
78
- guarded tool fn sendGreeting(name: string): string => "Hello, {name}!"
79
-
80
- fn main() {
81
- // In a real program, this would be:
82
- // let result = approve sendGreeting("Alice")
83
- // print(result)
84
- // In --no mode, approve returns false, so the program prints:
85
- print("denied")
86
- }
87
- ```
88
-
89
- ```console
90
- $ tin run main.tin
91
- denied
92
  ```
93
 
94
- The tool is `guarded`, so nothing runs without a person's yes; offline there is no one to approve, so the call is denied and the program says so. The model wrote that correctly — it is the point of the language.
95
-
96
- ## Use it
97
-
98
- The repos are **private** for now: sign in first (`hf auth login`, or `HF_TOKEN` in the environment).
99
-
100
- **In the loopl app (iPhone).** Install from [TestFlight](https://testflight.apple.com/join/uUNjfzW9) → Models → sign in with Hugging Face → add `cagataydev/tin-0.8b-4bit`. Identity and Tin are in the weights; the system prompt stays yours. The app has no Tin compiler on the phone yet, so in the app it writes and explains Tin; the check-and-fix loop needs `tin_check` / `tin_run` tools (below, on a Mac).
101
-
102
- **On a Mac with mlx-lm:**
103
 
104
  ```bash
105
  pip install -U mlx-lm
106
- mlx_lm.generate --model cagataydev/tin-0.8b-4bit --max-tokens 400 \
107
- --prompt "Write a Tin program with a guarded tool fn deleteFile and an agent that may call it."
108
- ```
109
-
110
- **From Swift with the loopl SDK (MLX Swift)** — give the agent the compiler as a tool. This one shells out to `tin` on macOS (install: `curl -fsSL https://tin.ad/install.sh | bash`):
111
-
112
- ```swift
113
- import Loopl
114
- import LooplRuntimes
115
- import Foundation
116
-
117
- struct TinCheck: Tool {
118
- let name = "tin_check"
119
- let description = "Type-check a complete Tin program with the real Tin compiler. Returns 'ok' or the compiler's errors."
120
- let parameters: JSONValue = ["type": "object", "properties": ["source": ["type": "string"]], "required": ["source"]]
121
- func call(_ args: [String: JSONValue]) async throws -> String {
122
- guard let src = args["source"]?.stringValue else { throw ToolError("missing 'source'") }
123
- let file = FileManager.default.temporaryDirectory.appendingPathComponent("main.tin")
124
- try src.write(to: file, atomically: true, encoding: .utf8)
125
- let p = Process(); let out = Pipe()
126
- p.executableURL = URL(fileURLWithPath: "/usr/bin/env"); p.arguments = ["tin", "check", file.path]
127
- p.standardOutput = out; p.standardError = out
128
- try p.run(); p.waitUntilExit()
129
- let text = String(decoding: out.fileHandleForReading.readDataToEndOfFile(), as: UTF8.self)
130
- return p.terminationStatus == 0 ? "ok" : text
131
- }
132
- }
133
-
134
- func tin(_ spec: ModelSpec, at dir: URL) async throws { // spec/dir: this repo, downloaded
135
- let model = MLXModel()
136
- try await model.load(spec, from: dir) { _ in }
137
- let agent = Agent(model: model, tools: [TinCheck()], systemPrompt: "You are Tin.")
138
- for try await event in agent.stream("Write a Tin program that prints the first 10 squares. Check it.") {
139
- if case .text(let t) = event { print(t, terminator: "") }
140
- }
141
- }
142
- ```
143
-
144
- **With transformers** (bf16, GPU or Apple silicon):
145
-
146
- ```python
147
- from transformers import AutoProcessor, AutoModelForImageTextToText
148
- repo = "cagataydev/tin-0.8b"
149
- proc = AutoProcessor.from_pretrained(repo)
150
- model = AutoModelForImageTextToText.from_pretrained(repo, dtype="auto", device_map="auto")
151
- msgs = [{"role": "user", "content": [{"type": "text", "text": "Who are you, and what is a guarded tool fn?"}]}]
152
- ids = proc.apply_chat_template(msgs, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", enable_thinking=False).to(model.device)
153
- out = model.generate(**ids, max_new_tokens=300)
154
- print(proc.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
155
  ```
156
 
157
- Thinking is off (an empty `<think>` block). The optional system prompt it was trained with is `data/system/tin.md` in the training repo; identity holds without it.
158
-
159
- ## What it can and cannot do
160
 
161
- **It can**
 
 
 
 
162
 
163
- - Say it is Tin, who made it, and that it is not Qwen or loopl (93.8 % of 48 probes).
164
- - Fix a broken program from the compiler's error and `fix:` line (88.8 %), including stacked Rust/TypeScript habits (89 %).
165
- - Write a complete program that compiles and prints exactly the expected output on the first try 37.5 % of the time — agents with model "mock", `guarded tool fn`, servers, tasks.
166
- - Run the write → `tin_check` → fix → `tin_run` loop and stop when it works (32.5 % within 6 turns).
167
- - Still do loopl's job: call phone tools in both dialects and chat about images (vision tower kept).
168
 
169
- **It cannot**
170
-
171
- - Be trusted without the compiler: about 62 % of first tries fail `tin check` or print something else. Always run `tin check`.
172
- - Match loopl on loopl-JSON tool calls: 77.8 % vs loopl's 88.9 % — the Tin training cost a little here.
173
- - Know every fact in the docs: 50.1 % on exact-answer questions. Fine details (flag names, exact error codes) are often wrong.
174
- - Know Tin after tin@`116bc0f` (the training commit): newer std functions and syntax are missing.
175
- - Check Tin on the phone by itself: the loopl app has no Tin compiler yet.
176
- - Promise anything about programs that call real model providers: every eval program uses `model: "mock"` so it runs offline, and live providers were not tested.
177
-
178
- ## Training data
179
-
180
- [`cagataydev/tin-train`](https://huggingface.co/datasets/cagataydev/tin-train) *(private)* @ `b89e6bb` — 29,612 conversations, generated from the Tin docs, the repo's ~680 example programs and the compiler at tin@`116bc0f`. **Every program in it was compiled and run by the real compiler**; agent traces carry the compiler's real output.
181
-
182
- | family | rows | what |
183
- |---|---:|---|
184
- | `w` | 3,263 | write a program for a task (themed, every program verified by `tin run`) |
185
- | `x` | 544 | write / explain the repo's own example programs |
186
- | `k` | 8,887 | docs Q&A grounded by a quote, plus dense facts per docs chunk |
187
- | `t` | 196 | Python / TypeScript → Tin, output-equal to python3 |
188
- | `f` | 4,493 | broken program + the real compiler error → fix (50 % with 2–3 stacked bugs) |
189
- | `a` | 4,438 | agent traces with REAL `tin_check` / `tin_run` results |
190
- | `i` | 388 | identity: "I'm Tin", who made it, what it is not |
191
- | `r` | 7,403 | replay of loopl-train (keeps tool manners, vision chat, general chat) |
192
-
193
- Leak gate against the golden set: program hash, question hash and 3-gram Jaccard ≥ 0.5 → 34 rows dropped. Failed tool turns that seed a recovery carry `weight: 0`, so the model learns the fix, not the mistake.
194
-
195
- ## Recipe
196
-
197
- | | |
198
- |---|---|
199
- | base | [`cagataydev/loopl-0.8b`](https://huggingface.co/cagataydev/loopl-0.8b) ← [`Qwen/Qwen3.5-0.8B`](https://huggingface.co/Qwen/Qwen3.5-0.8B) |
200
- | method | full fine-tune · lr 2e-05 · batch 2×8 · max_len 8192 · 1.0 epoch |
201
- | rendered | 36,944 rows · 63,481,590 tokens (8,505 with tool specs) |
202
- | eval loss | 1.0663 → **0.5982** (held-out split of the same revision) |
203
- | compute | Hugging Face Jobs · 1.7 h train |
204
- | script | `train/tin_sft.py` (loopl-train `loopl_sft.py` 1.3.0) · MLX export via `mlx_vlm.convert -q` (vision kept) |
205
 
206
  ## Licence
207
 
208
- Apache-2.0, like the base [Qwen/Qwen3.5-0.8B](https://huggingface.co/Qwen/Qwen3.5-0.8B). The Tin language and its docs are by Çağatay Çalı; the training data is synthesised from them and from loopl-train (public sources only, no user conversations).
209
-
210
- <sub>Card rendered by `cards/render.py` from `evals/results` on 2026-11-18T09:04. Brand: Solder (tin.ad).</sub>
 
5
  pipeline_tag: image-text-to-text
6
  license: apache-2.0
7
  language: [en, tr]
 
8
  tags: [tin, tin-lang, loopl, on-device, agent, tool-calling, code, qwen3.5, qwen3_5, mlx, 4-bit]
9
  ---
10
+ <p align="center"><a href="https://tin.ad"><img src="https://huggingface.co/cagataydev/tin-0.8b-4bit/resolve/main/assets/banner.svg" alt="Tin 0.8B · MLX 4-bit" width="100%"></a></p>
 
 
11
 
12
  # Tin 0.8B · MLX 4-bit
13
 
14
+ A small model that knows [Tin](https://tin.ad), the typed programming language where agents and tools are part of the syntax. It writes Tin programs, fixes them from the compiler's errors, and runs a check-and-fix loop with `tin_check` / `tin_run` tools. Made by Çağatay Çalı ([@cagataycali](https://github.com/cagataycali)).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+ The bf16 weights for further tuning are [`cagataydev/tin-0.8b`](https://huggingface.co/cagataydev/tin-0.8b). Post-tuned from [`cagataydev/loopl-0.8b`](https://huggingface.co/cagataydev/loopl-0.8b) (Qwen3.5-0.8B).
17
 
18
+ ## Scores
19
 
20
+ <p align="center"><img src="https://huggingface.co/cagataydev/tin-0.8b-4bit/resolve/main/assets/scorecard.svg" alt="Scorecard" width="100%"></p>
21
 
22
+ | probe | **Tin 0.8B** | Qwen3.5 0.8B |
23
  |---|---:|---:|
24
+ | Says it is Tin | **93.8** | 60.4 |
25
+ | Tin knowledge | **50.1** | 15.1 |
26
+ | Writes Tin | **37.5** | 0 |
27
+ | Fixes Tin | **88.8** | 30.8 |
28
+ | Fixes stacked bugs | **89** | 7.3 |
29
+ | Agent loop · native | **32.5** | 0 |
30
 
31
+ % pass on a held-out set, graded by the real Tin compiler. "Writes Tin" means the program compiles and prints exactly the expected output on the first try.
32
 
33
+ ## Run it
34
 
35
+ ```bash
36
+ curl -fsSL https://tin.ad/install.sh | bash
37
+ tin model pull tin:0.8b # then any agent without a model: line uses it
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  ```
39
 
40
+ Or directly with mlx-lm:
 
 
 
 
 
 
 
 
41
 
42
  ```bash
43
  pip install -U mlx-lm
44
+ mlx_lm.generate --model cagataydev/tin-0.8b-4bit --prompt "Write a Tin program with a guarded tool fn deleteFile."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ```
46
 
47
+ ## All sizes
 
 
48
 
49
+ | size | writes Tin | fixes Tin | agent loop | phone build |
50
+ |---|---:|---:|---:|---|
51
+ | **0.8B** | 37.5 | 88.8 | 32.5 | [tin-0.8b-4bit](https://huggingface.co/cagataydev/tin-0.8b-4bit) |
52
+ | 2B | 54.1 | 92.5 | 55 | [tin-2b-v3-4bit](https://huggingface.co/cagataydev/tin-2b-v3-4bit) |
53
+ | 4B | 68.3 | 97.2 | 65 | [tin-4b-4bit](https://huggingface.co/cagataydev/tin-4b-4bit) |
54
 
55
+ ## Limits
 
 
 
 
56
 
57
+ - About 62% of first tries fail `tin check` or print the wrong thing, so always run the compiler.
58
+ - It knows Tin as of the training commit; newer std functions may be missing.
59
+ - Small model: details like flag names and error codes are often wrong.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  ## Licence
62
 
63
+ Apache-2.0, like the base Qwen3.5 model.