A Target Language-Oriented Training Method for Large Language Models Based on Language Sensitivity and Gradient Routing

By using language sensitivity analysis and gradient routing mechanism, a hierarchical language sensitivity representation is constructed, the change ratio of parameter weights in each layer is calculated, and gradient update weights are allocated. This solves the problem of unbalanced parameter updates in multilingual processing of large language models and achieves stable enhancement of target language capabilities.

CN122491384APending Publication Date: 2026-07-31HARBIN INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HARBIN INST OF TECH
Filing Date
2026-05-12
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing large language models suffer from problems in multilingual processing, such as unbalanced parameter update strategies during model fine-tuning, disruption of cross-language shared structures during target language training, degradation of non-target language capabilities, and unstable training results.

Method used

By using language sensitivity analysis and gradient routing mechanism, a hierarchical language sensitivity representation is constructed, the change ratio of parameter weights in each layer is calculated, gradient update weights are allocated, hierarchical differential updates are realized, gradient routing is controlled, and the forward propagation structure of the model remains unchanged.

Benefits of technology

It significantly improves the stability and controllability of the target language ability enhancement process, avoids language ability degradation, and is suitable for multilingual scenarios and cross-language applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122491384A_ABST
    Figure CN122491384A_ABST
Patent Text Reader

Abstract

This invention relates to a target language-oriented training method for large language models based on language sensitivity and gradient routing. It pertains to the fields of multilingual analysis and large model training. The invention utilizes a language sensitivity analysis module to model the response characteristics of each layer's parameters under different language tasks, constructing the sensitivity level of each layer to the target language as the weight for gradient updates. Subsequently, during the model's backpropagation phase, a gradient routing control mechanism is introduced to weight the gradient updates of different layers, thereby achieving hierarchical differentiation control of parameter updates. When performing targeted training for a specific language, this invention significantly reduces irrelevant perturbations to the parameter spaces of other languages ​​and effectively avoids the limitations in representational power and reduced generalization performance caused by only fine-tuning specific language-sensitive layers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of multilingual analysis and large model training technology, and is a target language-oriented training method for large language models based on language sensitivity and gradient routing. Background Technology

[0002] With the development of artificial intelligence technology, large language models have been widely used in fields such as multilingual understanding, cross-language generation, and multimodal intelligent systems, becoming a core foundational model in scenarios such as intelligent question answering, machine translation, and human-computer interaction. In practical applications, large language models often need to be enhanced for specific target languages ​​or specific language tasks while maintaining their original general language capabilities, in order to meet the differentiated language capability requirements of different application scenarios.

[0003] In the early days, when technology was limited, multilingual processing systems relied primarily on rule design, feature engineering, or manually constructed language resources for optimization, resulting in limited adaptability and scalability. Even in subsequent statistical learning or neural network methods, the model training process typically employs a uniform parameter update strategy, making it difficult to fine-tune for different language characteristics. When a model is optimized for one language, it often has an adverse effect on other language capabilities.

[0004] In recent years, with the development of large-scale pre-trained models, artificial intelligence technology has made significant progress in multilingual processing. Related studies have found that in multilingual tasks, the parameters of each layer of a large language model do not contribute equally to language ability, but rather exhibit obvious hierarchical differences. Different network layers undertake different functions in terms of vocabulary, grammar, semantics, and cross-language shared representations. This hierarchical phenomenon has been verified in multiple studies.

[0005] However, current large language models still face many unresolved issues in multilingual processing and targeted optimization, mainly in the following aspects: First, during model fine-tuning, a uniform update strategy is usually adopted for the parameters of each layer, which makes it difficult to fully utilize the differences in the contribution of different layers to language ability. Second, when training for the target language, it is easy to destroy the original cross-language shared structure of the model, resulting in the degradation of non-target language capabilities. Third, existing methods mostly rely on empirical freezing or selection of some network layers, lacking fine control over the intensity of parameter updates, resulting in insufficient stability of training effects; Fourth, without changing the model structure and reasoning process, there is still a lack of effective training control mechanisms to achieve targeted enhancement and stable maintenance of multilingual capabilities. Summary of the Invention

[0006] This invention addresses the problems of severe language transfer interference, degradation of non-target language capabilities, and uncontrollable overall parameter updates in large-scale models when performing specific language enhancement, thereby improving the overall stability and practicality of the model in multilingual scenarios. It discloses a target language-oriented training method for large-scale language models based on language sensitivity and gradient routing.

[0007] This invention provides the following technical solutions: A target language-oriented training method for large language models based on language sensitivity and gradient routing, the method comprising the following steps: Step 1: Build the training system, and enter the system to select and load multilingual training data and model parameters; Step 2: Perform language sensitivity analysis on each layer of the model and construct a hierarchical language sensitivity representation. Record the changes in the weights of the parameters of each layer before and after training. By calculating the magnitude of the change in the weights of each layer and the ratio of the change relative to the initial weights, characterize the parameter response of different model layers during the target language training process. Step 3: Calculate the gradient update weights for each layer of the model corresponding to the target language. Based on the change ratio of the parameter weights of each layer obtained in Step 2, assign corresponding gradient update weights to different layers in the model to achieve hierarchical differential updates of model parameters during target language training. Step 4: In the backpropagation stage, perform hierarchical differentiated parameter updates based on the gradient routing mechanism. According to the gradient update weights calculated in Step 3, the gradients of each layer are weighted to achieve hierarchical differentiated control of model parameter updates. Step 5: Training feedback monitoring and convergence judgment, evaluate the performance of the target language task and the stability of the non-target language, and output the target language-oriented augmentation model.

