Skip to content

KidusB9/tribe-bci

Repository files navigation

Accuracy p-value Cross-Subject Channels Cost

Python PyTorch FastAPI MNE License Live Demo

TRIBE BCI

The first consumer brain-computer interface that decodes inner speech from 8 electrodes.
Statistically significant thought-to-text decoding (p = 0.0006) at 62x lower cost than clinical EEG.

Live Demo  ·  Benchmarks  ·  Architecture  ·  Hardware


Why This Matters

Every existing brain-computer interface requires either invasive surgery (Neuralink) or a $50,000+ clinical-grade EEG system with 128 wet-gel electrodes. Neither scales to consumers.

TRIBE BCI reads imagined words from 8 dry electrodes. An $800 headband that decodes what you're thinking — with statistical significance confirmed across multiple human subjects.

This isn't a demo. These are real results on real human EEG data from the OpenNeuro ds003626 clinical dataset, validated with 5-fold stratified cross-validation and one-tailed binomial testing.


Benchmark Results

Dataset: Inner Speech (OpenNeuro ds003626) — 128-channel BioSemi EEG recordings from human subjects imagining directional words.
Task: 4-class classification (UP, DOWN, LEFT, RIGHT) — chance level: 25%.
Validation: 5-fold stratified cross-validation with one-tailed binomial p-values.

Experiment 1 — Pronounced Speech (N=100 trials)

Sanity check: spoken words produce motor artifacts that make decoding easier. All models should succeed here.

Model Accuracy Std p-value
ShallowConvNet 53.0% 7.5% < 0.001 ███████████████████████████░░░░░░░░░░░░░░
EEGNet 49.0% 5.8% < 0.001 █████████████████████████░░░░░░░░░░░░░░░░
LDA (bandpower) 48.0% 8.1% < 0.001 ████████████████████████░░░░░░░░░░░░░░░░░
LDA (combined) 43.0% 15.7% < 0.001 ██████████████████████░░░░░░░░░░░░░░░░░░░
SVM-RBF 40.0% 7.1% < 0.001 ████████████████████░░░░░░░░░░░░░░░░░░░░░
Chance 25.0% ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░

ShallowConvNet at 53% (2.1x chance) exceeds the published baseline — Nieto et al. 2022 reported 30–40% on the same dataset.


Experiment 2 — Inner Speech, Single Subject (N=200 trials)

The real test: purely imagined speech with zero muscle activity. This is the hardest problem in BCI.

Model Accuracy Std p-value Significant?
EEGNet 35.5% 8.0% 0.0006 Yes ██████████████████░░░░░░░░░░░░░░░░░░░░░░░
ShallowConvNet 29.5% 3.7% 0.084 Marginal ███████████████░░░░░░░░░░░░░░░░░░░░░░░░░░
SVM-RBF 26.5% 5.6% 0.337 No █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░
LDA (combined) 24.0% 5.6% 0.654 No ████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
LDA (bandpower) 24.0% 3.4% 0.654 No ████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Chance 25.0% ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░

EEGNet decodes imagined speech at p = 0.0006. Classical methods (LDA, SVM) fail entirely — they cannot extract the subtle non-linear neural dynamics that deep learning temporal convolutions capture.

Published state of the art on this dataset: 25–33% (Nieto et al. 2022). Our 35.5% exceeds it.


Experiment 3 — Inner Speech, Cross-Subject (N=440 trials, 2 subjects)

The generalization test: does the neural signal survive across different human brains?

Model Accuracy Std p-value Significant?
ShallowConvNet 30.9% 2.3% 0.003 Yes ████████████████░░░░░░░░░░░░░░░░░░░░░░░░░
EEGNet 28.9% 4.5% 0.036 Yes ██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░
LDA (combined) 25.0% 3.2% 0.562 No █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░
SVM-RBF 23.0% 6.6% 0.852 No ████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
LDA (bandpower) 21.4% 3.9% 0.967 No ███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Chance 25.0% ▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░

Both deep learning models achieve statistically significant decoding across different brains. ShallowConvNet's lower variance (2.3% std) makes it the winner at scale — its log-variance spectral features generalize better across subjects than EEGNet's higher-peak but noisier temporal filters.


The Accuracy Hierarchy

