BCI · PyTorch · LLM · Python
ZUMA
Hackathon brain-to-text pipeline that projects EEG and fNIRS into CLIP semantic space, retrieves the closest command, and has Gemma write the care-team alert.
Overview
ZUMA was a hackathon attempt at the decoding problem from the other end. Most brain-to-text work tries to predict characters or phonemes. I wanted to skip the spelling entirely: project the neural signal into a semantic space that already has structure, then find the nearest thing a person might plausibly be trying to say.
The pipeline is a chain of small pieces. Preprocessed EEG goes into a ZUNA-380M encoder that produces a 768-dimensional latent. A small MLP, the semantic bridge, maps that into the 512-dimensional space of CLIP's text encoder, which is frozen and never fine-tuned — it only supplies fixed targets. A precomputed pool of command vectors sits in that same space, so retrieval is just cosine similarity against anchors.
The part I care about most is the router, because a BCI that acts on a wrong guess is worse than one that does nothing. Matches at 0.85 and above execute. Between 0.50 and 0.85 the system asks for confirmation, optionally through a binary motor-imagery classifier. Below 0.50 it stays quiet. Only once a command survives that gate does Gemma 4 turn the matched concept into natural-language text for a care team.
This is hackathon code and I want to be honest about that: it was four commits in a single day, it runs on public datasets rather than a live headset, and the encoder is doing most of the work. What it does show is that the semantic-retrieval framing is buildable, and that the confidence gate is the right place to put the safety argument.