Model update method for database and electronic device

By evaluating changes in multiple dimensions and handling them differently, the system addresses the issue of targeted incremental fine-tuning of large language models in databases, achieving efficient and secure model updates and version management, and adapting to training differences in different data.

CN123138271APending Publication Date: 2026-11-20SPRING RESEARCH INSTITUTE (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611390249.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-08
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

When incrementally fine-tuning large language models in database scenarios, existing technologies lack awareness of data business attributes and quality, and cannot reflect the training differences of different data, resulting in a lack of targeted model updates.

Method used

By generating multiple change events and evaluating information based on multiple dimensions such as business importance, semantic diversity, and differences in existing training sets, the change events are divided into different batches, and differentiated iteration counts, rank values, and learning rates are set. Gradient updates are performed using the main channel and auxiliary channel adapters, and the parameters of conflicting change events are replaced. Combined with activation distribution statistics and version management, the differential adaptive incremental fine-tuning of the model is achieved.

Benefits of technology

It improves the targeting and security of model updates, reduces computing resource consumption, supports precise rollback and version management, and improves the incremental update effect of models in database scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123138271A_ABST
    Figure CN123138271A_ABST
Patent Text Reader

Abstract

The application discloses a model updating method for a database and an electronic device in the field of computer technology. The application obtains comprehensive evaluation information of each change event through multi-dimensional utility evaluation, and divides the change events into different batches according to the comprehensive evaluation information, so that different batches correspond to different iteration numbers, rank values and learning rates, thereby differentiating the processing of different change events when updating the target model, instead of updating the model in a unified configuration. In the updating process, the main updating channel and the auxiliary updating channel are used to calculate respectively and then perform parameter fusion. The scheme enables the model updating process to distinguish the utility difference of different change events, improves the pertinence of model incremental updating in the database scenario, and realizes adaptive incremental fine-tuning of a large language model in the database based on sample difference.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a model update method and electronic device for databases. Background Technology

[0002] In incremental fine-tuning of large language models in database scenarios, a uniform low-rank adaptation rank value is typically applied to all selected samples to ensure that the model is updated equivalently across various samples. While some dynamic rank allocation schemes can adjust rank values ​​based on gradient norms or parameter statistical characteristics, they lack awareness of data business attributes and quality, and cannot reflect the training differences between different data.

[0003] Therefore, how to incrementally fine-tune large language models in a database based on sample differences is a problem that needs to be solved by those skilled in the art. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a model update method and electronic device for databases, so as to incrementally fine-tune a large language model in the database based on sample difference adaptability.

[0005] Firstly, this application provides a method for updating a database model, comprising: For table structure change operations, field change operations, and / or data record change operations in the database, generate multiple corresponding change events; The utility of each change event to model updates is evaluated according to multiple preset dimensions to obtain comprehensive evaluation information of each change event in multiple dimensions; the multiple dimensions include at least two of the following: business importance, semantic diversity, and difference from the existing training set; Based on comprehensive evaluation information, multiple change events are divided into multiple batches, and the configuration information corresponding to different batches is determined. The configuration information includes: number of iterations, rank value, and learning rate, with different configuration information corresponding to different batches. The process of updating the target model in the database using each batch includes: The adjustment factor for the current batch is determined based on the comprehensive evaluation information of each change event in the current batch. The initial principal gradient is obtained by training the current batch with the configuration information corresponding to the current batch. The final principal gradient is obtained by constraining the initial principal gradient with the adjustment factor. The principal update parameters are obtained by updating based on the final principal gradient. Based on the final primary gradient and the historical gradient trend of the target model, conflict change events are identified in the current batch, and auxiliary update parameters are determined using the fixed configuration information corresponding to the conflict change events. The parameters whose absolute values ​​are greater than a preset threshold in the auxiliary update parameters are used to replace the corresponding values ​​in the main update parameters to obtain the final update parameters; the target model is then updated based on the final update parameters to obtain the updated target model.

[0006] Optionally, before evaluating the utility of each change event for the model update operation according to multiple preset dimensions, the method further includes: Based on the table structure type, the amount of data changed, and / or the type of field changed involved in the change event, multiple change events are divided into multiple priorities; After the division, if the preset triggering conditions corresponding to any priority are met, the steps of evaluating the effectiveness of each change event on the model update according to multiple preset dimensions and other subsequent steps are executed.

[0007] Optionally, multiple change events can be divided into multiple batches based on comprehensive evaluation information, and the configuration information corresponding to different batches can be determined, including: Multiple change events are sorted according to comprehensive evaluation information to obtain an event sequence; The event sequence is divided into multiple sequence segments, and each sequence segment is treated as a batch. The number of iterations, rank, and learning rate are set for different batches to obtain the configuration information for different batches; among them, the number of iterations, rank, and learning rate are positively correlated with the comprehensive evaluation information.

[0008] Optionally, the adjustment factor for the current batch is determined based on the comprehensive evaluation information of each change event in the current batch, including: Calculate the average value of the comprehensive assessment information for each change event in the current batch; The adjustment factor is determined based on the ratio of the average value to the preset reference threshold; wherein the average value and the adjustment factor are positively correlated.

[0009] Optionally, the initial principal gradient is obtained by training the current batch with the configuration information corresponding to the current batch, the final principal gradient is obtained by constraining the initial principal gradient with an adjustment factor, and the principal update parameters are obtained based on the final principal gradient, including: Construct a master channel adapter using the rank value in the configuration information corresponding to the current batch, and perform forward and backward propagation on the current batch based on the master channel adapter to obtain the initial master gradient; The initial principal gradient is projected onto the orthogonal complement space of the historical task subspace constructed based on the historical gradient trend to obtain the safety gradient; The safety gradient and the initial principal gradient are weighted according to the adjustment factor to constrain the initial principal gradient and obtain the final principal gradient; Gradient descent is used to update the matrix in the main channel adapter with the final principal gradient and the learning rate in the configuration information corresponding to the current batch. After reaching the number of iterations corresponding to the current batch, the main update parameters are obtained based on the current matrix in the main channel adapter.

[0010] Optionally, based on the final primary gradient and the historical gradient trend of the target model, conflicting change events are identified in the current batch, and auxiliary update parameters are determined using the fixed configuration information corresponding to the conflicting change events, including: Calculate the angle between the final principal gradient and the historical task subspace constructed based on historical gradient trends, and identify change events where the angle is less than a preset angle threshold as conflict change events; or, identify change events where the main channel loss increases beyond a preset loss threshold as conflict change events. A secondary channel adapter is constructed using the rank value in the fixed configuration information. The secondary channel adapter and the preset secondary channel loss function are used to train on conflict change events to obtain secondary update parameters.

[0011] Optionally, the values ​​at corresponding positions in the main update parameters are replaced with parameters in the secondary update parameters whose absolute values ​​are greater than a preset threshold to obtain the final update parameters, including: The absolute value of each element in the secondary update parameter is compared with a preset threshold to generate a conflict mask with the same shape as the primary update parameter. Among them, the elements in the secondary update parameter whose absolute value is greater than the preset threshold are assigned the first value at the corresponding position in the conflict mask, and the remaining elements are assigned the second value at the corresponding position in the conflict mask. The first intermediate parameter is obtained by multiplying the main update parameter by the inverted result of the conflict mask element by element. The auxiliary update parameter is multiplied element by element with the collision mask to obtain the second intermediate parameter; The first intermediate parameter and the second intermediate parameter are added element by element to obtain the final update parameter.

[0012] Optionally, it also includes: During each batch update of the target model, the activation distribution statistics generated by the training samples through the intermediate layers of the model are stored, including the mean and variance, but the original samples are not stored. Accordingly, during the training of the current batch, the activation distribution statistics of the current sample in the same intermediate layer are calculated; the divergence between the current activation distribution statistics and the historical activation distribution statistics is used as the regularization term of the replay loss and added to the total loss function.

[0013] Optionally, after obtaining the updated target model, the following steps are also included: Get the log sequence number range corresponding to the current batch; Establish and store the mapping relationship between the current model version and the log sequence number range; When a rollback is required, the corresponding model version is found and deployed in the mapping relationship based on the set time point or log sequence number.

[0014] Secondly, this application provides a model updating apparatus for a database, comprising: The generation module is used to generate multiple corresponding change events for table structure change operations, field change operations, and / or data record change operations in the database; The evaluation module is used to evaluate the utility of each change event for model updates according to multiple preset dimensions, and obtain comprehensive evaluation information of each change event in multiple dimensions; the multiple dimensions include at least two of the following: business importance, semantic diversity, and difference from the existing training set; The segmentation module is used to divide multiple change events into multiple batches based on comprehensive evaluation information and determine the configuration information corresponding to different batches. The configuration information includes: number of iterations, rank value, and learning rate, with different configuration information corresponding to different batches. The update module is used to update the target model in the database for each batch. The process includes: determining the adjustment factor for the current batch based on the comprehensive evaluation information of each change event in the current batch; training the current batch with the configuration information corresponding to the current batch to obtain the initial principal gradient; constraining the initial principal gradient with the adjustment factor to obtain the final principal gradient; updating the main update parameters based on the final principal gradient; identifying conflicting change events in the current batch based on the final principal gradient and the historical gradient trend of the target model; determining the auxiliary update parameters with the fixed configuration information corresponding to the conflicting change events; replacing the values ​​at the corresponding positions in the main update parameters with the parameters in the auxiliary update parameters whose absolute values ​​are greater than a preset threshold to obtain the final update parameters; and updating the target model based on the final update parameters to obtain the updated target model.

[0015] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor is configured to execute the computer program to implement the aforementioned disclosed method for updating a database model.

[0016] Fourthly, this application provides a non-volatile storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned disclosed model update method for a database.

[0017] Fifthly, this application provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the aforementioned disclosed model update method for a database.

[0018] As can be seen, this application obtains comprehensive evaluation information for each change event through multi-dimensional utility evaluation, and divides the change events into different batches accordingly. Different batches correspond to different iteration numbers, rank values, and learning rates, thus allowing for differentiated handling of different change events when updating the target model, rather than updating the model with a uniform configuration. During the update process, in the main update channel, the adjustment factor is determined based on the comprehensive evaluation information of the current batch and is used to constrain the initial principal gradient, ensuring that the gradient updates of different batches are constrained to varying degrees, thereby adapting to the learning needs of different batches. In the secondary update channel, for conflicting change events, secondary update parameters are determined using fixed configuration information, and parameters with absolute values ​​greater than a preset threshold are used to replace the corresponding values ​​in the main update parameters. This ensures that the update corresponding to the conflicting event only affects the local position, while the main update parameters are retained in other positions. This scheme enables the model update process to distinguish the utility differences of different change events, improves the targeting of incremental model updates in database scenarios, and realizes incremental fine-tuning of large language models in the database based on sample difference adaptability.

[0019] Accordingly, the model update device, electronic device, non-volatile storage medium and computer program product for database provided in this application also have the above-mentioned technical effects. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in the embodiments or conventional technologies of this application, the accompanying drawings used in the description of the embodiments or conventional technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0021] Figure 1 This is a flowchart of a database model update method disclosed in this application; Figure 2 This is a schematic diagram of a database model update system disclosed in this application; Figure 3 for Figure 2 A schematic diagram illustrating the interaction process between modules in the system shown. Figure 4 This is a schematic diagram of an electronic device disclosed in this application; Figure 5 A server architecture diagram provided for this application; Figure 6 A terminal structure diagram provided for this application. Detailed Implementation