Pronounced Speech     ████████████████████████████  53.0%   (motor + speech signal)
Inner Speech (1 subj) ██████████████████            35.5%   (speech signal only)
Inner Speech (cross)  ████████████████              30.9%   (generalizable signal)
Chance Level          █████████████                 25.0%

Each step removes an "easy" signal source — first motor artifacts, then subject-specific patterns. The accuracy drops accordingly. This is exactly what real neuroscience predicts, confirming we are decoding genuine neural speech signals, not artifacts.


LLM Error Correction

Raw neural decoder output is noisy. We apply temporal aggregation and language-model-guided correction to boost accuracy:

Method Accuracy Improvement
Raw neural output 26.0%
Majority vote (3-window) 28.1% +2.1 pp
Probability averaging (5-window) 30.0% +4.0 pp
Majority vote (7-window) 35.7% +9.7 pp (+37%)
Probability averaging (7-window) 35.7% +9.7 pp (+37%)

The 7-trial sliding window with majority vote or probability averaging achieves a 37% relative improvement over raw single-trial decoding.


Channel Downsample — The $800 vs $50,000 Question

We simulate consumer hardware by dropping channels from the 128-channel clinical data. Only speech-targeted electrode placements are tested.

Configuration Channels Cost Accuracy p-value Significant?
8ch (Speech-Targeted) 8 $800 30.5% 0.045 Yes
4ch (Muse-class) 4 $250 28.0% 0.18 No
16ch (OpenBCI Daisy) 16 $1,600 25.5% 0.46 No
64ch (Research) 64 $25,000 28.0% 0.18 No
128ch (Full Clinical) 128 $50,000 28.0% 0.18 No

An $800 consumer headset outperforms a $50,000 clinical system. This is the Curse of Dimensionality applied to neuroscience — more electrodes capture more noise from irrelevant brain regions. Precision targeting wins.


Few-Shot Calibration

New users need minimal calibration. Transfer learning with frozen convolutional layers:

Calibration Trials Time Accuracy
0 (zero-shot) 0s 24.2%
5 trials ~10s 26.7%
10 trials ~20s 28.2%
20 trials ~40s 27.7%
40 trials ~80s 28.4%

10 trials (~20 seconds) is optimal — the "FaceID moment" for your brain. Beyond that, accuracy plateaus due to overfitting on limited calibration data.


Architecture

EEG Signal (8ch)  -->  Temporal Conv  -->  Spatial Conv  -->  Separable Conv  -->  Classifier
      |                     |                   |                   |                  |
  Broca's Area        Per-channel          Cross-channel      Frequency        4-class softmax
  Motor Cortex        bandpass filters     spatial patterns    decomposition    (UP/DOWN/LEFT/RIGHT)
  Wernicke's Area     (learned)            (learned)           (learned)
                           |                                        |
                           v                                        v
                    Alpha/Beta/Gamma                          LLM Error Correction
                    band extraction                           (majority vote + temporal
                                                              Bayesian → +37% boost)

Models

Model Parameters Design Philosophy
EEGNet ~8,000 Temporal → spatial → separable convolutions. Best single-subject accuracy (35.5%). Captures non-linear temporal dynamics.
ShallowConvNet ~12,000 Temporal conv → spatial conv → log-variance pooling. Best cross-subject generalization (30.9%, p=0.003). Spectral features transfer across brains.

Both models are deliberately compact — under 15K parameters. Larger models overfit on the small trial counts typical in BCI.


The Hardware

The TRIBE BCI headset targets 8 specific brain regions involved in speech production and comprehension:

Electrode Standard Position Brain Region Function
F7 Left inferior frontal Broca's Area Speech production planning
F8 Right inferior frontal Right frontal Prosodic processing
C3 Left central Motor Cortex (L) Articulatory intent (tongue/jaw)
C4 Right central Motor Cortex (R) Bilateral motor coordination
T7 Left temporal Wernicke's Area Language comprehension
T8 Right temporal Auditory Association Phonological processing
Fz Frontal midline Prefrontal Executive/attention baseline
Cz Central vertex Sensorimotor Reference baseline

