Separated architecture LoRA model training method
By extracting interactive features to generate modules of varying degrees of sophistication, performing gradient propagation analysis and synchronous communication, and optimizing the LoRA model training process, the problems of underoptimized module generation and inaccurate gradient analysis in traditional methods are solved, thereby improving the performance and adaptability of the model.
Patent Information
- Application Number
- CN202511255749.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-04
- Publication Date
- 2025-10-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional LoRA model training methods have difficulty generating modules of varying degrees of sophistication when processing training data of different resolutions, resulting in incomplete and inaccurate feature extraction, and a lack of effective training queue control and gradient analysis, affecting the overall performance and adaptability of the model.
By acquiring the initial training data set in real time, extracting interactive features and generating modules of varying degrees of sophistication, building a training queue for synchronous communication, performing gradient propagation analysis, identifying the number of parameter updates, and optimizing the module in combination with preset rules, multi-granularity feature distribution and gradient state data are generated.
It improves the model's ability to analyze and adapt to data, ensures good connection and collaborative work between modules, enhances the model's training effect and convergence speed, and strengthens the model's analytical capabilities in different scenarios.
Smart Images

Figure CN120804720A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of machine learning model training, specifically to a separated architecture LoRA model training method. BACKGROUND
[0002] In the rapid development process of artificial intelligence technology, deep learning models have been widely applied in many fields. LoRA (Low-Rank Adaptation) model as an important model type faces many challenges in model training.
[0003] With the continuous expansion of data size and the increasing complexity of application scenarios, the traditional LoRA model training method gradually shows its shortcomings. When dealing with training data of different resolutions, the traditional method is difficult to efficiently generate modules of different levels of detail, resulting in incomplete and inaccurate extraction of data features by the model. For example, when facing training data sets containing multiple data types (such as structured data and unstructured data), the traditional method cannot well standardize the data, resulting in poor feature extraction effect.
[0004] In the feature extraction process, the traditional method does not extract the interaction features in the initial feature sequence deeply. When the feature dimension is high, the effect of dimension reduction processing is not ideal, which cannot effectively enhance the correlation features between the basic features, interaction features and adaptive features, thereby affecting the understanding of the model to the internal relationship of the data.
[0005] In addition, in the module generation process, the traditional method lacks effective training queue control and synchronous communication mechanism. The body unit and unique identifier between adjacent sub-modules are difficult to achieve good mapping, resulting in sub-optimal generated modules and affecting the overall performance of the model.
[0006] In terms of gradient analysis, the traditional method cannot well combine the training load spectrum for gradient propagation analysis, cannot accurately obtain the gradient distribution of each separated module, and is also difficult to analyze the time and space variation trend of the gradient, thereby affecting the acquisition of model gradient state data and leading to inaccurate model parameter update.
[0007] Moreover, when the target module needs to be analyzed, the traditional method cannot accurately extract the data sequence of the corresponding position from the gradient state data and analyze it according to different calculation accuracy requirements, which limits the application of the model in different scenarios. SUMMARY
[0008] The present application aims to provide a separated architecture LoRA model training method to solve the problems raised in the background.
[0009] To achieve the above object, the application provides a separated architecture LoRA model training method, which comprises the following steps: Real-time acquisition of initial training data set of a LoRA model to be trained, extraction of initial feature sequence from the training data set; wherein the LoRA model to be trained comprises a plurality of separated modules; Extraction of interaction features from the initial feature sequence; based on the interaction features, different modules with different levels of fineness are respectively generated according to the training data resolution of different modules of the LoRA model to be trained, and a multi-granularity feature distribution is obtained according to the module generation result; wherein the corresponding level of fineness of the module with relatively high resolution is greater than the corresponding level of fineness of the module with relatively low resolution; Analysis of the training sequence of the multi-granularity feature distribution to obtain a training load spectrum; Based on the training load spectrum, the gradient distribution of the plurality of separated modules is calculated by gradient propagation analysis to obtain the gradient state data of the LoRA model to be trained; According to the gradient state data, the parameter update times of the separated modules are identified; and combined with a preset model update rule, the residual update amount of the separated modules is obtained, and then based on the residual update amount of each module, the final training parameters of the LoRA model to be trained are obtained.
[0010] Preferably, the level of fineness is set according to the module granularity, the module quantity and the module density; Based on the interaction features, different modules with different levels of fineness are respectively generated according to the training data resolution of different modules of the LoRA model to be trained, and a multi-granularity feature distribution is obtained according to the module generation result, which comprises: The training area of the LoRA model to be trained is divided into a plurality of sub-modules; A plurality of training queues are constructed, and each training queue corresponds to a sub-module; According to the training data resolution of each sub-module, the module granularity, the module quantity and the module density of each sub-module are determined; The plurality of training queues are controlled to generate target modules of each sub-module according to the module granularity, the module quantity and the module density of each sub-module; Based on the interaction features and the target modules of each sub-module, the multi-granularity feature distribution is obtained.
[0011] Preferably, the control of the plurality of training queues to generate target modules of each sub-module according to the module granularity, the module quantity and the module density of each sub-module comprises: The plurality of training queues are controlled to respectively preliminarily generate module surface information according to the module granularity, the module quantity and the module density of each sub-module; Controlling the multiple training queues to generate a three-dimensional module of each sub-module based on the module surface information and obtaining module body information; According to the module body information, obtaining nodes and body cells of each three-dimensional module; and numbering the nodes and body cells of each three-dimensional module to obtain unique identifiers of each node and unique identifiers of each body cell; Controlling the multiple training queues to synchronize communication between each other to map the body cells and unique identifiers between adjacent sub-modules to each other to obtain mapping information; According to the mapping information, optimizing the three-dimensional module of each sub-module to obtain a target module of each sub-module.
[0012] Preferably, the initial feature sequence is extracted from the training data set, comprising: Standardizing the initial training data set to obtain standardized data; Extracting basic features, interaction features and adaptive features from the standardized data using a preset feature extraction network to obtain the initial feature sequence.
[0013] Preferably, the interaction feature is extracted from the initial feature sequence, comprising: Extracting a preliminary feature set coupled with the basic features, interaction features and adaptive features from the initial feature sequence; When the feature dimension of the preliminary feature set is greater than a preset dimension threshold, performing dimension reduction processing on the preliminary feature set to obtain dimension-reduced data; Analyzing the training sequence of the dimension-reduced data, enhancing the associated features related to the dynamic characteristics of the basic features, interaction features and adaptive features to obtain the interaction features.
[0014] Preferably, the LoRA model to be trained is connected with at least one adaptive layer; based on the training load spectrum, the gradient distribution of the multiple separated modules is calculated by gradient propagation analysis to obtain gradient state data of the LoRA model to be trained, comprising: Constructing a basic model of the LoRA model to be trained; constructing an adaptive model of each adaptive layer respectively, embedding all adaptive models into the basic model to obtain a target model; Based on the training load spectrum, a training task is constructed; according to the target model and the training task, gradient propagation analysis is performed in combination with a preset constraint condition to obtain the gradient distribution of each separated module; According to the gradient distribution of each separated module, the time variation trend and the space variation trend of the gradient of each separated module are analyzed; Based on the time variation trend and the space variation trend of the gradient of each separation module, a dynamic gradient distribution diagram of the LoRA model to be trained is obtained, and the gradient state data is obtained according to the dynamic gradient distribution diagram.
[0015] Preferably, the separation architecture LoRA model training method further comprises: In response to an analysis instruction of a target module, the analysis instruction comprising a calculation accuracy requirement; According to the analysis instruction, a data sequence corresponding to the position of the target module is extracted from the gradient state data; And according to the calculation accuracy requirement, the gradient analysis result of the target module is obtained based on the data sequence analysis.
[0016] Preferably, the standardization processing of the initial training data set to obtain the standardized data comprises: The initial training data set is divided into structured data and unstructured data; The structured data is respectively subjected to missing value filling processing, and the unstructured data is subjected to word segmentation and denoising processing to obtain the standardized data.
[0017] Preferably, the extraction of the basic feature, the interaction feature and the adaptive feature from the standardized data by using the preset feature extraction network comprises: The standardized data is received by the input layer of the feature extraction network; The statistical features of the structured data are extracted by the first hidden layer of the feature extraction network to obtain the basic features; The semantic association features of the unstructured data are extracted by the second hidden layer of the feature extraction network to obtain the interaction features; The statistical features and the semantic association features are fused by the output layer of the feature extraction network to obtain the adaptive features.
[0018] Preferably, the synchronization communication between the plurality of training queues is controlled to map the body unit and the unique identifier between adjacent sub-modules to each other to obtain mapping information, comprising: A communication buffer is configured for each training queue; The body unit number list and the unique identifier set of adjacent sub-modules are exchanged through the communication buffer; An index mapping relationship is established based on the number list and the identifier set to obtain the mapping information.
[0019] Compared with the prior art, the present application has the following advantages: The separated architecture LoRA model training method has multiple advantages. After obtaining the initial training data set of the LoRA model to be trained, the initial feature sequence can be extracted from the training data set, and the LoRA model to be trained includes multiple separated modules, which makes the model more flexible in structure and can be trained according to the characteristics of different modules.
[0020] After extracting the interaction features from the initial feature sequence, based on the interaction features, different modules with different levels of refinement are generated according to the training data resolution of different modules, and then the multi-granularity feature distribution is obtained. Since the module with high resolution corresponds to a more refined level, this processing method can better adapt the model to data with different resolutions and more comprehensively capture the features in the data. For example, the training area is divided into multiple sub-modules and the corresponding training queue is constructed, the module granularity, number and density are determined according to the training data resolution of each sub-module, and then the target module is generated. This refined processing can improve the data analysis ability of the model.
[0021] In the process of generating the module, the training queue generation module surface information and the three-dimensional module are controlled, the nodes and body units are obtained and numbered, the body units and unique identifiers of adjacent sub-modules are mapped to each other through synchronous communication between training queues, and then the target module is optimized. This method ensures good connection and cooperation between modules, improves the overall quality of the module and the performance of the model.
[0022] The training sequence of the multi-granularity feature distribution is analyzed to obtain the training load spectrum, and based on this, the gradient distribution of the separated module is calculated by gradient propagation analysis to obtain the gradient state data. This process can more accurately grasp the gradient change in the model training process, and provide more reliable basis for subsequent parameter updating.
[0023] According to the gradient state data, the number of parameter updates of the separated module is identified, and the remaining update amount is obtained combined with the preset model update rule to obtain the final training parameters. This parameter updating method based on gradient state makes the parameter updating more reasonable and accurate, which can improve the training effect and convergence speed of the model.
[0024] When responding to the analysis instruction of the target module, the data sequence at the corresponding position can be extracted from the gradient state data according to the calculation accuracy requirement and analyzed to obtain the gradient analysis result, which makes the model meet the corresponding analysis requirements in different application scenarios, and enhances the adaptability and practicality of the model.
[0025] In terms of data processing, the initial training data set is standardized, divided into structured data and unstructured data, and subjected to missing value filling and word segmentation and denoising processing, which can improve the quality of the data and lay a good foundation for subsequent feature extraction. The preset feature extraction network is used to extract basic features, interaction features and adaptive features, and through the processing of different hidden layers and output layers, various features in the data can be more effectively extracted, and the understanding and processing ability of the model for the data can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0026] Figure 1 A working principle diagram of the separated architecture LoRA model training method is provided. Figure 2 A flowchart for generating multi-granularity feature distribution is provided. Figure 3 A flowchart for generating and optimizing target modules is provided. Figure 4 A flowchart for extracting interaction features is provided. Figure 5 A flowchart for generating gradient state data is provided. DETAILED DESCRIPTION
[0027] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0028] Please refer to Figures 1-5 The present application provides a separated architecture LoRA model training method, which has the following specific implementation steps: An initial training data set of a LoRA model to be trained is acquired in real time, and an initial feature sequence is extracted from the training data set; wherein the LoRA model to be trained includes a plurality of separated modules. The initial training data set is first processed, and is divided into structured data and unstructured data. The structured data is subjected to missing value filling processing, and the unstructured data is subjected to word segmentation and denoising processing, to obtain standardized data. The standardized data is received by the input layer of a preset feature extraction network, the statistical features of the structured data are extracted by the first hidden layer to obtain basic features, the semantic association features of the unstructured data are extracted by the second hidden layer to obtain interaction features, and the statistical features and the semantic association features are fused by the output layer to obtain adaptive features, thereby obtaining the initial feature sequence.
[0029] The interaction feature is extracted from the initial feature sequence; based on the interaction feature, different modules with different degrees of refinement are generated according to the training data resolution of different modules of the to-be-trained LoRA model, and a multi-granularity feature distribution is obtained according to the module generation result; wherein the module with relatively high resolution corresponds to a degree of refinement greater than that of the module with relatively low resolution. First, the initial feature sequence is extracted to obtain a preliminary feature set coupled with the basic feature, the interaction feature and the adaptive feature. When the feature dimension of the preliminary feature set is greater than the preset dimension threshold, the dimensionality reduction data is obtained by dimensionality reduction processing. Then, the training sequence of the dimensionality reduction data is analyzed, the correlation feature of the dynamic characteristics related to the basic feature, the interaction feature and the adaptive feature is enhanced, and the interaction feature is obtained. Then, the training area of the to-be-trained LoRA model is divided into multiple sub-modules, multiple training queues are constructed, each training queue corresponds to a sub-module, the module granularity, the module number and the module density of each sub-module are determined according to the training data resolution of each sub-module, the module surface information of each training queue is preliminarily generated according to the parameters of each sub-module, the three-dimensional module of each sub-module is generated based on the module surface information, and the module body information is obtained. According to the module body information, the nodes and body units of each three-dimensional module are obtained and numbered to obtain the unique identity. Then, the synchronous communication between the multiple training queues is controlled, the communication buffer area is configured for each training queue, the body unit number list and the unique identity set of the adjacent sub-modules are exchanged through the communication buffer area, the index mapping relationship is established based on the number list and the identity set to obtain the mapping information, the three-dimensional module of each sub-module is optimized according to the mapping information, and the target module of each sub-module is obtained. Finally, the multi-granularity feature distribution is obtained based on the interaction feature and the target module of each sub-module.
[0030] The training sequence of the multi-granularity feature distribution is analyzed to obtain a training load spectrum.
[0031] Based on the training load spectrum, the gradient distribution of the multiple separated modules is calculated by gradient propagation analysis to obtain the gradient state data of the to-be-trained LoRA model. The base model of the to-be-trained LoRA model is constructed, the adaptive model of each adaptive layer is constructed and embedded into the base model to obtain the target model, the training task is constructed based on the training load spectrum, the gradient distribution of each separated module is obtained by gradient propagation analysis based on the target model and the training task, combined with the preset constraint condition, the time variation trend and the space variation trend of the gradient of each separated module are analyzed, and the dynamic gradient distribution diagram of the to-be-trained LoRA model is obtained, and then the gradient state data is obtained.
[0032] According to the gradient state data, the parameter update times of the separated modules are identified; and combined with the preset model update rule, the residual update amount of the separated modules is obtained, and then based on the residual update amount, the final training parameters of the to-be-trained LoRA model are obtained.
[0033] Embodiment one In the process of extracting the initial feature sequence from the training data set, the initial training data set needs to be processed. The initial training data set contains various types of data, in order to facilitate subsequent feature extraction, it needs to be divided into structured data and unstructured data. Structured data usually has a fixed format and explicit fields, such as table data in a database; while unstructured data has no fixed format, such as text, images, audio, etc.
[0034] For structured data, due to the possibility of missing values during data collection and storage, these missing values will affect subsequent feature extraction and model training, so missing value filling processing is needed. Specifically, the appropriate filling method can be selected according to the distribution characteristics of structured data. If the data follows a normal distribution, the mean filling method can be used, that is, the average value of the field is used to fill in the missing values; if the data has obvious skew distribution, median filling may be more appropriate, because the median is not affected by extreme values; and for categorical data, mode filling is a common method, that is, the value that appears most frequently in the field is used to fill in the missing values. Through such processing, the integrity of the structured data can be ensured, providing a reliable data basis for subsequent feature extraction.
[0035] For unstructured data, such as text data, which may contain a large amount of noise information, such as special characters, stop words, etc., these noises will interfere with the extraction of semantic features, so it is necessary to perform word segmentation and noise removal processing. Use professional word segmentation tools to segment text data into word units, which are the basic units of text semantics. Remove noise characters such as punctuation marks, special symbols, etc., while filtering out stop words, which are usually words without actual semantics, such as "of", "of", "in", etc. Through word segmentation and noise removal processing, relatively pure unstructured data can be obtained, preparing for subsequent extraction of semantic association features.
[0036] After completing the standardization processing of the initial training data set, the standardized data is obtained. The basic features, interaction features and adaptive features need to be extracted from the standardized data through the pre-set feature extraction network, so as to obtain the initial feature sequence. The feature extraction network is a neural network with a specific architecture, which includes an input layer, a first hidden layer, a second hidden layer and an output layer, each layer has its specific function.
[0037] The standardized data first enters the network through the input layer of the feature extraction network, the function of the input layer is to receive and transmit data, and transmit the standardized data to the subsequent hidden layer for processing.
[0038] The first hidden layer is mainly responsible for processing structured data and extracting its statistical features. For numerical data in structured data, the first hidden layer calculates statistical quantities such as mean, variance, maximum, and minimum, which can reflect the central tendency, dispersion, and range of the data, constituting the basic features. For example, for a set of students' test scores, the first hidden layer can calculate the average score, the highest score, and the lowest score, which can intuitively describe the overall performance of the students.
[0039] The second hidden layer processes unstructured data and extracts semantic association features. Unstructured data, such as text data, contains semantic information in the association and context between words. The second hidden layer analyzes the semantic similarity between words, context, and other information to capture the semantic association features of the text. For example, when analyzing a text about "artificial intelligence", the second hidden layer can identify words related to "artificial intelligence" such as "machine learning" and "deep learning", and analyze their semantic relationships to obtain semantic association features, which constitute interaction features.
[0040] The output layer's role is to integrate the statistical features obtained by the first hidden layer and the semantic association features obtained by the second hidden layer to obtain adaptive features. The output layer integrates the two different types of features through specific fusion methods such as weighted summation, so that the integrated features can better adapt to the subsequent model training requirements. In this way, the feature extraction network extracts basic features, interaction features, and adaptive features from standardized data, which together form an initial feature sequence, providing rich feature information for subsequent model training.
[0041] Embodiment Two When extracting interaction features from the initial feature sequence, the preliminary feature set coupled with the basic features, interaction features, and adaptive features needs to be extracted from the initial feature sequence. The initial feature sequence contains various features obtained from standardized data through the feature extraction network. These features may be coupled with each other during preliminary extraction, forming a preliminary feature set containing multiple feature information.
[0042] It is necessary to determine whether the feature dimension of the preliminary feature set is greater than the preset dimension threshold. The preset dimension threshold is a value pre-set according to the requirements of model training and computing resources. When the feature dimension of the preliminary feature set is greater than the threshold, it means that the preliminary feature set contains a large number of features, which may contain a large amount of redundant information. These redundant information not only increases the complexity of the calculation, but also may interfere with the subsequent feature analysis and model training, so the preliminary feature set needs to be reduced in dimension.
[0043] The dimension reduction processing is implemented by using a suitable algorithm, such as principal component analysis (PCA) or linear discriminant analysis (LDA) method. Taking the principal component analysis as an example, the core idea of the method is to map high-dimensional data to a low-dimensional space through linear transformation, while preserving the main information of the original data as much as possible. When performing principal component analysis, first, the covariance matrix of the preliminary feature set is calculated, then the eigenvalues and eigenvectors of the covariance matrix are solved, the number of principal components is determined according to the size of the eigenvalues, the principal components that can preserve sufficient information are selected, the original features are mapped to these principal components, thereby realizing dimension reduction, and obtaining the dimension reduction data. Through the dimension reduction processing, the redundant features in the preliminary feature set are removed, the dimension of the features is reduced, the data is more concise, and the main feature information is preserved.
[0044] After obtaining the dimension reduction data, the training sequences of the dimension reduction data need to be analyzed. The training sequences contain the eigenvalues of the dimension reduction data at different training steps or different samples. Through the analysis of these training sequences, the dynamic characteristics of the correlation between the basic features, the interaction features and the adaptive features can be mined. For example, the change trend of these features in the training process, the correlation degree between them changing over time, etc.
[0045] For these correlation features about the dynamic characteristics of the correlation between the basic features, the interaction features and the adaptive features, enhancement processing is needed. The enhancement processing can be realized by a specific algorithm, such as adjusting the weight of the features, increasing the weight of the features with close correlation, thereby highlighting the correlation between them; or introducing a new feature representation method to enhance the interaction expression ability between the features. For example, when analyzing the features of text data, for those basic features and interaction features that frequently co-occur in context and have close semantic correlation, the enhancement processing can be used to highlight the correlation between them, so that these correlation features can be better utilized in the subsequent model training.
[0046] Through the analysis of the training sequences of the dimension reduction data and the enhancement processing of the correlation features, the interaction features are finally obtained. This interaction feature can more accurately reflect the correlation between the basic features, the interaction features and the adaptive features, and provide more valuable feature information for the subsequent generation of modules with different levels of refinement based on the interaction features and the training of the entire LoRA model.
[0047] Extracting the preliminary feature set is the basis, accurately determining the dimension threshold is the key to deciding whether to perform dimension reduction processing, selecting a suitable dimension reduction algorithm can effectively remove redundant information, and analyzing the training sequences of the dimension reduction data is an important link for mining the dynamic characteristics of feature correlation, while the enhancement processing of the correlation features is a key step for improving the quality of the interaction features.
[0048] Embodiment three When generating modules of different levels of detail based on interaction features, the training area of the LoRA model to be trained is divided into multiple sub-modules. The division of the training area needs to be combined with the structure and functional characteristics of the model, so that each sub-module undertakes a relatively independent training task, and the sub-modules maintain reasonable logical association. Each sub-module after division has a specific input-output interface and processing logic, so that subsequent targeted module generation operations can be performed.
[0049] After completing the division of the training area, a corresponding training queue needs to be constructed for each sub-module. Each training queue is an independent processing unit responsible for processing the training data of the corresponding sub-module and generating modules related operations. The number of training queues is consistent with the number of sub-modules, and each training queue is configured to only process the information of its corresponding sub-module to ensure the specificity and efficiency of processing.
[0050] According to the training data resolution of each sub-module, the module granularity, module number and module density of each sub-module are determined. The training data resolution reflects the level of detail and accuracy requirements of the data processed by the sub-module. For a sub-module with high resolution, it means that more detailed features need to be captured in the data, so a smaller module granularity should be set to enable the module to process the data more meticulously. At the same time, in order to fully express the features of high-resolution data, the number of modules needs to be increased, and the module density needs to be correspondingly improved to enhance the expression ability of the model. For a sub-module with low resolution, the module granularity can be set larger, and the number of modules and the module density are correspondingly reduced to reduce the computational overhead while ensuring a certain processing capacity.
[0051] After determining the module granularity, module number and module density of each sub-module, multiple training queues are controlled to generate modules according to these parameters of each sub-module. First, the training queue generates module surface information according to the module granularity, module number and module density of the corresponding sub-module. Module surface information mainly describes the structural characteristics of the module in a two-dimensional plane, including the shape, boundary and distribution of each part of the module, etc. For example, for a rectangular module surface, the length, width and position distribution of key nodes on the surface need to be determined.
[0052] Based on the generated module surface information, the training queue further generates the three-dimensional module of each sub-module and obtains module body information. Module body information is a complete description of the module in three-dimensional space, including the volume, internal structure and spatial distribution of each part of the module, etc. When generating a three-dimensional module, it needs to be extended in the direction perpendicular to the surface based on the module surface information to form a three-dimensional structure with a certain thickness, and the internal layering and structure distribution are determined.
[0053] After obtaining the module body information, the nodes and body cells of each solid module need to be obtained from the module body information, and the nodes and body cells are numbered to obtain the unique identification of each node and the unique identification of each body cell. The node is the basic point element for constructing the solid module, and the body cell is the three-dimensional space unit surrounded by the node. When numbering the nodes and body cells, a specific coding rule is adopted to ensure that the identification of each node and body cell is unique in the entire model. For example, the node number can adopt the form of "submodule number_node sequence number in submodule", and the body cell number can adopt the form of "submodule number_body cell sequence number in submodule" to ensure the uniqueness and identifiability of the identification.
[0054] Suppose that when generating a solid module of a certain submodule, the node number is N i,j , where i represents the number of the submodule, and j represents the sequence number of the node in the submodule; the body cell number is E i,k , where i is the submodule number, and k is the sequence number of the body cell in the submodule. Such numbering method can clearly identify the submodule to which each node and body cell belongs and the position in the submodule, providing an explicit identification basis for subsequent operations.
[0055] After completing the node and body cell numbering of each solid module, the synchronization communication between multiple training queues needs to be controlled to map the body cells and unique identifications between adjacent submodules, obtaining the mapping information. Synchronization communication is an important link to ensure that adjacent submodules can correctly interact and work cooperatively. In order to realize synchronization communication, a communication buffer is configured for each training queue, which is used to store and temporarily exchange the relevant information of adjacent submodules.
[0056] Through the communication buffer, the training queues corresponding to adjacent submodules exchange the body cell number list and the unique identification set. The body cell number list contains the numbering information of the body cells in each submodule, and the unique identification set contains the unique identification of each node and body cell. When exchanging information, the training queue sends the body cell number list and the unique identification set of its own submodule to the communication buffer, and reads the relevant information of the adjacent submodule from the communication buffer.
[0057] Based on the exchanged number list and identification set, an index mapping relationship is established to obtain the mapping information. The establishment of the index mapping relationship is to associate the body cells and unique identifications between adjacent submodules, so that the body cells of one submodule can correspond to the related body cells and identifications of the adjacent submodule. For example, the body cell E A,k of submodule A is adjacent in space to the body cell E B,m of submodule B. Through the establishment of the index mapping relationship, E A,k and EB,m Correlate them and record their positional relationship and interaction mode.
[0058] After obtaining the mapping information, the stereoscopic modules of each sub-module are optimized according to the mapping information. During the optimization process, the connection and interaction requirements between adjacent sub-modules are considered, and the structure, node position and body cell distribution of the stereoscopic module are adjusted to ensure the compatibility and consistency between adjacent sub-modules. For example, the node position at the boundary of adjacent sub-modules is adjusted to enable accurate docking; the distribution of body cells is optimized to ensure smooth transmission and processing of data between adjacent sub-modules.
[0059] After optimization, the target module of each sub-module is obtained. The target module is the final module formed after a series of processes described above, has a fine degree that meets the resolution requirements of the training data, and can meet the needs of model training. Finally, based on the interaction features and the target modules of each sub-module, the interaction features and the features of each target module are fused and integrated through specific processing methods and algorithms, thereby obtaining a multi-granularity feature distribution. The multi-granularity feature distribution contains feature information of different levels of detail, which can describe the features of the data from multiple levels and angles, providing richer and more comprehensive feature support for subsequent model training.
[0060] The reasonable division of the training area is the foundation, the correct construction of the training queue is the guarantee, the accurate determination of the parameter is the key, the generation of the module surface information and the body information is the core, the numbering of the node and the body cell is the identification basis, the synchronous communication between the training queues and the establishment of the mapping information are important links to ensure the cooperation between the modules, the optimization of the module is a necessary step to ensure the quality, and the finally obtained multi-granularity feature distribution lays a solid feature foundation for subsequent model training.
[0061] Embodiment Four During the process of generating the target module of each sub-module, controlling the synchronous communication between multiple training queues is an important link to ensure the cooperative work of adjacent sub-modules. Taking the text classification task in the natural language processing field as an example, assume that the training area of the LoRA model to be trained is divided into three sub-modules: word embedding sub-module, semantic encoding sub-module and classifier sub-module, each sub-module corresponds to a training queue, which is queue A, queue B and queue C.
[0062] Configure a communication buffer for each training queue. The communication buffer can be a specific area in memory, used to temporarily store and exchange information between adjacent sub-modules. Taking queue A and queue B as an example, queue A is responsible for the training of the word embedding sub-module, and queue B is responsible for the training of the semantic encoding sub-module. These two sub-modules are adjacent in the model structure and need to interact, so their respective communication buffers need to be able to store and process the relevant data of the other party.
[0063] The list of body cell numbers and the set of unique identifiers of the adjacent sub-modules are exchanged through the communication buffer. In the word embedding sub-module, the body cell can be a three-dimensional structural unit composed of different word vectors, each body cell has a unique number and identifier; in the semantic encoding sub-module, the body cell can be a three-dimensional structural unit composed of different semantic features, also with a unique number and identifier. The queue A sends the list of body cell numbers and the set of unique identifiers of the word embedding sub-module to the communication buffer, and the queue B reads these information from the communication buffer; at the same time, the queue B sends the list of body cell numbers and the set of unique identifiers of the semantic encoding sub-module to the communication buffer, and the queue A reads these information from the communication buffer.
[0064] For example, a certain body cell of the word embedding sub-module is numbered E1, and its unique identifier contains the coordinates of the body cell in the word embedding space, the corresponding word, and other information; a certain body cell of the semantic encoding sub-module is numbered E2, and its unique identifier contains the encoding of the body cell in the semantic space, the corresponding semantic feature, and other information. Through the exchange of the communication buffer, the queue A and the queue B both obtain the list of body cell numbers and the set of unique identifiers of the opposite sub-module.
[0065] Based on the exchanged list of numbers and the set of identifiers, an index mapping relationship is established to obtain mapping information. The establishment of the index mapping relationship needs to determine the correspondence between the body cells and the unique identifiers of the adjacent sub-modules. In the above example, the word corresponding to the body cell E1 of the word embedding sub-module is "artificial intelligence", and its word vector coordinates are (x1, y1, z1); there is a body cell E2 in the semantic encoding sub-module, and its semantic feature is related to "artificial intelligence", and the semantic encoding coordinates are (a1, b1, c1). By analyzing the identification information of the two, it is found that they have strong semantic association, so the index mapping relationship is established, E1 and E2 are associated, and the mapping rule between them is recorded, such as the conversion relationship between the word vector coordinates and the semantic encoding coordinates.
[0066] The process of establishing the index mapping relationship needs to consider various factors, including the function of the body cell, the similarity of the features, the correspondence of the spatial position, etc. For different sub-modules, different mapping strategies may be needed. For example, in image processing tasks, the body cells of adjacent sub-modules may need to be mapped according to the pixel position; while in speech processing tasks, it may need to be mapped according to the time sequence.
[0067] After obtaining the mapping information, the stereoscopic modules of each sub-module are optimized according to the mapping information. The purpose of optimization is to ensure the compatibility and consistency between adjacent sub-modules, so that data can be smoothly transmitted and processed between sub-modules. Continuing to take the text classification task as an example, after establishing the mapping information between the word embedding sub-module and the semantic encoding sub-module, the stereoscopic modules of these two sub-modules need to be optimized.
[0068] Optimization may include adjusting the structure and parameters of the body unit. For example, the word vector dimension of body unit E1 in the word embedding sub-module may not match the input dimension of body unit E2 in the semantic encoding sub-module. Through the mapping information, it can be determined that the word vector of E1 needs to be converted in dimension so that it can match the input dimension of E2. Specifically, a conversion layer can be added at the output end of E1 to convert the word vector from (x1, y1, z1) to (a1, b1, c1, d1) to adapt to the input requirements of E2.
[0069] Optimization may also include adjusting the position and connection mode of the nodes. In the stereoscopic module, nodes are the basic elements that constitute the module, and the connection relationship between nodes determines the data flow path. Through the mapping information, the correspondence between the nodes of adjacent sub-modules can be determined, and the connection mode of the nodes can be adjusted so that data can be smoothly transmitted from the nodes of one sub-module to the corresponding nodes of the adjacent sub-module. For example, node N1 in the word embedding sub-module corresponds to node N2 in the semantic encoding sub-module in function. By optimizing the connection mode, the output of N1 is directly used as the input of N2, reducing the intermediate links of data transmission and improving the processing efficiency of the model.
[0070] In addition, optimization may also involve adjusting the overall structure of the module. For example, in order to better adapt to the mapping information, a transition layer may be added between adjacent sub-modules, or the hierarchical structure within the sub-module may be adjusted. In the text classification task, a transition layer may be added between the word embedding sub-module and the semantic encoding sub-module. Based on the mapping information, the word embedding features are converted and integrated so that they can be better processed by the semantic encoding sub-module.
[0071] After the above optimization processing, the target module of each sub-module is obtained. The target module can seamlessly interface with adjacent sub-modules in structure and function, realizing smooth data transmission and effective feature interaction. In the text classification task, the optimized word embedding sub-module, semantic encoding sub-module and classifier sub-module can work cooperatively. The word embedding sub-module converts words into vector representation, which is transmitted to the semantic encoding sub-module through the optimized interface. The semantic encoding sub-module encodes the vector, and then transmits it to the classifier sub-module for classification and prediction. The whole process is smooth and efficient.
[0072] Based on the interaction features and the target modules of each sub-module, a multi-granularity feature distribution is obtained. Interaction features in the text classification task may include semantic associations between words, sentence grammatical structures, and other features. The target modules of each sub-module process data from different granularities. The word embedding sub-module processes data from the word granularity, the semantic encoding sub-module processes data from the sentence granularity, and the classifier sub-module processes data from the text category granularity. The interaction features and the features of each target module are fused to obtain a multi-granularity feature distribution containing word granularity, sentence granularity, and category granularity. These features can describe the features of the text from multiple levels and provide more comprehensive feature support for the text classification task.
[0073] Embodiment five When calculating the gradient distribution based on the training load spectrum, a base model for the LoRA model to be trained needs to be constructed. The base model includes the core architecture of the model. For example, in the natural language processing scenario, the base model may be composed of multiple layers of Transformer structure, which has the basic ability to process sequence data. The parameter initialization of each layer follows a pre-set rule to ensure that the model has an initial processing function.
[0074] An adaptation model for each adaptation layer is constructed respectively. The adaptation layer is used to adapt the model to different task requirements. For example, in the text classification task, the adaptation layer may be a fully connected layer, and its structure and parameters are designed according to the number of categories and feature requirements of the classification task. In the sentiment analysis task, the adaptation layer may include an attention mechanism to focus on the sentiment keywords in the text. The construction of each adaptation model is based on the characteristics of the specific task to ensure that it can effectively extract task-related features.
[0075] All adaptation models are embedded into the base model to obtain a target model. During embedding, the position and connection method of the adaptation model in the base model need to be determined. For example, the adaptation layer may be embedded in the last few layers of the base model to convert and map the features extracted by the base model according to the task. During embedding, the flow of data between the base model and the adaptation model should be smooth, and the input and output dimensions of each layer should be matched. By adjusting parameters such as connection weights and biases, the target model can integrate the general feature extraction capability of the base model and the task-specific processing capability of the adaptation model.
[0076] A training task is constructed based on the training load spectrum. The training load spectrum describes the distribution and variation of data during training, including the feature distribution of input data, the weight of samples, and other information. According to the training load spectrum, the specific goal of the training task is determined, such as minimizing the classification loss function in the classification task or minimizing the mean square error in the regression task. At the same time, parameters such as the batch size and the number of iterations are determined to make the training task reflect the actual distribution of the training data and the training needs of the model.
[0077] According to the target model and the training task, gradient propagation analysis is performed in combination with preset constraints. The preset constraints can include regularization constraints on parameters, limitations on model complexity, etc., to prevent overfitting of the model. Gradient propagation analysis employs a backpropagation algorithm to calculate the gradient of the loss function with respect to the parameters of each separate module of the target model, starting from the loss function of the training task. For example, for each separate module in the target model, the gradient value of its parameters is calculated, which represents the degree of influence of parameter changes on the loss function, and the direction of the gradient determines the direction of parameter updates.
[0078] After obtaining the gradient distribution of each separate module, the time variation trend and the spatial variation trend of the gradient of each separate module need to be analyzed. The time variation trend refers to the change of the gradient with the number of iterations during the training process, for example, whether the gradient gradually decreases and tends to be stable, or whether there is a shock phenomenon. By plotting the curve of the gradient change with time, the convergence of the model can be observed. The spatial variation trend refers to the distribution of the gradient in each separate module of the model, for example, the gradient of some modules is larger, indicating that these modules have a greater impact on the loss function and require more parameter updates; while the gradient of some modules is smaller, which may require adjustment of the training strategy.
[0079] Based on the time variation trend and the spatial variation trend of the gradient of each separate module, a dynamic gradient distribution map of the LoRA model to be trained is obtained. The dynamic gradient distribution map visually displays the change and distribution of the gradient of the model during the training process, for example, different colors are used to represent the gradient size of different modules, and curves are used to represent the change of the gradient with time. Through the dynamic gradient distribution map, the training state of the model can be intuitively understood, and possible problems such as gradient vanishing or gradient explosion can be found.
[0080] According to the dynamic gradient distribution map, gradient state data is obtained. The gradient state data contains detailed information of the gradient of each separate module, such as the gradient value of each module at different training time points, the average value of the gradient, and the variance and other statistical quantities. These data provide a basis for subsequent parameter updates, for example, the amplitude and direction of parameter updates can be determined according to the size and direction of the gradient to optimize the performance of the model.
[0081] Taking the image classification task as an example, suppose the base model of the LoRA model to be trained is a ResNet structure, containing multiple convolutional blocks as separate modules, and the adaptation layer is a fully connected layer embedded after the last convolutional block, used to map the convolutional features to specific categories. The training load spectrum is constructed according to the category distribution and sample difficulty of the image dataset, and the training task is to minimize the cross-entropy loss function. In gradient propagation analysis, the gradient of the loss function with respect to each convolutional block and fully connected layer parameter is calculated to obtain the gradient distribution of each separate module. Analysis shows that the gradients of the first few convolutional blocks are small, while the gradients of the last few convolutional blocks and the fully connected layer are large, indicating that the high-level modules of the model have a greater impact on the classification results. As training progresses, the gradient gradually decreases and stabilizes, indicating that the model is gradually converging. According to these gradient trends, a dynamic gradient distribution graph is generated, from which gradient state data is extracted to guide subsequent parameter updates, such as increasing the learning rate for modules with large gradients to speed up convergence, and adjusting the regularization parameters for modules with small gradients to avoid overfitting.
[0082] Throughout the process of calculating the gradient distribution based on the training load spectrum, the construction of the base model and the adaptation model is a prerequisite, the construction of the training task is a goal, the gradient propagation analysis is the core, the analysis of the gradient change trend is the key, and the dynamic gradient distribution graph and the gradient state data are the results.
[0083] It should be noted that, in this article, relational terms such as first and second are used only to distinguish one entity or action from another, and do not necessarily require or imply that there is any such actual relationship or order between these entities or actions. Moreover, the terms "include", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or device.
[0084] Although embodiments of the present application have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and alterations can be made without departing from the principles and spirit of the present application, and the scope of the present application is defined by the appended claims and their equivalents.
Claims
1. The separated architecture LoRA model training method is characterized by: include: Acquire an initial training data set of a LoRA model to be trained in real time, and extract an initial feature sequence from the training data set; wherein the LoRA model to be trained includes multiple separate modules; Extracting interactive features from the initial feature sequence; based on the interactive features, generating modules with different degrees of refinement according to the training data resolution of different modules of the LoRA model to be trained, and obtaining a multi-granularity feature distribution based on the module generation results; wherein the module with relatively high resolution corresponds to a higher degree of refinement than the module with relatively low resolution; Analyzing the training sequence of the multi-granularity feature distribution to obtain a training load spectrum; Based on the training load spectrum, gradient propagation analysis is used to calculate the gradient distribution of the multiple separable modules to obtain the gradient state data of the LoRA model to be trained; According to the gradient state data, the number of parameter updates of the separate module is identified; and combined with the preset model update rules, the remaining update amount of the separate module is obtained, and then based on each of the remaining update amounts, the final training parameters of the LoRA model to be trained are obtained.
2. The split-architecture LoRA model training method according to claim 1, wherein: The degree of refinement is set according to the module granularity, the number of modules and the module density; Based on the interaction features, modules with different degrees of refinement are generated according to the training data resolution of different modules of the LoRA model to be trained, and multi-granularity feature distribution is obtained according to the module generation results, including: Divide the training area of the LoRA model to be trained into multiple submodules; Build multiple training queues, each corresponding to a submodule; Determining the module granularity, module quantity, and module density of each submodule according to the training data resolution of each submodule; Controlling the plurality of training queues to generate target modules for the submodules according to the module granularity, module quantity and module density of the submodules; The multi-granularity feature distribution is obtained based on the interaction features and the target modules of each submodule.
3. The split-architecture LoRA model training method according to claim 2, wherein: The controlling the plurality of training queues to generate target modules for the submodules according to the module granularity, module quantity, and module density of the submodules respectively includes: Controlling the plurality of training queues to respectively preliminarily generate module surface information according to the module granularity, module quantity and module density of each of the submodules; Controlling the plurality of training queues to generate a three-dimensional module of each submodule based on the module surface information and obtain module body information; Obtaining nodes and body units of each stereo module according to the module body information; and numbering the nodes and body units of each stereo module to obtain a unique identifier of each node and a unique identifier of each body unit; Controlling synchronous communication between the plurality of training queues so that the body units and unique identifiers between adjacent submodules are mapped to each other to obtain mapping information; The stereo modules of each submodule are optimized according to the mapping information to obtain the target modules of each submodule.
4. The split-architecture LoRA model training method according to claim 1, wherein: The step of extracting an initial feature sequence from a training data set includes: performing standardization processing on the initial training data set to obtain standardized data; A preset feature extraction network is used to extract basic features, interactive features and adaptive features from the standardized data to obtain the initial feature sequence.
5. The split-architecture LoRA model training method according to claim 1, wherein: The step of extracting interactive features from the initial feature sequence includes: Extracting a preliminary feature set of basic features, interactive features and adaptive features coupled from the initial feature sequence; When the feature dimension of the preliminary feature set is greater than a preset dimension threshold, performing dimensionality reduction processing on the preliminary feature set to obtain dimensionality-reduced data; The training sequence of the dimension reduction data is analyzed, and the associated features of the dynamic characteristics of the association between the basic features, the interactive features and the adaptation features are enhanced to obtain the interactive features.
6. The split-architecture LoRA model training method according to claim 1, wherein: The LoRA model to be trained is connected to at least one adaptation layer; the gradient distribution of the multiple separate modules is calculated based on the training load spectrum using gradient propagation analysis to obtain gradient state data of the LoRA model to be trained, including: Constructing a base model of the LoRA model to be trained; constructing adaptation models of each adaptation layer respectively, embedding all adaptation models into the base model, and obtaining a target model; Constructing a training task based on the training load spectrum; performing a gradient propagation analysis based on the target model and the training task in combination with preset constraints to obtain a gradient distribution of each separable module; Analyze the temporal and spatial variation trends of the gradients of each separable module based on the gradient distribution of each separable module; Based on the temporal variation trend and spatial variation trend of the gradient of each of the separable modules, a dynamic gradient distribution map of the LoRA model to be trained is obtained, and the gradient state data is obtained according to the dynamic gradient distribution map.
7. The split-architecture LoRA model training method according to claim 1, wherein: The split architecture LoRA model training method further includes: Responding to an analysis instruction of a target module, wherein the analysis instruction includes a calculation accuracy requirement; extracting a data sequence corresponding to a position of the target module from the gradient state data according to the analysis instruction; And according to the calculation accuracy requirement, the gradient analysis result of the target module is obtained based on the data sequence analysis.
8. The split-architecture LoRA model training method according to claim 4, wherein: The step of normalizing the initial training data set to obtain normalized data includes: Dividing the initial training data set into structured data and unstructured data; Missing value filling processing is performed on the structured data, and word segmentation and denoising processing is performed on the unstructured data to obtain the standardized data.
9. The split-architecture LoRA model training method according to claim 8, wherein: The method of extracting basic features, interactive features, and adaptive features from the standardized data using a preset feature extraction network includes: receiving the normalized data through an input layer of the feature extraction network; Extracting statistical features of structured data through the first hidden layer of the feature extraction network to obtain the basic features; Extracting semantic association features of unstructured data through the second hidden layer of the feature extraction network to obtain the interaction features; The statistical features and semantic association features are fused through the output layer of the feature extraction network to obtain the adaptation features.
10. The split architecture LoRA model training method according to claim 3, wherein: The controlling the synchronous communication between the plurality of training queues so as to map the body units and unique identifiers between adjacent submodules to each other to obtain mapping information includes: Configure a communication buffer for each training queue; exchanging body unit number lists and unique identification sets of adjacent submodules through the communication buffer; An index mapping relationship is established based on the number list and the identifier set to obtain the mapping information.