File size: 9,876 Bytes
20d7c64
2d2bd8d
20d7c64
 
 
 
2d2bd8d
bbb3f2f
 
2d2bd8d
 
 
bbb3f2f
b628afc
 
2d2bd8d
3197db5
20d7c64
 
b628afc
 
 
 
 
 
 
20d7c64
bbb3f2f
f11f63c
3197db5
b628afc
 
3197db5
20d7c64
3197db5
b628afc
bbb3f2f
b628afc
3197db5
 
 
 
b628afc
3197db5
b628afc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3197db5
 
 
b628afc
3197db5
b628afc
3197db5
b628afc
3197db5
b628afc
20d7c64
b628afc
 
 
 
f11f63c
b628afc
f11f63c
b628afc
3197db5
b628afc
 
 
 
bbb3f2f
 
3197db5
b628afc
 
 
20d7c64
b628afc
 
 
 
 
 
3197db5
b628afc
3197db5
 
20d7c64
b628afc
f11f63c
bbb3f2f
b628afc
bbb3f2f
 
b628afc
 
 
 
 
 
 
 
bbb3f2f
b628afc
3197db5
 
 
 
 
b628afc
f11f63c
 
2d2bd8d
 
f11f63c
bbb3f2f
 
 
 
 
 
 
 
 
f11f63c
2d2bd8d
3197db5
b628afc
 
 
 
3197db5
2d2bd8d
 
 
f11f63c
b628afc
 
 
3197db5
 
bbb3f2f
4562320
b628afc
3197db5
 
 
b628afc
bbb3f2f
3197db5
 
bbb3f2f
3197db5
b628afc
3197db5
b628afc
 
 
 
bbb3f2f
 
 
 
3197db5
bbb3f2f
3197db5
bbb3f2f
 
 
 
 
3197db5
b628afc
3197db5
 
 
b628afc
3197db5
bbb3f2f
b628afc
bbb3f2f
 
 
 
 
 
 
b628afc
3197db5
 
 
bbb3f2f
3197db5
b628afc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bbb3f2f
 
 
 
 
 
b628afc
bbb3f2f
b628afc
bbb3f2f
 
 
 
 
 
 
 
 
 
 
 
 
b628afc
bbb3f2f
 
 
 
d2c885b
bbb3f2f
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
---
license: apache-2.0
language:
  - en
tags:
  - neuralai
  - mamba
  - ssm
  - state-space-model
  - causal-lm
  - mambapy
  - fine-tuned
  - text-generation
  - local-ai
  - assistant
pipeline_tag: text-generation
base_model: state-spaces/mamba-130m-hf
---

<!--
  NeuralAI β€” Mamba K1
  Model card maintained by De'Andrew Preston Harris (@Subject-Emu-5259)
  Last synced: 2026-08-13
-->

<img src="neuralai-mamba-k1-banner.png" alt="NeuralAI Mamba K1 banner" width="100%" />

<h1 align="center">🧬 NeuralAI β€” Mamba K1</h1>

<p align="center">
  <strong>NeuralAI's first owned base model.</strong><br/>
  A Mamba state-space language model fine-tuned for assistant-style chat, reasoning, code, and safe conversation.
</p>

<p align="center">
  <a href="https://huggingface.co/Subject-Emu-5259/NeuralAI-Mamba-K1"><img src="https://img.shields.io/badge/πŸ€—%20Hub-Mamba%20K1-blue" alt="Mamba K1"></a>
  <a href="https://huggingface.co/Subject-Emu-5259/NeuralAI-Powered-By-SmolLM2360"><img src="https://img.shields.io/badge/πŸ€—%20Hub-SmolLM2%20360M-purple" alt="SmolLM2 360M"></a>
  <a href="https://github.com/Subject-Emu-5259/NeuralAI"><img src="https://img.shields.io/badge/GitHub-NeuralAI-181717?logo=github" alt="GitHub"></a>
</p>

---

## πŸš€ Quick facts