[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0023] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0024] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0025] Currently, when incrementally fine-tuning large language models in database scenarios, a uniform low-rank adaptation rank value is typically applied to all selected samples, ensuring that various samples update the model equivalently. While some dynamic rank allocation schemes can adjust rank values ​​based on gradient norms or parameter statistical characteristics, they lack awareness of data business attributes and quality, failing to reflect training differences among different data. Therefore, this application provides a model update scheme for databases that can distinguish the utility differences of different change events, improve the targeting of incremental model updates in database scenarios, and achieve incremental fine-tuning of large language models in databases based on sample difference adaptability.

[0026] See Figure 1 As shown in the figure, this application discloses a model update method for a database, including: S101. Generate multiple corresponding change events for table structure change operations, field change operations, and / or data record change operations in the database.

[0027] Table structure change operations include, for example, adding or deleting table fields using Data Definition Language (DDL); field change operations include, for example, modifying the data type or constraints of a field; and data record change operations include, for example, inserting, updating, or deleting records in a business table using Data Manipulation Language (DML). By parsing these change operations, corresponding change events can be obtained. Each change event can carry information such as change type, changed table name, changed field name, previous value, new value, change timestamp, transaction identifier, and log sequence number (LSN). The log sequence number is a number in the database log used to identify the order of change operations.

[0028] S102. Evaluate the utility of each change event for model updates according to multiple preset dimensions to obtain comprehensive evaluation information of each change event in multiple dimensions; the multiple dimensions include at least two of the following: business importance, semantic diversity, and difference from the existing training set.

[0029] Business importance can be determined based on the business weight of the table to which the change event belongs, the criticality of the changed fields, and the historical access frequency of the table or record. For example, the business weight of the core transaction table is higher than that of the log table, and the criticality of primary key field changes is higher than that of ordinary fields. Semantic diversity can be measured by vectorizing the data corresponding to the change event and calculating the distance and local density of the vector to its nearest neighbors in the existing training data vector set. The sparser the distribution of change events in the semantic space and the farther apart they are, the higher their semantic diversity score. The difference from the existing training set can be obtained by calculating the cosine similarity between the vector corresponding to the change event and the most similar sample in the historical training data, and then subtracting the similarity from one. The greater the difference, the more new knowledge the change event brings to the model. By evaluating change events from multiple dimensions, the utility difference of each change event for model updates can be quantified, ensuring that subsequent training resource allocation matches the value of the data itself and avoiding the indiscriminate use of all changed data for training.

[0030] In one example, business importance is assessed as follows: a weighted sum is obtained based on the preset business weight of the table to which the change event belongs, the criticality of the changed field, and the historical access frequency of the table or record. The criticality of the changed field is identified by parsing the data dictionary; if the changed field is a primary key, 0.3 points are added; if the changed field is a foreign key, 0.2 points are added; if the changed field is an index field or partition key, 0.15 points are added; the accumulated scores are then normalized to the [0,1] interval.

[0031] In one example, semantic diversity is evaluated by vectorizing the data corresponding to the change event to obtain the change vector; calculating the weighted average distance from the change vector to the k nearest neighbor vectors in the existing training data vector set; calculating the local sample density within a preset radius centered on the change vector; the semantic diversity score is proportional to the weighted average distance and inversely proportional to the local sample density.

[0032] In one example, the dissimilarity to the existing training set is evaluated by calculating the cosine similarity between the data vector corresponding to the change event and the most similar sample in the historical training dataset; subtracting the cosine similarity from one yields the dissimilarity score.

[0033] In one example, the comprehensive evaluation information is a weighted sum of business importance, semantic diversity, and heterogeneity; the weight coefficients of each dimension are dynamically adjusted according to the objectives of the current model update task.

[0034] In one implementation, before evaluating the utility of each change event on the model update operation according to preset multiple dimensions, the method further includes: classifying multiple change events into multiple priorities based on the table structure type, the amount of changed data, and / or the type of changed fields involved in the change event; after classification, if the preset triggering conditions corresponding to any priority are met, the step of evaluating the utility of each change event on the model update according to preset multiple dimensions and other subsequent steps are executed. For example, insert, update, or delete operations involving core business tables with a business weight of not less than 0.7 and table structure changes can be classified as high priority; batch data changes involving ordinary business tables with a business weight between 0.3 and 0.7 can be classified as medium priority; and data changes involving log tables or temporary tables with a business weight less than 0.3 can be classified as low priority. High priority events can be evaluated immediately, medium priority events can be evaluated when the cumulative change volume exceeds 1000 records or the cumulative time exceeds 5 minutes, and low priority events are not triggered by default, and are only included in the evaluation as additional data when associated with high priority or medium priority events. By pre-prioritizing and setting corresponding trigger conditions, computing resources can be concentrated on change events that have a real impact on the business, reducing ineffective responses to low-value changes, thereby ensuring that the model can detect important changes in a timely manner while avoiding unnecessary computing overhead.

[0035] S103. Based on the comprehensive evaluation information, divide the multiple change events into multiple batches and determine the configuration information corresponding to different batches; the configuration information includes: iteration number, rank value and learning rate, and different batches correspond to different configuration information.

