EEG intelligent agent automatic analysis method based on large language model

By constructing an EEG agent based on a large language model and combining deep neural networks and traditional statistical methods, multi-scale temporal feature extraction and automated analysis process planning were achieved. This solved the problem of multi-task integration in EEG analysis, improved analysis efficiency and accuracy, and generated professional EEG reports.

CN120804603BActive Publication Date: 2026-01-20ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511271176.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-08
Publication Date
2026-01-20
Estimated Expiration
2045-09-08

AI Technical Summary

Technical Problem

Existing EEG analysis technologies lack an intelligent framework that can coordinate and invoke each other, resulting in complex and inefficient analysis processes, insufficient transparency and credibility, and an inability to automatically integrate multiple independent analysis technologies to address complex, multi-tasking needs.

Method used

An EEG intelligent agent based on a large language model is constructed. Combining a deep neural network classification model and traditional statistical analysis methods, multi-scale temporal-dependent feature extraction is performed through classification neural networks of full time period, window segment and single second segment. The large language model is used to autonomously plan and execute the analysis process, dynamically call tool modules and retrieval enhancement generation modules, and generate structured EEG analysis reports.

Benefits of technology

It achieves end-to-end, highly automated EEG analysis, improving the accuracy and robustness of clinical semantic classification. It can autonomously plan the analysis process and generate professional EEG reports, solving the integration challenge of multi-task requirements in traditional EEG analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804603B_ABST
    Figure CN120804603B_ABST
Patent Text Reader

Abstract

The application discloses an EEG intelligent agent automatic analysis method based on a large language model, takes the large language model as a strategy engine, autonomously understands user analysis intentions and performs intelligent decomposition of tasks, and then dynamically schedules and cooperatively integrates analysis resources including traditional feature engineering, diversified deep learning models and external knowledge bases. The application can realize end-to-end automatic coordination and execution of complex EEG analysis tasks from signal preprocessing, feature extraction, event positioning to classification diagnosis, emotion recognition, sleep staging, etc., breaks through the limitation of single detection or classification tasks, and enables multi-task, continuous deep reasoning and interpretation of complex EEG data through context perception and flexible space-time analysis capability. The application deeply integrates the general planning and reasoning capability of the large language model with the special analysis model in the EEG field, and significantly improves the automation level, flexibility and clinical application potential of EEG analysis.
Need to check novelty before this filing date? Find Prior Art

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 technology 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:

[0007] (1) Obtain an EEG dataset, wherein each EEG data contains multi-channel EEG signals collected from a subject (lasting several minutes to several tens of minutes);

[0008] (2) After preprocessing the EEG data, divide the entire EEG dataset into a training set and a test set;

[0009] (3) Construct a deep neural network classification model and train the model using the training set, the deep neural network classification model comprising:

[0010] A full-period classification neural network takes the full-channel EEG signal of the entire duration of the EEG data as input, uses a window as the basic feature analysis unit, extracts features of each window through a multi-layer convolutional network, 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;

[0011] A window segment classification neural network takes the full-channel EEG signal of the EEG data window segment as input, calculates the spectral graph features of the short-time Fourier transform (STFT) of the input data, then obtains the window features through a multi-layer convolutional network and a self-attention network and performs clinical semantic-related classification;

[0012] A single-second segment classification neural network takes a single-channel EEG signal of a single-second segment of EEG data as input, obtains features of the single-channel EEG signal through a multi-layer convolutional neural network and a self-attention network, and performs clinical semantic correlation classification;

[0013] (4) Collecting clinical knowledge texts related to EEG (in the form of TXT, PDF, etc.);

[0014] (5) Deploying a large language model and an embedding model, the former supporting natural language dialogue and the latter supporting storage and retrieval of EEG-related clinical knowledge;

[0015] (6) Constructing an EEG automatic analysis intelligent agent, which includes:

[0016] A tool module based on the trained deep neural network classification model for analyzing 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;