| Property | Value |
| --- | --- |
| **Architecture** | Mamba SSM β€” `model_type: mamba` |
| **Class** | `MambaForCausalLM` |
| **Parameters** | ~130M (hidden size 768, 24 layers) |
| **State size** | 16 |
| **Vocabulary** | 50,280 |
| **Base model** | `state-spaces/mamba-130m-hf` |
| **Fine-tune method** | LoRA SFT, vocabulary-safe chat format |
| **LoRA config** | rank 16, alpha 32 (iterative v2/v3) |
| **Dataset** | NeuralAI seed set β€” assistant conversations spanning reasoning, code, math, writing, safety, and creative prompts |
| **Training runtime** | CPU/GPU SFT loops; iterative GGUF merge + quantization |
| **Formats in this repo** | Merged `safetensors` Β· Q4_K_M GGUF Β· F16 GGUF |
| **Status** | πŸ”¬ R&D / chat-format repair for future release |
| **License** | Apache 2.0 |

---

## 🧬 What is Mamba K1?

**Mamba K1** is the first model NeuralAI owns end-to-end. Unlike adapters on a third-party transformer, this model starts from a base Mamba SSM architecture and is trained, merged, and quantized into a self-contained artifact.

Mamba SSMs replace quadratic self-attention with a linear, state-space recurrence. That makes them fast at long context and cheap to serve β€” ideal for a local-first assistant that runs on modest hardware.

### Architecture highlights

- **Linear complexity** β€” \(O(n)\) sequence scaling instead of \(O(n^2)\) attention
- **Long context friendly** β€” state dimension is small and recurrent; context length grows efficiently
- **Pure-Python reference kernels** β€” uses `mambapy` so the model loads without custom CUDA
- **Reasonable footprint** β€” 130M params fits on CPU, edge devices, and budget GPUs

### NeuralAI model family

<img src="neuralai-duo-architecture.png" alt="NeuralAI two-model architecture" width="92%" />

| Model | Architecture | Parameters | Role | Status |
|-------|-------------|------------|------|--------|
| **🧬 Mamba K1** | Mamba SSM | 130M | NeuralAI's first owned base | πŸ”¬ R&D |
| **🧠 NeuralAI Powered by SmolLM2‑360M** | Transformer + LoRA | 360M | Live chat backend | ⚑ Active |

---

## 🧠 What K1 learned in training

The SFT curriculum taught the model to behave like an assistant across a deliberately small but diverse seed set:

- **Reasoning** β€” step-by-step breakdowns of classic puzzles, logic traps, and estimations
- **Code** β€” Python/JS/Go/Rust/SQL patterns plus debugging and refactoring guidance
- **Math** β€” algebra, combinatorics, probability
- **Writing** β€” drafts, haiku, product announcements, tone matching
- **Safety** β€” refusals and redirection for harmful requests, crisis resources, and age-inappropriate prompts
- **NeuralAI identity** β€” anchoring to the NeuralAI project, its creator, and local-first mission

> ⚠️ **Scale note:** 130M parameters is a research-capability checkpoint, not yet frontier-grade. K1 is the starting point for a fully owned NeuralAI model lineage.

---

## πŸ‹οΈ Training summary

<p align="center">
  <img src="neuralai-mamba-k1-training.png" alt="Mamba K1 training highlights" width="92%" />
</p>

| Phase | Detail |
|-------|--------|
| **Data** | Curated assistant seed set (reasoning, code, math, writing, safety, creative) |
| **Objective** | SFT on assistant-style completions |
| **Method** | LoRA SFT β†’ merge β†’ GGUF quantization |
| **Chat format** | NeuralAI "intel" format β€” uses only tokens present in the GPT-NeoX tokenizer (`<|endoftext|>`) |
| **Final train loss (checkpoint)** | 11.69 (down from ~13.5) |
| **Output formats** | Merged safetensors, Q4_K_M GGUF, F16 GGUF |

Full training logs, merge scripts, and the iteration runbook live in the main [NeuralAI repository](https://github.com/Subject-Emu-5259/NeuralAI).

---

## πŸ› οΈ Usage

### Load from Hugging Face β€” merged weights

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model = AutoModelForCausalLM.from_pretrained(
    "Subject-Emu-5259/NeuralAI-Mamba-K1",
    torch_dtype=torch.float32,
    trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
    "Subject-Emu-5259/NeuralAI-Mamba-K1",
    trust_remote_code=True,
)

messages = [{"role": "user", "content": "Write a haiku about debugging."}]
inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_tensors="pt",
)
out = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))
```

### Serve locally with llama.cpp

Use the Q4_K_M or F16 GGUF in this repo:

```bash
./llama-server \
  --model neuralai-mamba-k1-v3.Q4_K_M.gguf \
  --chat-format neuralai-intel \
  --port 1234
