Cloud AI model training method and cloud AI system
By constructing a cross-user stimulus response evolution matrix and an individual feature subspace, and training an individual regulatory subnetwork, the problem of insufficient individual adaptability of cloud-based AI models in personalized neurostimulation devices is solved, achieving higher response accuracy and adaptability.
Patent Information
- Application Number
- CN202511004138.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-11-07
AI Technical Summary
In existing technologies, cloud-based AI models lack dynamic modeling of individual structural adaptability in personalized neurostimulation devices, making it difficult for a uniform model to adapt to individual differences among different users, thus affecting the accuracy and generalization ability of modulation.
By collecting multimodal state data from multiple users, a cross-user stimulus-response evolution matrix is constructed. Individual feature subspaces and shared response core subspaces are extracted, and individual regulatory subnetworks are trained. By combining tensor path response factor maps and time sliding windows, personalized adjustment of the model and group common learning are achieved.
It improves the accuracy and expressive power of individual modulation response of neural electrical stimulation devices, enhances the model's adaptability and convergence efficiency in the face of changes in user state, and ensures the intervention effect and stability during long-term use.
Smart Images

Figure CN120911552A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of artificial intelligence, and in particular relates to a cloud AI model training method and a cloud AI system. BACKGROUND
[0002] In recent years, with the wide application of wearable neuromodulation devices, great potential has been gradually shown in the fields of rehabilitation medicine, neurological disease intervention, and intelligent medical treatment. In order to improve the accuracy of individual neural response modulation, academia and industry have explored solutions to integrate artificial intelligence technology to achieve personalized and dynamic stimulation strategies. In such systems, cloud-deployed artificial intelligence models can optimize stimulation parameter settings through learning of user physiological and feedback data, thereby improving intervention effects.
[0003] In the prior art, a unified structure of deep neural network is usually used to model all users, and parameter fine-tuning is performed based on the feedback data of each user. This kind of method mainly relies on the representation ability of the global model in the shared feature space, and lacks dynamic modeling of individual structure adaptability. SUMMARY
[0004] To solve the problems in the prior art, the present application provides a cloud AI model training method, comprising the following steps:
[0005] Collecting multi-modal state data and stimulation response data of multiple users during the use of a neuroelectric stimulation device, and uploading to a cloud server for structured storage and preprocessing;
[0006] Constructing a cross-user stimulation response evolution matrix, wherein each row corresponds to a state-stimulation-feedback sequence of a user, and each column represents the response mode of different users under the same stimulation scenario;
[0007] Based on the stimulation response evolution matrix, extracting multiple individual feature subspaces and a shared response core subspace, the individual feature subspaces reflecting the individualized response of a user to a certain stimulation, and the shared response core subspace capturing the group common response rule;
[0008] Based on the shared response core subspace, training a stimulation prediction main model to learn the average mapping relationship between the state vector and the feedback, as a shared base model for each user model;
[0009] Configuring an individual regulation subnetwork with variable microstructure for each user, the individual regulation subnetwork being based on the shared base model;
[0010] Based on the individual feature subspaces, activating or freezing part of the submodules of the shared base model to obtain the individual regulation subnetwork model.
[0011] Further, the constructing the stimulation-response evolution matrix across users comprises:
[0012] defining a standardized stimulation-response triple format, the triple consisting of a state vector, a set of electrical stimulation parameters, a post-stimulation feedback vector;
[0013] constructing the triple for each user as a time series structure, forming a user response trajectory;
[0014] performing a clustering operation on the user response trajectory according to the similarity of the stimulation parameters, classifying the tasks into different stimulation context clusters;
[0015] in each context cluster, the corresponding tasks are organized into a sub-matrix, each item of the sub-matrix being a triple;
[0016] splicing all the sub-matrices to generate the stimulation-response evolution matrix.
[0017] Further, the extracting the shared response core subspace comprises:
[0018] for each user and each task, collecting the original triple data, splicing it into a first vector, and densifying the first vector to obtain a tensor T;
[0019] performing zero-mean unit-variance normalization on the vector set of each user to generate a mask of the tensor T;
[0020] performing tensor decomposition on the tensor T to obtain a feature embedding matrix;
[0021] performing covariance analysis on the feature embedding matrix, retaining the first preset dimension in descending order, to obtain the shared response core subspace.
[0022] Further, the extracting the individual feature subspace comprises:
[0023] calculating a projection value in the direction of the shared response core subspace according to the embedding vector of the user;
[0024] subtracting the projection value from the embedding vector of the user to obtain the individual feature subspace of the user.
[0025] Further, the training of the stimulation prediction main model based on the shared response core subspace comprises:
[0026] mapping the original state vector to a unified shared subspace;
[0027] establishing a group prediction network in the shared input space as a basis for feedback estimation;
[0028] using input features and feedback to construct training samples, and optimizing prediction network parameters through error.
[0029] Further, the variable part in the individual regulatory sub-network includes one or any combination of the following:
[0030] Freezing part of the main model hidden layer nodes according to feature sensitivity;
[0031] Reconstructing the hidden layer connection mode according to the activation probability;
[0032] Perturbing or fine-tuning part of the weight parameters according to the input;
[0033] Inserting individualized residual connection modules on certain structures;
[0034] Selecting different nonlinear activation strategies.
[0035] Further, training the shared base model based on the individual feature subspace, activating or freezing part of the sub-modules of the shared base model, to obtain the individual regulatory sub-network includes:
[0036] Obtaining the individual feature embedding vector of the current user U;
[0037] Presetting a mapping matrix to define the correlation strength between the feature embedding vector and the structure module;
[0038] Setting an activation threshold;
[0039] Calculating the dot product score of each structure module according to the feature embedding vector and the correlation strength;
[0040] Determining the activation state of the structure module according to the dot product score and the set activation threshold;
[0041] According to the activation state, changing the simulated activation state in the shared base model to obtain the individual regulatory sub-network.
[0042] Further, the individual feature subspace trains the shared base model, activates or freezes part of the sub-modules of the shared base model, to obtain the individual regulatory sub-network includes:
[0043] According to the individual feature embedding vector, combining the user historical feedback tensor, constructing a tensor path response atlas;
[0044] Normalizing the path response atlas to obtain a flux control factor;
[0045] Determining the flux gate weight according to the flux control factor and the historical input, and the modules with flux gate weight greater than a preset value are activated and participate in training and optimization;
[0046] Obtaining training samples in a sliding window;
[0047] For each training sample in the sliding window, calculate the response change rate of the feedback vector, map the response change rate to a sample weight coefficient;
[0048] Construct a training target function according to the sample weight coefficient;
[0049] Based on the target function, use the Adam optimizer to perform training, and only update the path parameters whose flux gate weight is greater than the threshold value;
[0050] According to the training result, extract the individual regulatory subnetwork structure.
[0051] In another implementation, a cloud AI system is also disclosed, which is trained using the method described above.
[0052] The present application effectively breaks through the granularity limitation of the traditional module-level activation strategy by constructing a tensor-level path response factor graph, enabling the system to achieve more fine-grained structure control within the neural network, thereby improving the response accuracy and expression ability of individual regulation.
[0053] The present application introduces a feedback-driven dynamic path shaping mechanism, combines time sliding window and response trend modeling, and realizes progressive optimization of model structure on multiple time scales, effectively improving the adaptability and convergence efficiency of the system when facing user state changes.
[0054] The present application proposes a plastic individual regulation subnetwork generation and snapshot management method, which realizes the dynamic evolution and verification mechanism of subnetwork structure through structure template extraction, individual graph construction and version tracking, ensuring that the model can maintain high intervention effect and stability in the long-term use process. BRIEF DESCRIPTION OF DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0056] Figure 1 is a flowchart of the method of the present application;
[0057] Figure 2 is a method for generating an individual regulatory subnetwork;
[0058] Figure 3 is a further improved method for generating an individual regulatory subnetwork. DETAILED DESCRIPTION
[0059] The preferred description of the present application is made below in combination with the drawings and specific embodiments.
[0060] As Figure 1 shown, in one embodiment, the present application discloses a cloud AI model training method, based on a cloud computing architecture, for realizing multi-user cross-individual data fusion, adaptive optimization and continuous iterative update of artificial intelligence model training method, the method through building cloud platform with multi-source data access, feedback closed loop perception and individual difference modeling ability, support for physiological state data collected by neuromodulation type wearable device unified management, aggregation learning and strategy generalization training, so as to realize the collaborative learning, self evolution and remote deployment control of model in multi-user scene.
[0061] In order to realize the above functions, in one embodiment, the method comprises the following steps:
[0062] Step S10, collecting multi-modal state data and stimulation response data of multiple users in the process of using the neuroelectric stimulation device, and uploading to the cloud server for structured storage and preprocessing.
[0063] In the individualization regulation of neuroelectric stimulation device, there is a high individual difference between the physiological state of the user and the corresponding electric stimulation response. The traditional method relies on single-user local modeling, which is difficult to complete complex modeling due to hardware performance limitations on the one hand; on the other hand, it is difficult to capture the common rules of different users under similar physiological states, and it is also difficult to realize group optimization and generalization learning. Therefore, the present application proposes a mechanism for collecting the use process data of multiple users and uploading it to the cloud for structured processing, so as to realize multi-source data fusion, unified modeling and continuous evolution of cloud AI system.
[0064] In the present application, multi-modal state data refers to the physiological and motion signals of multiple dimensions obtained by neuroelectric stimulation device and its attached sensing unit, including but not limited to: electromyography (EMG), heart rate variability (HRV), electrodermal activity (EDA), body temperature (TEMP), tremor amplitude and frequency, acceleration sensor (IMU) and other data.
[0065] Stimulation response data refers to the immediate or lagged physiological changes of the user under the action of specific stimulation parameters, which is used to reflect the stimulation effect, usually obtained by measuring or labeling the feedback of the difference between the before and after states.
[0066] In an optional specific implementation, the step S10 specifically comprises the following sub-steps:
[0067] Initialize the multi-channel data acquisition module of the neural electrical stimulation device. This step includes the following specific operations: the system assigns a unique device ID to each electrical stimulation device and binds it to the user's identity information through the companion App or management platform, generating a multi-level identification structure containing the user number (UID), device number (DID), and record number (RID). Then the system activates the various sensors built into the device, including electromyography sensors (for EMG signal acquisition), electrodermal activity sensors (for EDA), body temperature sensors (TEMP), heart rate sensors (for HRV), inertial measurement units (IMU), etc. During the initialization phase, the device automatically calibrates the baseline values of each channel and sets a fixed sampling rate (e.g., EMG set to 1000 Hz, HRV set to 1 Hz, IMU set to 50 Hz), ensuring time synchronization of different signal sources. After this step, the system enters a ready state, waiting for the stimulation task to start.
[0068] Record the control parameters and time markers of each electrical stimulation event in real time during the acquisition process. This step involves the complete encapsulation of stimulation parameter configuration, including: stimulation frequency (f), current intensity (I), pulse width (τ), stimulation mode (one-way / two-way), stimulation channel sequence (C1, C2, …), and stimulation duration (T). Each electrical stimulation event is triggered by a command issued by the controller, and the system generates a unique event number (EID) synchronously when the stimulation occurs, and binds this number to the current sampling window to form a state-stimulation pair. Here, the state refers to the vector sequence of all modal signals within N seconds before stimulation, and the stimulation refers to the complete parameter set of this issuance.
[0069] Determine the validity of the acquired data. This step includes noise detection, signal integrity check, and user interaction confirmation. First, the system evaluates the signal-to-noise ratio (SNR) based on a sliding window algorithm, calculates the SNR value of each channel within a specific window, and if it is below the set threshold (e.g., SNR < 5 dB), marks the segment as noise-contaminated. Second, the system detects whether there is sensor detachment, sudden value (e.g., EMG instantaneous voltage exceeds the set range ±5mV), or large-area missing samples (more than 30% data is NaN). Finally, after the acquisition is complete, the system can prompt the user for subjective confirmation, such as whether a stimulation training is successfully completed, and record the user's confirmation marker. Only when all three conditions are met, the system will mark the sampled data segment as valid.
[0070] The effective data is subjected to modal alignment and timing correction operations. First, the discontinuous data in each channel is filled by an interpolation algorithm (such as cubic spline interpolation) to ensure consistent time series length; second, the multi-modal signals are aligned and mapped to a unified timeline referenced to the master clock. For example, if the EMG sampling frequency is 1000 Hz and the HRV is 1 Hz, the system needs to add a flag bit to the EMG sequence to correspond to each HRV point. To prevent modeling errors caused by inter-modal time delay mismatches, the system sets a maximum allowed time error (such as ±100 ms), and data segments exceeding the range will be discarded or corrected.
[0071] Modal standardization processing is performed. For each channel's time series signal, the system uses the maximum-minimum normalization method to scale it to the [0, 1] range, eliminating dimensional differences. The normalization function is:
[0072] x norm =(x-x min ) / (x max -x min )
[0073] where x is the original sample value, x min and x max are the minimum and maximum values of the channel in the current time period. If the signal shows a long-term drift trend (such as continuous offset of skin conductance response value), the system can enable a sliding window normalization strategy, with each 10-second sub-window dynamically calculating the normalization range, thereby avoiding error amplification caused by edge drift.
[0074] All data of the stimulation task is encapsulated as a structured data unit. Each data unit includes the following fields: user ID (UID), device ID (DID), stimulation event number (EID), stimulation parameters (including frequency, current, pulse width, etc.), pre-stimulation state sequence (such as the previous 3-second EMG, EDA, IMU, etc. vector sequence), post-stimulation state sequence (such as the 3-second multi-modal signal after stimulation), feedback score (such as tremor frequency change amount Δf, user self-evaluation score, etc.). The data unit is encapsulated as a JSON format object or a database record, and the structure is as follows:
[0075] {
[0076] UID:U0235,
[0077] EID:E20250618023,
[0078] StimParams:{Freq:150,Amp:2.5,PW:200},
[0079] PreState: [[emg1, emg2,...], [eda1,...], [imu1,...]],
[0080] PostState: [...],
[0081] Feedback: {DeltaFreq: -1.3Hz, UserScore: 4.5}
[0082] }
[0083] All structured data units are uploaded to the cloud server. The server deploys a unified data receiving interface for encrypted transmission through the HTTPS protocol. After uploading, the data enters the database system for archiving, and the server automatically performs data integrity checking and organizes the data into a user-session-task three-layer index structure according to the UID and timestamp for subsequent AI model training system calls.
[0084] The present application effectively realizes a high-quality, unified standard, full-modal, multi-granularity data acquisition and processing mechanism between user equipment and cloud servers. This mechanism ensures that the collected data has good timing consistency, modal coordination and structured specification, providing a solid input basis for subsequent construction of cross-user learning models and strategy self-evolution systems.
[0085] In a specific example, take user A as an example, who wears a neural stimulation device for lunch training, and the task is set to relieve hand tremor through median nerve stimulation. The system sets the stimulation frequency to 150Hz, the current amplitude to 2.5mA, the pulse width to 200us, and the duration to 5 seconds. The device collects multi-modal data such as EMG (sampling rate 1000Hz), EDA (20Hz), IMU acceleration (50Hz) before and after stimulation for 3 seconds. After detection, the signal-to-noise ratio of this round of stimulation data is good, there is no abnormal mutation, the user confirms that the curative effect is remarkable, and gives a feedback score of 4.5. The system encapsulates this round of data as a structured unit, labeled as an effective task, and then uploads it to the cloud. In the cloud database, this data is archived together with the user's historical tasks, becoming a basic sample for training cross-user feedback mode AI models.
[0086] Step S20, construct a cross-user stimulation response evolution matrix, where each row corresponds to a user's state-stimulation-feedback sequence, and each column represents the response mode of different users under the same stimulation situation.
[0087] In a multi-user neuro-electric stimulation control system, the response patterns of individuals under the same or similar stimulation parameters may differ, while there are common rules. In order to extract these rules from the group data and provide a unified structured input for subsequent models, a mathematical structure capable of expressing individual differences and group patterns is needed. The present application realizes the alignment and organization of the multi-user state-stimulation-feedback sequence by constructing a cross-user stimulation response evolution matrix, facilitates the mining of common response trends and abnormal individual response trajectories in the group, and improves the generalization ability and stability of the AI model.
[0088] In the present application, the stimulation response evolution matrix refers to a two-dimensional structure matrix, wherein each row represents a state-stimulation-feedback triple sequence of a user under different time or task conditions, and each list represents the feedback results of different users under the same stimulation condition or similar state condition, for describing the double coupling relationship between time evolution and group response. The state-stimulation-feedback sequence refers to a combined structure composed of the pre-stimulation physiological state, the applied stimulation parameters and the observed feedback response of the user collected in each stimulation event in time sequence. The stimulation context refers to the state background of the user under a given set of stimulation parameters, including the pre-state vector and device configuration.
[0089] In an alternative specific implementation, the step S20 specifically comprises the following sub-steps:
[0090] Step S201: defining a standardized stimulation response triple format
[0091] The purpose of this step is to unify the data structure so that the data generated by different users and tasks is comparable. The system first sets the triple basic format (S i ,P i ,R i ), wherein:
[0092] S i represents the state vector, including the multi-modal signal fragments from 2 seconds before the start of each stimulation task to the stimulation start instant. For example, for EMG signals, a time sequence of 2000 points is collected at a sampling rate of 1000 Hz; EDA and IMU are 40 and 100 point sequences respectively. The modal signals are spliced to form a high-dimensional vector.
[0093] P i represents the set of electrical stimulation parameters, such as frequency f (Hz), current intensity I (mA), pulse width τ (μs), stimulation channel combination C (such as [Ch1, Ch3]).
[0094] R iThe feedback vector after stimulation represents the feedback vector after stimulation, the collection period is the window from 3 seconds to 6 seconds after the end of stimulation, and the content includes: tremor frequency change Delta f (Hz), HRV change Delta HRV (unit: ms), user score Uscore (1-5).
[0095] The system sets a unique identifier for each triple, such as TID = UID + EID + Timestamp, for subsequent retrieval and indexing.
[0096] Exemplarily:
[0097] The third stimulation task of user A is frequency 160 Hz, current 2.5 mA, pulse width 200 us, channel [Ch1, Ch3], the collected state is EMG 2000 point sequence, EDA 40 point sequence, the feedback is tremor drop 1.3 Hz, and the user score is 4.5. The system encapsulates this task as:
[0098] (S3, P3, R3) = ([EMGseq, EDAseq, IMUseq], [160, 2.5, 200, Ch1 & Ch3], [-1.3, Delta HRV = 12 ms, 4.5])
[0099] Step S202: User sequence construction and triple time sequence sorting
[0100] This step constructs the triple of each user into a time sequence structure to form the user response trajectory. For each user, the system sorts all triples in ascending order according to the task start timestamp, and generates a response trajectory linked list:
[0101] UserATrack = [(S1, P1, R1), (S2, P2, R2), …]
[0102] UserBTrack = [(S1, P1, R1), (S2, P2, R2), …]
[0103] The system allows some users to miss some feedback items of some tasks, and the missing items are marked as null, and sets a flag indicating whether it can be used for model training.
[0104] Exemplarily:
[0105] User A completes 5 rounds of tasks, task 3 has no user feedback, the system sets the corresponding feedback field to null, but keeps S3 and P3 for clustering and anomaly detection.
[0106] Task 5 is missing IMU data, but EMG and EDA are intact, and is still included in part of the training.
[0107] Step S203: Stimulation parameter clustering and stimulation scenario cluster construction
[0108] This step clusters the tasks into different stimulation context clusters according to the similarity of stimulation parameters. The system employs a multi-dimensional feature distance algorithm, such as weighted Euclidean distance:
[0109] D(P i ,P j )=sqrt(w1*(f i -f j )^2+w2*(I i -I j )^2+w3*(τ i -τ j )^2)
[0110] where f, I, τ are frequency, current, pulse width, respectively, and w1, w3, w3 are weight coefficients. The system maps the stimulation tasks into K clusters, such as K = 10, forming context clusters C1 to C10.
[0111] Exemplarily:
[0112] User A's tasks 1, 3 and user B's tasks 2, 4 are all 150 Hz ± 5 in frequency, 2.5 mA ± 0.3 in current, and 200 μs ± 20 in pulse width, and are clustered into context cluster C2. The system generates an index for cluster C2:
[0113] C2={(A,1),(A,3),(B,2),(B,4),…}
[0114] Step S204: Alignment within stimulation context cluster and construction of sub-matrix
[0115] Within each context cluster, the corresponding tasks are organized into a sub-matrix Mc with dimensions U x T, i.e., U users and T times of context matching tasks, each item being a triple (S ij ,P ij ,R ij ). Missing tasks are filled with NULL. In order to avoid the influence of sparse matrix on training, the system sets a minimum filling rate threshold (such as 80%) to filter out sparse rows and columns.
[0116] Exemplarily:
[0117] The responses of users A, B, and C within cluster C2 are as follows:
[0118] Table 1: Example of stimulation response evolution sub-matrix
[0119] T1 T2 T3 User A (SA1, PA1, RA1) (SA2, PA2, RA2) NULL User B (SB1, PB1, RB1) NULL (SB3, PB3, RB3) User C (SC1, PC1, RC1) (SC2, PC2, RC2) (SC3, PC3, RC3)
[0120] The sub-matrix MC2 is then used to train an intra-cluster sub-model or calculate response consistency.
[0121] Step S205: Splice all sub-matrices to generate a total response evolution matrix M
[0122] This step transversely splices the sub-matrices of all context clusters to generate a response evolution matrix M with a dimension of N x Ttotal, where N is the number of users and Ttotal is the total number of all task time points. The elements in the matrix M are (S ij ,P ij ,R ij ), and the system generates a missing mask matrix Mmask at the same time to mark invalid data areas and prevent subsequent model from learning errors.
[0123] Exemplarily:
[0124] User A completes 10 tasks in three clusters C1 to C3, and the corresponding row in the matrix M contains 10 triple records. User B only completes 6 items, and the system fills in null in the corresponding column and sets it as a mask.
[0125] Step S206: Abnormality detection and feedback standardization processing
[0126] This step ensures that the feedback values in the matrix have a uniform scale and exclude abnormal value interference. The system calculates the mean μ and standard deviation σ of the feedback indicators (such as Δf and ΔHRV) in each Rij item. If a certain item meets:
[0127] |R ij- μ|>3σ
[0128] it is marked as an abnormal response item. The system can optionally clip or replace the median value. At the same time, normalization is performed on all feedback indicators to fall within the [0, 1] interval, and the normalization formula is:
[0129] R norm =(R-R min ) / (R max -R min )
[0130] The normalization parameters are independently calculated for each context cluster to ensure context consistency.
[0131] Through the above steps, the system constructs a complete cross-user response evolution matrix, which not only unifies the data structure, but also realizes the comparison and modeling basis of the response behavior of different users under similar stimulation conditions through the context clustering and time alignment mechanism. The matrix can be used as a unified input interface for multiple function modules such as subsequent deep model training, personalized strategy recommendation, and abnormality detection analysis.
[0132] Exemplarily, continuing the midday training of user A, the system classifies its task 1 (150 Hz, 2.5 mA) into C1 and task 3 (160 Hz, 2.5 mA) into C2. Correspondingly, user B's tasks 2 and 4 also enter C2, and user C has complete feedback in C2. The system compares and finds in the cluster C2 that the amplitude of the decrease in Δf after stimulation of users A and B is significantly higher than that of C, prompting the model to consider generating a common regulation strategy effective for A and B in the cluster and generating a personalized parameter adjustment suggestion for C. The mode is then input into the AI model to optimize the cross-user adaptability and generalization performance.
[0133] In step S30, based on the stimulation response evolution matrix, a plurality of individual characteristic subspaces and a shared response core subspace are extracted, the individual characteristic subspaces reflect the individualized response of a user to a certain stimulation, and the shared response core subspace captures the group common response law.
[0134] In a neural electrical stimulation system, different users often show different physiological feedback when facing similar stimulation situations. This individual difference makes it difficult for a unified strategy to adapt to all users, and also contains high-value personalized rules. Therefore, the present application proposes a method of extracting a plurality of individual characteristic subspaces and a shared response core subspace on the basis of a unified response evolution matrix. Through subspace decomposition, individual differences and group commonality can be effectively decoupled, facilitating the realization of a model structure that has both individual adaptability and group generalization ability, and supporting the construction of individual regulation networks and shared main models.
[0135] In the present application, the individual characteristic subspace refers to a data substructure in the neural electrical stimulation response data that reflects the individualized information of a single user, such as sensitivity, response amplitude, feedback mode, etc. under a specific stimulation situation, which is composed of high-dimensional vectors. The shared response core subspace refers to the common physiological response characteristics of multiple users under similar stimulation conditions, which is essentially the cross-similarity region between users and is a data structure that maps the stable response law at the group level.
[0136] In an alternative specific implementation, the step S30 specifically includes the following sub-steps:
[0137] Step S301: Construct a dense feature tensor
[0138] The system sets the number of users U, the total number of tasks T, and the splicing feature dimension F;
[0139] For each user u and each task t, collect the original triple data (Sut, Put, Rut) and splice it into a vector Vutf of length F;
[0140] Vutf is densified using the following rules:
[0141] If the original data is missing part of the mode, use mean filling or interpolation to fill in;
[0142] Standardize the interval to [0, 1] to avoid scale bias introduced by mode difference;
[0143] The resulting tensor structure is T∈R^(U×T×F).
[0144] Exemplarily:
[0145] If the EMG dimension is 256, the EDA is 64, the IMU is 64, the stimulation parameter is 64, and the feedback value is 64, then F = 512.
[0146] If user A collects 8 rounds of tasks, TA∈R^(8×512). All user data constructs a tensor T∈R^(U×T×512), such as U = 100.
[0147] Step S302: User vector normalization and mask generation
[0148] Each user performs zero-mean unit-variance normalization in their own vector set;
[0149] The system generates a corresponding mask tensor M∈{0,1}^(U×T×F) for the tensor T, and when a certain feature f is missing in a certain user in a certain task, M(u,t,f) = 0;
[0150] The data positions marked as 0 in M are ignored in subsequent model training or decomposition.
[0151] Exemplarily:
[0152] User B's 3rd round of task has no EDA, and the system sets T(B,3,f) to 0 in the corresponding EDA dimension, and sets it to 0 in M at the same time.
[0153] Step S303: Perform tensor decomposition to obtain low-order embedding structure
[0154] Set the dimension reduction dimension kuser=20, ktask=30, kfeature=40;
[0155] Use Tucker decomposition algorithm to decompose the tensor T as:
[0156] T≈G×1A×2B×3C
[0157] Where:
[0158] A∈R^(U×20): User embedding matrix;
[0159] B∈R^(T×30): Task embedding matrix;
[0160] C ∈ R^(F×40): feature embedding matrix
[0161] G ∈ R^(20×30×40): core tensor.
[0162] The system iteratively optimizes A, B, C, G using alternating least squares (ALS) until the loss is less than 1e-3 or the maximum number of iterations is reached.
[0163] Step S304: Extract shared response core subspace directions
[0164] The system performs covariance analysis on the feature mapping matrix C ∈ R^(F×40) and calculates C^TC;
[0165] Eigenvalues and eigenvectors are calculated for the covariance matrix, and the top kshared dimensions (e.g., kshared=5) are retained in descending order;
[0166] These 5 directions are constructed as a matrix Sshared ∈ R^(F×5), representing the response directions with the highest consensus in the group, i.e., the shared response core subspace;
[0167] The system can further evaluate the cosine similarity between directions to avoid redundant directions.
[0168] Step S305: Calculate user individual feature subspace residual and construct individual subspace
[0169] For each user u, its corresponding embedding vector Au ∈ R^20;
[0170] The system calculates its projection value Proju = Au·Sshared in the shared response core subspace direction;
[0171] Subtract the projection in the shared response core subspace direction from Au to retain the residual Ru = Au-Proju;
[0172] The residual vector Ru constitutes the individual feature subspace SAuind of the user.
[0173] In a specific example:
[0174] Taking user A as an example, assume that its tensor TA contains 10 rounds of tasks, and the state-stimulus-feedback vector extracted from each round of task is 512-dimensional. After Tucker decomposition, its corresponding embedding vector is:
[0175] AA = [0.2, 0.5, -0.1, 0.3, -0.4, 0.1,..., 0.6] ∈ R^20
[0176] The system extracts the shared direction orthonormal basis through principal component analysis:
[0177] Qshared= [
[0179] [0.4,0.0,0.6,0.1,0.3],
[0180] [0.1,0.5,-0.2,0.0,0.6], ...
[0182] ]∈R^(20×5)
[0183] The system calculates its projection on the shared space:
[0184] PA=AAQsharedQshared^T=[0.15,0.42,-0.05,0.28,-0.36,...,0.52]
[0185] Residual error RA=AA-PA=[-0.01,0.08,-0.05,0.02,-0.04,...,0.08]
[0186] After final normalization, the individual subspace features are obtained:
[0187] SAind=[0.12,-0.06,0.03,-0.11,...,0.17]
[0188] This subspace serves as the input module parameter of the personalized network and is used to fine-tune the prediction result.
[0189] Step S40, based on the shared response core subspace, training a stimulus prediction main model, learning the average mapping relationship between the state vector and the feedback, as the shared basic model of each user model.
[0190] Due to the high individual difference of neuromodulation tasks, if each user independently trains the model in actual training, it will lead to poor model generalization ability, high training cost and unstable inference. Therefore, it is necessary to construct a stimulus prediction main model that is common to all users based on the extracted shared response core subspace, so that it can learn the average mapping relationship between the state vector and the feedback response, provide a unified response prediction structure for all user models, and thus improve the model migration and system overall stability. The main model focuses on group common learning, and subsequent individual regulation sub-networks can be used for differential compensation.
[0191] In the present application, the state vector refers to the splicing result of the comprehensive physiological characteristics of the user before receiving the stimulus and the stimulus setting parameters, usually including multiple dimensions such as electroencephalogram, electromyogram, skin conductance, electric stimulation frequency, voltage, current intensity, etc.
[0192] The feedback vector is a quantitative physiological response generated by the user after receiving the stimulus, such as muscle response intensity, skin conductance change value, heart rate variability index, etc.
[0193] The master model refers to a neural network trained by input features derived from the shared response core subspace, which is a function structure for predicting the feedback response from the state vector, and is a basic component shared by all individual models.
[0194] In an alternative implementation, the step S40 specifically includes the following sub-steps:
[0195] Step S401, shared feature projection processing of the state vector
[0196] This step is used to map the original state vector with high dimension and large individual difference to a unified shared subspace, reduce the interference of redundant features, and at the same time retain the common response of the group.
[0197] In an implementation, the original state vector of the system is X i , the dimension is 1x512, the projection matrix Sshared has a dimension of 512x8, and the system performs the following operations:
[0198] The X i is normalized, that is, the Z-score standardization is performed:
[0199] For the jth feature component, the transformation is performed:
[0200] Z ij = (X ij - μ j ) / σ j
[0201] Where μ j is the overall mean of the jth feature, and σ j is the standard deviation.
[0202] Linear transformation is performed:
[0203] Y i = X i x Sshared
[0204] Where Y i is a 1x8 shared feature vector. Each Y i represents the representation result of the current state in the shared response dimension.
[0205] The above processing is performed on each training sample in turn, and finally a feature set {Y i} is constructed, where i=1 to N, and N is the total number of samples.
[0206] If implemented using a deep learning framework, matrix multiplication can be performed using tf.matmul in TensorFlow or torch.mm in PyTorch.
[0207] Step S402, initialization and configuration of the main model structure
[0208] This step is used to establish a group prediction network in a shared input space as a basis for feedback estimation.
[0209] In a preferred implementation:
[0210] The main model structure is configured as follows:
[0211] Input layer: dimension K=8.
[0212] First hidden layer: 128 nodes, activation function ReLU.
[0213] Second hidden layer: 64 nodes, activation function ReLU.
[0214] Third hidden layer: 32 nodes, activation function ReLU.
[0215] Output layer: dimension M=3, corresponding to feedback components, using linear activation.
[0216] Add regularization module:
[0217] Introduce Dropout operation after each hidden layer, rate 0.3.
[0218] Add BatchNormalization operation to prevent gradient explosion.
[0219] Parameter initialization:
[0220] Use He normal initialization method to initialize the weight matrix, the specific method is:
[0221] W~N(0,sqrt(2 / fanin))
[0222] All bias terms are set to 0.
[0223] The main model structure can be built using the Sequential mode in Keras, or defined as a class inheriting nn.Module in PyTorch.
[0224] Step S403, training process of the main model
[0225] This step is used to construct training samples using input features Y and feedback R, and optimize the main model parameters through error.
[0226] In an implementation, the training process is as follows:
[0227] Constructing loss function:
[0228] Using Mean Squared Error loss (MSE):
[0229] L = (1 / N) * ∑(Rhati - Ri)^2
[0230] Where Rhati is the output of the main model, Ri is the true feedback.
[0231] Optimizer settings:
[0232] Using Adam optimizer, initial learning rate set to 0.001, β1 = 0.9, β2 = 0.999.
[0233] Optional: Use learning rate decay mechanism, halve the learning rate every 10 iterations.
[0234] Batch configuration:
[0235] Batchsize = 64, use random sampling to construct each batch of training data.
[0236] Epochs = 100, if the validation loss does not decrease for 10 consecutive rounds, stop early.
[0237] Validation mechanism:
[0238] Evaluate the validation set error after each training round, keep the optimal model parameter state.
[0239] Record the loss curve and validation MAE (Mean Absolute Error) during training, if the validation error is less than 0.05, the model training goal is met.
[0240] Step S404, validation and robustness test of the main model
[0241] This step is used to evaluate the generalization ability, error stability and input disturbance tolerance of the model.
[0242] Validation data configuration:
[0243] Divide the sample data into training set and validation set according to 80:20.
[0244] After each training round, record the validation error, including:
[0245] MSE: Mean Squared Error.
[0246] MAE: Mean Absolute Error.
[0247] PCC: Pearson Correlation Coefficient, measures the correlation between prediction and true feedback.
[0248] Disturbance robustness test:
[0249] Add Gaussian noise ε to input Yval with standard deviation 0.01:
[0250] Yvalnoised = Yval + ε
[0251] Record the prediction result Rhatnoised, and the difference ΔR = Rhatnoised - Rhat.
[0252] If the maximum value of ΔR in three dimensions is less than 0.02, it is considered that the robustness is qualified.
[0253] Optional solutions include adding masking disturbance on the basis of Gaussian disturbance, that is, randomly setting part of the input dimension to zero to simulate sensor failure.
[0254] The main model constructed by the above steps is trained in the shared subspace, has significant cross-user generalization ability and structure migration ability. The dimension of its model parameters is significantly reduced, the training stability is enhanced, and the prediction accuracy is highly consistent through validation set evaluation. The output is stable after introducing disturbance, and has deployment conditions. In addition, the main model can be used as the structure basis for individual network fine-tuning, and is suitable for the individual evolution of subsequent adaptive neural regulation strategies.
[0255] Step S50, configure an individual regulation sub-network with variable microstructure for each user, and the individual regulation sub-network is based on the shared base model.
[0256] In the neural regulation system, different users have significant differences in response to the same stimulus, which leads to the fact that the shared model cannot completely adapt to the fine mapping relationship between individual physiological state and stimulus feedback at the individual level. In order to realize individualized accurate regulation, it is necessary to generate an individual regulation sub-network with microstructure difference for each user on the basis of the universal structure of the shared base model. By constructing an individual sub-network with adjustable structure on the basis of the shared model, not only the decision-making ability of the group commonality is retained, but also the expression ability of individual difference characteristics is introduced, realizing the individualization migration and efficient fine-tuning of the neural regulation model.
[0257] The shared base model is the main model trained based on the shared response core subspace in step S40, has a unified input dimension and structure configuration, and is used to express the average mapping relationship between the group level state and feedback.
[0258] Microstructure variability means that the individual sub-network allows part of the module structure, connection path or activation function strategy to be dynamically adjusted according to individual characteristics on the premise of maintaining the stability of the main structure.
[0259] The individual regulation sub-network is a neural network sub-model that uses a shared basic model as a structural template and performs module-level pruning, connection mode reconstruction, or weight fine-tuning according to a user individual characteristic subspace, and is used to enhance the fitting ability of individual response while maintaining the common prediction ability.
[0260] In an alternative implementation, the step S50 specifically includes the following sub-steps:
[0261] Step S501, load the shared basic model structure. The system calls the main model structure definition and parameter set of the current version from step S40, constructs a standardized neural network model architecture, including the input layer, multiple hidden layers, the output layer and their connection relationship, and preloads the weight parameters wshared and the bias parameters bshared. The shared model structure serves as a structural template for individual sub-networks.
[0262] Step S502, extract the user individual characteristic code. Based on the individual characteristic subspace Sindiv obtained in step S30, the system performs feature extraction and mean calculation on multiple state-feedback samples of the current user Uj, to obtain an individual embedding vector Ej∈R^K1. This vector represents the characteristic tendency of the user in the stimulus response behavior, and serves as a conditional input for structure pruning and parameter fine-tuning.
[0263] Step S503, construct a microstructure regulation rule set. The system presets multiple groups of sub-network transformation strategies, including but not limited to:
[0264] 1) Freeze part of the main model hidden layer nodes according to the feature sensitivity;
[0265] 2) Reconstruct the hidden layer connection mode according to the activation probability;
[0266] 3) Perturb or fine-tune part of the weight parameters according to Ej scores;
[0267] 4) Insert individualized residual connection modules on certain structures;
[0268] 5) Select different nonlinear activation strategies, such as ReLU, tanh, ELU, etc.
[0269] The above strategies are controlled by a rule mapping function fmap, whose input is Ej and output is a structure regulation configuration table configj. The system executes a model construction function according to configj to complete the creation of the individual regulation sub-network.
[0270] Step S60, train the shared basic model based on the individual characteristic subspace, activate or freeze part of the sub-modules of the shared basic model, to obtain the individual regulation sub-network.
[0271] In the neuromodulation system, the responses of different users to specific stimuli conditions have obvious individual differences. Although the shared base model has constructed an average mapping relationship through the group response mode, it is difficult to accurately adapt to the physiological state of individuals without introducing a personalized modulation mechanism. Therefore, to achieve precise neural feedback modulation, it is necessary to structureally prune the shared model according to the individual feature subspace information of the user, and construct an individual modulation sub-network with commonality and individual adaptability through module activation or freezing mechanism, so as to improve the accuracy and response sensitivity of the model in actual intervention tasks.
[0272] In this step, activation refers to placing the modules or pathways in the neural network model that are originally in a non-computing path or inhibited state into a state that can participate in training and reasoning.
[0273] Freezing refers to setting part of the modules or parameters in the neural network model to a state that cannot participate in training or back propagation, and only used for inference, in order to improve the calculation efficiency and avoid overfitting.
[0274] In an optional specific implementation, the step S60 specifically includes the following sub-steps:
[0275] Step S601, constructing a user feature activation mapping matrix.
[0276] The system first obtains the individual feature embedding vector Eu of the current user U. The vector is a low-dimensional vector representation learned from the state-feedback history sample in step S30, and is used to describe the individual feature distribution of the user in the response process to external stimuli. The dimension of Eu is denoted as K1, for example K1=16. The system divides the shared base model fshared into L structurally adjustable modules. Each module can be a neural network layer, a convolution group, an attention head, or a group of structurally independent functional blocks, such as residual connection modules or gating modules.
[0277] The system presets a mapping matrix Wmap with a dimension of LxK1, which is used to define the correlation strength between the feature embedding vector and the structural module. The system calculates the dot product score of each module i and Eu:
[0278] Si=∑{j=1}^{K1}(Wmap[i][j]×Eu[j])
[0279] The system sets an activation threshold θactive, for example θactive=2.5. If Si≥θactive, the module is marked as active Mactive[i]=1, otherwise it is set to frozen Mactive[i]=0. The above process can form an activation vector Mactive with a length of L, which is used to drive the subsequent module regulation.
[0280] In a specific implementation, Wmap can be generated offline according to various means such as sample data clustering, attention weight distribution, and structure importance analysis, or can be trained cooperatively with Eu.
[0281] Step S602, the shared model module is frozen and unlocked.
[0282] The system sets the parameter state of each module in the shared base model fshared in turn according to the state value in Mactive. For a frozen module (i.e., Mactive[i]=0), the system sets the training flag of all learnable parameters p in it to requiresgrad=False, ensuring that the gradient is always zero during training, so as to keep the weights in the original model unchanged and prevent interference with the paths of other users; and sets the switch flag of the module to the frozen state during inference, skipping execution during edge deployment or low-power operation to improve execution efficiency.
[0283] For an activated module (i.e., Mactive[i]=1), the system retains all its training capabilities and allows the module to participate in the training process of individual samples to enhance the model's response to user individual characteristics. The system can also set different training strategies according to the module type, such as retaining the historical mean in the BN layer or synchronously updating the mean.
[0284] Step S603, individual sample fine-tuning training.
[0285] The system loads the training sample set Du of the current user U, which consists of state vectors Yui and feedback vectors Rui, where Yui∈R 8 Rui∈R 3 is the physiological feedback result after stimulation (such as heart rate change, muscle electrical amplitude, skin conductance response, etc.). The system uses a small batch training strategy to locally train and optimize the activated modules in the shared model.
[0286] The training parameters are set as follows: the batch size (batchsize) can be set to 32, the training rounds (epoch) can be set to between 10 and 30 rounds, and the training learning rate (learningrate) is recommended to be between 0.00005 and 0.0002. The loss function usually uses the feedback prediction mean square error loss L=||fsubu(Yui)-Rui||2. Only the parameters in the activated module are updated, and the remaining modules remain in the frozen state, ensuring the controllability of the training process and the stability of the model.
[0287] The training process adopts gradient descent method or its variants (such as Adam optimizer), and the training framework can be selected from deep learning platforms such as TensorFlow and PyTorch which have the ability of module freezing.
[0288] In step S604, the individual regulatory sub-network is generated.
[0289] After the training is completed, the system constructs an individual regulatory sub-network fsubu according to the current module activation state Mactive and the learned module weight parameters. The structure of the sub-network is consistent with the shared model at the input and output interfaces, but only the activated modules are retained in the intermediate layer structure, and the remaining modules are in a frozen state and do not contain redundant connections. The system stores Mactive and the structure diagram of the activated modules as metadata, and encapsulates the trained model as a weight file and a structure definition file to form a deployable model package.
[0290] Further, the system binds fsubu with the unique identifier of the user U and deploys it on a cloud server or synchronizes it to an edge node or a terminal control device to support local inference and real-time feedback prediction.
[0291] Further, the system records the model version, training time, sample size, and fine-tuning layer number of the individual sub-network, which supports subsequent version updates and performance backtracking.
[0292] In this step, with the help of individual feature-driven module activation mechanism, the system does not need to reconstruct the overall model structure, but only activates the fine-tuned modules locally on the basis of the shared model, which not only inherits the generalization ability of the shared model, but also realizes efficient individual adaptability. By freezing part of the general modules, the training and inference costs are reduced, and in the multi-user scenario, fast deployment, low resource consumption, and high response accuracy are realized, which is particularly suitable for cloud-end collaborative training mechanism of remote neural regulation devices.
[0293] In a specific example, the individual feature vector of user A is EA = [0.62, -0.15,..., 0.44], which is mapped to L = 6 modules of the shared model by the system, and the module state Mactive = [1, 1, 0, 1, 0, 0] is obtained through activation determination, indicating that the first, second, and fourth modules are activated. The frozen modules are the third, fifth, and sixth layers, among which the fifth layer is a residual attention connection module and the sixth layer is a multi-head attention integration module.
[0294] The system inputs the EA into the fmodulemap function, completes the mapping score calculation, and selects the module activation training with a score greater than θactive. A total of 800 data in the user sample set is loaded, and under the premise of keeping most of the model frozen, only the activated module is trained. After 20 rounds of training, the mean square error is reduced by 45%. The individual regulatory sub-network fsubA is finally generated, and is deployed on the user's device to realize personalized feedback prediction and closed-loop stimulation regulation control.
[0295] Further, in the foregoing implementation, the module-level activation and freezing mechanism adopted has the problems of coarse structural granularity, limited response expression capability, and insufficient model evolution capability, although it realizes preliminary adaptation of individual differences in structure. Specifically, this method activates or freezes each module as a whole, and cannot control the tensor paths, feature channels, and other fine-grained structures inside the module, resulting in weak generalization capability and low regulation accuracy of the model when processing high-dimensional and variable individual physiological responses. In addition, this mechanism lacks dynamic feedback adjustment and time evolution mechanism, and cannot continuously optimize the sub-network structure according to the long-term changes of the user state, limiting the long-term adaptability and stability of the model in actual clinical intervention.
[0296] In a further implementation, the step S60 specifically comprises the following sub-steps:
[0297] Step S601', constructing a tensor-level path response factor map
[0298] Instead of using a fixed module activation binary vector Mactive, the system constructs a tensor path response map Rmap ∈ R^{L×D} based on the individual feature embedding vector Eu and the user historical feedback tensor Rseq (a Txd-dimensional time series), where L is the number of adjustable modules and D is the number of adjustable paths in each layer of tensor. Each element Rmap[i][j] represents the importance response score of the i-th layer j-th tensor path, which is calculated by the following formula:
[0299] Rmap[i][j] = σ (∑{k=1}^{K1} We[i][j][k] × Eu[k] + ∑{t=1}^{T} ∑{m=1}^{d} Wr[i][j][t][m] × Rseq[t][m])
[0300]
[0301] Wherein:
[0302] Rmap[i][j] represents the response importance score of the i-th layer j-th path in the tensor path response factor map, which is a real value, reflecting the applicability and weight of the path in the current individual structure.
[0303] σ(·) denotes a normalization function, which is used to normalize the weighted sum result to a certain numerical range (such as [0, 1]), common options include Sigmoid function (σ(x) = 1 / (1+e^(-x))) or Softmax function. The function is to convert the response score into probability or relative weight.
[0304] ∑{k=1}^{K1}We[i][j][k]×Eu[k] is the weighted sum part of individual feature terms:
[0305] K1: The dimension of the individual feature embedding vector Eu, that is, the number of individual features.
[0306] Eu[k]: The k-th component of the individual feature embedding vector Eu, representing the feature information of the individual in the k-th dimension.
[0307] We[i][j][k]: The weight of the i-th layer and the j-th path of the path response weight tensor We in the k-th individual feature dimension, which is a three-dimensional tensor with shape LxDK1.
[0308] ∑{t=1}^{T}∑{m=1}^{d}Wr[i][j][t][m]×Rseq[t][m] is the weighted sum part of the time feedback term:
[0309] T: The time length of the feedback sequence.
[0310] d: The dimension of the feedback vector at each time point, such as the total number of physiological signal dimensions such as electromyography, heart rate, and skin conductance.
[0311] Rseq[t][m]: The m-th feedback signal value at time point t, which constitutes the entire feedback tensor Rseq, which is a Txd matrix.
[0312] Wr[i][j][t][m]: The weight of the i-th layer and the j-th path of the feedback response weight tensor Wr corresponding to the time point t and the signal dimension m, which is a four-dimensional tensor with shape LxDXTd.
[0313] L is the total number of adjustable modules in the shared neural network, that is, the depth or level of the neural network.
[0314] D is the number of adjustable tensor paths in each layer, which usually represents the number of channels, feature paths or calculation units in the layer that can independently participate in inference and training. Through this path factor map, the system not only identifies the structure suitable for the current individual, but also refines the tensor path channel inside the module to form a plasticity tensor regulation baseline.
[0315] Step S602', dynamically regulating the internal tensor structure of the shared model, that is, the
[0316] The system sets the path flux coefficient ai,j∈[0,1] of the tensor path in each shared module as the participation degree of the path in training and inference according to the Rmap. The system sets the flux gate weight using the following formula:
[0317] Xout[i] = ∑{j=1}^{D}α i,j ×F i,j (Xin)
[0318] Wherein:
[0319] Xout[i] represents the output tensor of the ith layer in the shared model, that is, the total result after the current layer synthesizes the outputs of all activation paths, the dimension of which depends on the model architecture, but is usually in the form of a tensor (such as the number of channels × width × height);
[0320] ∑{j=1}^{D} represents the summation of all D tensor paths (such as D channels, branches or feature paths) in the ith layer, and D is the number of adjustable structural units in the current layer;
[0321] α i (the flux control factor) represents the “flux coefficient” of the jth path in the ith layer of the shared model, and the value range is [0, 1];
[0322] If α i ≈1, the path is fully activated and participates in training and inference;
[0323] If α i ≈0, the path is frozen and only used for inference, or completely shielded in extreme cases;
[0324] If 0 < α i <1, it is in a partially activated state, which is suitable for partial flux adjustment or residual reservation;
[0325] The coefficient is set by the normalized response map Rmap[i][j] calculated in step S601', which reflects the adaptability and importance of the current path to individual samples.
[0326] F i (·) (path processing function) represents the tensor transformation function on the jth path in the ith layer, which is a sub-network structure or operator that performs specific processing on the input tensor Xin, for example:
[0327] Convolution operation (Conv2D, DepthwiseConv);
[0328] Attention mechanism module (Self-Attention, Channel Attention);
[0329] Gate Unit, GRU channel
[0330] Nonlinear combination layer (such as a weighted residual module, a learnable dynamic routing module), etc.
[0331] Each F i Can have different structures to achieve different feature extraction, fusion or screening functions.
[0332] Xin represents an input tensor, which is the input data accepted by the current i layer, usually the output tensor from the previous layer. Its shape is consistent with that of the previous layer output, typically a three-dimensional or four-dimensional tensor (such as batch x channel x height x width).
[0333] Step S603': feedback-driven dynamic path shaping training
[0334] The core of this step is to introduce multi-dimensional feedback and time evolution information to accurately train the activation path, and to realize structure convergence through sparse regulation mechanism.
[0335] In an alternative implementation, the step S603' specifically includes the following sub-steps:
[0336] Step S6031, constructing a feedback sliding window sample set.
[0337] The system establishes a sliding window of training samples in the time dimension. Let the current time be t, and the window width be W. The system extracts the last W feedback state samples from the historical feedback sequence of the current user to form the training set Du^W = {(Y{u,t-w}, R{u,t-w}) | 0 <= w < W}.
[0338] Wherein:
[0339] Y{u,t-w} is the state vector at time t-w, mapped from the shared response core subspace, with a dimension of 8;
[0340] R{u,t-w} is the feedback response vector at this time, with a dimension of 3, including signals such as electromyography, heart rate, skin conductance, etc.
[0341] The sliding window width W is usually set to 32 to 128, which can be dynamically adjusted.
[0342] Step S6032, calculating response trend weight.
[0343] For each training sample in the sliding window, the system calculates the response change rate of its feedback vector to characterize its importance to the model weight. Define the response change rate as ΔRw = ||R{u,t-w}-R{u,t-w-1}||.
[0344] The system uses a normalization function to map ΔRwinto a sample weight coefficient ωw∈(0, 1], for example, using exponential normalization:
[0345] ωw= e^{\lambdaΔRw} / \Sigma{k=0}^{W-1}e^{\lambdaΔRk}, where λ is a response sensitivity parameter, usually taking a value of 3 to 5.
[0346] This weight will be used in the training loss function, adjusting the path weight shaping of the model on the dynamically changing response.
[0347] Step S6033, weighted path sparse training is performed.
[0348] The system constructs a joint training objective function with a weighted feedback error loss and a structure sparse regulation loss:
[0349] L = \Sigma{w=0}^{W-1}ωw×||fplastic,u(Y{u,t-w})-R{u,t-w}||^2+β×\Sigma{i,j}|α{i,j}|
[0350] Wherein:
[0351] The first term is the weighted prediction loss;
[0352] The second term is the path flux sparse regularization term;
[0353] w represents the index in the sliding window, w = 0 to W-1, representing each feedback sample position backtracking from the current time.
[0354] W represents the length of the sliding window, representing the number of historical samples used in training, usually set to 32 to 128.
[0355] ωwrepresents the sample weight coefficient at the wthtime step, representing the influence degree of this sample on the current training, which is obtained by normalizing the feedback change trend ΔRw, and the value range is (0, 1].
[0356] fplastic,u(·) represents the plasticity subnetwork model of the current individual u, which is used to perform feedback prediction on the state vector Y_{u,t-w}
[0357] Y{u,tw} represents the state vector at the twthtime, which is derived from the state sequence of individual u, has been mapped to the shared response core subspace, and is usually an 8-dimensional vector.
[0358] R{u,tw} represents the true feedback vector at the twthtime, for example, a combination of electromyography, heart rate, and skin conductance value, usually a 3-dimensional vector.
[0359] β is a sparsity control coefficient, which is a non-negative real number, used to adjust the weight of the structural sparsity loss term in the total loss.
[0360] α(i,j) represents the flux factor of the i-th layer and the j-th path, which represents the importance of the path, and the value range is [0, 1]. When α(i,j) is small, it means that the path contributes less and can be considered for pruning.
[0361] The system uses the Adam optimizer to perform training, only updates the path parameters whose flux coefficient is greater than the threshold, and freezes the path weight and does not update.
[0362] Step S6034, record the path importance snapshot.
[0363] After training, the system records the path retention index at the current time, including:
[0364] The average number of activated paths in each layer;
[0365] The average gradient size of each path;
[0366] The sparsity of the flux factor distribution (such as L1 norm, entropy, etc.);
[0367] The feedback convergence speed (such as the average error reduction rate in the sliding window).
[0368] The above information will be used for subsequent individual network structure determination and evolution strategy formulation.
[0369] Step S604': Constructing a plastic individual control sub-network and structure snapshot management
[0370] This step realizes the extraction of stable structure from the trained flux factor, generates a lightweight model with individual adaptability and encapsulates it into a deployable form, and establishes a structure tracking mechanism to support subsequent updates and verification.
[0371] In an optional specific implementation, the step S604' specifically includes the following sub-steps:
[0372] Step S6041, generate a structured flux template.
[0373] After the system reads all the flux factors α(i,j), it compares them with the set structure importance threshold θretain to generate a flux structure template Stemplate∈{0,1}^{L×D}, where:
[0374] Stemplate[i][j] = 1 if α(i,j) ≥ θretain, otherwise set to 0.
[0375] The template is used to guide the construction of the model structure diagram and determine which paths to retain and which to prune.
[0376] Step S6042, construct the structured individual model graph.
[0377] The system deletes or trims paths that do not meet the retention condition according to the shared model skeleton, and reconstructs the flux of the retained paths. The structured sub-model graph Gu=(Vu, Eu) is obtained, where:
[0378] Vu represents the set of effective structural modules in the individual network;
[0379] Eu represents the connection path between modules, and the connection strength is determined by the retained flux factor.
[0380] The system converts the graph into a standard neural network graph definition language (such as ONNX, TensorFlowSavedModel structure graph) for deployment.
[0381] Step S6043, package and version the deployment model.
[0382] The system packages the following into a model deployment package:
[0383] Model structure graph definition (structure template + module connection configuration);
[0384] Model parameter weight file (only contains retained paths);
[0385] Model training meta information (sample size, error change, training time, etc.);
[0386] Model fingerprint hash digest and version number.
[0387] The model package binds the current user's unique identifier UID and is uploaded to the cloud device management system or synchronized to the edge device.
[0388] Step S6044, establish a structure evolution and verification mechanism.
[0389] The system establishes a structure snapshot for each sub-network structure, recording its generation time, sample window used, flux distribution summary, inference accuracy, user feedback change curve, and other meta information.
[0390] If the system detects that the inference accuracy decreases by more than a set threshold (such as 15%), or the feedback response in the sliding window fluctuates significantly (such as 5 consecutive error increases), the structure self-plasticity process will be triggered, i.e. restart step S603' for retraining, and compare with historical snapshots to determine whether the structure update is effective.
[0391] Specifically, during the last two days of using the stimulation device, the system detects that the skin conductance and the muscle electrical response of user A have obvious trend changes in a certain time period, and the error accumulation in the feedback sequence rises by 18%. The system extracts samples in a sliding window with a step size of 64, and after calculating the trend weight, it finds that the flux of the 5th layer and the 2nd path (attention gate path) significantly increases from 0.22 to 0.76.
[0392] After the system performs structure reconstruction, a structure template Stemplate is generated, paths with flux coefficients less than 0.1 are deleted, 26 high-weight paths are retained, and a subnetwork GAv2 is generated. After the deployment of the new model, the error decreases by 28%, and the structure snapshot system records this change and marks it as an effective evolution.
[0393] This further improvement scheme realizes fine adjustment and dynamic evolution of the internal structure of the shared neural regulation model by introducing a tensor-level path regulation mechanism and a multi-scale feedback-driven training strategy. Compared with the traditional module-level activation method, this scheme significantly improves the adaptability of the model to individual physiological differences, enhances the flexibility and prediction accuracy of the structure expression, and can continuously optimize the individual subnetwork structure during the change of user state, has higher generalization, self-plasticity and long-term stability, and is especially suitable for personalized neural regulation deployment scenarios on resource-constrained devices.
[0394] In another embodiment, a cloud AI system is also disclosed, which is generated based on any one of the foregoing embodiments or a combination of embodiments.
[0395] Those of ordinary skill in the art can realize that the units and algorithm steps described in the embodiments disclosed herein can be realized in electronic hardware, computer software and a combination of electronic hardware and computer software. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0396] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.
[0397] In several embodiments provided in the present application, any function, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or in part or parts of the technical solutions that make contributions to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory; hereinafter referred to as: ROM), a random access memory (Random Access Memory; hereinafter referred to as: RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0398] The above is only a specific embodiment of the present application, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. The module structure of the part of the present application not specifically mentioned is subject to the content recorded in the prior art. The prior art mentioned in the foregoing background section and the specific embodiment section of the present application can be used as a part of the present application to understand the meaning of some technical features or parameters.
Claims
1. A cloud-based AI model training method, characterized in that, The method comprises the following steps: Collecting multi-modal state data and stimulation response data of a plurality of users during use of a neural electrical stimulation device and uploading to a cloud server for structured storage and preprocessing; Constructing a cross-user stimulation response evolution matrix, wherein each row corresponds to a state-stimulation-feedback sequence of a user, and each column represents the response mode of different users under the same stimulation situation; Based on the stimulation response evolution matrix, extracting a plurality of individual feature subspaces and a shared response core subspace, the individual feature subspaces reflecting the individualized response of a user to a certain stimulation, and the shared response core subspace capturing the group common response law; Based on the shared response core subspace, training a stimulation prediction main model to learn the average mapping relationship between the state vector and the feedback, as a shared base model for each user model; Configuring an individual regulation sub-network with variable microstructure for each user, the individual regulation sub-network being based on the shared base model; Based on the individual feature subspace, activating or freezing part of the sub-modules of the shared base model to obtain the individual regulation sub-network model. 2.The cloud AI model training method of claim 1, wherein, The construction of the cross-user stimulation response evolution matrix comprises: Defining a standardized stimulation response triple format, the triple consisting of a state vector, a set of electrical stimulation parameters, and a feedback vector after stimulation; Constructing the triple of each user into a time series structure to form a user response trajectory; According to the similarity of the stimulation parameters, the user response trajectories are clustered to classify the tasks into different stimulation situation clusters; In each situation cluster, the corresponding tasks are organized into sub-matrices, and each item of the sub-matrix is a triple; Splicing all the sub-matrices to generate the stimulation response evolution matrix. 3.The cloud AI model training method of claim 2, wherein, The extraction of the shared response core subspace comprises: For each user and each task, collect the original triple data, splice it into a first vector, and densify the first vector to obtain a tensor T; Each user performs zero-mean unit-variance normalization in its own vector set to generate a mask for the tensor T; Tensor decomposition is performed on the tensor T to obtain a feature embedding matrix; Covariance analysis is performed on the feature embedding matrix, and the first preset dimension is retained in descending order to obtain the shared response core subspace. 4.The cloud AI model training method of claim 3, wherein, The extraction of the individual feature subspace comprises: According to the embedding vector of the user, the projection value in the direction of the shared response core subspace is calculated; The individual feature subspace of the user is obtained by subtracting the projection value from the embedding vector of the user. 5.The cloud AI model training method of claim 1, wherein, Based on the shared response core subspace, training a stimulation prediction main model comprises: Mapping the original state vector to a unified shared subspace; Establishing a group prediction network in the shared input space as a feedback estimation basis; Using input features and feedback to construct training samples and optimizing prediction network parameters through error. 6.The cloud AI model training method of claim 1, wherein, The variable part in the individual regulation sub-network comprises one or any combination of the following: Freezing part of the hidden layer nodes of the main model according to feature sensitivity; Reconstructing the hidden layer connection mode according to the activation probability; According to the input, perturbing or fine-tuning part of the weight parameters; Inserting individualized residual connection modules on certain structures; Selecting different nonlinear activation strategies. 7.The cloud AI model training method of claim 1, wherein, The individual characteristic subspace trains the shared base model, activates or freezes part of the sub-modules of the shared base model, and obtains the individual regulation sub-network, which comprises: Obtaining an individual characteristic embedding vector of a current user U; Predefining a mapping matrix to define the correlation strength between the characteristic embedding vector and the structure module; Setting an activation threshold; Calculating the dot product score of each structure module according to the characteristic embedding vector and the correlation strength; Determining the activation state of the structure module according to the dot product score and the set activation threshold; According to the activation state, the simulated activation state in the shared base model is changed to obtain the individual regulation sub-network. 8.The cloud AI model training method of claim 1, wherein, The individual characteristic subspace trains the shared base model, activates or freezes part of the sub-modules of the shared base model, and obtains the individual regulation sub-network, which comprises: According to the individual characteristic embedding vector, a tensor path response atlas is constructed by combining the user historical feedback tensor; The path response atlas is normalized to obtain a flux control factor; According to the flux control factor and the historical input, a flux gating weight is determined, and the modules with the flux gating weight greater than a preset value are activated and participate in training and optimization; A training sample is obtained by using a sliding window; For each training sample in the sliding window, the response change rate of the feedback vector is calculated, and the response change rate is mapped to a sample weight coefficient; According to the sample weight coefficient, a training target function is constructed; Based on the target function, an Adam optimizer is used to perform training, and only the path parameters with the flux gating weight greater than a threshold value are updated; According to the training result, the individual regulation sub-network structure is extracted. 9.A cloud AI system, comprising: The system trained by using any one of the methods of claims 1-8.
Citation Information
Cited By
Ear-neck electrical stimulation electroencephalogram feedback decision method based on machine learning
CN122490481A