Thought-deciphering via hierarchical EEG-to-text alignment
Authors: Xiaopeng Mao, Morten Mørup, Xin Xu, Sang Wan Lee, Sadasivan Puthusserypady
Organizations: Department of Health Technology, Technical University of Denmark (DTU), Ørsteds Plads, Kongens Lyngby, 2800, Denmark. · Department of Applied Mathematics and Computer Science, Technical University of Denmark (DTU), Richard Petersens Plads, Kongens Lyngby, 2800, Denmark. · Department of Brain and Cognitive Sciences, Korea Advanced Institute of Science and Technology (KAIST), Daejeon, City, 34141, Republic of Korea. · Center for Neuroscience-inspired AI, Korea Advanced Institute of Science and Technology (KAIST), Daejeon, City, 34141, Republic of Korea. · Department of Bio and Brain Engineering, Korea Advanced Institute of Science and Technology (KAIST), Daejeon, City, 34141, Republic of Korea. · Kim Jaechul Graduate School of AI, Korea Advanced Institute of Science and Technology (KAIST), Daejeon, City, 34141, Republic of Korea. · Graduate School of Data Science, Korea Advanced Institute of Science and Technology (KAIST), Daejeon, City, 34141, Republic of Korea.
Non-invasive brain-to-text interfaces offer alternative communication pathways for people with communication disabilities. However, sentence-level decoding from electroencephalography (EEG) remains challenging. We propose a hierarchical EEG-text alignment framework that retrieves sentences by progressively decoding coarse-grained semantic information and fine-grained sentence representations. We hypothesize that broader semantic context can be more reliably captured from EEG than individual sentences. Accordingly, EEG representations are first aligned with semantic classes, followed by sentence retrieval within the predicted class. Among over 2,000 unique text samples, our approach achieves average top-5 and top-10 retrieval accuracies of 62.6% ± 1.0% and 83.5% ± 1.0%, respectively, compared with 50.3% ± 2.3% and 68.3% ± 2.0% for direct EEG-sentence alignment. Qualitative analysis further reveals that decoding performance depends strongly on textual context. These findings demonstrate the potential of hierarchical semantic alignment for improving sentence-level EEG-to-text decoding.
Figures & tables
Figure 1: Flow diagram of the study. Two different raw reading EEG datasets are used. A simple and fast preprocessing strategy is applied to both datasets (a). An EEG encoder converts an EEG sample into a 256-dimensional embedding, which is contrastively aligned with the corresponding text embedding at a class level. The encoded embeddings are used for semantic classification. Subsequently, a retrieval model is used to align EEG embeddings with text embeddings at a sentence level (b). For evaluation, the semantic classifier is evaluated using macro F1 scores, while the retriever limits its text search within the predicted class to find the target sentence (c).
Datasets
ChineseEEG - short novel (Little Prince)
ChineseEEG - long novel (Garnett Dream)
Chisco - daily phrases
Macro F1 (Class labels)
90.8 ± 0.4
100.0 ± 0.0
5.8 ± 1.1
Retrieval at 1 (Sentence labels)
20.0 ± 1.5
6.0 ± 0.3
0.9 ± 0.1
Retrieval at 5 (Sentence labels)
62.6 ± 1.0
25.3 ± 0.4
3.7 ± 0.6
Retrieval at 10 (Sentence labels)
83.5 ± 1.0
42.6 ± 0.9
5.9 ± 1.2
Table 1: Results on ChineseEEG and Chisco. The numbers are means (%) ± standard deviations (%). For ChineseEEG, the book chapters are used as classes. For Chisco, the semantic classes from its publication were reused. Firstly, all the EEG samples are classified by the semantic classifier. Secondly, the corresponding text samples are retrieved within their predicted class by the retriever.
Subject
Macro F1 (Class labels)
Retrieval at 1 (Sentence labels)
Retrieval at 5 (Sentence labels)
Retrieval at 10 (Sentence labels)
sub-04
92.1 ± 2.5
19.8 ± 1.3
64.1 ± 1.6
85.4 ± 1.2
sub-05
94.8 ± 1.4
20.3 ± 1.2
65.2 ± 1.1
85.4 ± 2.1
sub-06
92.3 ± 2.4
20.7 ± 3.0
63.6 ± 1.5
85.2 ± 0.5
sub-07
96.2 ± 2.8
21.3 ± 0.8
64.9 ± 1.0
87.4 ± 1.8
sub-08
92.4 ± 2.1
19.4 ± 2.4
65.4 ± 1.0
86.4 ± 1.0
sub-09
89.5 ± 3.5
20.8 ± 1.2
62.3 ± 0.4
80.2 ± 2.7
Table 2: Subject-wise results on ChineseEEG, The Little Prince. The numbers are means (%) ± standard deviations (%). The overall best-performing subject is sub-07, while the worst-performing subject is sub-15.
ChineseEEG - short novel (Little Prince)
Mean cosine similarity gap
p -value
ChineseEEG - long novel (Garnett Dream)
Mean cosine similarity gap
p -value
sub-04
6.5⋅10−2
4.1⋅10−29
sub-04
4.5⋅10−2
7.2⋅10−101
sub-05
6.8⋅10−2
4.1⋅10−29
sub-05
4.4⋅10−2
9.4⋅10−100
sub-06
7.2⋅10−2
6.8⋅10−28
sub-06
4.5⋅10−2
5.5⋅10−98
sub-07
6.4⋅10−2
4.8⋅10−26
sub-07
4.5⋅10−2
7.2⋅10−101
sub-08
6.6⋅10−2
4.8⋅10−26
sub-08
4.5⋅10−2
6.1⋅10−101
sub-09
6.8⋅10−2
1.1⋅10−14
sub-09
4.5⋅10−2
1.4⋅10−98
Table 3: Cosine similarity gaps and their significances for ChineseEEG between matched and unmatched EEG-text pairs. The unmatched pairs are constructed using different classes. Wilcoxon signed-rank tests are used with Holm-correction to compute the p -values. All p -values are highly significant p-value<<0.05 .
Chisco - daily phrases
Mean cosine similarity gap
p -value
s1
2.0⋅10−2
1.5⋅10−21
s2
2.1⋅10−2
1.5⋅10−21
s3
2.2⋅10−2
4.3⋅10−23
Table 4: Cosine similarity gaps and their significances for Chisco between matched and unmatched EEG-text pairs. The unmatched pairs are constructed using different classes. Wilcoxon signed-rank tests are used with Holm-correction to compute the p -values. All p -values are highly significant p-value<<0.05 .
Dataset
ChineseEEG - short novel (Little Prince)
Chisco - daily phrases
Metric
Macro F1 (Class labels)
Retrieval at 1 (Sentence labels)
Macro F1 (Class labels)
Retrieval at 1 (Sentence labels)
Chance level for hierarchical framework
3.4 ± 0.0
0.4 ± 0.0
2.5 ± 0.0
0.2 ± 0.0
Random model
0.5 ± 0.5
0.3 ± 0.3
1.5 ± 0.6
0.2 ± 0.1
Base model
68.8 ± 0.9
16.2 ± 1.3
1.9 ± 0.3
0.4 ± 0.1
+ KNN + Hierarchical alignment
90.8 ± 0.4
20.0 ± 1.5
4.4 ± 0.8
0.5 ± 0.2
+ KNN + Class-wise alignment
90.8 ± 0.4
10.0 ± 0.4
4.4 ± 0.8
0.4 ± 0.1
Table 5: Ablation studies on the short novel of ChineseEEG and the entire Chisco dataset. The chance level is defined via random classification using the class labels and thereupon random retrieval using the sentence labels. The random model is an untrained model, while the base model is a trained model without KNN. The parameter k of KNN is estimated using the validation set and tested on the test set. The numbers are means (%) ± standard deviations (%).
Figure 2: Violing plots comparing congruent and incongruent EEG-text pairs. The comparison has been done on ChineseEEG, The Little Prince, (a), Garnett Dream, (b), and Chisco, (c). For each subject, the congruent pairs are significantly different than the incongruent pairs (marked by three asterisks).
Dataset
No. of subjects
Classes
Montage
Text genre
No. of unique texts
No. of channels
Sampling rate (EEG)
ChineseEEG
10
27 and 19
Geodesic
Novel sentences
2,464 (Little Prince) 9,534 (Garnett Dream)
128
1,000 Hz
Chisco
3
39
10-20 system
Daily phrases
6,566
128
1,000 Hz
Table 6: Overview of the two datasets. ChineseEEG is further divided into two subsets, a short novel (The Little Prince) and a long novel (Garnett Dream).
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 3: Confusion matrices of the classification performance on ChineseEEG, The Little Prince (a), Garnett Dream (b), and Chisco daily phrases (c). Both stories show diagonal patterns, while daily phrases are biased toward some classes.
Datasets
ChineseEEG - short novel (Little Prince)
ChineseEEG - long novel (Garnett Dream)
Chisco - daily phrases
Macro F1 (Perfect classifier, class labels)
100.0 + 0.0
100.0 + 0.0
100.0 + 0.0
Retrieval at 1 (Sentence labels)
21.9 + 1.1
6.0 + 0.3
12.2 + 0.3
Retrieval at 5 (Sentence labels)
67.2 + 1.1
25.3 + 0.4
47.6 + 0.6
Retrieval at 10 (Sentence labels)
88.8 + 0.9
42.6 + 0.9
75.4 + 1.5
Appendix
Table 7: Retrieval evaluation assuming perfect classification. ChineseEEG, The Little Prince achieves the best overall performance, while Chisco outperforms Garnett Dream of ChineseEEG. The numbers are means (%) ± standard deviations (%).
Subject
Macro F1 (Class labels)
Retrieval at 1 (Sentence labels)
Retrieval at 5 (Sentence labels)
Retrieval at 10 (Sentence labels)
sub-04
100.0 ± 0.0
6.2 ± 0.2
25.5 ± 0.2
42.4 ± 0.8
sub-05
100.0 ± 0.0
6.2 ± 0.5
25.5 ± 0.5
43.1 ± 0.6
sub-06
100.0 ± 0.0
6.0 ± 0.3
26.0 ± 0.6
44.0 ± 0.3
sub-07
100.0 ± 0.0
6.3 ± 0.4
25.3 ± 0.1
42.5 ± 0.5
sub-08
100.0 ± 0.0
6.1 ± 0.3
25.9 ± 0.8
43.1 ± 1.1
sub-09
99.8 ± 0.1
5.8 ± 0.2
25.2 ± 0.7
42.6 ± 0.7
Appendix
Table 8: Subject-wise results for ChineseEEG long novel, Garnett Dream. The numbers are means (%) ± standard deviations (%). Slightly superior performance is seen on sub-06.
Subject
Macro F1 (Class labels)
Retrieval at 1 (Sentence labels)
Retrieval at 5 (Sentence labels)
Retrieval at 10 (Sentence labels)
s1
6.2 ± 1.4
0.9 ± 0.2
3.8 ± 0.7
6.5 ± 1.7
s2
5.4 ± 0.9
1.1 ± 0.2
4.0 ± 0.7
6.2 ± 1.3
s3
5.3 ± 0.4
0.7 ± 0.3
3.3 ± 0.3
5.2 ± 1.0
Appendix
Table 9: Subject-wise results for Chisco. The numbers are means (%) ± standard deviations (%).
Dataset
ChineseEEG - short novel (Little Prince)
Chisco - daily phrases
Metric
Macro F1 (Class labels)
Retrieval at 1 (Sentence labels)
Retrieval at 5 (Sentence labels)
Retrieval at 10 (Sentence labels)
Macro F1 (Class labels)
Retrieval at 1 (Sentence labels)
Retrieval at 5 (Sentence labels)
Retrieval at 10 (Sentence labels)
Chance level for hierarchical framework
3.4 ± 0.0
0.4 ± 0.0
1.8 ± 0.0
2.9 ± 0.0
2.5 ± 0.0
0.2 ± 0.0
0.9 ± 0.0
1.7 ± 0.0
Random model
0.5 ± 0.5
0.3 ± 0.3
1.0 ± 0.2
1.2 ± 0.4
1.5 ± 0.6
0.2 ± 0.1
1.2 ± 0.5
2.3 ± 0.4
Base model
68.8 ± 0.9
16.2 ± 1.3
51.9 ± 1.2
68.7 ± 0.4
1.9 ± 0.3
0.4 ± 0.1
1.7 ± 0.5
2.4 ± 0.5
+ KNN + Hierarchical alignment
90.8 ± 0.4
20.0 ± 1.5
62.6 ± 1.0
83.5 ± 1.0
4.4 ± 0.8
0.5 ± 0.2
2.4 ± 0.4
3.8 ± 0.8
+ KNN + Class-wise alignment
90.8 ± 0.4
10.0 ± 0.4
45.6 ± 0.3
74.8 ± 0.3
4.4 ± 0.8
0.4 ± 0.1
1.9 ± 0.1
3.4 ± 0.2
Appendix
Table 10: Ablation studies on the short novel of ChineseEEG and the entire Chisco dataset. The chance level is defined via random classification using the class labels and thereupon random retrieval using the sentence labels. The random model is an untrained model, while the base model is a trained model without KNN. The parameter k of KNN is estimated using the validation set and tested on the test set. The numbers are means (%) ± standard deviations (%).
Figure 4: Topographic maps of ChineseEEG, The Little Prince. The correctly classified samples from the test set are used to generate the maps. Each chapter is associated with different brain areas. In addition, the strongest responses are seen in the temporal and parietal areas, which are important for understanding word meanings and relationships.
Decoding speech information directly from scalp electroencephalography (EEG) into text provides a potential non-invasive neural communication pathway for individuals with severe speech and motor impairments. Compared with invasive approaches such as electrocorticography, EEG is safer and more widely deployable, yet substantially more challenging to decode.This challenge is exacerbated for Chinese sentence decoding, which must handle a high-dimensional output space with thousands of characters, severe inter-subject variability, and low signal-to-noise ratios for text alignment.Existing methods commit to a single supervisory axis---either text semantics or audio acoustic features---yet neither can simultaneously satisfy the demands of sentence-level discriminability and fine-grained temporal resolution required for large-vocabulary Chinese decoding. We introduce EEGAlign, a novel parameter-efficient framework that jointly aligns EEG with two axes---text alignment with BGE-M3 text embeddings and audio alignment with wav2vec~2.0 speech features via contrastive learning followed by CTC character-sequence decoding. On ChineseEEG-2 data, EEGAlign yields state-of-the-art closed-set sentence classification performance, reaching up to 82.37% Top-1 accuracy on Reading Aloud EEG and 41.43% on Passive Listening EEG out of 101 candidates. Ablation studies show that the two alignment axes are highly complementary: combining them yields consistently better performance than either alone. To the best of our knowledge, this is the first study on decoding large-vocabulary Chinese sentences from non-invasive EEG during overt speech production, and achieving strong classification performance with relatively large closed-set candidate-sentence setting.
Tian Zheng, Xurong Xie, Xinxin Zhu +2
University of the Chinese Academy of Sciences · Institute of Software, Chinese Academy of Sciences · Beijing Language and Culture University
Decoding natural language from non-invasive electroencephalography (EEG) remains constrained by low signal-to-noise ratio and limited information bandwidth. This raises a central question: can sentence-level language be reliably recovered from such signals? Under realistic information constraints, this direct-recovery assumption may be too strong. We introduce a semantic compression hypothesis: non-invasive EEG may preserve recoverable semantic anchors rather than the full lexical--syntactic form of a sentence. From this perspective, direct sentence reconstruction is overly fine-grained relative to the recoverable information scale of EEG. To address this mismatch, we propose Brain-CLIPLM, a two-stage framework that decomposes EEG-to-text decoding into semantic-anchor recovery and anchor-guided sentence reconstruction. Stage 1 uses contrastive learning to align word-level EEG evidence with a fixed keyword vocabulary and recover ordered semantic anchors. Stage 2 uses a retrieval-grounded large language model with chain-of-thought reasoning prompts to reconstruct sentence meaning from these anchors, following a granularity matching principle that aligns decoding complexity with the recoverable neural information scale. On the combined Zurich Cognitive Language Processing (ZuCo) benchmark, Brain-CLIPLM achieves 67.6% Top-5 and 85.0% Top-25 sentence retrieval accuracy, with the strongest performance at intermediate anchor granularity. Control analyses show that EEG-derived anchors carry sentence-specific information beyond language-model priors. Within the constrained ZuCo sentence pool and fixed keyword-vocabulary settings, these findings suggest that EEG-to-text decoding is better framed as recovering compressed semantic content before anchor-guided sentence reconstruction.
Xiaoli Yang, Huiyuan Tian, Yurui Li +3
College of Computer Science and Technology, Zhejiang University, Hangzhou, China · State Key Lab of Brain-Machine Intelligence, Zhejiang University, Hangzhou, China
The decoding of linguistic information from electroencephalography (EEG) signals remains an extremely challenging problem in brain-computer interface (BCI) research. In particular, sentence-level decoding from EEG is difficult due to the low signal-to-noise ratio of these recordings. Previous studies tackling this problem have typically failed to surpass random baseline performance unless teacher forcing is used during the inference phase. In this work, we propose a retrieval-augmented generation (RAG)-based sentence-level EEG-to-text decoding pipeline that combines an EEG encoder aligned with semantic sentence embeddings, a vector retrieval stage, and a large language model (LLM) to refine retrieved sentences into coherent output. Experiments are conducted on the Zurich Cognitive Language Processing Corpus (ZuCo) dataset, which contains single-trial EEG recordings collected during silent reading. To evaluate whether the system extracts meaningful information from these EEG signals, the results are compared with a random baseline. In nine subjects, the proposed pipeline outperforms the random baseline, achieving a mean cosine similarity of 0.181 +- 0.022 compared to 0.139 +- 0.029 for the baseline, corresponding to a relative improvement of 30.45%. Statistical analysis further confirms that this improvement is significant, following a strict evaluation workflow where inference is performed without access to ground-truth labels.
Enrico Collautti, Xiaopeng Mao, Luca Tonin +2
IAS-LAB, Department of Information Engineering, University of Padova, 35122 Padova (PD), Italy · Department of Health Technology, Technical University of Denmark, 2800 Kgs. Lyngby, Denmark · Padova Neuroscience Center, 35131 Padova (PD), Italy.