[0008] Preferably, the training system includes a data input module, a model training module, and a training feedback monitoring module; the data input module is used to read the target language training data and complete data preprocessing; the model training module sequentially performs language sensitivity analysis, hierarchical gradient weight calculation, and gradient routing control operations; the training feedback monitoring module is used to monitor the performance changes of the target language and non-target languages, and to adjust and terminate the training process. Preferably, step 1 specifically comprises: Step 1.1: Acquire and preprocess multilingual training data containing the target language. Read the multilingual training dataset from local storage or remote data source through a preset data interface. The training data contains text samples corresponding to the target language. The read data is preprocessed, including but not limited to text cleaning, character encoding unification, language label verification, and sample format normalization, to generate standardized training data representations. The processed data is then stored in the training cache for subsequent language sensitivity analysis and model training steps. Step 1.2: Load the pre-trained large language model parameters and complete the model initialization. Before training begins, load the pre-trained large language model parameters. The model is a multi-layer neural network structure that supports multilingual input and backpropagation training mechanism. During the loading process, the integrity of the model parameters is checked, and the model initialization settings are completed according to the training configuration, including parameter precision mode, gradient calculation switch and training mode switching, to ensure that the model participates in the subsequent target language-oriented training process. Step 1.3: Configure the target language training task and establish the training environment. After the model and data are loaded, configure the training environment according to the target language training task specified by the user or preset. This includes target language identifier binding, training round parameter setting, and gradient update strategy initialization. This ensures that the model training process revolves around the target language task and provides a unified training condition and baseline state for subsequent language sensitivity analysis based on parameter weight changes.

[0009] Preferably, step 2 specifically comprises: Step 2.1: While keeping the model structure unchanged, perform at least one benchmark training iteration on the large language model for the target language training task. Record the initial weight values ​​of the parameters of each layer of the model before training and the corresponding updated weight values ​​after the training iteration, for subsequent parameter change analysis. The model parameters include, but are not limited to, the weight matrix and bias vector of each layer. Step 2.2: Based on the parameter states recorded in Step 2.1, adjust the model for the... The calculation of the change magnitude of the layer's parameter weights is as follows:

[0010] in, The model number is represented by the first... The initial parameter weights of the layer before training in the target language. The model number is represented by the first... The corresponding parameter weights of the layer after performing the target language training iteration. This represents the norm operation used to measure the magnitude of parameter variation; Step 2.3: Calculate the relative change rate of the parameter weights in each layer of the model. After obtaining the magnitude of the change in the parameter weights in each layer, calculate the model's... The relative change rate of layer parameter weights is calculated as follows:

[0011] in, The model number is represented by the first... The percentage change in parameter weights of the layer under the target language training task. This is a preset smoothing constant; Step 2.4: Use the change ratio of the parameter weights of each layer obtained in Step 2.3 as a language sensitivity metric to construct a hierarchical language sensitivity representation of the model, which is used to characterize the response of different model layers to the target language training task. The model layer with the largest change ratio is determined to be the target language sensitive layer, and the model layer with the smallest change ratio is determined to be the target language insensitive layer or low-sensitivity layer. Step 2.5: Normalize the language sensitivity representation of each layer of the model to obtain standardized language sensitivity weights. The normalization method includes, but is not limited to, linear normalization or scaling, so that the language sensitivity representation of different model layers meets the uniform numerical range constraint.

[0012] Preferably, step 3 specifically comprises: Step 3.1: Generate initial gradient update weights based on hierarchical language sensitivity representation, and update the weights based on the parameter weight change ratios of each layer of the model obtained in Step 2. , for the model The layer generates the corresponding initial gradient and updates the weights. :

[0013] in, The model number is represented by the first... Gradient update weights of the layer during target language training. It is a monotonically increasing mapping function used to map the rate of change of parameter weights to gradient update weights; Step 3.2: Apply a normalized mapping function to numerically constrain the gradient update weights and normalize the initial gradient update weights:

[0014] in, This represents the total number of layers in the model. satisfy ; Step 3.3: Introduce a smoothing factor to adjust the gradient update weight distribution. Based on the weights calculated in Step 3.2, a smoothing factor is introduced when calculating the gradient update weights. This is used to weigh the trade-off between target language-oriented augmentation and overall model stability, and its calculation method is as follows:

[0015] in, To smooth the control parameters, when When the gradient updates weights at their maximum, they reflect language sensitivity differences more effectively; when... When the gradient update weights are at their minimum, they tend to be uniformly distributed. Step 3.4: Construct the hierarchical gradient update weight vector and output it to the gradient routing module. After completing the weight calculation, update the calculated gradient weights for each layer. A hierarchical gradient update weight vector is formed, and the weight vector is passed as a control parameter to the gradient routing control module in the backpropagation stage to differentiate the gradient update intensity of different model layers.

[0016] Preferably, step 4 specifically comprises: Step 4.1: Obtain the original gradients of each layer of the model during the backpropagation phase. After completing the forward propagation and loss function calculation, calculate the original gradients corresponding to the parameters of each layer in the model during the backpropagation phase. The original gradients represent the gradient information of the model with respect to the loss function under the current training iteration, which are used to guide the direction of model parameter update. Step 4.2: Perform weighted routing of gradients for each layer of the model based on gradient updates, and update the weights according to the layer gradients obtained in Step 3. For the model number The original gradient of the layer We perform weighted processing to obtain the updated gradient after gradient routing. :

[0017] in, The model number is represented by the first... The original gradient calculated by the layer during the backpropagation phase, This represents the gradient update weights of the corresponding model layer. This represents the gradient after language-sensitive gradient routing control; Step 4.3: Utilize the weighted gradient The parameters of each layer of the model are updated to complete the parameter adjustment process of one training iteration. The parameter update process follows a preset optimization algorithm, including but not limited to stochastic gradient descent, Adam or its variants. Step 4.4: Perform gradient routing control while keeping the forward propagation structure of the model unchanged. During the entire gradient routing and parameter update process, the forward propagation structure, inference process and network topology of the model are not modified. Only the gradient is routed and weighted during the back propagation stage.