[0036] In one implementation, multiple change events are divided into multiple batches based on comprehensive evaluation information, and configuration information corresponding to different batches is determined. This includes: sorting the multiple change events according to comprehensive evaluation information to obtain an event sequence; dividing the event sequence into multiple sequence segments, and treating each sequence segment as a batch; setting corresponding iteration counts, rank values, and learning rates for different batches to obtain configuration information corresponding to different batches; wherein the iteration counts, rank values, and learning rates are positively correlated with the comprehensive evaluation information. For example, batches with higher comprehensive evaluation rankings can be set with higher rank values, larger learning rates, and more iteration counts, while batches with lower comprehensive evaluation rankings can be set with lower rank values, smaller learning rates, and fewer iteration counts, thereby achieving differentiated updates. The rank value can be understood as the matrix width used to control the parameter update capacity in a low-rank adapter, the learning rate is used to control the step size of each parameter update, and the number of iterations is used to control the number of rounds in which data within a batch is repeatedly learned. By dividing the batches according to comprehensive evaluation information and setting differentiated configuration information, the high-efficiency use of change events can obtain a larger parameter update capacity and more sufficient learning opportunities, while the low-efficiency use of change events consumes only less computing resources, thereby improving the overall utilization efficiency of computing resources during the model update process.

[0037] In one example, the event sequence is sorted in descending order based on comprehensive evaluation information. The first 20% of change events are assigned to the first event group, the middle 60% to the second event group, and the last 20% to the third event group. The rank of the first event group is 32, and the learning rate is 5 × 10⁻⁶. -4 The full number of iterations was used; the rank of the second event group was 16, and the learning rate was 3×10. -4 The standard number of iterations is used; the rank of the third event group is 2, and the learning rate is 1×10. -4 The number of iterations is halved.

[0038] S104. Update the target model in the database using each batch.

[0039] The specific process of updating the target model in the database using each batch includes: S1041. Determine the adjustment factor for the current batch based on the comprehensive evaluation information of each change event in the current batch, train the current batch with the configuration information corresponding to the current batch to obtain the initial principal gradient, constrain the initial principal gradient with the adjustment factor to obtain the final principal gradient, and update the principal update parameters based on the final principal gradient.

[0040] In one implementation, determining the adjustment factor for the current batch based on the comprehensive evaluation information of each change event in the current batch includes: calculating the average value of the comprehensive evaluation information of each change event in the current batch; determining the adjustment factor based on the ratio of the average value to a preset reference threshold; wherein the average value and the adjustment factor are positively correlated. For example, the adjustment factor can be equal to the smaller value of the average value divided by the preset reference threshold and one, thereby limiting the adjustment factor to between zero and one; the higher the average value, the larger the adjustment factor. By determining the adjustment factor based on the comprehensive evaluation information of the current batch, the adjustment factor can reflect the overall importance of the data in the current batch in the training context, providing a quantitative basis for the differentiated adjustment of the gradient constraint strength in the future.

[0041] In one implementation, the initial principal gradient is obtained by training the current batch using the configuration information corresponding to the current batch. The final principal gradient is obtained by constraining the initial principal gradient with an adjustment factor. The principal update parameters are then updated based on the final principal gradient. This includes: constructing a main channel adapter using the rank value in the configuration information corresponding to the current batch; performing forward and backward propagation on the current batch based on the main channel adapter to obtain the initial principal gradient. The main channel adapter can be a low-rank adapter (LoRA), which includes a first matrix and a second matrix. The first matrix has a dimension of r×d, and the second matrix has a dimension of d×r, where r is the rank value and d is the dimension of the corresponding layer of the target model. At the start of training, the first and second matrices are initialized to values ​​close to zero, thus making the initial update amount of the main channel adapter close to zero. The initial principal gradient is obtained by performing forward and backward propagation on the current batch based on the main channel adapter.

[0042] Furthermore, the initial principal gradient is projected onto the orthogonal complement space of the historical task subspace constructed based on historical gradient trends to obtain the safety gradient. The historical task subspace can be spanned by the normalized direction vectors of the principal gradients in each update of the target model, and the orthogonal complement space is the set of directions perpendicular to the historical task subspace. The safety gradient and the initial principal gradient are weighted according to the adjustment factor to constrain the initial principal gradient and obtain the final principal gradient. The maintenance method of the historical task subspace includes: after each batch of updates is completed, the normalized principal gradient direction vector of the current batch is added to the historical task subspace; when the number of direction vectors in the historical task subspace exceeds a preset upper limit, QR decomposition compression is performed on the historical task subspace to retain the main directions. QR decomposition is a matrix decomposition method that decomposes a matrix into an orthogonal matrix and an upper triangular matrix, where Q represents an orthogonal matrix and R represents an upper triangular matrix. The transpose of an orthogonal matrix is ​​equal to its inverse matrix, and the upper triangular matrix is ​​a matrix in which all elements below the main diagonal are zero. QR decomposition compression can preserve the main directions from the historical gradient direction vectors, reduce the number of columns in the basis matrix of the historical task subspace, and control storage and computational overhead.

[0043] Accordingly, gradient descent is performed on the matrix in the main channel adapter using the final principal gradient and the learning rate in the configuration information corresponding to the current batch. After reaching the number of iterations corresponding to the current batch, the principal update parameters are obtained based on the current matrix in the main channel adapter. The principal update parameters can be equal to the matrix obtained by multiplying the updated second matrix by the updated first matrix. By projecting the initial principal gradient onto the orthogonal complement space of the historical task subspace and weighting it according to the adjustment factor, the model can retain the necessary avoidance of historical task directions while absorbing new knowledge. The larger the adjustment factor, the higher the learning freedom; the smaller the adjustment factor, the stricter the protection of old knowledge, thus achieving a flexible balance between data value and the need for anti-forgetting.

[0044] S1042. Based on the final primary gradient and the historical gradient trend of the target model, identify conflict change events in the current batch, and determine the auxiliary update parameters using the fixed configuration information corresponding to the conflict change events.

[0045] In one implementation, based on the final master gradient and the historical gradient trend of the target model, conflict change events are identified in the current batch. Auxiliary update parameters are determined using the fixed configuration information corresponding to the conflict change events. This includes: calculating the angle between the final master gradient and the historical task subspace constructed based on the historical gradient trend; identifying change events with an angle less than a preset angle threshold as conflict change events; or identifying change events where the main channel loss increases beyond a preset loss threshold as conflict change events. The preset angle threshold is, for example, 30 degrees, and the preset loss threshold is, for example, a loss increase exceeding 10% compared to the initial value.

[0046] Furthermore, an auxiliary channel adapter is constructed using the rank value from the fixed configuration information. This auxiliary channel adapter is also a low-rank adapter, but its rank value is fixed, for example, 2, and does not change with batches. Based on the auxiliary channel adapter and a preset auxiliary channel loss function, conflict change events are trained to obtain auxiliary update parameters. The auxiliary channel loss function can include the task loss and the Frobenius Norm regularization term of the auxiliary update parameter matrix. For example, the auxiliary channel loss function equals the cross-entropy loss plus the regularization coefficient multiplied by the square of the Frobenius Norm of the auxiliary update parameter matrix. The regularization coefficient can be set to 0.01, thereby constraining the update magnitude of the auxiliary channel adapter and preventing excessive diffusion of conflict knowledge. By identifying conflict change events that are highly similar to the historical task direction or cause a significant increase in loss, and training them in isolation with a fixed low-rank auxiliary channel adapter, conflict knowledge is constrained to be learned in an independent low-rank parameter space, preventing it from directly entering the normal learning path of the main update parameters. This reduces the interference of conflicts between old and new knowledge on the model's existing capabilities.

[0047] S1043. Replace the corresponding values ​​in the main update parameters with the parameters whose absolute values ​​are greater than a preset threshold in the auxiliary update parameters to obtain the final update parameters; update the target model based on the final update parameters to obtain the updated target model.

