File size: 15,767 Bytes
48a3deb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
---
language:
  - en
library_name: peft
license: apache-2.0
tags:
  - lora
  - conversational
  - text-generation
  - peft
  - smollm2
  - dpo
  - fine-tuned
model_id: Subject-Emu-5259/NeuralAI
base_model: HuggingFaceTB/SmolLM2-360M-Instruct
inference: false
---

# 🧠 NeuralAI: The Generative AI Engine

<img src="neuralai_banner.svg" alt="NeuralAI - Your AI. On your hardware. In your browser." />

## 📊 Repository Composition

| Language | Percentage |
| --- | --- |
| Python | 71.1% |
| HTML | 13.0% |
| JavaScript | 12.4% |
| CSS | 2.6% |
| Shell | 0.4% |
| Jupyter Notebook | 0.3% |
| Jinja | 0.2% |

**The High-Velocity Model for Your Entire Vibe Stack**

NeuralAI is the central intelligence engine developed by **De'Andrew Preston Harris**. Conceived and engineered by **De'Andrew Preston Harris** (Founder), it is a highly tuned, DPO-aligned multimodal AI ec\[...\]

---

## 🌟 Vision & Manifesto

NeuralAI doesn't just predict text; it *operates the work*. The core mission is to create a multimodal generative system that bridges the gap between raw idea and execution. By fusing autoregressi\[...\]

Born from resilience and ambition in Memphis, Tennessee and West Memphis, Arkansas, NeuralAI represents a forward-thinking approach to personal, private AI computing.

---

## 🛠️ Tech Stack & Architecture (v7.2)

NeuralAI is built on a high-performance architecture that decouples the inference engine from the web interface, enabling lightweight cloud hosting with powerful local inference.

### Core Stack