[0018] Preferably, step 5 specifically comprises: Step 5.1: During training, construct evaluation metrics for assessing the performance of the target language task and the stability of the non-target language task. The target language performance evaluation metric measures the learning effect of the model on the target language task, while the non-target language stability evaluation metric measures the performance retention of the model on the non-target language task. Step 5.2: In each training iteration or preset training cycle, the target language performance evaluation index and the non-target language stability evaluation index are monitored through the training feedback monitoring module. The changing trend of the model's performance on different language tasks during the training process is recorded to determine whether the model has experienced performance degradation or training instability. Step 5.3: Process the results based on the verification results of Steps 5.1 and 5.2.

[0019] Preferably, when it is determined that the convergence or stopping condition is not met, the training strategy is adjusted according to the training feedback results. The adjustment of the training strategy includes, but is not limited to, re-executing step 2 of language sensitivity analysis, step 3 of updating gradient update weights, or step 4 of adjusting gradient routing control parameters; when the convergence or stopping condition is met, the training process ends and a large language model with targeted enhancement of target language ability is output.

[0020] A computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement a target language-oriented training method for a large language model based on language sensitivity and gradient routing.

[0021] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement a target language-oriented training method for a large language model based on language sensitivity and gradient routing.

[0022] The present invention has the following beneficial effects: This invention, by introducing language sensitivity and gradient routing mechanisms, achieves fine-grained control over parameter update behavior during model training with minimal changes to the original model structure and inference process. This allows the model to dynamically adjust the update intensity based on the differences in the contribution of different network layers to language ability, effectively avoiding the language ability degradation problem caused by traditional uniform update strategies. Compared to existing technologies, this invention does not rely on human experience to divide the model structure, nor does it employ simple freeze or unfreeze strategies. Instead, it adaptively guides the gradient update direction and intensity by analyzing the characteristics of layer parameter changes during model training, significantly improving the stability and controllability of the target language ability enhancement process. Furthermore, the method of this invention has good versatility and scalability, adaptable to large language models of different sizes and multiple language training tasks. It is suitable for fine-tuning multilingual pre-trained models, low-resource language enhancement, and cross-language application scenarios, possessing broad application prospects and high practical application value. Attached Figure Description

[0023] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0024] Figure 1 The flowchart shown is that of the present invention; Figure 2 The flowchart shown illustrates the language-sensitive layer modeling of this invention. Figure 3 This is a diagram illustrating the architecture of the training process of this invention. Figure 4 The figure shown is an example diagram of the present invention. Detailed Implementation

[0025] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0026] The present invention will be described in detail below with reference to specific embodiments. Specific Implementation Example 1: according to Figures 1 to 4 As shown, the specific optimization technical solution adopted by the present invention to solve the above-mentioned technical problems is: The present invention relates to a target language oriented training method for a large language model based on language sensitivity and gradient routing.

[0028] This invention provides a method for training a large language model with a target language orientation based on language sensitivity and gradient routing. The method includes the following steps: Step 1: Build the training system, and enter the system to select and load multilingual training data and model parameters; Step 1 specifically involves: Step 1.1: Acquire and preprocess multilingual training data containing the target language. Read the multilingual training dataset from local storage or remote data source through a preset data interface. The training data contains text samples corresponding to the target language. The read data is preprocessed, including but not limited to text cleaning, character encoding unification, language label verification, and sample format normalization, to generate standardized training data representations. The processed data is then stored in the training cache for subsequent language sensitivity analysis and model training steps. Step 1.2: Load the pre-trained large language model parameters and complete the model initialization. Before training begins, load the pre-trained large language model parameters. The model is a multi-layer neural network structure that supports multilingual input and backpropagation training mechanism. During the loading process, the integrity of the model parameters is checked, and the model initialization settings are completed according to the training configuration, including parameter precision mode, gradient calculation switch and training mode switching, to ensure that the model participates in the subsequent target language-oriented training process. Step 1.3: Configure the target language training task and establish the training environment. After the model and data are loaded, configure the training environment according to the target language training task specified by the user or preset. This includes target language identifier binding, training round parameter setting, and gradient update strategy initialization. This ensures that the model training process revolves around the target language task and provides a unified training condition and baseline state for subsequent language sensitivity analysis based on parameter weight changes.

[0029] Step 2: Perform language sensitivity analysis on each layer of the model and construct a hierarchical language sensitivity representation. Record the changes in the weights of the parameters of each layer before and after training. By calculating the magnitude of the change in the weights of each layer and the ratio of the change relative to the initial weights, characterize the parameter response of different model layers during the target language training process. The training system includes a data input module, a model training module, and a training feedback monitoring module. The data input module is used to read the target language training data and complete the data preprocessing. The model training module sequentially performs language sensitivity analysis, hierarchical gradient weight calculation, and gradient routing control operations. The training feedback monitoring module is used to monitor the performance changes of the target language and non-target languages, and to adjust and terminate the training process. Step 2 specifically involves: Step 2.1: While keeping the model structure unchanged, perform at least one benchmark training iteration on the large language model for the target language training task. Record the initial weight values ​​of the parameters of each layer of the model before training and the corresponding updated weight values ​​after the training iteration, for subsequent parameter change analysis. The model parameters include, but are not limited to, the weight matrix and bias vector of each layer. Step 2.2: Based on the parameter states recorded in Step 2.1, adjust the model for the... The calculation of the change magnitude of the layer's parameter weights is as follows:

[0030] in, The model number is represented by the first... The initial parameter weights of the layer before training in the target language. The model number is represented by the first... The corresponding parameter weights of the layer after performing the target language training iteration. This represents the norm operation used to measure the magnitude of parameter variation; Step 2.3: Calculate the relative change rate of the parameter weights in each layer of the model. After obtaining the magnitude of the change in the parameter weights in each layer, calculate the model's... The relative change rate of layer parameter weights is calculated as follows:

