MEG-GPT: A transformer-based foundation model for magnetoencephalography data

Rukuang Huang, SungJun Cho, Chetan Gohil, Oiwi Parker Jones, Mark Woolrich · 2025

Read MEG-GPT: A transformer-based foundation model for magnetoencephalography data by Rukuang Huang, SungJun Cho, Chetan Gohil, Oiwi Parker Jones, Mark Woolrich (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2510-18080.txt.

Introduction

Rukuang Huang and four co-authors present a foundation model for magnetoencephalography, the magnetic echo of brain activity. Modeling large-scale brain dynamics is hard, and classic methods miss much of the structure in such signals. MEG-GPT uses a transformer that attends over time and learns by predicting the next time point.

A new data-driven tokenizer keeps the fine time detail of continuous signals without lossy steps. Training used a large resting-state data set of several hundred people with eyes closed. The trained model generates data with realistic space and frequency traits, including brief events. Neuroscientists get a language-model-style tool for brain signals.

Catalog record

CREATORRukuang Huang, SungJun Cho, Chetan Gohil, Oiwi Parker Jones, Mark Woolrich
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE67 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2510-18080

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

MEG-GPT: A transformer-based foundation model for magnetoencephalography data Rukuang Huang, SungJun Cho, Chetan Gohil, Oiwi Parker Jones, Mark Woolrich Abstract Modelling the complex spatiotemporal patterns of large-scale brain dynamics is crucial for neuroscience, but traditional methods fail to capture the rich structure in modalities such as magnetoencephalography (MEG). Recent advances in deep learning have enabled significant progress in other domains, such as language and vision, by using foundation models at scale. Here, we introduce MEG-GPT , a transformer-based foundation model that uses time-attention and next time-point prediction. To facilitate this, we also introduce a novel data-driven tokeniser for continuous MEG data, which preserves the high temporal resolution of continuous MEG signals without lossy transformations. We trained MEG-GPT on tokenised brain region time-courses extracted from a large-scale MEG dataset (N=612, eyes-closed rest, Cam-CAN data), and show that the learnt model can generate data with realistic spatio-spectral properties, including transient events and population variability. Critically, it performs well in downstream decoding tasks, improving downstream supervised prediction task, showing improved zero-shot generalisation across sessions (improving accuracy from 0.54 to 0.59) and subjects (improving accuracy from 0.41 to 0.49) compared to a baseline methods. Furthermore, we show the model can be efficiently fine-tuned on a smaller labelled dataset to boost performance in cross-subject decoding scenarios. This work establishes a powerful foundation model for electrophysiological data, paving the way for applications in computational neuroscience and neural decoding. Keywords: Electrophysiology; MEG; GPT; Transformer; Foundation Model; Tokenisation Highlights • MEG-GPT , a transformer-based foundation model that learns complex spatiotemporal dynamics from large-scale resting-state MEG data. • A novel data-driven tokeniser converts continuous MEG signals into discrete tokens without loss of temporal or spectral resolution. • MEG-GPT generates realistic synthetic MEG signals that replicate key spatio-spectral properties, including transient events, inter-subject variability and subject-specific fingerprints. • Boosts zero-shot decoding accuracy across subjects (from 0.41 to 0.49) and sessions (from 0.54 to 0.59) compared to traditional baselines. • The pre-trained model efficiently fine-tunes on small, labelled datasets to enhance cross-subject decoding. 1 Introduction A central aim in neuroscience is to understand the rich, dynamic patterns observed in large-scale brain activity. Electrophysiological imaging techniques provide a direct measure of neural activity with millisecond temporal resolution, making them particularly useful for studying fast brain dynamics. Among these techniques, magnetoencephalography (MEG) offers a non-invasive measure of neural activity that is localised with good spatial accuracy and excellent temporal resolution ( Proudfoot et al., 2014 ) . Traditional analyses of source-localised MEG data often involve averaging over space or time, leading to a loss of spatiotemporal information ( Tzovara et al., 2012 ; Brookes et al., 2010 ; König et al., 2015 ; Alexander et al., 2013 ) . For instance, power spectral density (PSD) analyses average over time and sometimes space ( Luck, 2014 ) , while static functional connectivity analyses average over time ( Gohil et al., 2024b ) . Furthermore, these analyses are often applied to small datasets in isolation. The recent availability of large-scale MEG datasets, like Cam-CAN ( Taylor et al., 2017 ; Shafto et al., 2014 ) , offers a new opportunity to move beyond these limitations. Modern deep learning approaches can be trained on large-scale data to extract rich spatiotemporal structure and patterns of population variability, which can then be leveraged to benefit inferences on smaller, specialized datasets ( Géron, 2022 ; Murphy, 2012 ) . Foundation models ( Bommasani et al., 2021 ) are a class of models trained on large amounts of data at scale, often using self-supervised learning ( Géron, 2022 ; Murphy, 2012 ) . This contrasts with supervised learning , which aims to learn a mapping from the data to labels 1 1 1 Auxiliary quantities that we would like to predict. . In self-supervised learning, the objective is to model the statistical dependencies within the data using a label derived from the data itself. In time series data, and in the approach we take here, this is often achieved by predicting the next time step; note that this can also be thought of as fitting an autoregressive generative model to the data. Foundation models can extract ‘general features’ from the training data that can be applied to new datasets. Often, a pre-trained foundation model is fine tuned 2 2 2 Trained for a short period. This can be with the same or a different objective (loss function). on an independent dataset, which may be labelled, for a particular downstream application, such as a prediction task ( Bommasani et al., 2021 ) . Adopting this approach has achieved remarkable success in modelling language and vision ( Radford et al., 2021 ; Ramesh et al., 2021 ; Brown et al., 2020 ; Touvron et al., 2023 ; Dosovitskiy et al., 2020 ; Zhai et al., 2022 ; Nie et al., 2022 ) . This approach is potentially valuable in the analysis of MEG data, where unlabelled resting-state data is abundant and labelled data, such as that for cognitive tasks or clinical populations, is limited. Improving supervised learning performance on MEG data is critical for a variety of neuroscience studies and applications. This includes: predicting a cognitive state based on data, referred to as decoding ( Thomas et al., 2022 ) ; disease classification and biomarker discovery ( Craik et al., 2019 ) ; patient stratification ( Bosl et al., 2018 ; Cassani et al., 2018 ) ; and brain-computer interfaces ( Lotte et al., 2018 ; Dash et al., 2019 ; Tang et al., 2023 ) . Foundation models offer a powerful framework for such applications, as they can be adapted to specific tasks with minimal labelled data while leveraging prior knowledge from large-scale unlabelled data ( Bommasani et al., 2021 ) . While existing foundation models for electrophysiological data often rely on time-frequency transformations, such as wavelet methods ( Wang et al., 2023 ; Yuan et al., 2024 ) , that compromise data resolution, our approach circumvents this entirely. Inspired by the Generative Pre-Trained Transformer (GPT) family of models ( Radford et al., 2018 ; Radford et al., 2019 ; Brown et al., 2020 ) , we introduce MEG-GPT , a foundation model that learns directly from tokenised MEG data. MEG-GPT is a nonlinear autoregressive (AR) model ( Marple Jr, 2019 ) based on a transformer architecture 3 3 3 More specifically, MEG-GPT is based on the decoder block of a transformer architecture. ( Vaswani et al., 2017 ; Géron, 2022 ) . This model predicts the next token from a sequence of previous tokens. This is made possible by another contribution: a bespoke, data-driven tokeniser for continuous electrophysiological data that operates with no loss in temporal or spectral resolution. Foundation models are typically evaluated in terms of their performance on downstream tasks, such as classification or prediction ( Bommasani et al., 2021 ; Zhai et al., 2022 ) . However, the generative nature of GPT models means they are able to produce new synthetic data. This offers a complementary approach for evaluating model performance. We can assess whether the model can generate important features of interest that are present in the training data in the new synthetic data. In language and vision models, this is done by qualitatively examining the

Read the complete text