[0017] A retrieval enhancement generation module for converting the collected clinical knowledge texts related to EEG into vector form through the embedding model and storing them in the knowledge vector database; when a user issues a task, the most similar vectors corresponding to the knowledge texts are found from the vector database according to the task requirements and added to the dialogue context;

[0018] A thinking, planning and execution module for analyzing the user-specified task, the data environment, the dialogue context and the knowledge vector database using the large language model, planning the process and method for solving the task and executing it;

[0019] (7) According to the user-specified task and the provided EEG data, the EEG automatic analysis intelligent agent is used for automatic analysis and summary of EEG (including but not limited to EEG event detection, sleep staging, emotion recognition, EEG report generation, etc.).

[0020] 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 subjected to 0.5-70 Hz band-pass filtering, 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 system to generate 22 channels of EEG signals as pre-processed EEG data.

[0021] 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 a respective 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 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.

[0022] Further, the window segment classification neural network first performs short-time Fourier transform on the full-channel EEG signal of the input EEG data window segment (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 segment is sent to a fully connected layer for classification to obtain a classification prediction result related to the clinical semantics.

[0023] 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.

[0024] 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.

[0025] 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.

[0026] 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.

[0027] 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.

[0028] 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.

[0029] 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. Firstly, 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 signal from second-level instantaneous event to long-period overall background activity is realized. Each model uses the combination of convolution 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.

[0030] 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

[0031] Figure 1 The present application is a flowchart of the EEG intelligent agent automatic analysis method based on a large language model.

[0032] Figure 2 The present application is a structural diagram of the deep neural network classification model.

[0033] Figure 3 The present application is a structural diagram of the EEG automatic analysis intelligent agent. DETAILED DESCRIPTION

[0034] 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.

[0035] As shown in Figure 1 The EEG intelligent agent automatic analysis method based on a large language model of the present application includes the following steps:

[0036] (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.

[0037] In this 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 this 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.

[0038] 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.

[0039] 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 518 files, divided into a training set (359 files) and an evaluation set (159 files).

[0040] (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.

[0041] 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, 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), because the TUAB data is long 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.

[0042] The subsequent data set division when training the neural network, TUAB, TUSL and TUEV are all 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, 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 categories of labels are constructed, and five deep neural network classification models are trained.

[0043] (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.

[0044] 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

[0045] ​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:

[0046]

[0047]

[0048]

[0049] 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.

[0050] 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:

[0051]

[0052]

[0053]

[0054]

[0055] 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, , , respectively represent three tensors obtained by linear transformation, represents the dimension of , represents the output of the rotary position self-attention network, in particular representing window fusion features.

[0056] Finally, the classification result is obtained through a feature classification module composed of a full connection layer:

[0057]

[0058] 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. It 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 frequency spectrum graph. Then, the time-frequency features represented by the frequency spectrum graph are extracted. The frequency domain features of each time segment are fused in the full-time segment. Finally, the fused features are classified through a classification layer. The above process can be represented as:

[0059]

[0060]

[0061]

[0062]

[0063]

[0064] wherein: represents the short-time Fourier transform, represents the transformed frequency spectrum graph, represents the intermediate result, and other operations are the same as those in the aforementioned window segment classification neural network. Here, due to the shorter data length, only two layers of .

[0065] 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 fewer. 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 time segments shorter than a single second. The above process can be represented as:

[0066]

[0067]

[0068]

[0069]

[0070] wherein: represents the single-second time segment EEG data; due to the shorter data length, only two layers of Other operations are the same as those in the aforementioned window segment classification neural network.

[0071] Each data set is organized in the manner of step (2) and trained in the manner of data and label organization and division. The training process uses a cross-entropy loss function as the loss function, and the cross-entropy loss function has a LogSoftmax (LogSoftmax) operation, which can convert the output of the last layer of the network model into a probability vector. The specific expression is as follows:

[0072]

[0073] Wherein: Z y is the correct class y unnormalized score, denotes the sum of the exponential scores of all classes.

[0074] Small batch training is used in training, and the loss in a batch is the average of the loss of each sample. The specific expression is as follows:

[0075]

[0076] 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.

[0077] The Adam optimizer is used in training, and the cosine annealing learning rate adjustment strategy is used, which is helpful for stable updating of parameters in the training process.

[0078] (4) Collect EEG-related clinical knowledge texts, which can be papers, web pages, manuals, published books, etc., in TXT or PDF format.

[0079] In the implementation method, knowledge texts are collected in multiple aspects to construct a knowledge base. General knowledge texts cover professional terms of EEG interpretation, including knowledge of epilepsy significance and recognition, and guiding opinions on EEG report writing; academic papers include introductions and achievements of multiple tasks of EEG, involving sleep staging, emotion recognition, attention level, and related papers of depression; teaching materials include texts of the nature of EEG application and operation guide, involving operation methods in practical applications. 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.

[0080] (5) Model deployment, including a large language model and a language embedding model, can be replaced as needed.

[0081] The large language model is a deep neural network model supporting natural language dialogue, and the language embedding model is a model establishing the mapping relationship between natural language text and numerical feature vectors. In the present embodiment, 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 at present, supports online calling, and can be replaced with other large language models without affecting the agent structure. 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 agent structure. 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.

[0082] (6) Construct an electroencephalogram automatic analysis intelligent agent as shown in Figure 3 The main body is a tool module, a retrieval enhancement generation module, and a thinking, planning, and execution module.

[0083] In the present embodiment, all functions of processing EEG signals and extracting specific information are abstracted into a flexible "tool" module, which is represented as follows:

[0084]

[0085] Among them: represents the tool, represents the data itself, which may have constraints such as intercepting part of the time or part of the channel, represents the observation results obtained by operating the data with the tool.

[0086] This module supports easy addition, deletion, and replacement. This tool module includes two parts: parameter tools and non-parameter tools. The parameter tools specifically refer to deep neural network models that need to be trained through data, and their internal parameters can be adjusted through learning. For example, five trained and deployed neural network models are used for three time granularities: full period, window period, and single second period, and two spatial granularities: full channel and single channel. In contrast, non-parameter tools refer to methods based on fixed statistical formulas that do not require training and can be used directly. Examples selected in the present embodiment include mean, variance, root mean square value, brain activity band energy, and symmetry analysis. The calculation methods of these tools are determined and uniform. All parameter tools and non-parameter tools form a tool set, which directly operates on EEG data itself and is represented as follows:

[0087]

[0088]

[0089]

[0090] wherein: denotes a parametric tool, denotes a learnable parameter, denotes a non-parametric tool, denotes a classification result, denotes a statistical result, denotes a tool execution result.

[0091] The retrieval enhancement generation module in the embodiment method is to enhance the understanding of the EEG signal and the EEG related task, such as emotion recognition, epilepsy detection and sleep staging, etc. by the large language model, which uses an external knowledge base to store reliable EEG related clinical knowledge. Specifically, the knowledge text is cut according to natural sentences and a 300-word upper limit, which can suppress the problem of long text expression meaning not concentrated and solve the problem of incomplete sentences. Then a language embedding model is used to convert the text block into a vector representation and pre-store it in a vector database. This preparation process can be formally represented as follows:

[0092]

[0093] wherein: denotes a knowledge text, denotes a text cutting operation, denotes a cut-out text block, denotes a text block embedding operation, denotes a vector database.

[0094] When a problem or task to be solved comes, the problem is also converted into a numerical vector by a language embedding model, and then the similarity between vectors in the vector database is calculated. The three feature vectors with the highest similarity are selected as the representative text blocks with high correlation. Then the decoding module of the language embedding model is used to restore the selected feature vector blocks to natural language blocks. Subsequently, these natural language blocks and the problem are passed to the large language model to enhance its generation ability. This retrieval process can be formally represented as follows:

[0095]

[0096] wherein: Q denotes a problem, i.e. a task to be solved, denotes a text block embedding operation, denotes a vector database, denotes a decoding process, denotes a natural language block, which is retrieved and decoded from VDB, represents the task to be solved and the retrieved potentially meaningful knowledge to the large language model.

[0097] The thinking, planning, and execution modules in the implementation method are the decision-making core of the entire EEG automatic analysis agent. The design aims to upgrade the large language model from a passive text generator to an intelligent agent that can autonomously think, plan, and execute tools based on the task. All actions of the agent are based on a dynamically updated context, which is represented as follows:

[0098]

[0099] Where: 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 enhancement generation module, represents the history record of all past interactions.

[0100] Its workflow follows an iterative “thinking-planning-execution” cycle: first, the large language model based on thinks, decomposes the task, and forms a solution strategy; then, it converts the thinking into a specific and executable plan, which usually manifests as a call instruction to a certain tool. The system then executes this plan and obtains an observation result. This complete single-cycle from receiving the context to producing a new observation can be formally represented as:

[0101]

[0102] Where: 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.

[0103] The agent iterates this cycle continuously, incorporating new observation results into the context until the task is determined to be complete and the final conclusion is given.

[0104] (7) EEG automatic analysis and summary.

[0105] The automatic EEG analysis and summary capability is the capability of intelligent agent to have intelligent EEG analysis and adaptive summary. The large language model can autonomously 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 the characteristics of intelligent decision-making. The core advantage of this process is its high flexibility and customizability. Users can inject specific business rules or constraints into the context of the intelligent agent (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 intelligent agent can accurately follow the format to generate highly standardized and structurally consistent professional reports. This capability ensures that the intelligent agent not only performs standardized tasks but also flexibly adapts to special requirements in different application scenarios.

[0106] The above description of the embodiments is to facilitate the understanding and application of the present application by those skilled in the art. 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 to the present application by those skilled in the art based on the disclosure of the present application shall be within the scope of protection of the present application.

Claims

1. A large language model-based EEG intelligent agent automatic analysis method, characterized in that, The method comprises the following steps: (1) obtaining an EEG dataset, wherein each piece of EEG data contains multi-channel EEG signals collected from a subject; (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, wherein the deep neural network classification model comprises: a full-period classification neural network, which takes the full-channel EEG signals of the entire time length of the EEG data as input, takes a window as a basic feature analysis unit, extracts features of each window through a multi-layer convolutional network, then fuses the features of each window 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 signals of the window segment of the EEG data as input, calculates the frequency spectrum feature of the short-time Fourier transform 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 signals of the single-second segment of the EEG data as input, obtains the features of the single-channel EEG signals 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; (5) deploying a large language model and an embedding model, the former supports natural language dialogue, and the latter supports storage and retrieval of EEG-related clinical knowledge; (6) constructing an EEG automatic analysis intelligent agent, which comprises: a tool module based on the trained deep neural network classification model for analyzing high-level semantics and low-level semantics of EEG; a retrieval enhancement generation module for converting the collected clinical knowledge texts related to EEG into vector form through the embedding model and storing them in a knowledge vector database; when a user issues a task, the most similar vectors corresponding to several knowledge texts are found from the vector database and added to the dialogue context according to the task requirements; a thinking, planning and execution module for analyzing the user-specified task, the data environment, the dialogue context and the knowledge vector database using the large language model, planning a process method to solve the task and executing it; (7) using the EEG automatic analysis intelligent agent to automatically analyze and summarize the EEG according to the user-specified task and the provided EEG data.

2. The EEG intelligent agent automatic analysis method based on a large language model according to claim 1, characterized in that: The preprocessing 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 subjected to 0.5-70 Hz band-pass filtering, 60 Hz notch filtering, and finally the 21 channels of EEG signals are differentially recombined according to the standard transverse central parietal lead system to generate 22 channels of EEG signals as the preprocessed EEG data.

3. The EEG intelligent agent automatic analysis method based on a large language model according to claim 1, characterized in that: The whole-time period classification neural network first processes the whole-channel EEG signal of the input EEG data throughout the time period, divides the whole-channel EEG signal into a plurality of non-overlapping time windows according to a preset length, then generates respective deep feature vectors by a convolution network composed of a one-dimensional convolution layer, root mean square normalization, a GELU activation function and a one-dimensional maximum pooling layer connected in sequence, concatenates the deep feature vectors of all the windows into a feature vector sequence, adds a learnable global classification identifier at the start position of the sequence, and then inputs the whole sequence 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 feature into the global classification identifier, and finally inputs the global classification identifier that has aggregated the whole-time period information into a fully connected layer for classification to obtain a classification prediction result related to clinical semantics.

4. The EEG intelligent 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 short-time Fourier transform on the whole-channel EEG signal of the input EEG data window segment to convert the data from the time domain to the frequency domain, which generates a corresponding frequency spectrum for each time domain analysis window, then extracts frequency domain deep feature vectors from the frequency spectrum by a convolution network composed of a one-dimensional convolution layer, root mean square normalization, a GELU activation function and a one-dimensional maximum pooling layer connected in sequence, concatenates the frequency domain deep feature vectors of all the windows into a feature vector sequence, adds a learnable global classification identifier at the start position of the sequence, and then inputs the whole sequence 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 feature, and aggregates the fused key information into the global classification identifier, and finally inputs the global classification identifier that has aggregated the whole window segment information into a fully connected layer for classification to obtain a classification prediction result related to clinical semantics.

5. The EEG intelligent 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 input EEG data single-second segment, which is decomposed and extracted into a series of deep feature vectors by a convolution network composed of a one-dimensional convolution layer, root mean square normalization, a GELU activation function and a one-dimensional maximum pooling layer connected in sequence, where each vector represents a micro time period in the single-channel EEG signal; then, the deep feature vectors of all the micro time periods are concatenated into a feature vector sequence, a learnable global classification identifier is added at the start position of the sequence, and then the whole sequence is input into a multi-layer self-attention transformer network based on rotary position encoding, which deeply fuses the local information of each micro time period and the global timing feature, and aggregates the fused key information into the global classification identifier, and finally inputs the global classification identifier that carries the whole single-second segment information into a fully connected layer for classification to obtain a classification prediction result related to clinical semantics.

6. The EEG intelligent agent automatic analysis method based on a large language model according to claim 1, characterized in that: The tool module includes two parts of parametric tools and non-parametric tools, the parametric tools are the trained deep neural network classification model, which extracts features through the corresponding classification neural network according to the specific EEG input data, and finally maps the EEG input data into labels with clinical semantics; the non-parametric tools include some general feature statistical methods, which are used to extract statistical features of the EEG input data including mean, variance, root mean square value, brain activity band energy, symmetry, etc.

7. The EEG intelligent 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-in clinical knowledge text into blocks with a block size of 300 characters, then converts each block through Qwen3-Embedding-8B vectorization, and stores the vector of each converted block into the FAISS vector database.

8. The EEG intelligent agent automatic analysis method based on a large language model according to claim 1, characterized in that: The thinking, planning and executing module takes a large language model as the basis, automatically analyzes the user's task, generates a planning using the corresponding tool based on the analysis, then executes the tool and obtains the execution result, splices the execution result with the dialogue context, reanalyzes and executes the tool, and finally answers the user.

9. A computer device comprising a memory and a processor, said memory having stored therein a computer program, characterized in that: The processor is configured to execute the computer program to implement the automatic analysis method of the EEG intelligent agent based on the large language model according to any one of claims 1-8.

10. A computer readable storage medium storing a computer program, characterized in that: The computer program is configured to be executed by the processor to implement the automatic analysis method of the EEG intelligent agent based on the large language model according to any one of claims 1-8.

Citation Information

Patent Citations

  • EEG time-sharing frequency spectrum Riemannian-based semantic visual image classification method and device

    CN113974658A

  • KR20250055215A