[0048] In one possible implementation, the absolute values ​​of each element in the auxiliary update parameter can be compared with a preset threshold to generate a conflict mask with the same shape as the main update parameter. Elements in the auxiliary update parameter whose absolute values ​​are greater than the preset threshold are assigned a first value (e.g., 1) at their corresponding positions in the conflict mask, while the remaining elements are assigned a second value (e.g., 0) at their corresponding positions. The main update parameter and the inverted result of the conflict mask are multiplied element-wise to obtain a first intermediate parameter, which retains the value of the main update parameter at positions where the conflict mask is 0 and sets it to zero at positions where the conflict mask is 1. The auxiliary update parameter and the conflict mask are multiplied element-wise to obtain a second intermediate parameter, which retains the value of the auxiliary update parameter at positions where the conflict mask is 1 and sets it to zero at positions where the conflict mask is 0. The first and second intermediate parameters are added element-wise to obtain the final update parameter, thus achieving the goal of replacing the main update parameter with the auxiliary update parameter only at the positions marked in the conflict mask, while keeping the main update parameter unchanged at other positions. The final update parameter can be added to the original weights of the target model to obtain the updated target model. By replacing the main update parameter with the auxiliary update parameter only at the local parameter positions related to conflict knowledge, the update corresponding to the conflict event will not spread to the entire parameter space. This ensures that the impact of conflict knowledge is limited to a minimum while maintaining the normal learning effect of the main update parameter, thereby improving the overall stability of the model after the update.

[0049] In one possible implementation, the method may further include a privacy-preserving experience replay process. During each batch update of the target model, the activation distribution statistics generated by the training samples through intermediate layers of the model, including the mean and variance, are stored, but the original samples are not stored. These intermediate layers are, for example, the hidden layers of the last transformer. Accordingly, during the current batch training, the activation distribution statistics of the current samples in the same intermediate layer are calculated, and the divergence between the current activation distribution statistics and historical activation distribution statistics is used as a regularization term for the replay loss and added to the total loss function. This divergence, for example, is the Kullback-Leibler divergence, which, by constraining the activation distribution of the current model on historical data to prevent shifts, consolidates old knowledge without storing the original samples. By storing only the activation distribution statistics instead of the original samples, it is possible to provide the model with constraint signals of old knowledge while meeting data privacy requirements, thereby mitigating the catastrophic forgetting problem without accessing the original data, making it suitable for data security-sensitive applications.

[0050] In one possible implementation, after obtaining the updated target model, a version management process may also be included. This involves obtaining the log sequence number range corresponding to the current batch, which is the interval between the start and end log sequence numbers of the data change transaction that triggered this update. A mapping relationship between the current model version and the log sequence number range is established and stored. This mapping relationship may also include at least one of the following: model version identifier, start log sequence number, end log sequence number, list of involved tables, number of involved records, fine-tuning parameters, and performance score. When a rollback is required, the corresponding model version is located and deployed in the mapping relationship based on a set time point or log sequence number, thereby supporting precise transaction-level rollback and audit traceability. By establishing a precise mapping between the model version and the log sequence number range, the rollback granularity of the model version is refined from a coarse overall version to the database transaction level. Operations personnel can quickly locate and restore the corresponding model version based on a specific time point or log sequence number, thereby shortening fault recovery time and meeting the audit requirements for the model change process.

[0051] Furthermore, the process of updating the target model using each batch also includes: collecting database load metrics, including at least one of query concurrency, I / O throughput, processor utilization, memory utilization, average transaction response time, and lock wait ratio; determining the current load level based on the load metrics; pausing the update process and saving the current training state when the current load level meets preset conditions; and resuming the update process from the pause point after the load level recovers.

[0052] It should also be noted that after obtaining the updated target model, the process includes: using a reserved validation set to perform performance validation on the updated target model, evaluating the performance retention of the updated target model on the original task and / or the learning effect on new data; if the performance validation fails to pass the preset threshold, the updated target model is prevented from being released and marked as pending review.

[0053] Through the above embodiments, when incrementally updating the target model in a database scenario, this method can divide change events into different batches based on the comprehensive evaluation information of the change events and set different iteration numbers, rank values, and learning rates, so that change events of different values ​​can obtain differentiated update configurations, thereby improving the targeting of model updates. During the update process, the adjustment factor is determined based on the comprehensive evaluation information of the current batch and used to constrain the initial principal gradient, so that the gradient updates of different batches are subject to different degrees of constraints, thereby adapting to the learning needs of different batches. For conflicting change events, auxiliary update parameters are determined with fixed configuration information, and the parameters in the auxiliary update parameters whose absolute values ​​are greater than a preset threshold are used to replace the values ​​at the corresponding positions in the principal update parameters, so that the update corresponding to the conflicting event only acts on the local position, while the other positions still retain the principal update parameters, thereby reducing the impact of conflicting knowledge on the existing model capabilities. At the same time, by storing activation distribution statistics instead of original samples and adding divergence regularization terms during training, old knowledge can be consolidated without storing the original data. By establishing a mapping relationship between model version and log sequence number range, accurate rollback can be achieved. Overall, this method can distinguish the differences in utility of different change events, improve the targeting and security of incremental model updates in database scenarios, reduce computational resource consumption, and facilitate version management and rollback.

[0054] Please see Figure 2 This application discloses a model update system for a database. The system includes a change data capture unit, an event and task mapping unit, a multi-dimensional data value assessment unit, a dynamic rank allocation unit, a dual-channel parameter high-efficiency fine-tuning unit, a load-aware scheduling unit, and a model version management unit. These functional units interact with each other through standardized data interfaces and an event-driven approach, jointly completing the entire process from data change awareness to incremental model updates. The following describes each functional unit in detail.

[0055] The change data capture unit serves as the data awareness entry point, monitoring and capturing data change events in the database in real time. This unit features multi-source database log parsing capabilities, enabling it to interface with various types of relational databases, such as MySQL, PostgreSQL, and Oracle. By adapting to different database log formats, such as MySQL's binlog, PostgreSQL's WAL (Write-Ahead Logging), and Oracle's Redo Log, it achieves unified change capture capabilities across database platforms. The parsing process employs an incremental reading strategy, retrieving only newly added logs from the last read position to avoid redundant parsing. This unit also features real-time change event stream generation, converting captured data changes into standardized event streams in real time. Each event includes information such as change type, changed table name, changed field name, previous value, new value, change timestamp, transaction identifier, and log sequence number (LSN). Change types include INSERT, UPDATE, and DELETE, and the log sequence number is a number in the database log used to identify the order of change operations. This information ensures the complete traceability of changed data. This unit also features a change event classification and labeling function, which can initially classify and label change events based on dimensions such as the table structure type involved, the amount of changed data, and the types of changed fields. Table structure types include system tables and business tables; changed data volume includes single records and batches; and changed field types include ordinary fields, primary keys, foreign keys, and indexed fields. The results of this initial classification and labeling can provide a basis for the triggering decisions of the subsequent event and task mapping unit. This unit also features change event persistence and fault tolerance capabilities, allowing captured change events to be persistently stored in a built-in message queue or log storage. It supports event backtracking and replaying after fault recovery, thereby ensuring high reliability of the model update triggering mechanism. The change data capture unit outputs the encapsulated change event stream to the event and task mapping unit via a standard message queue.

[0056] The event and task mapping unit is used to transform data change events into model update tasks, enabling automated linkage between data change awareness and model updates. This unit has a built-in change event classifier that, based on the hierarchical labeling information passed in from the change data capture unit and combined with the business weights of the change table, further subdivides change events into three trigger levels according to their impact scope and business importance. Business weights can be read from the data dictionary or information pre-configured by the database administrator (DBA).

[0057] The first trigger level is high-priority, corresponding to insert, update, or delete operations involving core business tables with a business weight of not less than 0.7, or table structure change operations (DDL, Data Definition Language). The second trigger level is medium-priority, corresponding to batch data changes involving ordinary business tables with a business weight between 0.3 and 0.7; batch data changes are, for example, changes to more than 100 rows of data. The third trigger level is low-priority, corresponding to data changes involving log tables or temporary tables with a business weight below 0.3, or small-scale data changes; small-scale data changes are, for example, changes to no more than 10 rows of data.

[0058] The event and task mapping unit also includes a built-in trigger condition evaluator, which can automatically determine whether a model update needs to be triggered and, if so, at what granularity, based on classification results and preset multi-level trigger thresholds. For events at the first trigger level, a full incremental update is triggered immediately. For events at the second trigger level, a full incremental update is triggered when the cumulative number of changes exceeds a preset threshold or when the cumulative time exceeds a preset window period. The preset threshold is, for example, 1000 changes, and the preset window period is, for example, 5 minutes. For events at the third trigger level, no trigger is triggered by default; they are only included in the model update data scope as additional context when associated with events at the first or second trigger levels.

