File size: 4,141 Bytes
02ae998
 
 
 
 
 
 
 
 
 
 
 
 
 
7dd14b2
 
 
02ae998
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7dd14b2
 
02ae998
 
 
7dd14b2
0d49d45
7dd14b2
 
0d49d45
 
 
7dd14b2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0d49d45
02ae998
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
base_model: nokeepai/Inkling-2-Mini-Unbound
base_model_relation: finetune
tags:
  - lora
  - moe
  - inkling
  - text-generation
  - thinking
---

# Lamarck-Inkling-2-Mini-Unbound

A cybersecurity continued-pretraining LoRA fine-tune of
[Inkling-2-Mini-Unbound](https://huggingface.co/nokeepai/Inkling-2-Mini-Unbound)
(the Unbound variant of Thinking Machines' Inkling-2-Mini), in the Lamarck series.

## Model details

| | |
|---|---|
| Base model | `nokeepai/Inkling-2-Mini-Unbound` (v2) |
| Architecture | `Inkling2LoopForConditionalGeneration` — 26.4B-parameter mixture-of-experts |
| Experts | 128 routed experts, top-8, per layer; looped core (3 weight-tied passes) |
| Attention | Hybrid sliding-window + full attention, short-convolution, relative position bias |
| Adapter | LoRA on attention projections (r=32) + fused expert projections (r=8) |
| Trainable params | ~215M (0.8% of base) |
| Base precision | BF16 |
| Distributed as | Q4_K_M GGUF (local serving) |
| Context | up to 512K tokens serving; model supports up to 1M |
| Vocabulary | 201,024 (tiktoken) |
| Behavior | Thinking model — emits reasoning before the final answer |

## Usage

Supported by recent `llama.cpp` builds (`inkling2_loop` architecture):

```bash
llama-server -m Lamarck-Inkling-2-Mini-Unbound-Q4_K_M.gguf \
  -ngl 99 -c 32768 -fa on -ctk q8_0 -ctv q8_0 \
  --host 127.0.0.1 --port 8081
```

Exposes an OpenAI-compatible API (`/v1/chat/completions`) and the Anthropic Messages
API (`/v1/messages`). Allow generous `max_tokens` so the reasoning trace can complete
before the answer.

## Training method

Cybersecurity continued-pretraining via parameter-efficient LoRA (attention r=32 +
fused-expert r=8) on a security text corpus, with validation-aware early stopping and
best-checkpoint selection by held-out evaluation. The adapter is merged into the base
weights for distribution as a single self-contained model.

## Metrics

Cybersecurity continued-pretraining evaluation, base vs. this adapter (ckpt-300,
validation-aware early stop). Perplexity — lower is better.

| Metric | Base | Fine-tuned |
|---|---|---|
| Held-out security perplexity | 6.15 | **4.90** |
| OOD CyberMetric perplexity | 16.73 | **15.76** |
| OOD MMLU-security perplexity | 8.03 | **7.50** |
| OOD SecQA-v2 perplexity | 4.79 | **4.14** |
| OOD math-control perplexity | 6.49 | **6.47** |
| MMLU-security accuracy | 0.170 | 0.155 |
| SecQA-v2 accuracy | 0.20 | **0.27** |
| GSM8K accuracy | 0.84 | **0.90** |

The adapter lowers held-out and out-of-domain security perplexity substantially while
the math-control perplexity stays flat — no catastrophic forgetting. GSM8K accuracy is
preserved/improved, and SecQA-v2 accuracy rises.

Note: Inkling-2-Mini is a thinking model, so the multiple-choice accuracy figures are
sensitive to answer extraction from the reasoning trace and are reported as measured;
perplexity is the parsing-independent, sensitive measure here. These are research
measurements, not a safety certification.

## Files

- `Lamarck-Inkling-2-Mini-Unbound-Q4_K_M.gguf` — merged standalone model (base + adapter), ready for llama.cpp.
- `adapter/` — the raw LoRA adapter (attention r=32 + fused-expert r=8).
- `inkling_lora_min.py` — loader for the fused-expert adapter.

### Applying the adapter yourself

The expert portion uses a fused grouped-GEMM LoRA (not standard per-Linear peft), so
loading the raw adapter requires `inkling_lora_min.py`:

```python
import inkling_lora_min as ink
from transformers import Inkling2LoopForConditionalGeneration
from peft import PeftModel
model = Inkling2LoopForConditionalGeneration.from_pretrained(
    "nokeepai/Inkling-2-Mini-Unbound", dtype="bfloat16", device_map="cuda")
ink.attach_fused_expert_lora(model, r=8, alpha=16)
model = PeftModel.from_pretrained(model, "adapter")
```

The merged GGUF needs none of this — it is self-contained.

## License

Apache-2.0, inherited from the base model.

## Provenance

Part of the Lamarck series. Fine-tune of the Unbound variant of Inkling-2-Mini;
the base model's own abliteration and self-distillation are upstream (nokeep).