Gemini 3 Integration

Neural Pattern Translator uses Gemini 3 as the core reasoning engine in a two-pass architecture. In Pass 1, Gemini 3 receives structured EEG features (ERP peaks, frequency band power, electrode activations, and experiment context) and performs scientific reasoning — generating ranked cognitive hypotheses with supporting evidence, confidence levels, alternative explanations, and explicit uncertainty statements. The output is enforced as structured JSON. In Pass 2, a second Gemini 3 call receives the structured analysis and synthesizes it into a plain-language narrative interpretation, streamed token-by-token to the user.

Gemini 3 is not used for summarization or classification. It performs contextual multimodal reasoning over temporal patterns (ERP timing), frequency content (alpha, beta, gamma bands), spatial context (brain regions), and experimental context — generating plausible scientific interpretations that no classical ML pipeline can produce.

The system supports three modes: pre-computed analysis of real MNE dataset recordings, live analysis of user-uploaded CSV files, and real-time analysis of a simulated EEG monitor stream. All live modes call Gemini 3 directly with no pre-computation. The streaming narrative demonstrates Gemini 3's reasoning process transparently.

Inspiration

EEG data is one of the richest windows into the human brain, but interpreting it requires years of expertise. Current tools output numbers and plots — not meaning. Junior researchers, students, and interdisciplinary teams are blocked by a gap between raw neural data and understanding. I wanted to build a layer that answers: "What might this pattern mean, and why?"

What it does

Neural Pattern Translator takes real EEG recordings and uses Gemini 3 as a reasoning layer to produce:

  • Detected neural patterns with confidence levels
  • Ranked cognitive hypotheses with supporting evidence
  • Rejected interpretations with explanations
  • Explicit uncertainty statements
  • Plain-language narrative that any researcher can understand

Users can analyze pre-loaded examples, upload their own EEG data as CSV, or freeze a live simulated EEG stream for instant Gemini 3 analysis.

How I built it

Signal Processing Pipeline: MNE-Python extracts ERPs, frequency band power, and electrode activations from real EEG data (MNE Sample Dataset — 60 channels, 4 conditions).

Two-Pass Gemini 3 Architecture:

  • Pass 1: Structured scientific reasoning — Gemini receives extracted features and produces ranked hypotheses, evidence, rejected alternatives, and uncertainty in structured JSON
  • Pass 2: Narrative synthesis — a second Gemini call transforms the structured analysis into a plain-language interpretation, streamed token-by-token

Frontend: Next.js with an animated brain topomap, staged reveal UI, live EEG monitor with freeze-and-analyze, file upload, and side-by-side comparison mode.

Challenges I ran into

Mapping MNE sample dataset channel names (EEG 001-060) to standard 10-20 electrode positions for topographic visualization. Handling Gemini API rate limits on the free tier while keeping the live analysis responsive. Ensuring the streaming narrative display was stable across different response sizes.

What I learned

Gemini 3's structured output capability is remarkably well-suited for scientific reasoning tasks. The two-pass architecture — structured analysis followed by narrative synthesis — produces significantly better results than a single prompt approach. Client-side feature extraction before sending to Gemini reduces payload size and makes the API calls fast and reliable.

What's next

Support for standard EEG file formats (.edf, .fif) with server-side MNE processing. Multi-session comparison for longitudinal analysis. Integration with real-time EEG hardware for live clinical and research use.

Built With

Share this project:

Updates