[0059] The event and task mapping unit also has the function of generating and issuing model update tasks. For change events that need to be triggered, it generates standardized model update task instructions. The task instructions include information such as task identifier, task type, data range involved, priority, and expected completion time. The task type includes full update and lightweight update, and the data range involved includes table name, time range, or log sequence number range. The task instructions are issued to the load-aware scheduling unit for queuing and execution.

[0060] The event and task mapping unit also has a dynamic configuration function for mapping strategies, which allows administrators to dynamically adjust classification thresholds, trigger thresholds and time window parameters through the configuration center, so that the mapping strategy can adapt to business changes.

[0061] The multidimensional data value assessment unit is used to filter samples with high training value from massive amounts of changing data and provide a quantitative basis for subsequent dynamic rank allocation. This unit has a change data extraction function, which can extract the corresponding change data records and their contextual information, such as relevant fields of related tables, from the database according to the data range specified in the model update task instruction, and construct the original data pool to be evaluated.

[0062] The multidimensional data value assessment unit evaluates the importance of changes from the first dimension. The change importance score is calculated based on the database's inherent attributes and includes three sub-indicators. The first sub-indicator is business weight, read from a pre-configured table business weight mapping table by the database administrator. Core transaction tables can be assigned a business weight of 0.8 to 1.0, ordinary business tables 0.3 to 0.7, and log tables 0 to 0.2. The second sub-indicator is field criticality, identified by parsing the data dictionary. If the changed field is a primary key, 0.3 points are added; if it's a foreign key, 0.2 points; and if it's an index field or partition key, 0.15 points. The accumulated scores are normalized to a range of 0 to 1. The third sub-indicator is access frequency, obtained from the database statistics view, showing the recent access frequency of the table or record segment. Access frequency can be measured in Queries Per Second (QPS), with higher scores assigned to higher-frequency access data. The importance score is obtained by weighting and summing the three sub-indicators. The importance score can be expressed as: S_imp = w1 × business weight + w2 × field keyness + w3 × access popularity. It can be seen that S_imp is equal to the sum of the first weight coefficient multiplied by the business weight, the second weight coefficient multiplied by the field keyness, and the third weight coefficient multiplied by the access popularity.

[0063] The multidimensional data value assessment unit evaluates semantic diversity from a second dimension. The semantic diversity score is calculated through the following steps: First, the key fields of the changed data are textualized and input into a vector embedding model to generate vector representations. For example, a vector embedding model like Sentence-BERT (Sentence Bidirectional Encoder Representations from Transformers) is used. Next, the weighted average distance d_knn to the k nearest neighbors in the existing training data vector set is calculated, where k can be 10. Then, a local information density correction factor ρ is calculated, which counts the number of samples within a neighborhood of radius R centered on the vector. This local information density correction factor ρ equals the number of samples divided by the neighborhood volume. The diversity score can be expressed as S_div = d_knn / (1 + ρ). It is evident that S_div equals the weighted average distance divided by the sum of the weighted average distance and the local information density correction factor; that is, the larger the distance and the lower the local density, the higher the diversity score, thus encouraging sampling in sparse semantic regions.

[0064] The multidimensional data value assessment unit evaluates the difference from the existing training set from a third dimension. Through vector similarity retrieval, it calculates the cosine similarity (cos_sim_max) between each changed data vector and the most similar sample in the historical training dataset. The difference score can be expressed as S_diff = 1 - cos_sim_max, where S_diff equals one minus the cosine similarity. A lower cosine similarity indicates less overlap with historical data, resulting in a higher difference score and ensuring that incremental data brings new knowledge to the model.

[0065] The multidimensional data value assessment unit also features comprehensive scoring and adaptive truncation functions. The comprehensive score can be expressed as: S_total = α × S_imp + β × S_div + γ × S_diff; α, β, and γ are dynamic weight coefficients, which can be adjusted by the system or administrator based on the current fine-tuning task objectives. If the focus is on acquiring new knowledge, β and γ are increased; if the focus is on strengthening core business capabilities, α is increased. Therefore, S_total equals the first weight coefficient multiplied by the importance score, plus the second weight coefficient multiplied by the diversity score, plus the third weight coefficient multiplied by the difference score. These three weight coefficients are dynamic and can be adjusted by the system or administrator based on the current model and updated task objectives. For example, when the task focuses on acquiring new knowledge, the weight coefficients corresponding to the diversity and difference scores can be increased; when the task focuses on strengthening core business capabilities, the weight coefficient corresponding to the importance score can be increased. Sort the samples by comprehensive score from high to low, and combine the computational budget provided by the load-aware scheduling unit (which is the upper limit of the number of samples that can be processed). Adaptively select the top-ranked samples to construct the final incremental training dataset. At the same time, output the scores of each dimension and the comprehensive score of each selected sample in a structured format for use by the dynamic rank allocation unit.

[0066] The dynamic rank allocation unit maps the sample scores output by the multidimensional data value assessment unit to a differentiated rank configuration of the dual-channel low-rank adapter. This unit has sample grading and rank allocation functions, receiving the comprehensive score (comprehensive assessment information) of each sample output by the multidimensional data value assessment unit and grading the candidate samples in the current batch. Samples ranking in the top 20% of the comprehensive score are classified as high-value group and assigned a main channel rank value of 32. Samples ranking in the middle 60% of the comprehensive score are classified as medium-value group and assigned a main channel rank value of 16. Samples ranking in the bottom 20% of the comprehensive score are classified as low-value group and assigned a main channel rank value of 2. These rank values ​​can be configured according to the model size. The auxiliary channel rank value is fixed at 2 and does not change with the sample value.

[0067] This unit also features a group training strategy generation function, generating differentiated training strategies based on the tiering results. High-value group samples undergo full training iterations with a larger learning rate, such as 5e. -4This allows for larger gradient update magnitudes. The mid-value group samples are trained using the standard number of iterations and a standard learning rate, e.g., a learning rate of 3e. -4 The low-value group samples are trained with half the number of iterations and a smaller learning rate, for example, a learning rate of 1e. -4 Limit the update magnitude to avoid overfitting.

[0068] This unit also has a rank configuration delivery function, which encapsulates the rank configuration and training strategy parameters corresponding to each sample group into training configuration instructions, and delivers them together with the grouped sample data to the dual-channel parameter high-efficiency fine-tuning unit for execution.

[0069] The dual-channel parameter-efficient fine-tuning unit is used to perform incremental training with anti-forgetting capabilities. This unit deploys two functionally distinct low-rank adapters (LoRAs) at the attention projection matrix of each target layer of the model. A low-rank adapter is a method that approximates parameter updates by training a low-rank matrix.

[0070] In each fine-tunable layer of the base model, such as the query (Q), key (K), and value (V) projection matrices of the attention layer and the feed-forward network (FFN) layer, two low-rank adapters are deployed. The update amount of the main channel adapter can be expressed as ΔW_master = B_master × A_master, where ΔW_master equals B_master multiplied by A_master, and A_master has a shape of r_i rows and d columns, while B_master has a shape of d rows and r_i columns. The rank r_i is determined by the dynamic rank allocation unit based on sample value grouping. The main channel adapter is used to learn new knowledge and receive gradient updates. The update amount of the secondary channel adapter can be expressed as ΔW_aux = B_aux × A_aux, where ΔW_aux equals B_aux multiplied by A_aux, with a fixed rank of 2. The secondary channel adapter is used to learn conflicting knowledge, i.e., the parts of the new data that are inconsistent with the distribution of knowledge in the historical task. After training, the final model update amount is obtained by fusing the two.

[0071] The training process of the main channel includes the following steps: The system maintains a historical gradient subspace basis matrix G_history, where G_history ∈ ^{P×K}, where P is the total number of LoRA parameters and K is the number of effective directions accumulated from historical tasks (initially K=0, an empty matrix). After each batch (or task) of incremental fine-tuning, the normalized vector of the principal gradient of the current batch is added as a new column to G_history. When K exceeds a preset upper limit (e.g., K_max=50), QR decomposition and compression are performed. It can be seen that the number of rows in this matrix represents the total number of low-rank adapter parameters, and the number of columns represents the number of effective directions accumulated from historical tasks. Initially, the number of effective directions is zero, and the matrix is ​​empty. After each batch of incremental training, the normalized vector of the principal gradient of the current batch is added as a new column to this matrix. When the number of columns exceeds a preset upper limit, QR decomposition and compression are performed, retaining the principal directions.