[0031] in, The model number is represented by the first... The percentage change in parameter weights of the layer under the target language training task. This is a preset smoothing constant; Step 2.4: Use the change ratio of the parameter weights of each layer obtained in Step 2.3 as a language sensitivity metric to construct a hierarchical language sensitivity representation of the model, which is used to characterize the response of different model layers to the target language training task. The model layer with the largest change ratio is determined to be the target language sensitive layer, and the model layer with the smallest change ratio is determined to be the target language insensitive layer or low-sensitivity layer. Step 2.5: Normalize the language sensitivity representation of each layer of the model to obtain standardized language sensitivity weights. The normalization method includes, but is not limited to, linear normalization or scaling, so that the language sensitivity representation of different model layers meets the uniform numerical range constraint.

[0032] Step 3: Calculate the gradient update weights for each layer of the model corresponding to the target language. Based on the change ratio of the parameter weights of each layer obtained in Step 2, assign corresponding gradient update weights to different layers in the model to achieve hierarchical differential updates of model parameters during target language training. Step 3 specifically involves: Step 3.1: Generate initial gradient update weights based on hierarchical language sensitivity representation, and update the weights based on the parameter weight change ratios of each layer of the model obtained in Step 2. , for the model The layer generates the corresponding initial gradient and updates the weights. :

[0033] in, The model number is represented by the first... Gradient update weights of the layer during target language training. It is a monotonically increasing mapping function used to map the rate of change of parameter weights to gradient update weights; Step 3.2: Apply a normalized mapping function to numerically constrain the gradient update weights and normalize the initial gradient update weights:

[0034] in, This represents the total number of layers in the model. satisfy ; Step 3.3: Introduce a smoothing factor to adjust the gradient update weight distribution. Based on the weights calculated in Step 3.2, a smoothing factor is introduced when calculating the gradient update weights. This is used to weigh the trade-off between target language-oriented augmentation and overall model stability, and its calculation method is as follows:

[0035] in, To smooth the control parameters, when When the gradient updates weights at their maximum, they reflect language sensitivity differences more effectively; when... When the gradient update weights are at their minimum, they tend to be uniformly distributed. Step 3.4: Construct the hierarchical gradient update weight vector and output it to the gradient routing module. After completing the weight calculation, update the calculated gradient weights for each layer. A hierarchical gradient update weight vector is formed, and the weight vector is passed as a control parameter to the gradient routing control module in the backpropagation stage to differentiate the gradient update intensity of different model layers.

[0036] Step 4: In the backpropagation stage, perform hierarchical differentiated parameter updates based on the gradient routing mechanism. According to the gradient update weights calculated in Step 3, the gradients of each layer are weighted to achieve hierarchical differentiated control of model parameter updates. Step 4 specifically involves: Step 4.1: Obtain the original gradients of each layer of the model during the backpropagation phase. After completing the forward propagation and loss function calculation, calculate the original gradients corresponding to the parameters of each layer in the model during the backpropagation phase. The original gradients represent the gradient information of the model with respect to the loss function under the current training iteration, which are used to guide the direction of model parameter update. Step 4.2: Perform weighted routing of gradients for each layer of the model based on gradient updates, and update the weights according to the layer gradients obtained in Step 3. For the model number The original gradient of the layer We perform weighted processing to obtain the updated gradient after gradient routing. :

[0037] in, The model number is represented by the first... The original gradient calculated by the layer during the backpropagation phase, This represents the gradient update weights of the corresponding model layer. This represents the gradient after language-sensitive gradient routing control; Step 4.3: Utilize the weighted gradient The parameters of each layer of the model are updated to complete the parameter adjustment process of one training iteration. The parameter update process follows a preset optimization algorithm, including but not limited to stochastic gradient descent, Adam or its variants. Step 4.4: Perform gradient routing control while keeping the forward propagation structure of the model unchanged. During the entire gradient routing and parameter update process, the forward propagation structure, inference process and network topology of the model are not modified. Only the gradient is routed and weighted during the back propagation stage.

[0038] Step 5: Training feedback monitoring and convergence judgment, evaluate the performance of the target language task and the stability of the non-target language, and output the target language-oriented augmentation model.

[0039] Step 5 specifically involves: Step 5.1: During training, construct evaluation metrics for assessing the performance of the target language task and the stability of the non-target language task. The target language performance evaluation metric measures the learning effect of the model on the target language task, while the non-target language stability evaluation metric measures the performance retention of the model on the non-target language task. Step 5.2: In each training iteration or preset training cycle, the target language performance evaluation index and the non-target language stability evaluation index are monitored through the training feedback monitoring module. The changing trend of the model's performance on different language tasks during the training process is recorded to determine whether the model has experienced performance degradation or training instability. Step 5.3: Process the results based on the verification results of Steps 5.1 and 5.2.

[0040] When the convergence or stopping condition is not met, the training strategy is adjusted based on the training feedback results. The adjustment of the training strategy includes, but is not limited to, re-executing step 2 of language sensitivity analysis, step 3 of updating gradient update weights, or step 4 of adjusting gradient routing control parameters. When the convergence or stopping condition is met, the training process ends and a large language model with targeted enhancement of target language ability is output.

