Update README with setup instructions and project structure
Browse files
README.md
CHANGED
|
@@ -97,6 +97,32 @@ User → React Frontend → Express Proxy → Neural Daemon (FastAPI, :8766)
|
|
| 97 |
Updated adapter for next query
|
| 98 |
```
|
| 99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
## Hardware
|
| 101 |
|
| 102 |
- Apple Silicon Mac (M-series)
|
|
@@ -114,17 +140,40 @@ User → React Frontend → Express Proxy → Neural Daemon (FastAPI, :8766)
|
|
| 114 |
| Regularization | ≥33% | Below this: catastrophic forgetting |
|
| 115 |
| Batch size | 1 | Per-example steps; batching doesn't help |
|
| 116 |
|
| 117 |
-
##
|
| 118 |
|
| 119 |
```bash
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
python3 src/mlx_lora_trainer.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
# Full E2E
|
| 126 |
-
python3 src/neural_daemon.py # Terminal 1
|
| 127 |
-
curl -X POST http://localhost:8766/activate -d '{"hf_repo":"Qwen/Qwen3.5-2B-Base"}'
|
| 128 |
python3 tests/test_daemon_e2e.py # 4 facts, 20s
|
| 129 |
python3 tests/test_deep_e2e.py # 41 facts, 121s
|
| 130 |
python3 tests/test_statistical_e2e.py # 35+ facts, 3 trials, ~4 min
|
|
@@ -143,4 +192,4 @@ python3 tests/test_statistical_e2e.py # 35+ facts, 3 trials, ~4 min
|
|
| 143 |
|
| 144 |
## License
|
| 145 |
|
| 146 |
-
MIT License
|
|
|
|
| 97 |
Updated adapter for next query
|
| 98 |
```
|
| 99 |
|
| 100 |
+
## Project Structure
|
| 101 |
+
|
| 102 |
+
```
|
| 103 |
+
├── src/
|
| 104 |
+
│ ├── mlx_lora_trainer.py # Core training engine — LoRALinear, autograd, early stopping
|
| 105 |
+
│ ├── neural_daemon.py # FastAPI daemon — inference, training orchestration, SSE
|
| 106 |
+
│ ├── neural_config.py # Hyperparameter configuration
|
| 107 |
+
│ ├── neural_data.py # Training data manager — rolling + replay buffers
|
| 108 |
+
│ ├── ane_bridge_py.py # Python ctypes wrapper for ANE bridge
|
| 109 |
+
│ ├── ane_lora_trainer.py # ANE training engine (requires ANE bridge)
|
| 110 |
+
│ ├── ane_mil_lora.py # ANE kernel generators for LoRA forward/backward
|
| 111 |
+
│ ├── export_to_lms.py # GGUF export for LM Studio
|
| 112 |
+
│ └── bridge/ # ANE C bridge (from github.com/maderix/ANE, MIT)
|
| 113 |
+
│ ├── ane_bridge.h # C API header
|
| 114 |
+
│ ├── ane_bridge.m # Objective-C implementation
|
| 115 |
+
│ └── Makefile # Build: `make` → libane_bridge.dylib
|
| 116 |
+
├── tests/
|
| 117 |
+
│ ├── test_daemon_e2e.py # Experiment 1 — 4 fictional facts
|
| 118 |
+
│ ├── test_deep_e2e.py # Experiment 2 — 41 facts, 10 domains, 70 test cases
|
| 119 |
+
│ ├── test_statistical_e2e.py # Experiment 3 — real-world facts, 3 trials, CIs
|
| 120 |
+
│ ├── raw_facts_2026.txt # 122 post-cutoff facts for statistical evaluation
|
| 121 |
+
│ └── evaluation_results.json # Machine-readable results
|
| 122 |
+
├── figures/ # Paper figures
|
| 123 |
+
└── paper.pdf # Compiled paper
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
## Hardware
|
| 127 |
|
| 128 |
- Apple Silicon Mac (M-series)
|
|
|
|
| 140 |
| Regularization | ≥33% | Below this: catastrophic forgetting |
|
| 141 |
| Batch size | 1 | Per-example steps; batching doesn't help |
|
| 142 |
|
| 143 |
+
## Setup
|
| 144 |
|
| 145 |
```bash
|
| 146 |
+
git clone https://github.com/eelbaz/jit-lora.git
|
| 147 |
+
cd jit-lora
|
| 148 |
+
pip install -r requirements.txt
|
| 149 |
+
|
| 150 |
+
# Build the ANE bridge (requires Xcode Command Line Tools)
|
| 151 |
+
cd src/bridge && make && cd ../..
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
The ANE bridge (`src/bridge/`) provides direct access to Apple Neural Engine hardware via private APIs. It is based on [maderix/ANE](https://github.com/maderix/ANE) (MIT License). Requires macOS 15+ on Apple Silicon.
|
| 155 |
+
|
| 156 |
+
### Quick Validation
|
| 157 |
|
| 158 |
+
```bash
|
| 159 |
+
# Verify ANE bridge works
|
| 160 |
+
python3 src/ane_bridge_py.py
|
| 161 |
+
|
| 162 |
+
# Verify MLX training engine
|
| 163 |
python3 src/mlx_lora_trainer.py
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
### Full Experiments
|
| 167 |
+
|
| 168 |
+
```bash
|
| 169 |
+
# Terminal 1: Start daemon
|
| 170 |
+
python3 src/neural_daemon.py
|
| 171 |
+
|
| 172 |
+
# Terminal 2: Activate model + run experiments
|
| 173 |
+
curl -X POST http://localhost:8766/activate \
|
| 174 |
+
-H "Content-Type: application/json" \
|
| 175 |
+
-d '{"hf_repo":"Qwen/Qwen3.5-2B-Base"}'
|
| 176 |
|
|
|
|
|
|
|
|
|
|
| 177 |
python3 tests/test_daemon_e2e.py # 4 facts, 20s
|
| 178 |
python3 tests/test_deep_e2e.py # 41 facts, 121s
|
| 179 |
python3 tests/test_statistical_e2e.py # 35+ facts, 3 trials, ~4 min
|
|
|
|
| 192 |
|
| 193 |
## License
|
| 194 |
|
| 195 |
+
MIT License. See [LICENSE](LICENSE) for details.
|