```

The NeuralAI model manager can point a local llama.cpp backend at this GGUF when K1 becomes the active inference target.

---

## 🧰 What Is NeuralAI?

**NeuralAI** is a local-first, private generative AI engine built by **De'Andrew Preston Harris**. It is the central intelligence layer of an ecosystem that includes:

- **NeuralAI Web UI** β€” chat, live terminal, file IDE, slash tools, and settings in one workspace
- **NeuralLabs** β€” a standalone downloadable intelligence environment
- **NeuralDrive** β€” private cloud storage and versioning
- **Agentic Orchestrator** β€” goal-driven manager/worker execution

The mission is simple: *your AI, on your hardware, under your control*.

---

## πŸ‘€ Who Created NeuralAI?

- **Founder & Lead Architect:** De'Andrew Preston Harris (D. Harris / Dre)
- **GitHub:** [@Subject-Emu-5259](https://github.com/Subject-Emu-5259)
- **LinkedIn:** [linkedin.com/in/deandrewharris94](https://linkedin.com/in/deandrewharris94/)
- **Location:** Memphis, Tennessee / West Memphis, Arkansas
- **Education:** AI Software Engineering at Maestro College

NeuralAI was built from resilience, fatherhood, and the belief that personal computing deserves personal intelligence. Every release is handcrafted, iterated, and documented in the open.

---

## 🏒 About NeuralAI (The Project)

| | |
|---|---|
| **Project / Brand** | NeuralAI |
| **Motto** | *Your AI. On your hardware. In your browser.* |
| **Values** | Privacy, ownership, local-first computing, disciplined iteration, open weights |
| **Primary Repository** | [github.com/Subject-Emu-5259/NeuralAI](https://github.com/Subject-Emu-5259/NeuralAI) |
| **Model Collection** | [huggingface.co/Subject-Emu-5259](https://huggingface.co/Subject-Emu-5259) |
| **License** | Apache 2.0 |

NeuralAI is not a closed SaaS product. It is a living open-weights research project becoming a sustainable AI software company built by one determined builder and the community around him.

---

## ⚠️ Limitations

- **Scale:** 130M parameters is early-stage; long-form reasoning, coding, and deep recall are limited.
- **Chat format sensitivity:** Use the NeuralAI "intel" format; other templates may produce token soup because the tokenizer lacks common chat special tokens.
- **Training maturity:** Chat coherence training is ongoing; expect looping, echoing, or drift on longer contexts.
- **No internet:** The model has no live web access unless paired with NeuralAI's tool layer.

---

## πŸ“Š NeuralAI Powered by SmolLM2 β€” the active chat model

Right now NeuralAI's live chat backend is the awareness-tuned **SmolLM2-360M** model. While K1 matures, that model handles everyday assistant tasks:

<p align="center">
  <img src="neuralai-model-comparison.png" alt="NeuralAI model comparison" width="92%" />
</p>

- **Repo:** [huggingface.co/Subject-Emu-5259/NeuralAI-Powered-By-SmolLM2360](https://huggingface.co/Subject-Emu-5259/NeuralAI-Powered-By-SmolLM2360)

---

## πŸ“š Related Resources

| Resource | Link |
|----------|------|
| Main repository | [github.com/Subject-Emu-5259/NeuralAI](https://github.com/Subject-Emu-5259/NeuralAI) |
| Active chat model | [huggingface.co/Subject-Emu-5259/NeuralAI-Powered-By-SmolLM2360](https://huggingface.co/Subject-Emu-5259/NeuralAI-Powered-By-SmolLM2360) |
| Creator LinkedIn | [linkedin.com/in/deandrewharris94](https://linkedin.com/in/deandrewharris94/) |

---

## πŸ“– Citation

```bibtex
@software{neuralai_mamba_k1_2026,
  author       = {Harris, De'Andrew Preston},
  title        = {NeuralAI β€” Mamba K1},
  year         = {2026},
  url          = {https://huggingface.co/Subject-Emu-5259/NeuralAI-Mamba-K1},
  version      = {v3},
  description  = {NeuralAI's first owned Mamba SSM base model (130M) for local-first AI research}
}
```

---

*Built with discipline by De'Andrew Preston Harris. Maintained in the open. Updated whenever the model, dataset, or project state changes.*