[0041] This invention addresses the common problems in existing multilingual large language models when enhancing capabilities for a specific target language, such as severe language transfer interference, degradation of capabilities in non-target languages, and uncontrollable overall parameter updates. It innovatively proposes a gradient routing-based directional training method based on hierarchical language sensitivity. First, a language sensitivity analysis module models the response characteristics of each layer's parameters under different language tasks, constructing the sensitivity level of each layer to the target language as the weight for gradient updates. Then, during the model's backpropagation phase, a gradient routing control mechanism is introduced to weight gradient updates at different layers, thereby achieving hierarchical differentiated control of parameter updates. This achieves targeted enhancement of target language capabilities without altering the model's forward structure and inference flow. The system includes a language sensitivity assessment module, a model layer gradient weight calculation module, a gradient routing control module, and a training feedback monitoring module, which can map general training tasks into a hierarchical optimization process targeting the target language. The core innovations of this invention are: 1) constructing a hierarchical language sensitivity modeling method to calculate the weights of the target language-related layers; 2) designing a language sensitivity gradient routing mechanism based on backpropagation to achieve targeted updates of model parameters; and 3) proposing a general training framework compatible with multiple training strategies, which effectively suppresses performance degradation of non-target languages ​​while improving target language capabilities. Thus, when performing targeted training for a specific language, it significantly reduces irrelevant perturbations to the parameter spaces of other languages ​​and effectively avoids the problems of limited representational power and decreased generalization performance caused by only fine-tuning specific language-sensitive layers.

[0042] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement a target language-oriented training method for a large language model based on language sensitivity and gradient routing.

[0043] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement a target language-oriented training method for a large language model based on language sensitivity and gradient routing. Specific Implementation Example 2: The only difference between Embodiment 2 and Embodiment 1 of this application is that: Combination Figure 1 This implementation method presents a target language-oriented training method for large language models based on language sensitivity and gradient routing, specifically including the following steps: Step 1. Enter the system, select and load the multilingual training data and model parameters; When the training system starts, it first enters the initialization state. In this step, the system reads a multilingual training dataset containing the target language through a preset data interface. The training data may include text sequences, language identifiers, and corresponding supervision signals. Simultaneously, it loads the parameters of a pre-trained large language model, which supports a multi-layer network structure and backpropagation training mechanism. The loaded training data and model parameters will serve as the basic input for subsequent language sensitivity analysis and gradient updates. This step is a preliminary step, and its results will be applied to steps 2 through 5.

[0045] Step 2: Perform language sensitivity analysis on each layer of the model and construct a hierarchical language sensitivity representation; This step is a preliminary step in the language sensitivity quantification analysis. Under the target language training task conditions, the system performs at least one training iteration on the model and records the weight changes of each layer's parameters before and after training. By calculating the magnitude of the change in the parameter weights of each layer and the rate of change relative to the initial weights, the parameter response degree of different model layers during the target language training process is characterized. The magnitude and rate of change of the parameter weights are used to characterize the sensitivity of each layer of the model to the target language task and serve as the basis for subsequent gradient weight calculations.

[0046] Step 3: Calculate the gradient update weights for each layer of the model corresponding to the target language; This step is the gradient weight generation step. Based on the parameter weight change ratios of each layer obtained in step 2, the system assigns corresponding gradient update weights to different layers in the model. Specifically, layers with larger parameter weight change ratios are assigned higher gradient update weights, and layers with smaller parameter weight change ratios are assigned lower gradient update weights, in order to achieve quantitative control over the intensity of model parameter updates. These gradient update weights will be used for gradient routing control during the backpropagation stage to achieve hierarchical differentiated updates of model parameters during target language training.

[0047] Step 4: Update the hierarchical differentiated parameters based on the gradient routing mechanism during the backpropagation phase; This step is the core execution step of model training. While maintaining the model's forward propagation structure and inference flow unchanged, the system introduces a language-sensitive gradient routing control mechanism during the backpropagation phase. Based on the gradient update weights calculated in step 3, the gradients of each layer are weighted. Specifically, layers with high target language sensitivity are given full or larger proportion of gradient updates, while non-sensitive layers are given decayed gradient updates, thus achieving hierarchical differential control of model parameter updates. This step effectively limits irrelevant perturbations to parameters not related to the target language.

[0048] Step 5: Training feedback monitoring and convergence judgment, output target language-oriented augmentation model; This step summarizes and controls the training results from step 4. The system uses a training feedback monitoring module to evaluate the performance on the target language task and the stability on non-target languages, determining whether the model has reached the preset convergence or stopping conditions. When the conditions are met, the training process ends and a large language model with targeted enhancement of target language capabilities is output; when the conditions are not met, the system returns to step 2 or step 3, readjusts the language sensitivity analysis and gradient weight allocation strategies, and continues iterative training.

[0049] Step one involves selecting and loading multilingual training data and model parameters. The specific implementation process includes the following steps: Step 1.1 Acquire and preprocess multilingual training data containing the target language: The system reads multilingual training datasets from local storage or remote data sources through a preset data interface. The training data contains at least text samples corresponding to the target language. Preprocessing operations are performed on the read data, including but not limited to text cleaning, character encoding standardization, language label verification, and sample format normalization, generating standardized training data representations. The processed data is then stored in the training cache for subsequent language sensitivity analysis and model training steps.

[0050] Step 1.2 Loading Pre-trained Large Language Model Parameters and Completing Model Initialization: Before training begins, the system loads the pre-trained large language model parameters. The model is a multi-layer neural network structure that supports multilingual input and backpropagation training mechanisms. During loading, the model parameters are verified for integrity, and model initialization settings are completed according to the training configuration, including parameter precision mode, gradient calculation switch, and training mode switching, to ensure the model can participate in subsequent target language-oriented training.

[0051] Step 1.3 Configure the target language training task and establish the training environment: After loading the model and data, the system configures the training environment according to the user-specified or preset target language training task, including target language identifier binding, training round parameter settings, and gradient update strategy initialization. Through this configuration, the model training process can revolve around the target language task, and a unified training condition and baseline state are provided for subsequent language sensitivity analysis based on parameter weight changes.