[0072] At each step of the main channel training, the gradient g of the current batch is calculated, g∈ ^P, projecting it onto the orthogonal complement space of the historical task subspace, yields the initial principal gradient g_orth after projection, calculated as g_orth = g - G_history × (G_history T ×g). The orthogonal complement space is the set of directions perpendicular to the historical task subspace.

[0073] The adjustment factor, or relaxation factor λ, is calculated based on the overall score of the current batch of samples. The calculation method is λ = min(1, S_total_avg / S_ref). λ is equal to the smaller of one and S_total_avg divided by S_ref, where S_total_avg is the mean of the overall scores of the current batch of samples, and S_ref is a reference threshold, for example, 0.7. When the mean overall score of the batch of samples is high, the relaxation factor is large, allowing for more degrees of freedom in updating. When the mean overall score of the batch of samples is low, the relaxation factor is small, applying stricter orthogonal constraints.

[0074] The final master gradient is: g_final = (1-λ)×g_orth + λ×g. The master channel parameter is updated by subtracting the learning rate η from θ_master and multiplying by g_final.

[0075] The training process for the auxiliary channel includes the following steps: During training, samples where the angle between the gradient direction of the main channel and the historical task subspace is less than a preset angle threshold, or samples where the loss of the main channel on that sample increases by more than a preset loss threshold, are marked as high-conflict samples. The preset angle threshold is, for example, 30 degrees, and the preset loss threshold is, for example, a loss increase of more than 10% compared to the initial value.

[0076] The secondary channel loss function can be expressed as L_aux = L_CE(pred_aux, y_true) + β × ||ΔW_aux||_F^2, where the first term is the cross-entropy task loss, and the second term is the Frobenius norm regularization (β = 0.01), which forces the secondary channel parameters to remain at a small amplitude to avoid over-adjustment. Secondary channel training is only initiated on high-collision samples, and standard gradient descent is used to update the secondary channel parameters.

[0077] After training is complete, the final update of the current layer can be expressed as ΔW_final=ΔW_master⊙(1-M_conflict)+ΔW_aux⊙M_conflict; where M_conflict is the binary mask matrix corresponding to the conflicting samples (conflicting positions are 1, non-conflicting positions are 0), and ⊙ is the Hadamard product (element-wise multiplication).

[0078] The dual-channel parameter high-efficiency fine-tuning unit also features privacy-preserving experience replay functionality. During historical model training, the mean and variance of the activation distribution generated when historical training samples pass through intermediate layers of the model are stored, denoted as statistics μ_hist and σ_hist squared. The original sample data is not stored; intermediate layers are, for example, the hidden layers of the last Transformer (a neural network structure based on a self-attention mechanism). In incremental training, the current batch of samples is input into the current model, and the activation distribution statistics μ_cur and σ_cur squared from the same intermediate layer are extracted. Their KL divergence (a measure of the difference between two probability distributions) is then calculated. The replay loss can be expressed as L_replay=KL(N(μ_cur,σ_cur^2)||N(μ_hist,σ_hist^2)). Adding this loss as a regularization term to the total loss, we have: L_total=L_task+γ×L_replay, where γ=0.1 is the tradeoff coefficient. This loss function ensures that the activation distribution of the current model does not shift on historical data, consolidating old knowledge without needing to store the original data.

[0079] The dual-channel parameter fine-tuning unit also features training quality evaluation. After incremental training, the updated model's performance is validated using a reserved validation set. Evaluation metrics include the model's performance retention on the original task and its learning effect on new data. Performance retention can be measured by whether the F1 score or accuracy on the original task decreases by more than 5%, while learning effect can be measured by whether the F1 score on new data improves by more than 3%. If the evaluation result fails to meet a preset threshold, an alarm is triggered, preventing the release of the model version, and the training result is marked as pending review.

[0080] The load-aware scheduling unit monitors database load in real time and dynamically controls the execution rhythm of model update tasks based on load status, ensuring that model update tasks do not compete with normal database operations for critical resources. This unit continuously collects load metrics such as database query concurrency (QPS), input / output throughput (I / O throughput), GPU / CPU utilization, memory usage, average transaction response time, and lock wait ratio. Using a weighted algorithm, it categorizes load status into five levels: idle, normal, busy, congested, and bursty. Differentiated control strategies are implemented for each of the four stages: change event collection, training data screening, model update training, quality assessment, and release.

[0081] The dual-channel parameter fine-tuning unit receives real-time instructions from the load-aware scheduling unit during execution. When the load level switches from normal to busy, model update training is immediately paused and the current training state is saved, including the main channel gradient accumulation and the historical subspace basis matrix. Training resumes from the pause point after the load level returns to normal.

[0082] The model version management unit is used to achieve a precise mapping between model versions and database data versions, supporting fast rollback and fine-grained auditing. This unit has version-to-data mapping functionality. Each time incremental training is triggered, the system automatically obtains the start and end log sequence numbers of the data change transaction that triggered the training, as well as the system's global log sequence number at the start of training. A model version-to-data version mapping table is maintained, with fields including model version identifier, global log sequence number, start log sequence number, end log sequence number, list of involved tables, number of involved records, fine-tuning parameters, performance score, and generation time.

[0083] This unit also has model version storage and indexing functions, which uniformly stores the model files generated by each incremental training. The model files include the basic model weights and adapter parameters, and an index is built based on the version number, generation time, and associated log sequence number range to support efficient version retrieval.

[0084] This unit also features precise rollback functionality. When a rollback is needed, the operations and maintenance personnel specify the database time point to which they wish to roll back. The system converts this time point into a log sequence number, looks up the model version corresponding to the range of that log sequence number in the mapping table, and automatically loads and completes the deployment. The rollback operation can be completed within seconds, for example, less than 5 seconds.

[0085] This unit also has an audit traceability function, which supports combined queries by time range, log sequence number range, table name involved, operation type and performance score, etc. The audit results can display the source information of any model version, including which data transactions and which table changes triggered it.

[0086] This unit also has model version lifecycle management capabilities, supporting the setting of retention policies, such as retaining the most recent N versions or retaining versions within the most recent M days, automatically cleaning up expired versions, and providing protection for critical versions to prevent accidental deletion.

[0087] Please see Figure 3 The connections and data flows between the functional units are as follows: The Change Data Capture Unit continuously monitors the database transaction logs, captures data change events in real time, and outputs the encapsulated change event stream to the Event and Task Mapping Unit via a message queue. The Event and Task Mapping Unit receives the change event stream, classifies and evaluates it, and transforms the change events that trigger model updates into model update task instructions, which are then sent to the Multidimensional Data Value Assessment Unit and the Load-Aware Scheduling Unit. The Multidimensional Data Value Assessment Unit extracts change data according to the data range specified in the task instructions, constructs an incremental training dataset after multidimensional comprehensive scoring, outputs the comprehensive score of each selected sample to the Dynamic Rank Allocation Unit, and simultaneously outputs the dataset to the Dual-Channel Parameter High-Efficiency Fine-Tuning Unit. The Dynamic Rank Allocation Unit receives the comprehensive score, categorizes the samples, assigns differentiated low-rank adapter rank values ​​and training strategy parameters, and generates training configuration instructions to be delivered to the Dual-Channel Parameter High-Efficiency Fine-Tuning Unit. The Load-Aware Scheduling Unit operates throughout the entire process, monitoring the database load in real time. During the data filtering and model update training phases, it dynamically controls the start / stop and resource quotas of each stage according to the load level, ensuring that the filtering and training process does not interfere with database operations. The dual-channel parameter fine-tuning unit receives configuration instructions and sample datasets from the dynamic rank allocation unit, and performs training on the main and auxiliary channels. The main channel updates data-quality-aware relaxed orthogonal gradients using dynamic rank, while the auxiliary channel independently learns conflict knowledge. Simultaneously, privacy-preserving experience replay provides historical knowledge regularization. After training, a new model version is generated and submitted to the model version management unit. The model version management unit receives the new model version, automatically records the current log sequence number range and establishes a mapping relationship, persistently stores the model file, and updates the version index.

