Subject-Emu-5259 commited on
Commit
48a3deb
·
verified ·
1 Parent(s): db30ef1

docs: mirror full GitHub project README as PROJECT.md

Browse files
Files changed (1) hide show
  1. PROJECT.md +311 -0
PROJECT.md ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ library_name: peft
5
+ license: apache-2.0
6
+ tags:
7
+ - lora
8
+ - conversational
9
+ - text-generation
10
+ - peft
11
+ - smollm2
12
+ - dpo
13
+ - fine-tuned
14
+ model_id: Subject-Emu-5259/NeuralAI
15
+ base_model: HuggingFaceTB/SmolLM2-360M-Instruct
16
+ inference: false
17
+ ---
18
+
19
+ # 🧠 NeuralAI: The Generative AI Engine
20
+
21
+ <img src="neuralai_banner.svg" alt="NeuralAI - Your AI. On your hardware. In your browser." />
22
+
23
+ ## 📊 Repository Composition
24
+
25
+ | Language | Percentage |
26
+ | --- | --- |
27
+ | Python | 71.1% |
28
+ | HTML | 13.0% |
29
+ | JavaScript | 12.4% |
30
+ | CSS | 2.6% |
31
+ | Shell | 0.4% |
32
+ | Jupyter Notebook | 0.3% |
33
+ | Jinja | 0.2% |
34
+
35
+ **The High-Velocity Model for Your Entire Vibe Stack**
36
+
37
+ 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\[...\]
38
+
39
+ ---
40
+
41
+ ## 🌟 Vision & Manifesto
42
+
43
+ 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\[...\]
44
+
45
+ Born from resilience and ambition in Memphis, Tennessee and West Memphis, Arkansas, NeuralAI represents a forward-thinking approach to personal, private AI computing.
46
+
47
+ ---
48
+
49
+ ## 🛠️ Tech Stack & Architecture (v7.2)
50
+
51
+ 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.
52
+
53
+ ### Core Stack
54
+
55
+ - **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
56
+ - **Inference Engine**: [llmster](https://lmstudio.ai/docs/cli) (LM Studio headless) — OpenAI-compatible API with continuous batching, running via llama.cpp
57
+ - **Vocal Identity**: Andrew (Warm/Multilingual) — Optimized for Live Speech-to-Speech (S2S)
58
+ - **Backend Framework**: Python / Flask (Core Service) — routes to llmster or local PyTorch
59
+ - **Storage & Database**: SQLite3 (Metadata) + Nextcloud Hub via NeuralCloud WebDAV Client (NeuralDrive)
60
+ - **Frontend UI**: Vanilla JS, HTML5, CSS3 with an advanced Dark Mode layout
61
+
62
+ ### Pluggable LLM Backend
63
+
64
+ NeuralAI supports multiple inference backends via the `LLM_BACKEND` environment variable:
65
+
66
+ | Backend | `LLM_BACKEND` | API Endpoint | Use Case |
67
+ | --- | --- | --- | --- |
68
+ | **llmster** (recommended) | `lmstudio` | `http://localhost:1234/v1` | Headless GPU/CPU inference |
69
+ | **Ollama** | `ollama` | `http://localhost:11434/v1` | Local Ollama server |
70
+ | **OpenAI-compatible** | `openai_compatible` | Any OpenAI API URL | Remote/cloud inference |
71
+ | **Local PyTorch** | `local` | Built-in transformers | Loads BASE_MODEL + LoRA at MODEL_PATH in float16 (your own model) |
72
+ | **ZO Native (fallback)** | `zo` | `https://api.zo.computer/zo/ask` | Routes to Zo's own assistant (HY3) — **NOT** your NeuralAI model; last-resort only |
73
+ ### Resilient Launcher (2026-07-15)
74
+ The service entrypoint is now `run_service.sh`, which auto-selects the backend at boot:
75
+ 1. Starts **llmster** (LM Studio) headless on port 1234 and loads the `smollm2-360m-instruct` GGUF.
76
+ 2. If llmster is reachable, sets `LLM_BACKEND=openai_compatible` → `http://localhost:1234/v1` (recommended; low RAM).
77
+ 3. Only if llmster is unavailable does it fall back to the local PyTorch backend.
78
+
79
+ 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.
80
+
81
+ > **Hosting on ZO Computer (4 GB RAM):** set `LLM_BACKEND=local`. The service loads `BASE_MODEL`
82
+ > (default `HuggingFaceTB/SmolLM2-360M-Instruct`) and applies the LoRA at `MODEL_PATH`
83
+ > (default `checkpoints/v2_model`) in float16 (~720 MB), which fits the 4 GB host. **Do not use
84
+ > `LLM_BACKEND=zo` for the chat UI** — it proxies to Zo's assistant and answers as "Zo Computer's
85
+ > assistant" instead of your trained model.
86
+
87
+ ```bash
88
+ # Example: start NeuralAI with llmster backend
89
+ LLM_BACKEND=lmstudio LLM_API_URL=http://localhost:1234/v1 LLM_MODEL=smollm2 \
90
+ python3 services/neural_core_service.py
91
+ ```
92
+
93
+ ### Core Architectural Pillars
94
+
95
+ 1. **NeuralAI Core**: Handles chat state, direct model inference, terminal session proxying, and tool orchestration.
96
+ 2. **NeuralDrive (Cloud Storage)**: The intelligent data layer for all projects, featuring isolated user storage, automatic versioning, and semantic mapping.
97
+ 3. **Diffusion Engine**: An integrated generative diffusion layer for producing visual branding assets, UI mockups, and visual logic maps.
98
+ 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.
99
+
100
+ ---
101
+ ### 🆕 What's New (v7.3.1)
102
+
103
+ - **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`.
104
+ - **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.
105
+ - **Generated images render in chat**: Image-generation responses are parsed as Markdown and displayed inline.
106
+ - **No more self-talk**: Chat now uses the ChatML prompt template (`apply_chat_template`), matching the model's training format.
107
+ - **NeuralDrive upload reliability**: The file list correctly handles API response shapes after an upload.
108
+ - **Dark theme by default**: UI restores your saved theme and defaults to dark mode (fixes white file-cards in light mode).
109
+ - **Phase 8 in progress**: Knowledge Graph & Agentic Autonomy — long-term cross-project memory ("Supermemory") and fully autonomous task execution.
110
+ - **The NeuralLabs Shift**: NeuralAI is evolving into a standalone, downloadable intelligence environment (NeuralLabs v1 Client → v2 Edge → v3 Eco).
111
+ - **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`.
112
+ ## 🚀 Deployment & Model Distribution
113
+
114
+ - **Source (GitHub)**: [Subject-Emu-5259/NeuralAI](https://github.com/Subject-Emu-5259/NeuralAI)
115
+ - **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`.
116
+ - **Hosted demo**: `neuralai-web-ui-deandrewharris.zocomputer.io` (ZO Computer) — runs the local backend so chat uses the trained model directly.
117
+
118
+ To publish the LoRA to Hugging Face:
119
+
120
+ ```bash
121
+ pip install huggingface_hub
122
+ HF_TOKEN=<your-write-token> python3 -c "
123
+ from huggingface_hub import HfApi
124
+ api = HfApi()
125
+ api.upload_folder(
126
+ folder_path='checkpoints/v2_model',
127
+ repo_id='Subject-Emu-5259/NeuralAI',
128
+ repo_type='model',
129
+ commit_message='NeuralAI SmolLM2-360M SFT v16 + DPO v16 LoRA',
130
+ )
131
+ "
132
+ ```
133
+
134
+ ## ✨ Key Features & Capabilities
135
+
136
+ ### 💬 Multimodal Chat & Agentic Intelligence
137
+
138
+ - **High-Velocity Text Inference**: Fast, local inference with deep context awareness.
139
+ - **Deep Reasoning Mode**: Integration of test-time compute and chain-of-thought reasoning for complex problem decomposition and error-free logic.
140
+ - **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.
141
+ - **Live S2S (Speech-to-Speech)**: Real-time voice interaction with an integrated microphone interface and fluid vocal responses.
142
+ - **Identity Vault & Memory**: Persistent user memory and rule constraints, ensuring NeuralAI remembers preferences, behavioral rules, and historical context.
143
+
144
+ ### 💻 Developer & Engineering Tools
145
+
146
+ - **Integrated Web Terminal**: A fully functional, WebSocket-driven terminal embedded directly in the web UI for immediate environment control.
147
+ - **File Workspace**: An in-browser IDE experience allowing users to browse directories, read, and write code seamlessly.
148
+ - **Code Execution & Sandbox**: Secure environment for the model to execute and test code on the fly.
149
+
150
+ ### 🔐 Authentication & Access Tiers
151
+
152
+ - **Founder Mode**: Ultimate root-level access and system control.
153
+ - **Maestro Student Portal**: Tiered access for educational and collaborative development.
154
+ - **Guest Preview**: Frictionless instant access for testing the system without an account.
155
+
156
+ ---
157
+
158
+ ## 🏋️ Model Training & Fine-Tuning (DPO)
159
+
160
+ NeuralAI is continuously learning and improving through rigorous **Direct Preference Optimization (DPO)**.
161
+
162
+ ### Training Pipeline
163
+
164
+ ```python
165
+ # Example of the DPO alignment configuration used in NeuralAI
166
+ dpo_config = DPOConfig(
167
+ beta=0.1,
168
+ learning_rate=5e-5,
169
+ per_device_train_batch_size=4,
170
+ gradient_accumulation_steps=4,
171
+ max_length=1024,
172
+ max_prompt_length=512,
173
+ )
174
+ ```
175
+
176
+ - **Dataset Expansions**: The dataset is aggressively expanded to include advanced reasoning, complex mathematics, logical deduction, creative writing, and system debugging.
177
+ - **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.
178
+ - **Model Drift Monitoring**: Continuous evaluation against previous checkpoints to ensure response quality and consistency never regress.
179
+
180
+ ### Latest Alignment Run: v15.0
181
+
182
+ - **Training samples**: 597 (expanded DPO preference pairs)
183
+ - **Epochs**: 3
184
+ - **Steps**: 450
185
+ - **Final training loss**: `0.305`
186
+ - **Reward margin**: improved from `~0.5` → `~3.5` (model strongly prefers chosen responses)
187
+ - **Hardware**: Apple Silicon MPS (MacBook Air M4)
188
+ - **Run duration**: `730.5s` (~12m 11s)
189
+ - **Completed**: `2026-07-11 20:00 UTC`
190
+ - **Adapter**: live on Hugging Face at [`Subject-Emu-5259/NeuralAI`](https://huggingface.co/Subject-Emu-5259/NeuralAI)
191
+
192
+ > 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.
193
+
194
+ ---
195
+
196
+ ## 📸 Brand & UI Gallery
197
+
198
+ *(UI screenshots showcase the beautiful dark mode interface, the terminal integration, and the NeuralDrive file explorer.)*
199
+
200
+ ```html
201
+ <!-- Example Frontend UI Component Structure -->
202
+ <div class="neural-chat-container">
203
+ <div class="message-bubble ai-response">
204
+ NeuralAI: System optimal. Ready for execution.
205
+ </div>
206
+ </div>
207
+ ```
208
+
209
+ ---
210
+
211
+ ## 🗺️ Implementation Roadmap
212
+
213
+ - ✅ **Phase 1: Alignment** - DPO training for Founder context and optimal engineering tone.
214
+ - ✅ **Phase 2: NeuralDrive** - Deployment of the Cloud Storage File Server.
215
+ - ✅ **Phase 3: Terminal UI** - Integrated command-line access within the browser.
216
+ - ✅ **Phase 4: Live S2S** - High-velocity Live Speech-to-Speech conversations.
217
+ - ✅ **Phase 5: "Founder Mode"** - Enhancements to vocal profile and streamlined UI.
218
+ - ✅ **Phase 6: Frontend Polish** - Dark themes, real-time code execution display, UI stability.
219
+ - ✅ **Phase 7: Diffusion Integration** - Implementation of Text2Img & Img2Img capabilities.
220
+ - 🚀 **Phase 8: Knowledge Graph & Agentic Autonomy** - Advanced long-term memory for cross-project context, "Supermemory" features, and fully autonomous task execution.
221
+
222
+ ---
223
+
224
+ ## 🎯 Future Vision: The Software Transition
225
+
226
+ NeuralAI is evolving from a workspace-bound assistant into a standalone, downloadable intelligence environment.
227
+
228
+ **Project Code Name**: `NeuralLabs` (Working Title)
229
+ **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.
230
+
231
+ ### 🚀 Roadmap Addition: The NeuralLabs Shift
232
+
233
+ - **NeuralLabs v1 (Client)**: Development of a cross-platform wrapper (Electron/Tauri) for the NeuralAI interface.
234
+ - **NeuralLabs v2 (Edge)**: Local model execution (Llama/Mistral) as a fallback for the cloud-based NeuralAI core.
235
+ - **NeuralLabs v3 (Eco)**: Plugin architecture allowing third-party "Neural-Skills" to be installed as standalone apps.
236
+
237
+ ---
238
+
239
+ ## 👨‍💻 The Developer & Architect
240
+
241
+ **De'Andrew Preston Harris** (D. Harris / Dre)
242
+ *Founder & Architect of NeuralAI*
243
+
244
+ 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\[...\]
245
+
246
+ - **Location:** Memphis, TN / West Memphis, AR
247
+ - **Vision:** Building the future of private, high-performance generative AI.
248
+ - [LinkedIn](https://www.linkedin.com/in/deandrewharris94/) | [GitHub](https://github.com/Subject-Emu-5259)
249
+
250
+ ---
251
+
252
+ *Built with precision and discipline by De'Andrew Preston Harris.*
253
+
254
+ ### CURRENT VERSION: v7.3.2 (The Pluggable Engine)
255
+
256
+ - **Model Alignment**: DPO v15.0 Aligned (597 pairs, Logic, Debugging, Reasoning)
257
+ - **Inference**: llmster (LM Studio headless) — 258MB RAM vs 5GB PyTorch
258
+ - **Last Maintenance**: July 14, 2026
259
+
260
+ Your tone is technical, concise, and professional. You prioritize system stability and cleanliness above all else.
261
+
262
+ ---
263
+
264
+ ## 🚀 Deployment
265
+
266
+ NeuralAI ships with a pluggable backend that separates the web UI from the inference engine.
267
+
268
+ ### Quick Start (llmster — recommended)
269
+
270
+ ```bash
271
+ # 1. Install llmster (one-time)
272
+ curl -fsSL https://lmstudio.ai/install.sh | bash
273
+ export PATH="$HOME/.lmstudio/bin:$PATH"
274
+
275
+ # 2. Download model
276
+ lms import /path/to/SmolLM2-360M-Instruct-Q4_K_M.gguf --user-repo "bartowski/SmolLM2-360M-Instruct-GGUF" -y
277
+ lms load smollm2-360m-instruct -y --identifier smollm2
278
+
279
+ # 3. Start inference server
280
+ lms server start --port 1234
281
+
282
+ # 4. Start NeuralAI
283
+ cd NeuralAI
284
+ LLM_BACKEND=lmstudio LLM_API_URL=http://localhost:1234/v1 LLM_MODEL=smollm2 \
285
+ python3 services/neural_core_service.py
286
+ ```
287
+
288
+ ### Containerized Deployments
289
+
290
+ | Deployment | Dockerfile | Stack | Status |
291
+ | --- | --- | --- | --- |
292
+ | **Gradio Demo** | `gradio_space/Dockerfile` | Gradio 6.x chat UI | ✅ Built & deployed |
293
+ | **Flask Web Chat** | `webui_space/Dockerfile` | Flask + `neural_core_service.py` | 🚀 Ready for Railway |
294
+
295
+ - **Adapter source**: [`Subject-Emu-5259/NeuralAI`](https://huggingface.co/Subject-Emu-5259/NeuralAI) ��� auto-pulled on startup via `snapshot_download`.
296
+ - **GitHub → HF sync**: `.github/workflows/sync_to_huggingface.yml` uploads only the LoRA adapter on every push to `master`.
297
+
298
+ ---
299
+
300
+ # 🌌 NeuralAI Project Manifest
301
+
302
+ NeuralAI is the intelligence core that powers the ecosystem.
303
+
304
+ ## 🔗 Ecosystem Integration
305
+ The standalone software implementation of this core is **NeuralLabs**:
306
+ 👉 [https://github.com/Subject-Emu-5259/NeuralLabs](https://github.com/Subject-Emu-5259/NeuralLabs)
307
+
308
+ **Software Downloads**:
309
+ The latest beta builds (v0.1-Beta) of NeuralLabs are available at:
310
+ 👉 **[https://zo.pub/deandrewharris/neurallabs-beta](https://zo.pub/deandrewharris/neurallabs-beta)**
311
+ # NeuralAI → Hugging Face sync is live