[0052] Combination Figure 2 To clarify, this implementation method differs from Implementation Method Two in that step two, which involves performing language sensitivity analysis on each layer of the model and constructing a hierarchical language sensitivity representation, specifically includes the following steps: Step 2.1 Perform benchmark training iterations and record model parameter states under the target language training task conditions: While keeping the model structure unchanged, the system performs at least one benchmark training iteration on the large language model for the target language training task, recording the initial weight values ​​of each layer of the model before training and the corresponding updated weight values ​​after the training iteration, for subsequent parameter change analysis. The model parameters include, but are not limited to, the weight matrix and bias vector of each layer.

[0053] Step 2.2 Calculate the absolute change magnitude of the parameter weights for each layer of the model: Based on the parameter states recorded in Step 2.1, the system calculates the absolute change magnitude of the parameter weights for each layer of the model. The calculation of the change magnitude of the layer's parameter weights is as follows:

[0054] in, The model number is represented by the first... The initial parameter weights of the layer before training in the target language. The model number is represented by the first... The corresponding parameter weights of the layer after performing the target language training iteration. This represents the norm operation used to measure the magnitude of parameter variation.

[0055] Step 2.3 Calculate the relative change rate of parameter weights in each layer of the model: After obtaining the change magnitude of parameter weights in each layer, the system further calculates the relative change rate of the model's parameters in the [missing information]. The relative change rate of layer parameter weights is used to eliminate the impact of differences in the scale of different layer parameters on the sensitivity assessment. The calculation method is as follows:

[0056] in, The model number is represented by the first... The percentage change in parameter weights of the layer under the target language training task. This is a preset smoothing constant used to avoid numerical instability when the denominator is zero.

[0057] Step 2.4 Constructing a hierarchical language sensitivity representation based on the parameter weight change ratio: The system uses the parameter weight change ratio of each layer obtained in Step 2.3 as a language sensitivity metric to construct a hierarchical language sensitivity representation of the model, which is used to characterize the responsiveness of different model layers to the target language training task. Model layers with larger change ratios are identified as target language sensitive layers, while model layers with smaller change ratios are identified as target language insensitive layers or low-sensitivity layers.

[0058] Step 2.5 Normalize the hierarchical language sensitivity representation: To facilitate subsequent gradient weight allocation and routing control, the system normalizes the language sensitivity representation of each layer of the model to obtain standardized language sensitivity weights. The normalization method includes, but is not limited to, linear normalization or scaling, so that the language sensitivity representation of different model layers meets the unified numerical range constraint.

[0059] Step 3 involves calculating the gradient update weights for each layer of the model corresponding to the target language. The specific steps are as follows: Step 3.1 Generate initial gradients and update weights based on hierarchical language sensitivity representation: The system updates the weights of each layer of the model based on the weight change ratios obtained in Step 2. , for the model The layer generates the corresponding initial gradient and updates the weights. Its calculation method is as follows:

[0060] in, The model number is represented by the first... Gradient update weights of the layer during target language training. It is a monotonically increasing mapping function used to map the rate of change of parameter weights to gradient update weights.

[0061] Step 3.2 Applying a normalized mapping function to numerically constrain the gradient update weights: To ensure the numerical stability of the gradient update process, the system normalizes the initial gradient update weights in the following manner:

[0062] in, This represents the total number of layers in the model. satisfy .

[0063] Step 3.3 Introducing a smoothing factor to adjust the gradient update weight distribution: Based on the weights calculated in Step 3.2, in some implementations, to prevent the gradient update weight distribution from becoming too concentrated, the system introduces a smoothing factor when calculating the gradient update weights. This is used to weigh the trade-off between target language-oriented augmentation and overall model stability, and its calculation method is as follows:

[0064] in, To smooth the control parameters, when When the gradient is large, the gradient update weights reflect language sensitivity differences more; when When the gradient is small, the gradient update weights tend to be evenly distributed.

[0065] Step 3.4 Construct hierarchical gradient update weight vectors and output them to the gradient routing module: After completing the weight calculation, the system updates the calculated gradient weights for each layer. A hierarchical gradient update weight vector is formed. This weight vector is then passed as a control parameter to the gradient routing control module in the backpropagation stage to differentiate the gradient update intensity for different model layers.

[0066] Combination Figure 3 To clarify, the backpropagation phase involved in step 4 updates the hierarchical differentiated parameters based on the gradient routing mechanism. The specific steps are as follows: Step 4.1 Obtain the original gradients of each layer of the model during the backpropagation phase: After completing the forward propagation and loss function calculation, the system calculates the original gradients corresponding to the parameters of each layer in the model during the backpropagation phase. The original gradients represent the gradient information of the model with respect to the loss function under the current training iteration, and are used to guide the direction of model parameter update.

[0067] Step 4.2 Weighted routing of gradients at each layer of the model based on gradient update weights: The system updates the weights according to the hierarchical gradients obtained in step 3. For the model number The original gradient of the layer We perform weighted processing to obtain the updated gradient after gradient routing. :

[0068] in, The model number is represented by the first... The original gradient calculated by the layer during the backpropagation phase, This represents the gradient update weights of the corresponding model layer. This represents the gradient after language-sensitive gradient routing control. Step 4.3 The system utilizes the weighted gradient The parameters of each layer of the model are updated to complete the parameter adjustment process for one training iteration. The parameter update process follows a preset optimization algorithm, including but not limited to stochastic gradient descent, Adam, or variants thereof.

[0069] Step 4.4 Perform gradient routing control while keeping the forward propagation structure of the model unchanged: During the entire gradient routing and parameter update process, the system does not modify the forward propagation structure, inference process and network topology of the model. It only performs gradient routing and weighting control during the back propagation stage, thereby ensuring the consistency and stability of the model's inference behavior.