[0088] The seven functional units described above constitute a complete processing flow from data change perception to incremental model updates. These units interact with each other through standardized data interfaces, enabling both independent upgrades and collaborative model update tasks. The dynamic rank allocation unit and the dual-channel parameter efficient fine-tuning unit handle the main algorithm processing functions. These two units work in conjunction with the multi-dimensional data value assessment unit to form a coherent processing flow between data quality perception, parameter capacity allocation, and differentiated anti-forgetting training.

[0089] This embodiment has the following technical effects: Firstly, a direct mapping is established between data value scores and dynamic rank allocation. In conventional techniques, the data screening stage only outputs the judgment result of whether data is selected. Selected samples uniformly use a low-rank adapter with the same rank value during the training phase. The evaluation results of the importance and diversity of samples in the screening stage are not utilized in the training stage. This embodiment adds a dynamic rank allocation unit between the multi-dimensional data value evaluation unit and the dual-channel parameter efficient fine-tuning unit. This unit receives the comprehensive score of each selected sample and divides the samples into three levels according to the score: high-value group is assigned a main channel rank value of 32, medium-value group is assigned a main channel rank value of 16, and low-value group is assigned a main channel rank value of 2. At the same time, the high-value group uses a larger learning rate and a full number of iterations, while the low-value group uses a smaller learning rate and half the number of iterations. Through the above method, the screening result is transformed from a selection decision into a quantitative capacity allocation instruction, so that the data screening logic and the training logic are connected. High-value data obtains sufficient parameter capacity to absorb new knowledge, while low-value data only undergoes light updates to avoid overfitting.

[0090] Secondly, a dynamic rank allocation method that is aware of database business attributes is introduced. Conventional dynamic rank allocation methods typically determine rank values ​​based on internal model statistics such as gradient norms or parameter importance during training, failing to perceive the differences in data business origins and change attributes within a database context. This embodiment's multi-dimensional data value assessment unit calculates a comprehensive score from three dimensions, enabling rank allocation to possess database business semantic awareness capabilities. The change importance score is directly based on the database's inherent attributes, read from the table business weight mapping table configured by the database administrator. For example, the business weight of the core transaction table is 0.9, and the business weight of the log table is 0.1. The score is accumulated by parsing the data dictionary to identify whether the changed field is a primary key, foreign key, or index field, and the historical access frequency of the table is obtained from database statistics. The semantic diversity score calculates the distribution density of changed data in the semantic space through vector embedding and introduces a local information density correction factor, reducing diversity scores in dense areas and increasing scores in sparse areas. The difference score with the existing training set measures the degree of overlap with historical data through vector similarity retrieval. The comprehensive score simultaneously reflects the business value and model learning value of the data, and the dynamic rank allocation unit uses this score as the basis for sample classification and rank allocation. By employing the above methods, dynamic rank allocation can be adapted to the business semantics of database scenarios. Core business changes with high business weight and high differentiation can obtain higher rank values ​​and larger update capacity, while low-value log changes consume only lower parameter capacity, thereby improving the efficiency of computing resource utilization.

[0091] Thirdly, this paper designs a data quality-aware dual-channel low-rank adapter and a relaxed orthogonal constraint method. Conventional anti-forgetting methods impose uniform constraints on all samples. High-value new samples may be over-constrained, leading to insufficient absorption of new knowledge, while low-value samples may be constrained too loosely, potentially interfering with old knowledge. This embodiment sets up two low-rank adapters, a main channel and an auxiliary channel, structurally separating the learning of new knowledge from the protection of old knowledge. The main channel uses a dynamic-rank low-rank adapter, while the auxiliary channel uses a fixed-rank adapter. After training, the parameters of the main and auxiliary channels are merged to update. Simultaneously, this embodiment introduces privacy-preserving experience replay, not storing the original data of historical training samples, but only storing the activation distribution statistics of samples passing through the intermediate layer. In incremental training, KL divergence is used as a regularization term to consolidate historical knowledge without storing the original data. Through this approach, high-value data obtains sufficient update freedom to absorb new knowledge, low-value data is subject to stricter constraints to protect old knowledge, and conflicting knowledge is isolated and learned by the auxiliary channel. The learning effect of the new task is improved without reducing the performance of the old task, while simultaneously achieving privacy protection by not storing the original data samples.

[0092] Fourthly, a precise mapping of model versions based on log sequence numbers is established. Conventional solutions typically only establish a coarse-grained mapping between model versions and knowledge graph versions, failing to support precise rollback. This embodiment refines the anchoring granularity of model versions to the database log sequence number. Each time incremental training is triggered, the system automatically obtains the start and end log sequence numbers of the data change transaction that triggered the training, precisely recording information such as the model version identifier, global log sequence number, start log sequence number, end log sequence number, list of involved tables, and number of involved records in the model version-data version mapping table. During rollback, operations personnel specify a database time point, the system converts it to a log sequence number, and looks up the corresponding model version in the mapping table, completing deployment within seconds. Audit queries can trace the origin of any model version based on conditions such as log sequence number range and involved table names. Through this method, the rollback granularity is refined from a coarse version granularity to the granularity of a single data change transaction, significantly shortening rollback time and meeting the needs of application scenarios such as finance and government affairs, which have high audit requirements for model changes.

[0093] The following describes a model update apparatus for a database provided by an embodiment of this application. The model update apparatus for a database described below can be referred to in conjunction with other embodiments described herein.

[0094] This application discloses a model update apparatus for a database, comprising: The generation module is used to generate multiple corresponding change events for table structure change operations, field change operations, and / or data record change operations in the database; The evaluation module is used to evaluate the utility of each change event for model updates according to multiple preset dimensions, and obtain comprehensive evaluation information of each change event in multiple dimensions; the multiple dimensions include at least two of the following: business importance, semantic diversity, and difference from the existing training set; The segmentation module is used to divide multiple change events into multiple batches based on comprehensive evaluation information and determine the configuration information corresponding to different batches. The configuration information includes: number of iterations, rank value, and learning rate, with different configuration information corresponding to different batches. The update module is used to update the target model in the database for each batch. The process includes: determining the adjustment factor for the current batch based on the comprehensive evaluation information of each change event in the current batch; training the current batch with the configuration information corresponding to the current batch to obtain the initial principal gradient; constraining the initial principal gradient with the adjustment factor to obtain the final principal gradient; updating the main update parameters based on the final principal gradient; identifying conflicting change events in the current batch based on the final principal gradient and the historical gradient trend of the target model; determining the auxiliary update parameters with the fixed configuration information corresponding to the conflicting change events; replacing the values ​​at the corresponding positions in the main update parameters with the parameters in the auxiliary update parameters whose absolute values ​​are greater than a preset threshold to obtain the final update parameters; and updating the target model based on the final update parameters to obtain the updated target model.

[0095] For more detailed information on the working process of each module and unit in this embodiment, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.

[0096] As can be seen, this embodiment provides a model update device for databases, which can distinguish the utility differences of different change events, improve the targeting of incremental model updates in database scenarios, and realize incremental fine-tuning of large language models in databases based on sample difference adaptability.

[0097] The following describes an electronic device provided by an embodiment of this application. The electronic device described below can be referred to in conjunction with other embodiments described herein.

[0098] See Figure 4 As shown in the figure, an embodiment of this application discloses an electronic device, including: Memory 401 is used to store computer programs; Processor 402 is configured to execute the computer program to implement the method disclosed in any of the above embodiments.

[0099] Furthermore, embodiments of this application also provide an electronic device. The aforementioned electronic device can be, for example,... Figure 5 The server shown can also be as follows: Figure 6 The terminal shown. Figure 5 and Figure 6 These are all diagrams illustrating the structure of an electronic device according to an exemplary embodiment. The content in the diagrams should not be considered as any limitation on the scope of this application.

[0100] Figure 5This is a schematic diagram of a server structure provided in an embodiment of this application. The server may specifically include: at least one processor, at least one memory, a power supply, a communication interface, an input / output interface, and a communication bus. The memory stores a computer program, which is loaded and executed by the processor to implement the relevant steps in database model updating disclosed in any of the foregoing embodiments.

[0101] In this embodiment, the power supply is used to provide operating voltage for each hardware device on the server; the communication interface can create a data transmission channel between the server and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0102] In addition, the memory, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored on it include operating system, computer programs and data, etc., and the storage method can be temporary storage or permanent storage.

