| --- |
| 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 |