- **Core Model**: `SmolLM2-360M-Instruct` fine-tuned with the custom **SFT v16 + DPO v16 LoRA** at `checkpoints/v2_model` — aligned for logic, math, multi-step reasoning, and debugging
- **Inference Engine**: [llmster](https://lmstudio.ai/docs/cli) (LM Studio headless) — OpenAI-compatible API with continuous batching, running via llama.cpp
- **Vocal Identity**: Andrew (Warm/Multilingual) — Optimized for Live Speech-to-Speech (S2S)
- **Backend Framework**: Python / Flask (Core Service) — routes to llmster or local PyTorch
- **Storage & Database**: SQLite3 (Metadata) + Nextcloud Hub via NeuralCloud WebDAV Client (NeuralDrive)
- **Frontend UI**: Vanilla JS, HTML5, CSS3 with an advanced Dark Mode layout

### Pluggable LLM Backend

NeuralAI supports multiple inference backends via the `LLM_BACKEND` environment variable:

| Backend | `LLM_BACKEND` | API Endpoint | Use Case |
| --- | --- | --- | --- |
| **llmster** (recommended) | `lmstudio` | `http://localhost:1234/v1` | Headless GPU/CPU inference |
| **Ollama** | `ollama` | `http://localhost:11434/v1` | Local Ollama server |
| **OpenAI-compatible** | `openai_compatible` | Any OpenAI API URL | Remote/cloud inference |
| **Local PyTorch** | `local` | Built-in transformers | Loads BASE_MODEL + LoRA at MODEL_PATH in float16 (your own model) |
| **ZO Native (fallback)** | `zo` | `https://api.zo.computer/zo/ask` | Routes to Zo's own assistant (HY3) — **NOT** your NeuralAI model; last-resort only |
### Resilient Launcher (2026-07-15)
The service entrypoint is now `run_service.sh`, which auto-selects the backend at boot:
1. Starts **llmster** (LM Studio) headless on port 1234 and loads the `smollm2-360m-instruct` GGUF.
2. If llmster is reachable, sets `LLM_BACKEND=openai_compatible``http://localhost:1234/v1` (recommended; low RAM).
3. Only if llmster is unavailable does it fall back to the local PyTorch backend.

This guarantees the chat always has a live backend (no more 503/401 "model not authed" stalls) and keeps RAM low (llmster ~1.1 GB vs ~6 GB for local transformers), so the UI no longer freezes under memory pressure.

> **Hosting on ZO Computer (4 GB RAM):** set `LLM_BACKEND=local`. The service loads `BASE_MODEL`
> (default `HuggingFaceTB/SmolLM2-360M-Instruct`) and applies the LoRA at `MODEL_PATH`
> (default `checkpoints/v2_model`) in float16 (~720 MB), which fits the 4 GB host. **Do not use
> `LLM_BACKEND=zo` for the chat UI** — it proxies to Zo's assistant and answers as "Zo Computer's
> assistant" instead of your trained model.

```bash
# Example: start NeuralAI with llmster backend
LLM_BACKEND=lmstudio LLM_API_URL=http://localhost:1234/v1 LLM_MODEL=smollm2 \
  python3 services/neural_core_service.py
```

### Core Architectural Pillars

1. **NeuralAI Core**: Handles chat state, direct model inference, terminal session proxying, and tool orchestration.
2. **NeuralDrive (Cloud Storage)**: The intelligent data layer for all projects, featuring isolated user storage, automatic versioning, and semantic mapping.
3. **Diffusion Engine**: An integrated generative diffusion layer for producing visual branding assets, UI mockups, and visual logic maps.
4. **Agentic Orchestrator**: A high-autonomy layer enabling NeuralAI to plan, reason, and execute multi-step workflows across the OS and web, moving beyond simple chat to active goal achievement.

---
### 🆕 What's New (v7.3.1)

- **Developer / API Access (BYO API)**: Generate a personal API key from Settings to use NeuralAI as an OpenAI-compatible backend on other hosts (e.g. ZO Computer's "Bring Your Own Key"). Exposes `/v1/chat/completions` (SSE, CORS-enabled) and `/v1/models`; Base URL is `https://neuralai-web-ui-deandrewharris.zocomputer.io/v1`, model id is `neuralai`. Keys are hashed and revocable. Full ZO Computer setup walkthrough: `docs/BYOK_ZO_INTEGRATION.md`.
- **Auto Release Notes ("What's New")**: A new top-bar panel surfaces the latest features and fixes automatically. Open it anytime via the ✨ **What's New** button.
- **Generated images render in chat**: Image-generation responses are parsed as Markdown and displayed inline.
- **No more self-talk**: Chat now uses the ChatML prompt template (`apply_chat_template`), matching the model's training format.
- **NeuralDrive upload reliability**: The file list correctly handles API response shapes after an upload.
- **Dark theme by default**: UI restores your saved theme and defaults to dark mode (fixes white file-cards in light mode).
- **Phase 8 in progress**: Knowledge Graph & Agentic Autonomy — long-term cross-project memory ("Supermemory") and fully autonomous task execution.
- **The NeuralLabs Shift**: NeuralAI is evolving into a standalone, downloadable intelligence environment (NeuralLabs v1 Client → v2 Edge → v3 Eco).
- **v7.3.2 — Backend identity fix (ZO hosting)**: The hosted service now runs `LLM_BACKEND=local` so chat uses *your* SmolLM2-360M + SFT/DPO v16 LoRA. The previous `zo` fallback proxied to Zo's assistant and answered as "I'm Zo Computer's assistant" — that was a routing bug, not your model. See `docs/INCIDENT-2026-07-14-NEURALAI-PAUSES.md`.
## 🚀 Deployment & Model Distribution

- **Source (GitHub)**: [Subject-Emu-5259/NeuralAI](https://github.com/Subject-Emu-5259/NeuralAI)
- **Model (Hugging Face)**: [Subject-Emu-5259/NeuralAI](https://huggingface.co/Subject-Emu-5259/NeuralAI) — merged SmolLM2-360M + SFT v16/DPO v16 LoRA weights (drop-in, no PEFT needed). The LoRA adapter is also in `checkpoints/v2_model`.
- **Hosted demo**: `neuralai-web-ui-deandrewharris.zocomputer.io` (ZO Computer) — runs the local backend so chat uses the trained model directly.

To publish the LoRA to Hugging Face:

```bash
pip install huggingface_hub
HF_TOKEN=<your-write-token> python3 -c "
from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(
    folder_path='checkpoints/v2_model',
    repo_id='Subject-Emu-5259/NeuralAI',
    repo_type='model',
    commit_message='NeuralAI SmolLM2-360M SFT v16 + DPO v16 LoRA',
)
"
```

## ✨ Key Features & Capabilities

### 💬 Multimodal Chat & Agentic Intelligence

- **High-Velocity Text Inference**: Fast, local inference with deep context awareness.
- **Deep Reasoning Mode**: Integration of test-time compute and chain-of-thought reasoning for complex problem decomposition and error-free logic.
- **Autonomous Agentic Workflows**: Ability to operate as an agent—interacting with the browser, terminal, and third-party apps to complete end-to-end tasks with minimal supervision.
- **Live S2S (Speech-to-Speech)**: Real-time voice interaction with an integrated microphone interface and fluid vocal responses.
- **Identity Vault & Memory**: Persistent user memory and rule constraints, ensuring NeuralAI remembers preferences, behavioral rules, and historical context.

### 💻 Developer & Engineering Tools

- **Integrated Web Terminal**: A fully functional, WebSocket-driven terminal embedded directly in the web UI for immediate environment control.
- **File Workspace**: An in-browser IDE experience allowing users to browse directories, read, and write code seamlessly.
- **Code Execution & Sandbox**: Secure environment for the model to execute and test code on the fly.

### 🔐 Authentication & Access Tiers

- **Founder Mode**: Ultimate root-level access and system control.
- **Maestro Student Portal**: Tiered access for educational and collaborative development.
- **Guest Preview**: Frictionless instant access for testing the system without an account.

---

## 🏋️ Model Training & Fine-Tuning (DPO)

NeuralAI is continuously learning and improving through rigorous **Direct Preference Optimization (DPO)**.

### Training Pipeline

```python
# Example of the DPO alignment configuration used in NeuralAI
dpo_config = DPOConfig(
    beta=0.1,
    learning_rate=5e-5,
    per_device_train_batch_size=4,
    gradient_accumulation_steps=4,
    max_length=1024,
    max_prompt_length=512,
)
```

- **Dataset Expansions**: The dataset is aggressively expanded to include advanced reasoning, complex mathematics, logical deduction, creative writing, and system debugging.
- **Behavioral Alignment**: NeuralAI is aligned using Gemini-style behavioral principles—prioritizing safety, structured reasoning, helpful conversational flow, and transparent step-by-step explanations. Training enforces clear Markdown formatting, code-first responses, and rejection of boilerplate or overly verbose outputs.
- **Model Drift Monitoring**: Continuous evaluation against previous checkpoints to ensure response quality and consistency never regress.

### Latest Alignment Run: v15.0

- **Training samples**: 597 (expanded DPO preference pairs)
- **Epochs**: 3
- **Steps**: 450
- **Final training loss**: `0.305`
- **Reward margin**: improved from `~0.5` → `~3.5` (model strongly prefers chosen responses)
- **Hardware**: Apple Silicon MPS (MacBook Air M4)
- **Run duration**: `730.5s` (~12m 11s)
- **Completed**: `2026-07-11 20:00 UTC`
- **Adapter**: live on Hugging Face at [`Subject-Emu-5259/NeuralAI`](https://huggingface.co/Subject-Emu-5259/NeuralAI)

> The v15 dataset (`data/train_dpo_v15.jsonl`) was generated by expanding the template pools in `training/build_dataset_v15.py` from 302 → 597 unique preference pairs covering code correctness, logic, reasoning, debugging, and multi-step tasks.

---

## 📸 Brand & UI Gallery

*(UI screenshots showcase the beautiful dark mode interface, the terminal integration, and the NeuralDrive file explorer.)*

```html
<!-- Example Frontend UI Component Structure -->
<div class="neural-chat-container">
  <div class="message-bubble ai-response">
    NeuralAI: System optimal. Ready for execution.
  </div>
</div>
```

---

## 🗺️ Implementation Roadmap

- ✅ **Phase 1: Alignment** - DPO training for Founder context and optimal engineering tone.
- ✅ **Phase 2: NeuralDrive** - Deployment of the Cloud Storage File Server.
- ✅ **Phase 3: Terminal UI** - Integrated command-line access within the browser.
- ✅ **Phase 4: Live S2S** - High-velocity Live Speech-to-Speech conversations.
- ✅ **Phase 5: "Founder Mode"** - Enhancements to vocal profile and streamlined UI.
- ✅ **Phase 6: Frontend Polish** - Dark themes, real-time code execution display, UI stability.
- ✅ **Phase 7: Diffusion Integration** - Implementation of Text2Img & Img2Img capabilities.
- 🚀 **Phase 8: Knowledge Graph & Agentic Autonomy** - Advanced long-term memory for cross-project context, "Supermemory" features, and fully autonomous task execution.

---

## 🎯 Future Vision: The Software Transition

NeuralAI is evolving from a workspace-bound assistant into a standalone, downloadable intelligence environment.

**Project Code Name**: `NeuralLabs` (Working Title)
**Vision**: A local-first, AI-native operating environment that integrates the Agentic Orchestrator, World-Brain, and NeuralDrive into a seamless desktop experience—similar to the "Codex" model but expanded into a full cognitive workspace.

### 🚀 Roadmap Addition: The NeuralLabs Shift

- **NeuralLabs v1 (Client)**: Development of a cross-platform wrapper (Electron/Tauri) for the NeuralAI interface.
- **NeuralLabs v2 (Edge)**: Local model execution (Llama/Mistral) as a fallback for the cloud-based NeuralAI core.
- **NeuralLabs v3 (Eco)**: Plugin architecture allowing third-party "Neural-Skills" to be installed as standalone apps.

---

## 👨‍💻 The Developer & Architect

**De'Andrew Preston Harris** (D. Harris / Dre)
*Founder & Architect of NeuralAI*

A dedicated software engineer, thinker, and builder from West Memphis, AR. De'Andrew is currently pursuing an AAS in AI Software Engineering at Maestro College. NeuralAI is the culmination of his\[...\]

- **Location:** Memphis, TN / West Memphis, AR
- **Vision:** Building the future of private, high-performance generative AI.
- [LinkedIn](https://www.linkedin.com/in/deandrewharris94/) | [GitHub](https://github.com/Subject-Emu-5259)

---

*Built with precision and discipline by De'Andrew Preston Harris.*

### CURRENT VERSION: v7.3.2 (The Pluggable Engine)

- **Model Alignment**: DPO v15.0 Aligned (597 pairs, Logic, Debugging, Reasoning)
- **Inference**: llmster (LM Studio headless) — 258MB RAM vs 5GB PyTorch
- **Last Maintenance**: July 14, 2026

Your tone is technical, concise, and professional. You prioritize system stability and cleanliness above all else.

---

## 🚀 Deployment

NeuralAI ships with a pluggable backend that separates the web UI from the inference engine.

### Quick Start (llmster — recommended)

```bash
# 1. Install llmster (one-time)
curl -fsSL https://lmstudio.ai/install.sh | bash
export PATH="$HOME/.lmstudio/bin:$PATH"

# 2. Download model
lms import /path/to/SmolLM2-360M-Instruct-Q4_K_M.gguf --user-repo "bartowski/SmolLM2-360M-Instruct-GGUF" -y
lms load smollm2-360m-instruct -y --identifier smollm2

# 3. Start inference server
lms server start --port 1234

# 4. Start NeuralAI
cd NeuralAI
LLM_BACKEND=lmstudio LLM_API_URL=http://localhost:1234/v1 LLM_MODEL=smollm2 \
  python3 services/neural_core_service.py
```

### Containerized Deployments

| Deployment | Dockerfile | Stack | Status |
| --- | --- | --- | --- |
| **Gradio Demo** | `gradio_space/Dockerfile` | Gradio 6.x chat UI | ✅ Built & deployed |
| **Flask Web Chat** | `webui_space/Dockerfile` | Flask + `neural_core_service.py` | 🚀 Ready for Railway |

- **Adapter source**: [`Subject-Emu-5259/NeuralAI`](https://huggingface.co/Subject-Emu-5259/NeuralAI) — auto-pulled on startup via `snapshot_download`.
- **GitHub → HF sync**: `.github/workflows/sync_to_huggingface.yml` uploads only the LoRA adapter on every push to `master`.

---

# 🌌 NeuralAI Project Manifest

NeuralAI is the intelligence core that powers the ecosystem.

## 🔗 Ecosystem Integration
The standalone software implementation of this core is **NeuralLabs**:
👉 [https://github.com/Subject-Emu-5259/NeuralLabs](https://github.com/Subject-Emu-5259/NeuralLabs)

**Software Downloads**:
The latest beta builds (v0.1-Beta) of NeuralLabs are available at:
👉 **[https://zo.pub/deandrewharris/neurallabs-beta](https://zo.pub/deandrewharris/neurallabs-beta)**
# NeuralAI → Hugging Face sync is live