Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Skieriya/fMRI-key-generation-with-TRIBEv2/llms.txt

Use this file to discover all available pages before exploring further.

Neural Vault is a research pipeline that derives stable, 256-bit cryptographic keys directly from fMRI cortical activity. It ingests per-vertex cortical surface predictions generated by the TRIBEv2 brain-encoding model, feeds them through a few-shot Transformer encoder trained with triplet metric learning, and passes the resulting L2-normalized embedding through HKDF-SHA256 to produce a reproducible, high-entropy key. The result is a biometric authenticator that achieves a 0.75% Equal Error Rate and a d-prime of 5.95 — compared to ~50% EER (indistinguishable from random guessing) when SHA-256 or HMAC are applied naively to the same raw neural signals.
Neural Vault is a research pipeline. It requires TRIBEv2 cortical-prediction data (5classpreds.csv) generated by running data.py against the five stimulus video files. No synthetic fallback is provided for the full benchmark; model.py ships a synthetic stand-in for local development only.

What Neural Vault Does

Traditional cryptographic hashing functions — SHA-256, HMAC — are deterministic but not robust to noise: small session-to-session variation in a neural signal produces a completely different hash output, driving EER toward 50%. Neural Vault solves this by learning an embedding space in which all fMRI recordings of the same stimulus class cluster tightly around a prototype centroid, while recordings from different stimuli are pushed far apart. Verification then becomes a cosine-similarity comparison on the unit hypersphere, and key derivation operates on the stable prototype embedding rather than the raw, noisy signal.

Stimulus Classes

The model is trained and evaluated on five video stimuli (v1 through v5), each processed by TRIBEv2 to produce per-timestep cortical predictions across 20,484 vertices on the fsaverage5 surface (10,242 left hemisphere + 10,242 right hemisphere). These five classes form the classification vocabulary for the few-shot episodes.

System Architecture

The end-to-end pipeline flows through the following stages:
TRIBEv2 predictions (N × 20,484 float32)
  └─► data.py         — runs TribeModel on 5 MP4 videos → 5classpreds.csv
        └─► main.py / model.py
              └─► StandardScaler normalization
                    └─► NeuralVaultFewShot (Transformer encoder)
                          └─► L2-normalized embedding (128-d or 40-d)
                                └─► HKDF-SHA256 (info="neural-vault-few-shot-v1")
                                      └─► 256-bit cryptographic key

Two Entry Points

Neural Vault ships two Python entry points serving different purposes:
FilePurpose
main.pyFull benchmark pipeline: trains the model, runs 40 few-shot episodes, evaluates SHA-256 / HMAC / BioHashing / Neural / NeuralVault methods, stress-tests under AWGN and motion artifacts, exports a JSON results file, a 6-panel visualization dashboard, and a Markdown benchmark report.
model.pyStandalone enrollment and verification demo: loads (or synthesizes) data, trains the few-shot model for 150 epochs with cosine LR annealing, computes a user prototype, derives a 256-bit key, and plots similarity distributions, ROC, DET, and d-prime curves.
Run main.py to reproduce the published benchmark numbers. Run model.py to explore the enrollment-and-verification flow interactively.

Benchmark Highlights

The table below reproduces the published results from benchmark/reports/BENCHMARK_REPORT.md, generated against real TRIBEv2 predictions.
Methodd-primeEERNotes
Neural (binarized embeddings)5.950.75%Transformer embeddings, Hamming distance
NeuralVault (cosine similarity)4.840.94%Prototype cosine verification
BioHashing2.2115.09%GaussianRandomProjection + binarize
SHA-2560.1448.4%Raw signal hash, near-random
HMAC0.2552.6%Keyed hash, near-random
The Neural method also shows strong noise robustness: EER holds at 0.75% under 30 dB, 20 dB, and 15 dB SNR conditions, rising only to 1.13% at 0 dB SNR. SHA-256 and HMAC hover between 48–53% across all noise levels — effectively random. The few-shot classifier itself achieves 98.12% accuracy, 0.981 macro F1, and 0.9995 ROC-AUC across 40 evaluation episodes.

Explore the Documentation

Quickstart

Install dependencies, generate 5classpreds.csv with data.py, and run your first benchmark in under ten minutes.

Concepts

Deep-dives into triplet metric learning, prototypical networks, HKDF-SHA256 key derivation, EER, and d-prime.

Pipeline

Step-by-step walkthrough of the full data-processing and training pipeline from raw MP4 files to derived keys.

Benchmarking

Reproduce the full benchmark suite — noise robustness curves, motion artifact tests, and the 6-panel dashboard.

Build docs developers (and LLMs) love