[0070] Step five involves feedback monitoring and convergence assessment of the training processes in steps three and four. The specific steps are as follows: Step 5.1 Construct training performance evaluation metrics for target language and non-target language: During the training process, the system constructs evaluation metrics to assess the performance of the target language task and the stability of the non-target language task. The target language performance evaluation metric is used to measure the learning effect of the model on the target language task, and the non-target language stability evaluation metric is used to measure the performance retention of the model on the non-target language task.

[0071] Step 5.2 Real-time monitoring of model performance changes based on the training feedback monitoring module: In each training iteration or preset training cycle, the system monitors the target language performance evaluation index and the non-target language stability evaluation index through the training feedback monitoring module, records the performance change trend of the model in different language tasks during the training process, and uses this information to determine whether the model has experienced performance degradation or training instability.

[0072] Step 5.3 Based on the verification results of Steps 5.1 and 5.2, perform corresponding processing. When the system determines that the convergence or stopping conditions are not met, the training strategy is adjusted according to the training feedback results. The adjustment of the training strategy includes, but is not limited to, re-executing the language sensitivity analysis step (Step 2), updating the gradient update weights (Step 3), or adjusting the gradient routing control parameters (Step 4). When the convergence or stopping conditions are met, the system ends the training process and outputs a large language model with targeted enhancement of the target language capability.

[0073] This invention constructs a target language-oriented training system for large language models based on language-sensitive gradient routing, following predetermined steps. This system possesses good versatility and compatibility, and can be deployed on existing large language model training platforms or multilingual model fine-tuning frameworks, achieving plug-and-play functionality. The process of verifying the beneficial effects of this invention is detailed below: This embodiment follows Figure 1The process is as shown. The training system built based on this invention mainly includes three parts: a data input module, a model training module, and a training feedback monitoring module. The data input module is used to read the target language training data and complete data preprocessing; the model training module sequentially performs operations such as language sensitivity analysis, hierarchical gradient weight calculation, and gradient routing control; the training feedback monitoring module is used to monitor the performance changes of the target language and non-target languages, and to adjust and terminate the training process. Figure 4 The results show a comparison between the model trained using the system and the model trained directly with fine-tuning. Upon startup, the system built in this invention first loads a pre-trained large language model and its corresponding training configuration parameters. Then, the target language training data is input into the system, and the model enters the training state. During training, the system statistically analyzes the changes in parameters of each layer of the model under the target language task, calculating the magnitude and proportion of parameter changes in different network layers to characterize the responsiveness of each layer to the target language task. If any abnormality occurs during the above process, such as data entry error or model malfunction, the system training module will immediately terminate, exit the system, and report an error message. from Figure 4 The results show that after using the method of this invention to train a large language model with a target language (English) orientation, the model's performance on the target language task is significantly improved compared to direct fine-tuning training, while the performance changes on non-training language tasks remain within an acceptable range. This embodiment demonstrates that by differentially controlling the parameter update behavior of different layers of the model during training, the interference of target language training on other language abilities can be mitigated to some extent. The above description is merely a preferred embodiment of a target language-oriented training method for large language models based on language sensitivity and gradient routing. The scope of protection for this method is not limited to the above embodiments; all technical solutions falling within this framework are within the scope of protection of this invention. It should be noted that for those skilled in the art, any improvements and variations made without departing from the principles of this invention should also be considered within the scope of protection of this invention.

Claims

1. A target language-oriented training method for large language models based on language sensitivity and gradient routing, characterized by: The method includes the following steps: Step 1: Build the training system, and enter the system to select and load multilingual training data and model parameters; Step 2: Perform language sensitivity analysis on each layer of the model and construct a hierarchical language sensitivity representation. Record the changes in the weights of the parameters of each layer before and after training. By calculating the magnitude of the change in the weights of each layer and the ratio of the change relative to the initial weights, characterize the parameter response of different model layers during the target language training process. Step 3: Calculate the gradient update weights for each layer of the model corresponding to the target language. Based on the change ratio of the parameter weights of each layer obtained in Step 2, assign corresponding gradient update weights to different layers in the model to achieve hierarchical differential updates of model parameters during target language training. Step 4: In the backpropagation stage, perform hierarchical differentiated parameter updates based on the gradient routing mechanism. According to the gradient update weights calculated in Step 3, the gradients of each layer are weighted to achieve hierarchical differentiated control of model parameter updates. Step 5: Training feedback monitoring and convergence judgment, evaluate the performance of the target language task and the stability of the non-target language, and output the target language-oriented augmentation model.

2. The method according to claim 1, characterized in that: The training system includes a data input module, a model training module, and a training feedback monitoring module. The data input module is used to read the target language training data and complete data preprocessing. The model training module sequentially performs language sensitivity analysis, hierarchical gradient weight calculation, and gradient routing control operations. The training feedback monitoring module is used to monitor performance changes in the target language and non-target languages, and to adjust and terminate the training process.

3. The method according to claim 2, characterized in that: Step 1 specifically involves: Step 1.1: Acquire and preprocess multilingual training data containing the target language. Read the multilingual training dataset from local storage or remote data source through a preset data interface. The training data contains text samples corresponding to the target language. The read data is preprocessed, including but not limited to text cleaning, character encoding unification, language label verification, and sample format normalization, to generate standardized training data representations. The processed data is then stored in the training cache for subsequent language sensitivity analysis and model training steps. Step 1.2: Load the pre-trained large language model parameters and complete the model initialization. Before training begins, load the pre-trained large language model parameters. The model is a multi-layer neural network structure that supports multilingual input and backpropagation training mechanism. During the loading process, the integrity of the model parameters is checked, and the model initialization settings are completed according to the training configuration, including parameter precision mode, gradient calculation switch and training mode switching, to ensure that the model participates in the subsequent target language-oriented training process. Step 1.3: Configure the target language training task and establish the training environment. After the model and data are loaded, configure the training environment according to the target language training task specified by the user or preset. This includes target language identifier binding, training round parameter setting, and gradient update strategy initialization. This ensures that the model training process revolves around the target language task and provides a unified training condition and baseline state for subsequent language sensitivity analysis based on parameter weight changes.

