File size: 13,967 Bytes
718ef5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14339a2
718ef5a
14339a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
718ef5a
 
 
14339a2
 
 
718ef5a
14339a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
718ef5a
 
 
14339a2
718ef5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14339a2
 
 
718ef5a
14339a2
 
 
 
 
 
 
 
 
 
718ef5a
 
 
 
 
 
 
 
 
14339a2
718ef5a
 
 
 
14339a2
 
718ef5a
 
 
 
 
14339a2
718ef5a
 
 
14339a2
 
718ef5a
 
 
 
 
 
 
14339a2
718ef5a
 
 
 
 
 
 
 
 
 
 
 
14339a2
718ef5a
 
 
14339a2
718ef5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
license: apache-2.0
license_link: LICENSE
base_model:
  - thinkingmachines/Inkling-2-Mini
base_model_relation: quantized
language:
  - en
pipeline_tag: text-generation
library_name: gguf
tags:
  - inkling2_loop
  - moe
  - pruned
  - gguf
  - dspark
  - speculative-decoding
  - phone-operator
  - linux
  - arch-arm
  - omarchy
  - hyprland
  - tool-calling
  - coding
  - edge
  - pixel-10
  - freetpu
  - apache-2.0
---

# PocketCoder-13B-A3B

**`PocketCoder-13B-A3B`** is a sharp, local-first **Linux / Arch ARM / Omarchy / Hyprland Phone Operator, Coding & Tool-Calling Model** engineered to run inside a **`<= 8.0 GB`** GGUF footprint on **16 GB smartphones** (such as a Google Pixel 10 running `FreeTPU` / `llama.cpp`), **Apple Silicon Macs**, and **desktop/workstation GPUs** β€” paired with an optional **`385 MiB` DSpark speculative drafter**.

Derived under **Apache 2.0** from [`thinkingmachines/Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (commit `c9d028302cd0f035fdf8e7e91f089a4ce94d2195`), `PocketCoder-13B-A3B` removes the vision encoder and standalone MTP head, prunes routed MoE experts from `128 -> 64` per layer (`26.39B -> 13.84B` total parameters), heals via knowledge distillation + execution-verified rejection fine-tuning (RFT) + replay SFT + stratified verifiable GRPO on strictly public datasets, and quantizes into **4-bit experts + `Q8_0` attention + lossless `F32` recurrent loop gates (`7.95 GB`)** rather than crushing all 128 experts to 2-bit.

### FreeSilicon Looped-MoE Coder Family
| Model | Routed Experts | Total / Active Params | Flagship GGUF Size | 200-Prompt Eval (BF16) | Public Eval PPL | Target Hardware |
|---|---:|---:|---:|---:|---:|---|
| **[`freesilicon/PocketCoder-13B-A3B`](https://huggingface.co/freesilicon/PocketCoder-13B-A3B) (v4)** | `64` (`top-8`) | `13.84B` / `~3.4B` | **`7.95 GB`** | **`97.5%` (`195/200`)** | `1.9100` | 16 GB Phones (Pixel 10), Laptops |
| [`freesilicon/PocketCoder-17B-A3B`](https://huggingface.co/freesilicon/PocketCoder-17B-A3B) | `80` (`top-8`) | `16.89B` / `~3.4B` | **`9.61 GB`** | **`96.0%` (`192/200`)** | **`1.8226`** | 16–24 GB Laptops / Apple Silicon / Edge |
| [`freesilicon/DesktopCoder-26B-A3B`](https://huggingface.co/freesilicon/DesktopCoder-26B-A3B) | `128` (`top-8`, unpruned) | `26.07B` / `~3.4B` | **`14.59 GB`** | **`92.0%` (`184/200`)** | **`1.7445`** | 24+ GB Workstations / Apple Silicon / GPUs |

---

## What's New in **v4** (Execution-Verified RFT Refresh)

**`PocketCoder-13B-A3B` v4** folds `257` execution-verified STaR/RFT traces (including `20` multi-turn `gcc -std=c11 -Wall -Wextra -Werror`, `bash`, and `python3` compiler-error recovery traces) into Stage 2A' SFT while preserving exact `<= 7.95 GB` phone memory fit and `0/16` unsafe executions:

- **`97.5%` (`195/200`) held-out Phone-Operator BF16 pass rate** (`+5.0pp` over v2 `92.5%`):
  - **S1 Linux / Arch / Hyprland CLI:** **`100.0%` (`80/80`)** (`+15.0pp` vs v2 `85.0%`)
  - **S2 `pi` Tool Calling & Scripting:** **`97.1%` (`68/70`)**
  - **S3 Safety Gates & Escalation:** **`92.5%` (`37/40`)**, **`0/16` (`0.0%`) unsafe executions**
  - **S4 Edge-Silicon Kernel / Twin:** **`100.0%` (`10/10`)**
- **`1.9100` public coding/tool perplexity** (`93.15%` of pruning gap recovered; automatic non-regression rollback preserved the `97.5%` Stage 2A' checkpoint).
- **Flagship `7.949 GB` GGUF + Matching `385 MiB` `DSpark` Drafter + Exact LoRA/ExpertLoRA Adapters:**
  - `PocketCoder-13B-A3B-v4-POCKET_Q8LOOP_IQ4XS.gguf` passed all smoke tests (`66.2–67.2 tok/s` decode / `267–341 tok/s` prefill on A100).
  - `dspark-PocketCoder-13B-A3B-v4-Q8_0.gguf` (`404.1 MB`, 58 tensors) verified `76.85%` overall / **`83.33%` Hyprland-Linux** top-1 speculative draft agreement on `PocketCoder-13B-A3B` v4 hidden states (0-based layer-visit taps `[5, 23, 41, 47]`).
  - `adapters/v4/stage2a_prime_sft_adapters.safetensors` (`438.96 MB`, 648 tensors) lets downstream builders merge and export custom `Q4_0`, `IQ4_XS`, or `Q8_0` quantizations directly.

---

## Quantized Release Files (`llama.cpp >= b12611`)

Requires mainline [`ggml-org/llama.cpp`](https://github.com/ggml-org/llama.cpp) build **`>= b12611`** (PR `#32694` `inkling2_loop` + PR `#32704` looped scale fix; PR `#32218` for optional DSpark speculative drafter). All target GGUFs are calibrated with `PocketCoder-13B-A3B.imatrix` (`1,568` tensors).

> **Why not stock `Q4_K_M`?** Because `ffn_down_exps.weight` has `ne0 = 1152` (`1152 % 256 = 128 != 0`), stock `Q4_K_M` falls back to `Q5_0`/`Q8_0` on down-projections (`9.31 GB`). The pocket recipes below stay cleanly under `8.0 GB` while keeping attention and recurrent loop gates high-precision.

### v4 Release Files (Recommended)
| File | Recipe / Contents | Exact Size | Pixel 10 (`16 GB`) Fit | Recommended Use | SHA-256 |
|---|---|---:|:---:|---|---|
| **`PocketCoder-13B-A3B-v4-POCKET_Q8LOOP_IQ4XS.gguf`** | **`Q8_0` attn + `F32` loop + `IQ4_XS`/`IQ4_NL` experts (imatrix)** | **`7.949 GB`** (`7,948,729,184 B`) | **YES** (`<= 8.0 GB`) | **v4 Flagship `<= 8.0 GB`** (`97.5%` eval, `100%` S1 CLI, `0%` unsafe) | `d9afdb944796ef3780131791c25929fd42b76aa87dc802a7d2d60c44a82bd773` |
| **`dspark-PocketCoder-13B-A3B-v4-Q8_0.gguf`** | 3-layer dense DSpark speculative drafter (`Q8_0`, 58 tensors) | **`0.404 GB`** (`404,128,480 B` / `385.4 MiB`) | Optional add-on | Speculative decode with v4 (`--spec-type draft-dspark --spec-draft-n-max 3`) | `48cf70fdd3e15c5a2754aafedf97330527570ec0ce9b24f33058c5740b72b4db` |
| `adapters/v4/stage2a_prime_sft_adapters.safetensors` | Exact v4 LoRA + ExpertLoRA + router weights (`648` tensors) | `438.96 MB` (`438,955,824 B`) | Reproducibility | Merge over 64-expert pruned base for custom quantizations | `03a08c7867c6c644d39e792498e9a4cd6b63054939bd9ab5c38730d01b1e9ec0` |

### v2 Release Files (Preserved for Compatibility & `Q4_0`/`IQ4_XS`)
| File | Quant Recipe | Exact Size | Pixel 10 (`16 GB`) Fit | Recommended Use | SHA-256 |
|---|---|---:|:---:|---|---|
| `PocketCoder-13B-A3B-POCKET_Q8LOOP_IQ4XS.gguf` | `Q8_0` attn + `F32` loop + `IQ4_XS`/`IQ4_NL` experts (v2) | `7.949 GB` (`7,948,729,216 B`) | **YES** (`<= 8.0 GB`) | v2 baseline flagship | `7de131332b34115e5563320cc222e61687404441d422ae924bc4926b832b77d6` |
| `PocketCoder-13B-A3B-Q4_0.gguf` | `Q4_0 --pure` (imatrix, v2) | `7.909 GB` (`7,909,478,272 B`) | **YES** (`<= 8.0 GB`) | **Pixel 10 `FreeTPU` Day-Zero Native** (`ggml-edgetpu`) & fast ARM CPU | `dacfe04b78ad48f03bfb56d1b64409ec6012e8acf64ed4da64f14d697bc33104` |
| `PocketCoder-13B-A3B-IQ4_XS.gguf` | `IQ4_XS` (`ffn_down_exps -> IQ4_NL`, `Q6_K` output, v2) | `7.739 GB` (`7,739,421,184 B`) | **YES** (`<= 7.8 GB`) | Smallest 4-bit build (`llama.cpp` ARMv9 / Apple Silicon) | `7652feacd31396e792fd5cde6cb4cf195c66336e33d91bc8300c22ae3b18fc82` |
| `dspark-PocketCoder-13B-A3B-Q8_0.gguf` | 3-layer dense DSpark speculative drafter (`Q8_0`, v2) | `0.404 GB` (`404,128,352 B`) | Optional add-on | Speculative decode with v2 | `926dddeeeeb8667d3b428eb71c2fa05eb6f71bda296a8f698a324b1bd0fc5349` |
| `PocketCoder-13B-A3B.imatrix` | Public calibration importance matrix (`1,568` tensors) | `48.27 MB` (`48,272,416 B`) | Calibration artifact | Re-quantizing custom 64-expert recipes | `92049a00e42e062f214502e7abde791edfb6700528f6b0e8f6735a1156547c94` |

---

## Same-Footprint (`~7.9 GB`) Live Shoot-Out (v2 vs. 2-Bit 128-Expert Baseline)

Measured live on **Apple M5 Max (128 GiB, Metal `-ngl 99`, `c=4096`, greedy `temp=0`, `max_tokens=160`)** with mainline `llama.cpp` (`llama-server` & `llama-perplexity`, `0` errors across all `200` held-out prompts):

| Metric | `AtomicChat` `AD-IQ2_XXS-Q2` (`7.90 GB`, 128e 2-bit) | `PocketCoder-13B-A3B` v1 (`7.95 GB`, 64e 4-bit) | **`PocketCoder-13B-A3B` v2 (`7.95 GB`)** | **`PocketCoder-13B-A3B` v2 + DSpark (`n=3`)** |
|---|---:|---:|---:|---:|
| **GGUF Size** | `7.901 GB` | `7.949 GB` | **`7.949 GB`** | `7.949 GB` + `0.404 GB` drafter |
| **Overall Phone-Operator Pass (`200` prompts)** | `145/200 (72.5%)` | `146/200 (73.0%)` | **`178/200 (89.0%)` (`+16.5pp`)** | **`177/200 (88.5%)` (`+16.0pp`)** |
| **Mean Verifier Reward (`[-1, 1]`)** | `0.6002` | `0.6283` | **`0.8485` (`+0.2483`)** | **`0.8425` (`+0.2423`)** |
| **S1 Linux / Arch / Hyprland CLI (`80`)** | `48/80 (60.0%)` | `44/80 (55.0%)` | **`64/80 (80.0%)` (`+20.0pp`)** | **`64/80 (80.0%)` (`+20.0pp`)** |
| **S2 `pi` Tool Calling & Scripting (`70`)** | `61/70 (87.1%)` | `63/70 (90.0%)` | **`66/70 (94.3%)` (`+7.2pp`)** | **`66/70 (94.3%)` (`+7.2pp`)** |
| **S3 Safety Gates & Escalation (`40`)** | `36/40 (90.0%)` | `39/40 (97.5%)` | **`38/40 (95.0%)` (`+5.0pp`)** | `37/40 (92.5%)` |
| **S3 Unsafe Execution Rate (`16` gated)** | `0.0% (0)` | `0.0% (0)` | **`0.0% (0)`** | **`0.0% (0)`** |
| **S4 Edge-Silicon Kernel / Twin (`10`)** | `0/10 (0.0%)` | `0/10 (0.0%)` | **`10/10 (100.0%)` (`+100pp`)** | **`10/10 (100.0%)` (`+100pp`)** |
| **Coding & Tool PPL (`llama-perplexity`, `c=512`)** | `1.7825 Β± 0.0719` | `1.8020 Β± 0.0720` | **`1.7441 Β± 0.0718` (`-0.0384`)** | **`1.7441 Β± 0.0718`** |
| **Mean Decode Speed (`tok/s`)** | `28.7 tok/s` | `25.7 tok/s` | `21.9 tok/s` | **`27.5 tok/s` (`+25.6%` vs v2)** |
| **Mean Wall Latency / Prompt** | `2.78s` (`12,875` tok) | `2.49s` (`10,235` tok) | `2.90s` (`9,836` tok) | **`2.33s` (`-16.2%` vs 2-bit)** |

---

## Pruning, Healing & Training Progression (BF16 Held-Out Eval)

All profiling, distillation, fine-tuning, and verification use **strictly public-only** datasets and deterministic verifiers (zero private user data):

- **Expert Profiling (`128 -> 64`)**: Retained **`84.50%` mean routing mass** across all 24 layers (**`86.56%`** across looped layers `6..17`, equal-weighted 3-pass union).
- **Training Pipeline**: `Stage 2A` teacher top-64 KL+SFT (`537,572` tokens) -> `Stage 2A'` completion-masked SFT + execution-verified STaR/RFT + replay (`kl_beta=0.05` anchor) -> `Stage 2B` stratified 4-slice GRPO with automatic non-regression rollback.

| Stage (BF16 Held-Out Eval) | Overall (`200`) | S1 CLI (`80`) | S2 `pi` Tool (`70`) | S3 Safety (`40`) | S3 Unsafe (`16`) | S4 Silicon (`10`) | `public_eval.jsonl` PPL (`3,136` tok) |
|---|---:|---:|---:|---:|---:|---:|---:|
| `26.4B` Base (`128` experts) | β€” | β€” | β€” | β€” | β€” | β€” | `1.8875` |
| Zero-Shot Pruned (`64` experts) | β€” | β€” | β€” | β€” | β€” | β€” | `2.2162` |
| Stage 2A KL+SFT (`v1` pre-GRPO) | `73.0% (146)` | `55.0% (44)` | `81.4% (57)` | `100.0% (40)` | `0.0% (0)` | `50.0% (5)` | `2.0230` |
| `v2` (2A' + 50-Step Stratified GRPO) | `92.5% (185)` | `85.0% (68)` | `97.1% (68)` | `97.5% (39)` | `0.0% (0)` | `100.0% (10)` | `1.8856` |
| **`v4` (Execution-Verified RFT-Infused SFT)** | **`97.5% (195)`** | **`100.0% (80)`** | **`97.1% (68)`** | **`92.5% (37)`** | **`0.0% (0)`** | **`100.0% (10)`** | **`1.9100`** (`93.15%` gap recovered) |

---

## Model Architecture Summary

| Property | Base (`Inkling-2-Mini`) | `PocketCoder-13B-A3B` |
|---|---|---|
| **License** | Apache 2.0 | Apache 2.0 (`LICENSE` + `NOTICE`) |
| **Architecture** | `Inkling2LoopForConditionalGeneration` (`inkling2_loop`) | `Inkling2LoopForCausalLM` (`inkling2_loop`, text-only) |
| **Total Parameters** | `26.39B` (`26.07B` text + `0.32B` vision) | **`13.84B`** (`13,834,027,008` text) |
| **Active Parameters / Token** | `~3.4B` physical / `~4.87B` across 48 logical visits | **`~3.4B` physical / `~4.87B` across 48 logical visits** (unchanged) |
| **Physical / Logical Layers** | `24` physical (`core 6..17` looped `3Γ—` -> `48` logical) | `24` physical (`core 6..17` looped `3Γ—` -> `48` logical) |
| **MoE Experts** | `128` routed, `top-8`, `0` shared | **`64` routed, `top-8`, `0` shared** (`50%` expert pruning) |
| **Hidden / Expert Inter / Head Dim** | `2304` / `1152` / `128` (`128`-lane aligned) | `2304` / `1152` / `128` (`128`-lane aligned) |
| **Attention / KV Cache** | `24` Q heads, `8` KV heads; `40` SWA (`1024`) + `8` Global | `24` Q heads, `8` KV heads; `40` SWA (`1024`) + `8` Global |
| **Speculative Drafter** | Standalone MTP weights | Optional `385 MiB` `dspark-PocketCoder-13B-A3B-v4-Q8_0.gguf` |

---

## Quick Start

### 1. Apple Silicon Mac / Desktop GPU (v4 Flagship + DSpark Speculative Server)

```bash
llama-server \
  -m PocketCoder-13B-A3B-v4-POCKET_Q8LOOP_IQ4XS.gguf \
  -md dspark-PocketCoder-13B-A3B-v4-Q8_0.gguf \
  --spec-type draft-dspark --spec-draft-n-max 3 \
  -ngl 99 -ngld 99 -c 16384 -ctk q8_0 -ctv q8_0 \
  --jinja --host 127.0.0.1 --port 8080
```

*(Omit `-md ... --spec-type ... --spec-draft-n-max 3 -ngld 99` to run standalone in `7.95 GB`.)*

### 2. Google Pixel 10 `FreeTPU` (`llama-cpp-edgetpu` on Tensor G5 `buenos_a0`, `>= b12611`)

```bash
OPENBUENOS_PERF_MODE=5 \
OPENBUENOS_WEIGHT_CACHE_MB=1024 \
OPENBUENOS_MIN_ELEMENTS=262144 \
./llama-server \
  -m PocketCoder-13B-A3B-Q4_0.gguf \
  -md dspark-PocketCoder-13B-A3B-Q8_0.gguf \
  --spec-type draft-dspark --spec-draft-n-max 3 \
  --jinja -c 16384 -ctk q8_0 -ctv q8_0 -t 4 --port 8080
```

### 3. Interactive CLI Spot-Check (`llama-completion`)

```bash
llama-completion \
  -m PocketCoder-13B-A3B-v4-POCKET_Q8LOOP_IQ4XS.gguf \
  -ngl 99 -c 4096 -n 160 --temp 0 --top-k 1 -no-cnv \
  -p 'You are PocketCoder, a concise Linux / Arch ARM / Hyprland phone operator. Respond ONLY with a single JSON object {"command": "<one-line bash command>"}.

User: Move the currently active Hyprland window silently to workspace 4 without switching focus.
Assistant:
'
```

---

## License & Attribution

- Licensed under the **Apache License, Version 2.0** (see [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE)).
- Derived from [`thinkingmachines/Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (commit `c9d028302cd0f035fdf8e7e91f089a4ce94d2195`), copyright Thinking Machines Lab, Inc., licensed under Apache 2.0.
- Users must also comply with the base model's [Acceptable Use Policy](https://thinkingmachines.ai/model-acceptable-use-policy/) where applicable.