[0103] The operating system manages and controls the various hardware devices and computer programs on the server to enable the processor to perform operations and processes on the data in the memory. It can be Windows Server, Netware, Unix, Linux, etc. The computer programs, in addition to those capable of performing the database model update method disclosed in any of the foregoing embodiments, may further include computer programs capable of performing other specific tasks. The data may include application update information and application developer information.

[0104] Figure 6 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application. The terminal may include, but is not limited to, a smartphone, tablet computer, laptop computer, or desktop computer.

[0105] Typically, the terminal in this embodiment includes a processor and a memory.

[0106] The processor may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor can be implemented using at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor may also include a main processor and coprocessors. The main processor, also known as the CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor may also include an AI (Artificial Intelligence) processor, which handles computational operations related to machine learning.

[0107] The memory may include one or more computer non-volatile storage media, which may be non-transitory. The memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory is used to store at least the following computer program, which, after being loaded and executed by the processor, is capable of implementing the relevant steps in the database model update method executed by the terminal side as disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory may also include operating systems and data, and the storage method may be temporary or permanent storage. The operating system may include Windows, Unix, Linux, etc. The data may include, but is not limited to, application update information.

[0108] In some embodiments, the terminal may further include a display screen, an input / output interface, a communication interface, a sensor, a power supply, and a communication bus.

[0109] Those skilled in the art will understand that Figure 6 The structure shown does not constitute a limitation on the terminal and may include more or fewer components than illustrated.

[0110] The following describes a non-volatile storage medium provided in an embodiment of this application. The non-volatile storage medium described below can be referred to in conjunction with other embodiments described herein.

[0111] A non-volatile storage medium is provided for storing a computer program, wherein the computer program, when executed by a processor, implements the database model update method disclosed in the foregoing embodiments. The non-volatile storage medium is a computer-readable non-volatile storage medium, which, as a carrier of resource storage, can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored thereon include an operating system, computer programs, and data, and the storage method can be temporary storage or permanent storage.

[0112] The following describes a computer program product provided by an embodiment of this application. The computer program product described below can be referred to in conjunction with other embodiments described herein.

[0113] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the aforementioned disclosed model update method for a database.

[0114] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium for storing a computer program that, when executed by a processor, implements the steps in any of the above embodiments.

[0115] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0116] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of non-volatile storage medium known in the art.

[0117] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only intended to help understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A model update method for a database, characterized in that, include: For table structure change operations, field change operations, and / or data record change operations in the database, generate multiple corresponding change events; The utility of each change event to model updates is evaluated according to multiple preset dimensions to obtain comprehensive evaluation information of each change event in the multiple dimensions; the multiple dimensions include at least two of the following: business importance, semantic diversity, and difference from the existing training set; Based on the comprehensive evaluation information, the multiple change events are divided into multiple batches, and the configuration information corresponding to different batches is determined; The configuration information includes: number of iterations, rank value, and learning rate, with different configuration information corresponding to different batches; The process of updating the target model in the database using each batch includes: The adjustment factor for the current batch is determined based on the comprehensive evaluation information of each change event in the current batch. The initial principal gradient is obtained by training the current batch with the configuration information corresponding to the current batch. The initial principal gradient is constrained by the adjustment factor to obtain the final principal gradient. The principal update parameters are updated based on the final principal gradient. Based on the final primary gradient and the historical gradient trend of the target model, conflict change events are identified in the current batch, and auxiliary update parameters are determined using the fixed configuration information corresponding to the conflict change events. The parameters whose absolute values ​​are greater than a preset threshold in the auxiliary update parameters are used to replace the values ​​at the corresponding positions in the main update parameters to obtain the final update parameters; the target model is then updated based on the final update parameters to obtain the updated target model.

2. The method according to claim 1, characterized in that, Before evaluating the utility of each change event for the model update operation according to multiple preset dimensions, the process also includes: Based on the table structure type, the amount of data changed, and / or the type of field changed involved in the change event, the multiple change events are divided into multiple priorities; After the division, if the preset triggering conditions corresponding to any priority are met, the steps of evaluating the effectiveness of each change event on model update according to preset multiple dimensions and other subsequent steps are executed.

3. The method according to claim 1, characterized in that, Based on the comprehensive evaluation information, the multiple change events are divided into multiple batches, and the configuration information corresponding to different batches is determined, including: The multiple change events are sorted according to the comprehensive evaluation information to obtain an event sequence; The event sequence is divided into multiple sequence segments, and each sequence segment is used as one of the multiple batches. The number of iterations, rank, and learning rate are set for different batches to obtain the configuration information for different batches; among them, the number of iterations, rank, and learning rate are positively correlated with the comprehensive evaluation information.

4. The method according to claim 1, characterized in that, The adjustment factor for the current batch is determined based on the comprehensive evaluation information of each change event in the current batch, including: Calculate the average value of the comprehensive assessment information for each change event in the current batch; The adjustment factor is determined based on the ratio of the average value to a preset reference threshold; wherein the average value is positively correlated with the adjustment factor.

5. The method according to claim 1, characterized in that, The initial principal gradient is obtained by training the current batch with the configuration information corresponding to the current batch. The final principal gradient is obtained by constraining the initial principal gradient with the adjustment factor. The principal update parameters are then updated based on the final principal gradient, including: A master channel adapter is constructed using the rank value in the configuration information corresponding to the current batch. The current batch is then propagated forward and backward based on the master channel adapter to obtain the initial master gradient. The initial principal gradient is projected onto the orthogonal complement space of the historical task subspace constructed based on the historical gradient trend to obtain the safety gradient; The safety gradient and the initial principal gradient are weighted according to the adjustment factor to constrain the initial principal gradient and obtain the final principal gradient; Gradient descent is used to update the matrix in the main channel adapter using the final master gradient and the learning rate in the configuration information corresponding to the current batch. After reaching the number of iterations corresponding to the current batch, the main update parameters are obtained based on the current matrix in the main channel adapter.

6. The method according to claim 1, characterized in that, Based on the final primary gradient and the historical gradient trend of the target model, conflict change events are identified in the current batch. Secondary update parameters are determined using the fixed configuration information corresponding to the conflict change events, including: Calculate the angle between the final principal gradient and the historical task subspace constructed based on the historical gradient trend, and determine the change event where the angle is less than a preset angle threshold as the conflict change event; or, determine the change event where the main channel loss increases beyond a preset loss threshold as the conflict change event; A secondary channel adapter is constructed using the rank value in the fixed configuration information. The conflict change event is trained based on the secondary channel adapter and a preset secondary channel loss function to obtain the secondary update parameters.

7. The method according to claim 1, characterized in that, By replacing the values ​​at corresponding positions in the main update parameters with parameters whose absolute values ​​are greater than a preset threshold in the auxiliary update parameters, the final update parameters are obtained, including: The absolute value of each element in the auxiliary update parameter is compared with the preset threshold to generate a conflict mask with the same shape as the main update parameter; wherein, the element in the auxiliary update parameter whose absolute value is greater than the preset threshold takes the first value at the corresponding position in the conflict mask, and the other elements take the second value at the corresponding position in the conflict mask. The first intermediate parameter is obtained by multiplying the main update parameter element by element with the inverted result of the conflict mask. The auxiliary update parameter is multiplied element by element by the conflict mask to obtain the second intermediate parameter; The first intermediate parameter and the second intermediate parameter are added element by element to obtain the final update parameter.

8. The method according to claim 1, characterized in that, Also includes: During each batch update of the target model, the activation distribution statistics generated by the training samples through the intermediate layers of the model, including the mean and variance, are stored, but the original samples are not stored. Accordingly, during the training of the current batch, the activation distribution statistics of the current sample in the same intermediate layer are calculated; the divergence between the current activation distribution statistics and the historical activation distribution statistics is used as the regularization term of the replay loss and added to the total loss function.

9. The method according to any one of claims 1 to 8, characterized in that, After obtaining the updated target model, the following is also included: Get the log sequence number range corresponding to the current batch; Establish and store the mapping relationship between the current model version and the log sequence number range; When a rollback is required, the corresponding model version is located and deployed in the mapping relationship based on the set time point or log sequence number.

10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the method as claimed in any one of claims 1 to 9.