EEG intelligent agent automatic analysis method based on large language model
By building an EEG agent based on a large language model and combining deep neural networks with retrieval-enhanced generation technology, the problem of multi-task integration in EEG analysis is solved, and efficient and accurate EEG analysis and report generation are achieved.
Patent Information
- Application Number
- CN202511271176.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-09-08
AI Technical Summary
Existing EEG analysis technology lacks an intelligent framework that can coordinate and integrate multiple analysis technologies, resulting in low analysis efficiency and insufficient transparency, making it difficult to meet complex multi-task requirements.
Build an EEG agent based on a large language model, combine deep neural network classification models and retrieval enhancement generation technology to realize multi-scale temporal feature extraction, and conduct automated analysis of comprehensive EEG tasks through autonomous planning and calling tools of the large language model.
It achieves efficient and accurate EEG analysis, can independently plan the analysis process, dynamically call tools, and generate structured EEG reports, improving the transparency and credibility of the analysis.
Smart Images

Figure CN120804603A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of electroencephalogram information, and particularly relates to an EEG intelligent agent automatic analysis method based on a large language model. BACKGROUND
[0002] Accurate and efficient interpretation of brain activity is a core issue in modern neuroscience, clinical medicine, and even human-computer interaction. Among numerous neurophysiological techniques, electroencephalogram (EEG) has become the most widely used tool due to its non-invasive, high temporal resolution, and low cost. EEG captures electrical signals generated by neuronal activity through scalp electrodes, providing rich multi-channel time series data that encodes dynamic information of physiological processes and pathological changes. However, EEG analysis faces significant challenges, as the signal is highly non-stationary, has low signal-to-noise ratio, and exhibits significant inter-individual differences. To address these challenges, the research field has developed a variety of highly specialized analysis techniques.
[0003] Deep learning models, particularly convolutional neural networks (CNN) for extracting spatio-temporal patterns and Transformer architectures for modeling sequence dependencies, have become efficient modules for performing specific tasks such as feature extraction or classification. For example, the use of CNN and Transformer structures in EEG is thoroughly explored in the literature [Li Xiang, Aierken Haimudula. EEG decoding based on CNN and Transformer. Microelectronics and Computer, 1-12]. Meanwhile, to address signal denoising and individual differences, a variety of mature techniques have emerged, including blind source separation (BSS), denoising autoencoders, and transfer learning. For example, transfer learning is used to solve the brain load recognition task in the literature [Jiang Xinyi, Chen Lanlan, Zheng Shipeng. Research on mental workload recognition based on active transfer learning. Computer Engineering, 1-13]. These methods provide effective solutions for specific aspects of the EEG analysis process.
[0004] However, these advanced techniques are usually independent in application, lacking a framework for coordinated invocation, resulting in a systematic "task isolation problem". In practical applications, the analysis process is often complex and multi-step, requiring the ordered combination of multiple links such as artifact removal, event detection, state classification, and report generation. Currently, there is a lack of an intelligent framework that can automatically schedule and integrate these independent technologies according to specific task requirements; this lack of integration capability not only reduces analysis efficiency, but also makes the entire analysis process lack transparency and credibility. Therefore, a core challenge is to build an intelligent system that can credibly and explainably integrate and schedule existing analysis technologies to solve complex, multi-task requirements. Fortunately, the latest breakthroughs in large language models (LLM) provide an ideal solution, with their powerful task planning and tool integration capabilities making them an ideal technical foundation for achieving such intelligent coordination. SUMMARY
[0005] In view of the above, the present application provides a large language model-based EEG intelligent agent automatic analysis method, which can automatically solve complex EEG tasks of comprehensive nature.
[0006] A large language model-based EEG intelligent agent automatic analysis method, comprising the following steps: (1) obtaining an EEG dataset, wherein each EEG data contains multi-channel EEG signals collected from a subject (lasting several minutes to several tens of minutes); (2) dividing the entire EEG dataset into a training set and a test set after preprocessing the EEG data; (3) constructing a deep neural network classification model and training the model using the training set, the deep neural network classification model comprising: a full-period classification neural network, which takes the full-channel EEG signal of the entire duration of the EEG data as input, takes the window as the basic feature analysis unit, extracts the features of each window through a multi-layer convolutional network, then fuses the window features through a self-attention network to obtain the overall features of the EEG data and performs clinical semantic-related classification; a window segment classification neural network, which takes the full-channel EEG signal of the window segment of the EEG data as input, calculates the spectral feature of the short-time Fourier transform (STFT) of the input data, then obtains the window feature through a multi-layer convolutional network and a self-attention network and performs clinical semantic-related classification; a single-second segment classification neural network, which takes the single-channel EEG signal of the single-second segment of the EEG data as input, obtains the feature of the single-channel EEG signal through a multi-layer convolutional neural network and a self-attention network, and performs clinical semantic-related classification; (4) Collecting clinical knowledge texts related to EEG (in the form of TXT, PDF, etc.); (5) Deploying large language models and embedding models, the former supporting natural language dialogue and the latter supporting storage and retrieval of EEG-related clinical knowledge; (6) Building an EEG automatic analysis intelligent agent, which includes: a tool module based on a trained deep neural network classification model to analyze high-level semantics (such as pathological positive abnormalities, whether it is epilepsy or slow waves, etc.) and low-level semantics (such as frequency band energy intensity, EEG inter-channel symmetry, etc.) of EEG; a retrieval-enhanced generation module for converting the collected EEG-related clinical knowledge texts into vector form through the embedding model and storing them in the knowledge vector database; when the user issues a task, the most similar vectors corresponding to several knowledge texts are found from the vector database according to the task requirements and added to the dialogue context; a thinking, planning and execution module that analyzes the user-specified task, the data environment, the dialogue context and the knowledge vector database using the large language model to plan the process and method for solving the task and execute it; (7) According to the user-specified task and the provided EEG data, the EEG automatic analysis intelligent agent is used to automatically analyze and summarize the EEG (including but not limited to EEG event detection, sleep staging, emotion recognition, EEG report generation, etc.).
[0007] Further, the pre-processing process of the EEG data in step (2) is as follows: first, 21 channels of EEG signals specified by the international 10-20 standard lead system are selected from the EEG data, then the EEG signals of these channels are band-pass filtered at 0.5-70 Hz, then 60 Hz notch filtering is performed, and finally the 21 channels of EEG signals are differentially recombined according to the standard transverse central parietal (TCP) lead method to generate 22 channels of EEG signals as pre-processed EEG data.
[0008] Further, the full-time period classification neural network first processes the full-channel EEG signal of the input EEG data throughout the time period, divides it into multiple non-overlapping time windows according to a preset length (a 10-second window), then passes each window data through a convolution network composed of a one-dimensional convolution layer, a root mean square normalization, a GELU (Gaussian Error Linear Unit) activation function, and a one-dimensional maximum pooling layer connected in sequence, to generate respective deep feature vectors; then, the deep feature vectors of all windows are spliced into a feature vector sequence, and a learnable global classification identifier is added at the starting position of the sequence, and then the entire sequence is input into a multi-layer self-attention transformer network based on rotary position encoding, which deeply fuses the local information of each window and the global timing features into the global classification identifier, and finally the global classification identifier that has aggregated the full-time period information is sent to a fully connected layer for classification to obtain a classification prediction result related to the clinical semantics.
[0009] Further, the window period classification neural network first performs short-time Fourier transform on the full-channel EEG signal of the input EEG data window period (10 seconds in length), converting it from the time domain to the frequency domain, which generates a corresponding frequency spectrum for each time domain analysis window data, then passes these frequency spectra through a convolution network composed of a one-dimensional convolution layer, a root mean square normalization, a GELU activation function, and a one-dimensional maximum pooling layer connected in sequence, to extract frequency domain deep feature vectors from the frequency spectrum; then, the frequency domain deep feature vectors of all windows are spliced into a feature vector sequence, and a learnable global classification identifier is added at the starting position of the sequence, and then the entire sequence is input into a multi-layer self-attention transformer network based on rotary position encoding, which deeply fuses the local information of each window and the global features, and aggregates the key information after fusion into the global classification identifier, and finally the global classification identifier that has aggregated the information of the entire window period is sent to a fully connected layer for classification to obtain a classification prediction result related to the clinical semantics.
[0010] Further, the single-second segment classification neural network first processes the single-channel EEG signal of the input EEG data single-second segment (1 second in length). The signal is processed by a convolutional network composed of a one-dimensional convolutional layer, root mean square normalization, a GELU activation function, and a one-dimensional maximum pooling layer connected in sequence, to decompose and extract the single-channel EEG signal into a series of deep feature vectors, where each vector represents a micro-time segment in the single-channel EEG signal. Then, the deep feature vectors of all micro-time segments are spliced into a feature vector sequence, and a learnable global classification identifier is added at the beginning of the sequence. The entire sequence is then input into a multi-layer self-attention transformer network based on rotational position encoding. The network deeply fuses the local information of each micro-time segment with the global temporal features, and aggregates the fused key information into the global classification identifier. Finally, the global classification identifier, which carries the information of the entire single-second segment, is input into a fully connected layer for classification, and the classification prediction result related to the clinical semantics is obtained.
[0011] Further, the tool module includes two parts: a parametric tool and a non-parametric tool. The parametric tool is a trained deep neural network classification model that maps EEG input data to labels with clinical semantics by extracting features through the corresponding classification neural network. The non-parametric tool includes some general feature statistical methods for extracting statistical features of EEG input data, including mean, variance, root mean square value, brain activity band energy, and symmetry. Whether it is a parametric tool or a non-parametric tool, the core is a functional module that receives EEG data input and outputs meaningful results. These tools support flexible expansion and plug-and-play, and are not limited to the above examples. They can be dynamically added, deleted, and replaced according to the requirements of EEG tasks.
[0012] Further, the retrieval enhancement generation module first cuts the read-in clinical knowledge text into blocks of 300 characters, then converts each block into a vector through Qwen3-Embedding-8B (Qwen3-Embedding-8B), and stores the converted vector of each block in the FAISS (Facebook Artificial Intelligence Similarity Search) vector database.
[0013] Further, the thinking, planning, and execution module uses a large language model as the basis, automatically analyzes the user's task, generates a plan to use the corresponding tool based on the analysis, then executes the tool and obtains the execution result, and concatenates the execution result with the dialogue context to re-analyze and execute the tool and make a final answer to the user.
[0014] A computer device comprises a memory and a processor, the memory has a computer program stored therein, and the processor is configured to execute the computer program to implement the EEG intelligent agent automatic analysis method based on a large language model.
[0015] A computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the EEG intelligent agent automatic analysis method based on a large language model.
[0016] The present application solves the two challenges of complexity of multi-scale time sequence dependent feature extraction and end-to-end solution of comprehensive EEG related tasks in traditional EEG analysis by constructing an intelligent agent based on a large language model, which deeply integrates deep neural network classification model, traditional statistical analysis method and retrieval enhancement generation technology. First, by constructing classification neural networks of three different time scales of full period, window period and single second period, hierarchical and multi-granularity feature extraction of EEG signals from second-level transient events to long-period overall background activity is realized. Each model uses the combination of convolutional network and self-attention mechanism to efficiently capture key information from local waveform pattern to long-range time dependence, thereby accurately completing high-level semantic classification tasks such as pathological positive abnormalities and epileptic slow waves. Secondly, taking the large language model as the planning and execution core, and combining the retrieval enhancement generation module, the classification results of the deep model and the low-level feature analysis of the traditional statistical method are packaged as callable tools. The intelligent agent can autonomously plan the analysis process, dynamically call the corresponding tools, and integrate the analysis results with the retrieved clinical knowledge, and finally generate a structured and professional EEG analysis report in natural language form.
[0017] The present application not only significantly improves the accuracy and robustness of EEG clinical semantic classification through multi-scale deep learning model, but also innovatively constructs an intelligent agent that can autonomously plan, call tools and integrate domain knowledge, providing a complete and efficient solution for end-to-end, highly automated EEG analysis, interpretation and report generation. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 The present application is based on a large language model EEG intelligent agent automatic analysis method flowchart.
[0019] Figure 2 The present application is a structure diagram of the deep neural network classification model.
[0020] Figure 3 The present application is a structure diagram of the brain electrical automatic analysis intelligent agent. DETAILED DESCRIPTION
[0021] In order to more specifically describe the present application, the technical solutions of the present application are described in detail below in combination with the drawings and specific embodiments.
[0022] As Figure 1 shown, the EEG intelligent agent automatic analysis method based on a large language model of the present application includes the following steps: (1) Obtain a conventional electroencephalogram data set, each EEG in the data set has a duration of several minutes to several tens of minutes, and a label is assigned to the channel and time period of the data.
[0023] In the present embodiment, the data set comes from the public data sets TUAB, TUSL and TUEV created by Temple University Hospital, with versions v3.0.1, v2.0.0 and v2.0.0 respectively. TUAB is a clinical electroencephalogram data set, which contains 2,993 electroencephalogram files from 2,383 subjects, with a sampling rate of not less than 250Hz. The core content of the data set is to provide a global diagnostic label for each complete electroencephalogram record, determining whether it is "normal" or "abnormal". The data set is divided into a training set containing 2,717 files and an evaluation set containing 276 files, with no overlap between the subjects in the two groups. The data also contains demographic information such as the age and gender of the subjects.
[0024] TUSL is a data set focused on labeling "slowing" activities in electroencephalogram signals, with a sampling rate of 256Hz. The labeling method of this data set is at the term level, i.e. a 10-second electroencephalogram segment is applied with a uniform label on all channels. These labels are divided into three categories: "slowing", "seizure" and "complex background". The data set contains 300 files from 75 sessions, and provides 1,000 seconds of labeled data for each of the three categories mentioned above.
[0025] TUEV is a data set that provides event-level fine labeling, with a sampling rate of 256Hz. It contains labeling of six specific events: sharp and spike waves (spsw), generalized periodic epileptiform discharges (gped), periodic lateral epileptiform discharges (pled), eye movement (eyem), artifact (artf) and background (bckg). The labeling information clearly defines the start time, end time and specific channel of each event. The data set contains a total of 518 files, divided into a training set (359 files) and an evaluation set (159 files).
[0026] (2) Perform conventional preprocessing on the EEG signals in the data set to process the original EEG signals into a form that neural networks are good at processing.
[0027] The preprocessing method for TUAB, TUSL and TUEV in the embodiment is similar, first, 21 channels of the international 10-20 standard lead system are selected, then the 21 channel data is differentially recombined according to the standard transverse central parietal lead method of the American Clinical Neurophysiology Society to generate 22 difference channels as the processed data; then a band-pass filter of 0.5-70 Hz is used, which can remove high-frequency interference signals, and this is also a clinically summarized filtering method, and then a 60 Hz notch filter is used, which is to eliminate the interference of alternating current frequency in the data. The subsequent special processing of the TUAB data set reduces the data sampling rate to 100 Hz (the remaining data sets remain at 256 Hz sampling rate), which is because the TUAB data is longer in time and needs to reduce the amount of calculation, then the data of each EEG record from the 2nd minute to the 21st minute is taken out, with a total length of 20 minutes, and the insufficient part is filled with 0 at the end, which can remove the significant artifacts in the first minute due to the tightness of the collection device at the beginning of collection.
[0028] The subsequent data set division when training the neural network, TUAB, TUSL and TUEV are divided into training set and test set according to the default division method of the data set file. The data and label correspondence of the TUAB data set is that all channels of the full period correspond to a pathological normal and abnormal label; the TUSL data set takes out the corresponding window segment according to the label file, and the data and label correspondence is that all channels of the window segment correspond to a slow wave activity, epileptiform discharge and background activity label; the TUEV data set has 6 categories, first, the corresponding channel and single second segment are taken out according to the label file, the sharp wave and spike wave, generalized periodic epileptiform discharge, periodic lateral epileptiform discharge are merged into the epileptiform discharge class, the eye movement and artifact are merged into the artifact class, and the artifact class and the background activity can be further regarded as non-epileptiform discharge class, and then three labels are constructed: epileptiform discharge, artifact and background label; epileptiform discharge and non-epileptiform discharge label, eye movement and artifact label. In summary, five kinds of labels are constructed, and five kinds of deep neural network classification models are trained.
[0029] (3) Training a deep network classification model is a tool for converting EEG data into a classification result of labels with clinical semantics, which has learnable parameters and good generalization.
[0030] The embodiment method involves 3 network structures and 5 models, the difference between the 3 network structures is only reflected in the time and channel scale of the processed EEG, as shown in Figure 2 The all-time classification neural network can be divided into three parts: window feature extraction, window feature fusion, and feature classification. In the window feature extraction part, the basic structure of 1D convolution, root mean square normalization, Gaussian error linear unit, and max pooling is adopted, which is stacked twice, and then a global average pooling operation is performed to obtain the window feature, which is represented as follows: wherein: represents max pooling, represents activation operation, represents root mean square normalization, represents 1D convolution, represents the i-th data window, represents global average pooling, , , represents the feature obtained at each stage, in particular represents the window feature.
[0031] Subsequently, the window feature is passed through a window feature fusion part, which is an 8-layer stacked rotary position self-attention network, used to model the relationship between windows, and the summarized information is placed into a global classification identifier, the process being as follows: wherein: represents the rotary position self-attention mechanism, represents layer normalization, represents the feedforward network, represents the process of calculating attention output, represents the rotary position transformation, , , represent three tensors obtained by linear transformation, represents dimension, represents the output of the rotary position self-attention network, in particular represents the window fusion feature.
[0032] Finally, a feature classification module composed of a layer of fully connected layer can obtain the classification result: The window segment classification neural network is almost the same as the full-time segment classification neural network, except that the length of the data accepted is smaller, which is divided into four parts: short-time Fourier transform, extraction of time-frequency features, fusion of time-frequency features and feature classification. First, the short-time Fourier transform calculates the spectrogram, then the time-frequency features of the spectrogram are extracted, the frequency domain features of each time segment are fused in the full time period, and finally the fused features are classified through the classification layer. The above process can be represented as: Wherein: represents the short-time Fourier transform, represents the transformed spectrogram, represents the intermediate result, and other operations are the same as those in the window segment classification neural network described above. Here, due to the shorter length of the data, only two layers of are used.
[0033] The single-second segment classification neural network is almost the same as the full-time segment classification neural network, except that the length of the data accepted is smaller and the channel is less. It is divided into three parts: extraction of short-time features, fusion of short-time features and feature classification. The short-time features here refer to the features of a time segment shorter than a single second. The above process can be represented as: Wherein: represents the EEG data of a single-second time segment; due to the shorter length of the data, only two layers of are used, and other operations are the same as those in the window segment classification neural network described above.
[0034] Each data set is organized according to the way in step (2) to organize data and labels and division method for training. The training process uses a cross-entropy loss function as the loss function, and the cross-entropy loss function has a LogSoftmax (soft maximum value logarithm) operation, which can convert the output of the last layer of the network model into a probability vector. The specific expression is as follows: Wherein: Z y is the correct class y unnormalized score, denotes the sum of the index scores of all categories.
[0035] Small batch training is used in training, and the loss in a batch is the average of the loss of each sample, which is expressed as follows: wherein: L batch denotes the batch loss, N denotes the number of samples in the batch, L n denotes the cross-entropy loss of the n th sample.
[0036] The training uses the Adam optimizer, and the cosine annealing learning rate adjustment strategy is used to help the stable update of the parameters in the training process.
[0037] (4) Collect EEG-related clinical knowledge texts, which can be papers, web pages, manuals, published books, etc., in TXT or PDF format.
[0038] In this implementation method, knowledge texts are collected in multiple aspects to build a knowledge base. General knowledge texts cover professional terms for EEG interpretation, including knowledge of the meaning and identification of epilepsy, as well as guidance for writing EEG reports. Academic papers include introductions and achievements of multiple tasks of EEG, involving papers related to sleep staging, emotion recognition, attention level, and depression-related disorders. Textbook content includes texts of the nature of EEG application and operation guidelines, involving practical application methods. These collected knowledge texts will be used in a retrieval enhancement generation module of an EEG automatic analysis intelligent agent based on a large language model.
[0039] (5) Model deployment, including a large language model and a language embedding model, which can be flexibly replaced on demand.
[0040] The large language model is a deep neural network model that supports natural language dialogue, and the language embedding model is a model that establishes the mapping relationship between natural language text and numerical feature vectors. In this implementation method, the large language model uses a cloud-provided model, specifically Qwen3-235B, which is one of the best large language models for natural language understanding and expression, supports online calling, and can be replaced with other large language models without affecting the structure of the intelligent agent. The language embedding model uses Qwen3-embdding-8B, which is the best language embedding model at present, and can also be replaced with other language embedding models without affecting the structure of the intelligent agent. It is deployed in the knowledge base and is responsible for converting natural language text into numerical feature vectors and storing them in the vector database. Here, the vector database uses FAISS.
[0041] (6) Build a knowledge base as shown inFigure 3 The EEG automatic analysis agent shown in the figure is mainly composed of a tool module, a retrieval enhancement generation module, and a thinking, planning and execution module.
[0042] In this implementation, all functions for processing EEG signals and extracting specific information are abstracted into a flexibly pluggable "tool" module, as shown below: in: Indicates tools, The data itself may have the constraints of intercepting part of the time or part of the channel. Represents the observations obtained from tool operation data.
[0043] This module supports easy addition, deletion and replacement. The tool module includes two parts: parametric tools and non-parametric tools. Parametric tools specifically refer to deep neural network models that need to be trained with data. They contain parameters that can be adjusted through learning. For example, there are five neural network models that have been trained and deployed for three time granularities: full period, window segment and single second segment, and two spatial granularities: full channel and single channel. In contrast, non-parametric tools refer to methods that are based on fixed statistical formulas and can be used directly without training. The examples selected in this implementation method include mean, variance, root mean square value, brain activity frequency band energy and symmetry analysis. The calculation methods of these tools are deterministic and unified. All parametric tools and non-parametric tools constitute a toolset that directly operates on the EEG data itself, as shown below: in: Represents parameter tools, represents the learnable parameters, represents a nonparametric instrument, Represents the classification results, Represents the statistical results, Indicates the tool execution result.
[0044] The retrieval enhancement generation module in this implementation method is designed to enhance the large language model's understanding of EEG signals and EEG-related tasks, such as emotion recognition, epilepsy detection, and sleep staging. It uses an external knowledge base to store reliable EEG-related clinical knowledge. Specifically, the knowledge text is segmented according to natural sentences and a maximum size of 300 words. This can prevent the problem of long text expressions with unclear meanings and solve the problem of incomplete sentences. Then, a language embedding model is used to convert the text blocks into vector representations and pre-store them in the vector database. This preparation process can be formally expressed as follows: wherein: represents knowledge texts, represents text chunking operation, represents the cut-out text blocks, represents text block embedding operation, represents vector database.
[0045] When a problem or task to be solved comes, the problem is also converted into a numerical vector through the language embedding model, and then the similarity between vectors is calculated in the vector database, the top 3 feature vectors with the highest similarity are selected as the representative text blocks with high correlation, and then the decoding module of the language embedding model is used to restore the selected feature vector blocks to natural language blocks, and then these natural language blocks and the problem are passed to the large language model to enhance its generation ability. The retrieval process can be formalized as follows: wherein: Q represents the problem, i.e. the task to be solved, represents text block embedding operation, represents vector database, represents decoding process, represents natural language blocks, which are retrieved and decoded from VDB, represents feeding the task to be solved and the retrieved possibly meaningful knowledge to the large language model.
[0046] The thinking, planning and execution module in the implementation method is the decision-making core of the whole electroencephalogram automatic analysis intelligent agent. Its design aims to upgrade the large language model from a passive text generator to an intelligent agent that can independently think, plan and execute tools according to tasks. All actions of the agent are based on a dynamically updated context, which is represented as follows: wherein: represents the context at time t, represents the task to be solved, represents the basic information of the EEG signal, represents the relevant knowledge retrieved by the retrieval and enhancement generation module, represents the history record of all past interactions.
[0047] Its workflow follows an iterative "thinking-planning-execution" cycle: first, the large language model generates a plan based on the current context and the basic information of the EEG signal, and then executes the plan to achieve the task to be solved. The context is dynamically updated based on the interaction between the agent and the user, and the basic information of the EEG signal is updated in real time. The workflow can be formalized as follows: The thinking, task decomposition and solution strategy formation; then, it will convert thinking into a specific, executable plan, which is usually manifested as a call instruction to a certain tool, the system then executes this plan and gets an observation. This complete single-cycle from receiving context to generating new observations can be formally represented as: Wherein: represents the context at time t, represents the large language model, represents the thinking and planning at time t, represents the execution of the planning at time t, represents the set of execution results of the tool set observed at time t.
[0048] The agent will continuously iterate this cycle, incorporating new observations into the context until the task is judged to be complete and the final conclusion is given.
[0049] (7) Automatic analysis and summary of electroencephalogram.
[0050] The automatic analysis and summary of electroencephalogram is the ability of the agent to have intelligent EEG analysis and adaptive summary. The large language model can plan the analysis process and call the corresponding tools for execution according to the task requirements, real-time signal features and context information. After completing multi-step reasoning, it can integrate and condense all information to form a comprehensive conclusion or summary, fully embodying its intelligent decision-making characteristics. The big advantage of this process is its high flexibility and customizability; users can inject specific business rules or constraints into the agent's context (for example, following the specifications of a specific hospital or research project) to meet individual analysis needs. Taking EEG report generation as an example, users only need to provide a structural description and example of a report template, and the agent can accurately follow the format to generate highly standardized and structurally consistent professional reports; this ability ensures that the agent can not only perform standardized tasks, but also flexibly adapt to special requirements in different application scenarios.
[0051] The above description of the embodiments is to facilitate those skilled in the art to understand and apply the present application. Those skilled in the art can easily make various modifications to the above embodiments, and apply the general principles described herein to other embodiments without creative labor. Therefore, the present application is not limited to the above embodiments, and any improvements and modifications made by those skilled in the art based on the disclosure of the present application should be within the scope of protection of the present application.
Claims
1. An EEG agent automatic analysis method based on a large language model, characterized in that: The steps include: (1) Obtain an EEG dataset, where each EEG data piece contains a multi-channel EEG signal collected from a subject; (2) After preprocessing the EEG data, the entire EEG data set is divided into a training set and a test set; (3) Constructing a deep neural network classification model and training the model using a training set, wherein the deep neural network classification model includes: The full-time classification neural network takes the full-channel EEG signal of the entire EEG data as input and the window as the basic feature analysis unit. It extracts the features of each window through a multi-layer convolutional network, and then fuses the features of each window through a self-attention network to obtain the overall features of the EEG data and perform clinical semantic-related classification. The window segment classification neural network takes the full-channel EEG signal of the EEG data window segment as input, calculates the spectrogram features of the short-time Fourier transform of the input data, and then obtains the window features through a multi-layer convolutional network and a self-attention network to perform clinical semantic relevance classification; The single-second segment classification neural network takes the single-channel EEG signal of a single-second segment of EEG data as input, obtains the features of the single-channel EEG signal through a multi-layer convolutional neural network and a self-attention network, and performs clinical semantic relevance classification; (4) Collect clinical knowledge texts related to EEG; (5) Deployment of large language models and embedding models, the former supporting natural language conversations and the latter supporting the storage and retrieval of EEG-related clinical knowledge; (6) Construct an intelligent agent for automatic EEG analysis, which includes: A tool module that uses a trained deep neural network classification model to analyze high-level and low-level semantics of EEG; The retrieval enhancement generation module is used to convert the collected EEG-related clinical knowledge text into vector form through the embedding model and store it in the knowledge vector database. When the user issues a task, the vectors corresponding to the most similar knowledge texts are found from the vector database according to the task requirements and added to the conversation context. The thinking, planning, and execution module analyzes user-specified tasks based on the user-specified tasks, the data environment, the conversation context, and the knowledge vector database using a large language model, plans a process method to solve the task, and executes it. (7) Based on the user-specified tasks and the provided EEG data, the EEG automatic analysis agent is used to automatically analyze and summarize the EEG.
2. The EEG agent automatic analysis method based on a large language model according to claim 1, characterized in that: The process of preprocessing the EEG data in step (2) is as follows: first, 21 channels of EEG signals specified by the international 10-20 standard lead system are selected from the EEG data, and then the EEG signals of these channels are band-pass filtered at 0.5-70 Hz, and then notch filtered at 60 Hz. Finally, the EEG signals of these 21 channels are differentially recombined according to the standard transverse central parietal lead method to generate 22 difference channel EEG signals as the preprocessed EEG data.
3. The EEG agent automatic analysis method based on a large language model according to claim 1, characterized in that: The full-time classification neural network first processes the full-channel EEG signal of the entire time length of the input EEG data, divides it into multiple non-overlapping time windows according to a preset length, and then passes each window data through a convolutional network composed of a one-dimensional convolutional layer, root mean square normalization, GELU activation function, and a one-dimensional maximum pooling layer connected in sequence to generate its own deep feature vector; then, the deep feature vectors of all windows are spliced into a feature vector sequence, and a learnable global classification identifier is added at the starting position of the sequence, and then the entire sequence is input into a multi-layer self-attention transformer network based on rotational position encoding, which deeply fuses the local information of each window with the global temporal features into the global classification identifier. Finally, this global classification identifier that aggregates the full-time information is sent to a fully connected layer for classification to obtain a classification prediction result related to clinical semantics.
4. The EEG agent automatic analysis method based on a large language model according to claim 1, characterized in that: The window segment classification neural network first performs a short-time Fourier transform on the full-channel EEG signal of the input EEG data window segment, converting it from the time domain to the frequency domain. This process generates a corresponding spectrogram for the data of each time domain analysis window. These spectrograms are then passed through a convolutional network composed of a one-dimensional convolutional layer, root mean square normalization, GELU activation function, and a one-dimensional maximum pooling layer connected in sequence to extract frequency domain deep feature vectors from the spectrogram; then, the frequency domain deep feature vectors of all windows are spliced into a feature vector sequence, and a learnable global classification identifier is added at the starting position of the sequence, and the entire sequence is input into a multi-layer self-attention transformer network based on rotational position encoding, which deeply fuses the local information of each window with the global features, and aggregates the fused key information into the global classification identifier. Finally, this global classification identifier that aggregates the information of the entire window segment is sent to a fully connected layer for classification to obtain a classification prediction result related to clinical semantics.
5. The EEG agent automatic analysis method based on a large language model according to claim 1, characterized in that: The single-second segment classification neural network first processes the single-channel EEG signal of the single-second segment of the input EEG data. The signal passes through a convolutional network composed of a one-dimensional convolutional layer, root mean square normalization, GELU activation function, and a one-dimensional maximum pooling layer connected in sequence to decompose the single-channel EEG signal and extract it into a series of deep feature vectors, each of which represents a small time period in the single-channel EEG signal; then, the deep feature vectors of all small time periods are spliced into a feature vector sequence, and a learnable global classification identifier is added at the starting position of the sequence, and then the entire sequence is input into a multi-layer self-attention transformer network based on rotational position encoding, which deeply fuses the local information of each small time period with the global temporal features, and aggregates the fused key information into the global classification identifier. Finally, this global classification identifier carrying the entire single-second segment information is sent to a fully connected layer for classification to obtain a classification prediction result related to clinical semantics.
6. The EEG agent automatic analysis method based on a large language model according to claim 1, characterized in that: The tool module includes two parts: parametric tools and non-parametric tools. The parametric tool is a trained deep neural network classification model. It extracts features based on specific EEG input data through the corresponding classification neural network, and finally maps the EEG input data into labels with clinical semantics; the non-parametric tool contains some common feature statistical methods, which are used to extract statistical features of EEG input data including mean, variance, root mean square value, brain activity frequency band energy, and symmetry.
7. The EEG agent automatic analysis method based on a large language model according to claim 1, characterized in that: The retrieval enhancement generation module first cuts the read clinical knowledge text into blocks of 300 characters, then vectorizes each block through Qwen3-Embedding-8B, and stores the converted vector of each block into the FAISS vector database.
8. The EEG agent automatic analysis method based on a large language model according to claim 1, characterized in that: The thinking, planning and execution module uses a large language model as its basis to automatically analyze the user's tasks, automatically generate a plan for using the corresponding tools based on the analysis, then execute the tools and obtain the execution results, and then splice the execution results with the conversation context, re-analyze and execute the tools, and give the final answer to the user.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: The processor is used to execute the computer program to implement the EEG agent automatic analysis method based on the large language model as described in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the EEG agent automatic analysis method based on a large language model as described in any one of claims 1 to 8.
Citation Information
Patent Citations
EEG time-sharing frequency spectrum Riemannian-based semantic visual image classification method and device
CN113974658A
Smart Meat Processing and Production System for Enhanced Freshness and Preservation
KR102865031B1
Systems and methods for processing data involving aspects of brain computer interface (BCI), virtual environment and / or other features associated with activity and / or state of a user's mind, brain and / or other interactions with the environment
WO2024192445A1
Cited By
Mental disease identification method combining electronic medical record and electroencephalogram signal
CN122314351A