File size: 3,247 Bytes
9a9cece b02b5a9 9a9cece | 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 | ---
license: mit
language:
- en
base_model:
- OpenPeerAI/OpenPeerLLM
pipeline_tag: reinforcement-learning
tags:
- prediction
- AI
- llm
- training
- machine-learning
- regression
- accuracy
- visualization
- epoch
- epoch-time
---
# OpenPeer AI NTK Trainer
This workspace contains three related paths:
* A real fine-tuning path that uses [ntkmirror](https://github.com/leochlon/ntkmirror) to fit signed log-gate controllers on a frozen Hugging Face causal LLM, and
* A tinygrad-backed smoke demo that trains only gate parameters on a synthetic task so the controller idea can be validated locally and cheaply.
* A benchmark pipeline that records accuracy, loss, memory, process counts, predictability, and throughput, then renders a combined dashboard plus OpenBB-backed charts.
* A runtime GUI for live benchmark runs with current hardware specs baked into the view.
The trainer therefore targets any causal LLM that `transformers` can load, with `OpenPeerAI/OpenPeerLLM` as the primary model ID and a smaller fallback for local demos.

## Install
```powershell
pip install -e .
pip install tinygrad
pip install git+https://github.com/leochlon/ntkmirror.git
```
If you only want the local demo, install the demo extra instead:
```powershell
pip install -e ".[demo]"
```
To enable OpenBB-backed chart generation for benchmarks, install the chart extra too:
```powershell
pip install -e ".[demo,charts]"
```
To enable the runtime GUI, install the GUI extra:
```powershell
pip install -e ".[gui]"
```
## Run the tinygrad demo
```powershell
python -m openpeer_trainer.cli demo --steps 100 --target-accuracy 0.99
```
The demo stops early as soon as it reaches the requested accuracy target.
## Run benchmarks and charts
```powershell
python -m openpeer_trainer.cli bench --steps 10 25 50 --target-accuracy 0.99
```
The benchmark runner writes a CSV plus HTML charts under `artifacts/benchmarks/`. The main output is `benchmark_dashboard.html`, a multi-panel dashboard showing memory, processes, learned gates, loss, predictability, accuracy, training steps, time, and epoch in actual seconds. If the OpenBB charting extension is installed, the companion charts are rendered through OpenBB; otherwise the script falls back to Plotly with the same data.
## Launch the runtime GUI
```powershell
python -m openpeer_trainer.cli gui
```
The GUI shows the same dashboard, a live benchmark runner, and a hardware-spec table for this computer.
## Fit an ntkmirror controller
```powershell
python -m openpeer_trainer.cli fit --model OpenPeerAI/OpenPeerLLM --train-jsonl train.jsonl --out runs/openpeer_controller.pt
```
## JSONL format
Preferred schema:
```jsonl
{"prompt":"Question: 14 + 27 = ?\nAnswer:","completion":" 41"}
{"prompt":"Question: 36 + 18 = ?\nAnswer:","completion":" 54"}
```
The trainer also accepts `instruction`/`response`, `question`/`answer`, or `text` records when the underlying ntkmirror loader supports them.
## References
* OpenPeer AI / Riemann Computing Inc. / Andrew Magdy Kamal Nassief
* ntkmirror: https://github.com/leochlon/ntkmirror
* Tinygrad: https://github.com/tinygrad/tinygrad |