End-to-end ZKML over a brain–computer interface model: train / load an fNIRS classifier, prove inference with EZKL, without revealing the model weights as a black box you can’t verify.
Built for ZuThailand (EZKL Prize · Honorable Mention) as part of the think2earn open-neurotech stack.
Author: Carol Calin · @rainbowpuffpuff
Biometric models only become markets if third parties can trust results without taking the raw neural data. ZKML lets a contributor (or device) prove:
“This public sample, run through this committed model, produced class C.”
That is the cryptographic half of think2earn’s later pay-for-data-that-improves-models loop: verify inference, then verify improvement (separate systems / EigenLayer / NEAR work).
flowchart TB
subgraph Data
NIRS[fNIRS NIRS_01-29 · TU Berlin hBCI]
end
subgraph Train
NET[fNIRSNet-style classifier]
ONNX[model.onnx]
NET --> ONNX
end
subgraph Prove
EZ[EZKL circuit + proof]
ONNX --> EZ
NIRS --> EZ
EZ --> P[zk proof + public outputs]
end
subgraph Optional UI
FE[React frontend]
BE[Flask backend]
FE --> BE
BE --> EZ
end
| Class | Meaning (demo) |
|---|---|
| Mental arithmetic | Active cognitive task |
| Baseline | Rest / observation |
Demo subset: first 9 participants from TU Berlin NIRS for buildathon speed.
- Open the notebook:
ZuThailand_EZKL_demo.ipynb - Runtime → Run all (~1 minute after setup).
- Read the verified EZKL proof output for mental-arithmetic vs baseline.
No local GPU required for the Colab path.
git clone https://github.com/rainbowpuffpuff/ez_think2earn.git
cd ez_think2earn
# 1) Train (writes under fNIRSNET/save/)
cd fNIRSNET && python KFold_train.py && cd ..
# 2) Backend
cd flask-backend && python app.py
# 3) Frontend (second terminal)
cd frontend && npm install && npm startUpload model.onnx from e.g.
fNIRSNET/save/MA/KFold/1/1/ and generate proofs via the UI.
Training curves / confusion matrices from the Mental Arithmetic run are linked in repo history / assets (≈68–71% class-wise accuracy on the demo setup — moderate; the prize was for the verifiable pipeline, not SOTA accuracy).
- Source: TU Berlin hBCI / NIRS
- Model lineage: fNIRSNet-style architecture
- Demo files in-repo:
model.onnx,model.pt,train_data.npz,test_data.npz
| Path | Role |
|---|---|
ZuThailand_EZKL_demo.ipynb |
Start here — Colab-ready proof demo |
fNIRSNET/ |
Training |
flask-backend/ · frontend/ |
Local proof upload UI |
model.onnx / model.pt |
Example artifacts |
MIT (see LICENSE). Respect TU Berlin data access terms for redistributed NIRS usage.
| Repo | Role |
|---|---|
algo_t2e |
Data capture → ownership ASA mint flow (Algorand PoC) |
agentic_health |
Agents × health / financial data |
AVSAthon---PySyft-TenSEAL |
HE / federated biometric ML |
think2earn |
Product overview: chat → paid data |