4. The method according to claim 3, characterized in that: Step 2 specifically involves: Step 2.1: While keeping the model structure unchanged, perform at least one benchmark training iteration on the large language model for the target language training task. Record the initial weight values ​​of the parameters of each layer of the model before training and the corresponding updated weight values ​​after the training iteration, for subsequent parameter change analysis. The model parameters include, but are not limited to, the weight matrix and bias vector of each layer. Step 2.2: Based on the parameter states recorded in Step 2.1, adjust the model for the... The calculation of the change magnitude of the layer's parameter weights is as follows: in, The model number is represented by the first... The initial parameter weights of the layer before training in the target language. The model number is represented by the first... The corresponding parameter weights of the layer after performing the target language training iteration. This represents the norm operation used to measure the magnitude of parameter variation; Step 2.3: Calculate the relative change rate of the parameter weights in each layer of the model. After obtaining the magnitude of the change in the parameter weights in each layer, calculate the model's... The relative change rate of layer parameter weights is calculated as follows: in, The model number is represented by the first... The percentage change in parameter weights of the layer under the target language training task. This is a preset smoothing constant; Step 2.4: Use the change ratio of the parameter weights of each layer obtained in Step 2.3 as a language sensitivity metric to construct a hierarchical language sensitivity representation of the model, which is used to characterize the response of different model layers to the target language training task. The model layer with the largest change ratio is determined to be the target language sensitive layer, and the model layer with the smallest change ratio is determined to be the target language insensitive layer or low-sensitivity layer. Step 2.5: Normalize the language sensitivity representation of each layer of the model to obtain standardized language sensitivity weights. The normalization method includes, but is not limited to, linear normalization or scaling, so that the language sensitivity representation of different model layers meets the uniform numerical range constraint.

5. The method according to claim 4, characterized in that: Step 3 specifically involves: Step 3.1: Generate initial gradient update weights based on hierarchical language sensitivity representation, and update the weights based on the parameter weight change ratios of each layer of the model obtained in Step 2. , for the model The layer generates the corresponding initial gradient and updates the weights. : in, The model number is represented by the first... Gradient update weights of the layer during target language training. It is a monotonically increasing mapping function used to map the rate of change of parameter weights to gradient update weights; Step 3.2: Apply a normalized mapping function to numerically constrain the gradient update weights and normalize the initial gradient update weights: in, This represents the total number of layers in the model. satisfy ; Step 3.3: Introduce a smoothing factor to adjust the gradient update weight distribution. Based on the weights calculated in Step 3.2, a smoothing factor is introduced when calculating the gradient update weights. This is used to weigh the trade-off between target language-oriented augmentation and overall model stability, and its calculation method is as follows: in, To smooth the control parameters, when When the gradient updates weights at their maximum, they reflect language sensitivity differences more effectively; when... When the gradient update weights are at their minimum, they tend to be uniformly distributed. Step 3.4: Construct the hierarchical gradient update weight vector and output it to the gradient routing module. After completing the weight calculation, update the calculated gradient weights for each layer. A hierarchical gradient update weight vector is formed, and the weight vector is passed as a control parameter to the gradient routing control module in the backpropagation stage to differentiate the gradient update intensity of different model layers.

6. The method according to claim 5, characterized in that: Step 4 specifically involves: Step 4.1: Obtain the original gradients of each layer of the model during the backpropagation phase. After completing the forward propagation and loss function calculation, calculate the original gradients corresponding to the parameters of each layer in the model during the backpropagation phase. The original gradients represent the gradient information of the model with respect to the loss function under the current training iteration, which are used to guide the direction of model parameter update. Step 4.2: Perform weighted routing of gradients for each layer of the model based on gradient updates, and update the weights according to the layer gradients obtained in Step 3. For the model number The original gradient of the layer We perform weighted processing to obtain the updated gradient after gradient routing. : in, The model number is represented by the first... The original gradient calculated by the layer during the backpropagation phase. This represents the gradient update weights of the corresponding model layer. This represents the gradient after language-sensitive gradient routing control; Step 4.3: Utilize the weighted gradient The parameters of each layer of the model are updated to complete the parameter adjustment process of one training iteration. The parameter update process follows a preset optimization algorithm, including but not limited to stochastic gradient descent, Adam or its variants. Step 4.4: Perform gradient routing control while keeping the forward propagation structure of the model unchanged. During the entire gradient routing and parameter update process, the forward propagation structure, inference process and network topology of the model are not modified. Only the gradient is routed and weighted during the back propagation stage.

7. The method according to claim 6, characterized in that: Step 5 specifically involves: Step 5.1: During training, construct evaluation metrics for assessing the performance of the target language task and the stability of the non-target language task. The target language performance evaluation metric measures the learning effect of the model on the target language task, while the non-target language stability evaluation metric measures the performance retention of the model on the non-target language task. Step 5.2: In each training iteration or preset training cycle, the target language performance evaluation index and the non-target language stability evaluation index are monitored through the training feedback monitoring module. The changing trend of the model's performance on different language tasks during the training process is recorded to determine whether the model has experienced performance degradation or training instability. Step 5.3: Process the results based on the verification results of Steps 5.1 and 5.

2.

8. The method according to claim 7, characterized in that: When the convergence or stopping condition is not met, the training strategy is adjusted based on the training feedback results. The adjustment of the training strategy includes, but is not limited to, re-executing step 2 of language sensitivity analysis, step 3 of updating gradient update weights, or step 4 of adjusting gradient routing control parameters. When the convergence or stopping condition is met, the training process ends and a large language model with targeted enhancement of target language ability is output.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the method as claimed in any one of claims 1-8.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the method of any one of claims 1-8.