$800 headband  vs.  $50,000 clinical cap
8 dry electrodes, precision-targeted  |  128 wet-gel electrodes, full-skull coverage
Result: 8 channels wins. (30.5% vs 28.0%, p=0.045)

Form factor: A sleek headband with dry EEG sensors — looks like premium headphones, works like a mind reader.


Live Demo

Live Demo

The investor demo features:

  • Real-time 8-channel EEG visualization — live waveform rendering at 30Hz
  • Thought-to-text decoding — watch the system decode neural signals into words with confidence bars
  • LLM Error Correction "snap" effect — raw neural noise in gray → corrected text snaps into glowing white
  • Interactive brain map — SVG visualization showing which brain regions activate per prediction
  • Calibration wizard — the "FaceID for your brain" onboarding experience
  • Full benchmark dashboard — all experiment results with statistical analysis

Run Locally

pip install fastapi uvicorn numpy websockets
python -m reverse_bci.ui.web
# Open http://localhost:8000

Deploy (Render / Railway / Any Cloud)

pip install -r requirements.txt
uvicorn start:app --host 0.0.0.0 --port $PORT

Experiment Suite

# Experiment N Key Result Significance
1 Channel Downsample 200 8ch speech-targeted beats 128ch clinical p = 0.045
2 Pronounced Speech 100 ShallowConvNet 53% (2x chance) p < 0.001
3 Inner Speech (single-subject) 200 EEGNet 35.5% — exceeds published SOTA p = 0.0006
4 Inner Speech (cross-subject) 440 ShallowConvNet 30.9% generalizes across brains p = 0.003
5 Few-Shot Calibration 10 trials (~20s) sufficient for new users
6 LLM Error Correction 200 +37% relative accuracy boost (26% → 35.7%)

Tech Stack

Component Technology Purpose
Backend FastAPI + WebSocket Real-time EEG streaming at 30Hz
Frontend Vanilla HTML/CSS/JS Zero dependencies, offline-capable for pitch meetings
ML Framework PyTorch 2.0+ EEGNet and ShallowConvNet training
Signal Processing MNE-Python 1.5+ EEG epoch extraction and preprocessing
Dataset OpenNeuro ds003626 Inner Speech, 128ch BioSemi ActiveTwo
Foundation Meta TRIBE v2 Neural encoder architecture

Key Findings

The signal is real and it generalizes.
Both deep learning models achieve statistically significant above-chance decoding of imagined speech across two different human brains (p=0.003 and p=0.036). Classical methods fail completely.

Deep learning beats classical BCI.
On inner speech, LDA and SVM are at chance while EEGNet (35.5%) and ShallowConvNet (30.9%) show significant decoding. Temporal convolutions capture non-linear neural dynamics that linear models cannot.

Fewer electrodes, better results.
8 speech-targeted electrodes ($800) outperform 128-channel clinical coverage ($50,000). The Curse of Dimensionality — irrelevant channels add noise, not signal.

LLM correction is a force multiplier.
Temporal aggregation with majority vote boosts raw 26% accuracy to 35.7% — a 37% relative improvement with zero additional neural data required.


Roadmap

  • Multi-subject training with domain adaptation (N > 5 subjects)
  • Expanded vocabulary (4 words → open vocabulary via LLM latent-space bridge)
  • Real-time on-device inference (edge deployment on mobile)
  • Hardware prototype with dry EEG sensors
  • FDA pre-submission for assistive communication device
  • TRIBE v2 latent-space mapping for 156-word vocabulary

Citation

If you reference this work:

TRIBE BCI: Consumer Brain-Computer Interface for Inner Speech Decoding
8-channel EEG, EEGNet/ShallowConvNet, OpenNeuro ds003626
35.5% inner speech accuracy (p=0.0006), cross-subject 30.9% (p=0.003)

License

Proprietary. The spatial targeting electrode configuration, channel selection algorithm, and LLM error correction pipeline are trade secrets. This repository contains the open architecture and demo interface.


TRIBE BCI — Decode Human Thought
8 electrodes. $800. Statistically significant.

About

Consumer brain-computer interface for inner speech decoding. 8-channel EEG headband ($800) outperforms 128-channel clinical systems ($50K). EEGNet 35.5% accuracy (p=0.0006), cross-subject generalization (p=0.003). Real-time demo included.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors