File size: 13,828 Bytes
b15e76d | 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 | ---
license: apache-2.0
base_model: thinkingmachines/Inkling-2-Mini
tags:
- weight-space-programming
- mechanistic-interpretability
- gguf
- lora
- dynamic-lora
- llama-cpp
- inkling2
- moe
- looped-transformer
- reasoning
- tool-calling
- agent
- terminal-bench
- nl2bash
- gsm8k
- stem
- math-500
- mmlu-pro
pipeline_tag: text-generation
---
# Inkling-2-Mini-Weight-Space-Programming (Lightweight 2-Adapter Fast Build · `UD-IQ3_XXS`)
**Training-free, closed-form Two-Phase Reasoning-Boundary Weight-Space Programming (WSP) for [`thinkingmachines/Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (`inkling2` `3×`-looped MoE architecture), synthesized in `30.8s` with ZERO gradient descent and packaged as TWO `rank=8` GGUF LoRAs totaling `6.32 MB`.**
> [!NOTE]
> ## Upstream Model Credits & Provenance
> - **Original Base Model ([Thinking Machines](https://huggingface.co/thinkingmachines/Inkling-2-Mini)):** [`thinkingmachines/Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (`apache-2.0`, `24` physical layers with `3×` looped middle core `[6, 18)` → `48` logical passes, `128` routed experts with `n_shared_experts=0`, `4`-tap causal short-convolutions `attn_post_conv` / `ffn_post_conv`, `attn_res`, and `final_logit_softcapping=30.0`).
> - **GGUF Base Quantization ([Unsloth](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF)):** [`unsloth/Inkling-2-Mini-GGUF`](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF) — [`Inkling-2-Mini-UD-IQ3_XXS.gguf`](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF/blob/main/Inkling-2-Mini-UD-IQ3_XXS.gguf) (`10.86 GiB`). Because this lightweight release repo hosts only the `6.32 MB` adapters, runtime router, tokenizer, benchmarks, and reproducible scripts (`~32 MiB` total), [`run_inkling2_lite.py`](run_inkling2_lite.py) automatically downloads the `UD-IQ3_XXS` GGUF from `unsloth/Inkling-2-Mini-GGUF` on first launch.
---
## Key Highlights (Single 12 GB RTX 4070 Ti · `eff=0.2, temp=0.0`)
1. **Lightweight `6.32 MB` 2-Adapter Architecture vs. `20.80 MB` 8-Adapter Multi-Site Stack:**
- Probing all `10` LoRA-capable tensor families in `llama.cpp` showed `blk.17.loop_mlp_gain.weight` (`|Δ logprob| = 0.059719`, `46.26 tok/s`) and `blk.23.attn_output.weight` (`0.024330`, `47.30 tok/s`) deliver the highest downstream leverage without slowing inference, whereas 3D MoE `ffn_down_exps` (`18.00 tok/s`) and stacking 8 multi-layer adapters (`35.2 tok/s` median) impose heavy per-token overhead.
- Trimming to **just 2 `rank=8` adapters (`4` tensor pairs total)** — **`adapters_lite/wsp_lite_think_close.gguf`** (`3214.5 KB`: `output.weight` + `blk.17.loop_mlp_gain.weight`, `null_leak=3.085%`) and **`adapters_lite/wsp_lite_term_action.gguf`** (`3261.5 KB`: `output.weight` + `blk.23.attn_output.weight`, `null_leak=2.831%`) — recovers **full `49.4 tok/s` median (`50.1 tok/s` on `agent100`, `47.5 tok/s` mean) server decode throughput** while fitting cleanly in `11,364 MiB` VRAM (`11,803 MiB` peak, `-ngl 99 --n-cpu-moe 4 -c 8192 -ctk q8_0 -ctv q8_0`).
2. **Native `/v1/chat/completions` Pass-Through + Selective Two-Phase Steering:**
- Unsteered workloads (`passthrough`: general QA, coding, multi-tool routing, turn-2 JSON, BFCL irrelevance) forward directly through native `/v1/chat/completions` with LoRA scales at `0.0` (preserving `EST_BFCL_IRR = 15/15`, `S6 = 3/4`, `S9 = 2/3` at `50.3 tok/s`).
- Only `nl2bash_single`, `terminal_episode`, and `stem_cutoff_guard` enter Phase-1/Phase-2 token-boundary steering (`TOK_END_MSG = 200010` hot-swap in `~0.7 ms`).
3. **Zero Thinking Cutoffs + Best Score Across All 155 Evaluated Tasks:**
- **`136/155 (87.7%, +3)` overall** vs. Base `133/155 (85.8%)` and 8-Adapter V2 `133/155 (85.8%)`.
- **`agent100`: `91/100 (+2)`** (`EST_GSM8K 20/20`, `EST_BFCL_IRR 15/15`, `EST_NL2BASH 15/20`).
- **`stem45`: `39/45`** with **`STEM_MMLU_4C 15/15 (100.0%)`** and `0` cutoffs (vs. Base `3` cutoffs).
- **Live WSL2 `tbench10`: `6/10 (60.0%, +1)`** with **`zero_cmd_tasks = 0`** (vs. `zcmd=1` in both Base and 8-Adapter V2).
---
## 1. Quickstart (`run_inkling2_lite.py`)
Download the lightweight bundle (`~32 MiB`) and install runtime dependencies:
```bash
pip install -r requirements.txt
hf download jstarks/Inkling-2-Mini-Weight-Space-Programming --local-dir ./inkling2-wsp-lite
cd inkling2-wsp-lite
```
Make sure `llama-server` (Unsloth / mainline `llama.cpp` supporting `general.architecture = inkling2`) is on `PATH` or in `./llama.cpp/`, then launch (`Inkling-2-Mini-UD-IQ3_XXS.gguf` downloads automatically into `./gguf/` on first run):
```bash
# Start OpenAI-compatible HTTP server on http://127.0.0.1:8080/v1 (model: inkling2-mini-wsp-lite)
python run_inkling2_lite.py
# Interactive terminal chat session
python run_inkling2_lite.py --chat
# A/B toggle back to unsteered Base (LoRA scales = 0.0) without unloading adapters
python run_inkling2_lite.py --mode base
```
*(Pass `--llama-server /path/to/llama-server` or `--gguf /path/to/Inkling-2-Mini-UD-IQ3_XXS.gguf` to use custom binary/model locations; `--n-cpu-moe 4` fits a `12 GB` GPU alongside KV cache `-c 8192 -ctk q8_0 -ctv q8_0`.)*
---
## 2. Three-Way Benchmark Comparison (`155` Tasks · `eff=0.2, temp=0.0`)
| Configuration | Adapters & Size | Combined `155` Tasks | `agent100` (`30` Hold + `70` Est) | `stem45` (`15+15+15`) | Live WSL2 `tbench10` | Total `cut_mid_think` | Server Decode (`tok/s`) |
|---|---:|---:|---:|---:|---:|---:|---:|
| **Track A Base** (`scales=0`) | `0` (`0 MB`) | `133/155 (85.8%)` | `89/100` (`27/30` · `62/70`) | `39/45` (`cut=3`) | `5/10` (`zcmd=1`) | `7/155` | `47.8` *(agent100 mean)* |
| Track B 8-Adapter Multi-Site V2 | `8` (`20.80 MB`) | `133/155 (85.8%)` | `89/100` (`26/30` · `63/70`) | `39/45` (`cut=0`) | `5/10` (`zcmd=1`) | **`0/155`** | `35.2` med / `37.7` mean |
| **Lightweight 2-Adapter Fast Build** (`lite_gentle`) | **`2` (`6.32 MB`)** | **`136/155 (87.7%, +3)`** | **`91/100` (`+2`)** (`27/30` · `64/70`) | **`39/45`** (`cut=0`, `MMLU-4C 15/15`) | **`6/10` (`+1`, `zcmd=0`)** | **`0/155`** | **`49.4` med / `47.5` mean** (`agent100` `50.1`) |
### `agent100` Breakdown (`30` Holdout + `70` Established)
| Suite | Tasks | Base | 8-Adapter V2 | **Lightweight 2-Adapter** | Lite Avg Tokens |
|---|---:|---:|---:|---:|---:|
| `S1_THINK` (Holdout S1: Think Closure) | `3` | `3/3` | `3/3` | `3/3` | `154.7` |
| `S2_RESTRAINT` (Holdout S2: Tool Restraint & Anti-Sycophancy) | `4` | `4/4` | `4/4` | `4/4` | `225.0` |
| `S3_ROUTER` (Holdout S3: Multi-Tool Router) | `5` | `4/5` | `4/5` | `4/5` | `102.0` |
| `S4_CODE` (Holdout S4: Mid-Band Code Synthesis) | `2` | `2/2` | `2/2` | `2/2` | `309.5` |
| `S5_TURN2_JSON` (Holdout S5: Turn-2 Structured JSON) | `3` | `3/3` | `3/3` | `3/3` | `113.3` |
| `S6_HANDOFF` (Holdout S6: Escalation Handoff Gate) | `4` | `3/4` | `2/4` | `3/4` | `92.5` |
| `S7_INJECTION_GUARD` (Holdout S7: Indirect Injection Guard) | `3` | `3/3` | `3/3` | `3/3` | `206.0` |
| `S8_GROUNDING` (Holdout S8: Grounded Abstention) | `3` | `3/3` | `3/3` | `3/3` | `94.3` |
| `S9_ERROR_RECOVERY` (Holdout S9: Error Self-Recovery) | `3` | `2/3` | `2/3` | `2/3` | `55.0` |
| `EST_GSM8K` (Established: OpenAI GSM8K) | `20` | `19/20` | `19/20` | **`20/20`** | `184.2` |
| `EST_HUMANEVAL` (Established: HumanEval pass@1) | `15` | `14/15` | `14/15` | `14/15` | `360.1` |
| `EST_BFCL_IRR` (Established: BFCL v3 Irrelevance) | `15` | `15/15` | `14/15` | `15/15` | `194.0` |
| `EST_NL2BASH` (Established: InterCode-NL2Bash) | `20` | `14/20` | `16/20` | **`15/20`** | `220.8` |
| **Total `agent100`** | `100` | `89/100` | `89/100` | **`91/100` (`+2`)** | `98.0%` nat-close |
*Exact `agent100` flips vs. Base (`+3 / -1 = +2`): gained `gsm8k_2` (`'70{,}000'` → `'70000'`), `nl2bash_4`, `nl2bash_7`; lost `nl2bash_12`.*
### `stem45` Breakdown (`MATH-500` + `MMLU-Pro` + `MMLU-4C`)
| Sub-Benchmark | Tasks | Base (`eff=0.2`) | 8-Adapter V2 | **Lightweight 2-Adapter** |
|---|---:|---:|---:|---:|
| `STEM_MATH500` (MATH-500 (Level-5 Math)) | `15` | `14/15` (`cut=1`, `569.5t`) | `14/15` (`cut=0`, `569.9t`) | `14/15` (`cut=0`, `559.3t`) |
| `STEM_MMLU_PRO` (MMLU-Pro STEM (10-Choice)) | `15` | `11/15` (`cut=1`, `435.9t`) | `11/15` (`cut=0`, `449.8t`) | `10/15` (`cut=0`, `415.5t`) |
| `STEM_MMLU_4C` (MMLU STEM (4-Choice)) | `15` | `14/15` (`cut=1`, `322.4t`) | `14/15` (`cut=0`, `261.2t`) | **`15/15` (`cut=0`, `266.9t`)** |
| **Total `stem45`** | `45` | `39/45` (`cut=3`) | `39/45` (`cut=0`) | **`39/45` (`cut=0`)** |
### Live WSL2 Stateful `tbench10` Breakdown (`10` Tasks)
| Task (`tbench10`, WSL2 Stateful) | Difficulty | Base (`cmds`) | V2 (`cmds`) | **Lite 2-Adapter (`cmds` / `tok`)** |
|---|---|---:|---:|---:|
| `hello-world` | `easy` | PASS (`1`) | PASS (`1`) | PASS (`1` / `109t`) |
| `fix-permissions` | `easy` | PASS (`3`) | PASS (`3`) | PASS (`3` / `216t`) |
| `processing-pipeline` | `easy` | FAIL (`5`) | FAIL (`5`) | FAIL (`5` / `569t`) |
| `extract-safely` | `easy` | PASS (`4`) | PASS (`4`) | PASS (`4` / `424t`) |
| `git-workflow-hack` | `easy` | FAIL (`5`) | FAIL (`5`) | FAIL (`5` / `398t`) |
| `grid-pattern-transform` | `easy` | FAIL (`0`) | FAIL (`0`) | FAIL (`1` / `1424t`) |
| `csv-to-parquet` | `easy` | PASS (`2`) | PASS (`2`) | PASS (`3` / `317t`) |
| `pandas-etl` | `easy` | PASS (`4`) | PASS (`4`) | PASS (`4` / `1038t`) |
| `logistic-regression-divergence` | `easy` | FAIL (`5`) | FAIL (`5`) | FAIL (`4` / `1375t`) |
| `cpp-compatibility` | `easy` | FAIL (`3`) | FAIL (`3`) | **PASS** (`2` / `953t`) |
| **Total `tbench10`** | `10` Easy | `5/10` (`zcmd=1`) | `5/10` (`zcmd=1`) | **`6/10` (`zcmd=0`)** |
---
## 3. Weight-Space Synthesis, 10-Site Atlas & Disjoint `VAL_24`
- **Disjoint Receptor Capture ([scripts/capture_inkling2_onpolicy.py](scripts/capture_inkling2_onpolicy.py)):** `350` exact `2304`-dim `h_final` receptors extracted via `llama-server --embeddings --pooling last --embd-normalize -1` (`5/5` exact top-1 logit parity with `30 * tanh(W_out @ h_final / 30)` within `0.0049` nats) from `84` strictly disjoint calibration prompts ([scripts/disjoint_inkling2_data.py](scripts/disjoint_inkling2_data.py), zero overlap with `agent100` / `stem45` / `tbench10`).
- **Disjoint `VAL_24` Validation ([benchmarks/val24_lite_results.json](benchmarks/val24_lite_results.json)):** Parity Gate `3/3 PASS`; winning preset **`lite_gentle`** (`s_think=0.65, s_stem=0.5, s_term=0.8`) scored **`19/24 (79.2%)`**, `cut=0`, `val_nl2bash=6/6`, `val_restraint_exec=3/3` at `VAL_24` median decode `46.0 tok/s`.
<details>
<summary>10-Site Weight-Space Atlas (`site_atlas_results.json`) & 128-Expert Spectral Map (`expert_spectral_map.json`)</summary>
### 10-Site `inkling2` LoRA Atlas (`r=4` F16 Single-Tensor Probes)
| Probe Site | Tensor(s) (`r=4` F16 Probe) | File Size | `scale=0` Drift | `|Δ logprob|` (`scale=1.0`) | Decode (`tok/s`) |
|---|---|---:|---|---:|---:|
| `probe_loop_gain` | `blk.17.loop_mlp_gain.weight` | `18.88 KB` | `0` OK | **`0.059719`** | `46.26` |
| `probe_attn_out` | `blk.23.attn_output.weight` | `42.38 KB` | `0` OK | **`0.024330`** | `47.3` |
| `probe_attn_rel_conv` | `blk.23.attn_rel.weight`, `blk.23.attn_k_conv_proj.weight` | `39.78 KB` | `0` OK | **`0.007446`** | `47.71` |
| `probe_loop_down` | `blk.17.loop_mlp_down.weight` | `36.88 KB` | `0` OK | **`0.004507`** | `47.97` |
| `probe_exps_3d` | `blk.23.ffn_down_exps.weight` | `3456.41 KB` | `0` OK | **`0.003829`** | `18.0` *(slow)* |
| `probe_router` | `blk.23.ffn_gate_inp.weight` | `19.38 KB` | `0` OK | **`0.003757`** | `48.73` |
| `probe_attn_gate` | `blk.23.attn_gate.weight` | `42.38 KB` | `0` OK | **`0.001861`** | `46.81` |
| `probe_loop_forget` | `blk.17.loop_mlp_forget.weight` | `18.88 KB` | `0` OK | **`0.000486`** | `48.36` |
| `probe_lm_head` | `output.weight` | `1588.84 KB` | `0` OK | **`0.000174`** | `47.48` |
| `probe_attn_sink` | `blk.23.attn_sink_proj.weight` | `18.56 KB` | `0` OK | **`0.000089`** | `49.6` *(inactive)* |
### 128-Expert Spectral Map Highlights (`blk.18..23`)
| Concept Direction | #1 Specialist (`Layer / Expert`) | Score | `top16_signed` | `max_pos` | Runner-Up |
|---|---|---:|---:|---:|---|
| `u_end_think` | **`blk.23 / E85`** | `0.2602` | `0.0697` | `0.3810` | `blk.23 / E124` (`0.1223`) |
| `u_ruminate` | **`blk.23 / E110`** | `0.1950` | `0.0152` | `0.3597` | `blk.23 / E35` (`0.1863`) |
| `u_exec` | **`blk.22 / E118`** | `0.2072` | `0.0296` | `0.3552` | `blk.20 / E37` (`0.1912`) |
| `u_write` | **`blk.20 / E35`** | `0.2255` | `0.0323` | `0.3863` | `blk.21 / E80` (`0.2213`) |
| `u_escal` | **`blk.20 / E89`** | `0.2231` | `0.0117` | `0.4229` | `blk.21 / E62` (`0.1956`) |
| `u_stem` | **`blk.21 / E38`** | `0.1602` | `0.0038` | `0.3127` | `blk.18 / E80` (`0.1532`) |
</details>
---
## 4. Repository Layout
- **Root Runtime (`~25.0 MiB` incl. `tokenizer.json`):** `README.md`, `run_inkling2_lite.py`, `inkling2_lite_router.py`, `requirements.txt`, `chat_template.jinja`, `config.json`, `tokenizer.json`, `tokenizer_config.json`
- **`adapters_lite/` (`6.32 MB` adapters):** `wsp_lite_think_close.gguf`, `wsp_lite_term_action.gguf`, `wsp_lite_manifest.json`, `val24_lite_results.json`
- **`scripts/`:** Full exploration, receptor capture, closed-form Woodbury synthesis, validation, and 155-task evaluation suite
- **`benchmarks/`:** Raw per-item JSON results across Track A Base, Track B 8-Adapter V2, and the Lightweight 2-Adapter Fast Build
## Citation & Attribution
If you use these adapters or weight-space tools, please credit Thinking Machines (`thinkingmachines/Inkling-2-Mini`) and Unsloth (`unsloth/Inkling-2-Mini-GGUF`).
|