A method and system for early warning of recursive training crashes in large language models based on dual-index joint monitoring
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-01
- Publication Date
- 2026-08-14
AI Technical Summary
[0003]然而,上述现有技术在大语言模型使用自身生成数据进行递归训练的场景下,均存在显著的局限性,无法实现有效的早期预警
1、针对特定场景:首次专门针对大语言模型使用自身生成数据进行递归训练的场景设计预警方法,解决了该场景下现有技术预警滞后的问题。
Smart Images

Figure CN122570294A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence security and model monitoring technology, specifically to a large language model recursive training crash early warning system based on dual-indicator joint monitoring. Background Technology
[0002] In the training of Large Language Models (LLMs), to alleviate the problem of scarce real-world data, recursive training using model-generated data (synthetic data) to expand the training set has become a mainstream technique. Currently, to ensure the stability of this training process, the industry commonly uses macroscopic performance metrics such as validation loss or perplexity to assess the model's state. Meanwhile, some advanced monitoring techniques attempt to address the model's internal structure, such as evaluating model health by analyzing the spectral distribution of the weight matrix: Martin and Mahoney's HTSR theory characterizes the model's state by monitoring the fat-tailed exponent of the singular value distribution of the weight matrix; Dohare et al. detect signs of model degradation by monitoring changes in the eigenvalues of the covariance matrix; and there are methods that monitor representation space diversity by calculating the entropy of the model's embedding representation Gram matrix. These techniques collectively constitute the main technical paths of existing model training monitoring systems.
[0003] However, the aforementioned existing technologies all have significant limitations in scenarios where large language models use self-generated data for recursive training, failing to achieve effective early warning. Specifically: First, model collapses during recursive training are often irreversible, and by the time macro-indicators such as validation loss detect a sharp decline in performance, the model has already entered an irreversible degradation phase, resulting in a severe delay in early warning. Second, although the fat-tailed index can reflect the distribution of model weights, existing methods (such as HTSR theory) are not optimized for the specific scenario of recursive self-generated data. They use a fixed tail ratio to calculate the fat-tailed index at different training stages, leading to inconsistent sensitivity of the index at different degradation stages, and thus its failure. Third, both covariance eigenvalue monitoring and Gram matrix entropy monitoring are single-indicator monitoring, lacking joint consideration of degradation signals at different levels of the model (such as weight matrix and embedding representation), and failing to utilize the temporal differences in the decline of various indicators before collapse, resulting in late warnings or a high false alarm rate.
[0004] Therefore, there is an urgent need for a method that can provide earlier and more accurate crash warnings by taking into account the recursive training characteristics of large language models themselves, so as to provide an effective intervention window before the model performance undergoes irreversible degradation. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides a method and system for early warning of recursive training collapse of large language models based on joint monitoring of dual indicators. By jointly monitoring the fat-tailed exponent of the weight matrix and the Gram matrix log determinant of the embedding matrix, and utilizing the temporal difference in their descent and the theoretically derived critical value, accurate early warning thousands of steps in advance can be achieved.
[0006] The technical solution of this invention is: To achieve the above objectives, this invention provides a method for early warning of recursive training collapse of large language models based on joint monitoring of dual indicators, comprising the following steps: Data acquisition steps: During the recursive training of the large language model, the weight matrix of at least one fully connected layer and the embedding matrix of the model output layer are periodically collected.
[0007] The first index calculation step is to perform singular value decomposition on the weight matrix and calculate the first index used to characterize the thickness of the tail of the model weights based on the singular value distribution.
[0008] The second index calculation step is as follows: calculate the Gram matrix of the embedding matrix, and calculate the second index used to characterize the spatial volume represented by the model based on the eigenvalues of the Gram matrix.
[0009] Threshold generation step: Based on the historical sliding window statistics of the first indicator and the second indicator, generate a first dynamic threshold corresponding to the first indicator and a second dynamic threshold corresponding to the second indicator.
[0010] Joint early warning steps: Monitor the changing trends of the first indicator and the second indicator. When the first indicator drops below the first dynamic threshold and the second indicator has not yet dropped below the second dynamic threshold, generate a first early warning signal. When the first indicator drops below the first dynamic threshold and the second indicator drops below the second dynamic threshold at the same time, generate a second early warning signal.
[0011] Intervention steps: Implement corresponding intervention measures according to the warning level.
[0012] Preferably, the first index is the fat-tailed index κ, and the step of calculating the first index based on the singular value distribution includes: performing singular value decomposition on the weight matrix to obtain a descending sequence of singular values σ1≥σ2≥ …≥σ r The fat-tail index κ is calculated using the Hill estimator:
[0013] Where r is the total number of singular values, p is the preset tail ratio, which means selecting the k smallest singular values as the tail.
[0014] Preferably, the calculation of the fat-tailed index κ uses an adaptive tail selection algorithm, including: traversing the candidate tail proportion range (preferably 5% to 20%, with a step size of 1%), calculating the corresponding κ value for each candidate tail proportion, smoothing the κ value sequence and finding a region with stable values, and if a stable region exists, taking the κ value corresponding to that region; otherwise, taking the median of the κ values corresponding to all candidate tail proportions as the final κ value.
[0015] Preferably, the second index is the log determinant L of the Gram matrix, and the step of calculating the second index based on the eigenvalues of the Gram matrix includes: obtaining the embedding matrix M, M∈R d×n Calculate the Gram matrix G = M·M T After adding the regularization term ε, the eigenvalues of the Gram matrix are calculated. Calculate the logarithmic determinant:
[0016] The L is then smoothed using an exponential moving average, with a smoothing coefficient preferably being 0.9.
[0017] Preferably, the dynamic threshold is generated as follows: maintain a historical queue of the first indicator and the second indicator at the most recent preset number of collection times (preferably 500 collection times), calculate the moving average and moving standard deviation of each indicator respectively, and use the moving average minus a multiple of the moving standard deviation as the corresponding dynamic decreasing threshold; wherein, the multiple of the second indicator is greater than the multiple of the first indicator, so as to adapt to the left-skewed distribution of the second indicator.
[0018] Preferably, the multiple of the first indicator is 2, and the multiple of the second indicator is 3, that is, the first dynamic threshold thresh κ = μ κ - 2σ κ The second dynamic threshold thresh L = μ L - 3σ L , where μ κ and σ κ These are the moving mean and moving standard deviation of the first indicator, respectively, μ L and σ L These are the moving mean and moving standard deviation of the second indicator, respectively.
[0019] Preferably, the joint early warning step further includes: when the first indicator drops below a preset absolute threshold and the second indicator shows a continuous downward trend, generating a third early warning signal, wherein the level of the third early warning signal is higher than that of the second early warning signal. The preset absolute threshold is preferably 1.5; the rule for determining that the second indicator shows a continuous downward trend is: in the most recent preset number of data collection times (preferably 100 data collection times), the number of data collection times where the value of the second indicator at the current time is less than the value of the second indicator at the previous time reaches a preset percentage threshold (preferably 80%).
[0020] Preferably, the intervention steps specifically include: in response to the first warning signal, reducing the learning rate to 0.5 times the original value and increasing the dropout rate by 0.1; in response to the second warning signal, stopping training, loading the most recently saved model checkpoints, reducing the proportion of self-generated data in the training dataset by 20%, resetting the optimizer state, and continuing training; in response to the third warning signal, immediately stopping training, saving the current model state, and sending a notification to the administrator.
[0021] This invention also provides a large language model recursive training crash early warning system based on dual-index joint monitoring, comprising: The data acquisition module is used to periodically collect the weight matrix of at least one fully connected layer and the embedding matrix of the model output layer during the recursive training process of the large language model. The first index calculation module is used to perform singular value decomposition on the weight matrix and calculate a first index to characterize the thickness of the tail of the model weights based on the singular value distribution. The second index calculation module is used to calculate the Gram matrix of the embedding matrix and calculate a second index to characterize the spatial volume of the model based on the eigenvalues of the Gram matrix. The threshold generation module is used to generate a first dynamic threshold corresponding to the first indicator and a second dynamic threshold corresponding to the second indicator based on the historical sliding window statistical values of the first indicator and the second indicator, respectively. The joint early warning module is used to monitor the changing trends of the first indicator and the second indicator. When the first indicator drops below the first dynamic threshold and the second indicator has not yet dropped below the second dynamic threshold, a first early warning signal is generated; when the first indicator drops below the first dynamic threshold and the second indicator drops below the second dynamic threshold at the same time, a second early warning signal is generated.
[0022] Preferably, the system further includes an intervention execution module for executing corresponding intervention measures based on the warning level.
[0023] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any of the preceding claims.
[0024] The beneficial effects of this invention are: 1. Targeting specific scenarios: For the first time, an early warning method is designed specifically for scenarios where large language models use their own generated data for recursive training, which solves the problem of lagging early warning in existing technologies in this scenario.
[0025] 2. Adaptive tail selection: It overcomes the problem of fixed tail ratio failing at different stages of recursive training and improves the robustness of fat tail index calculation.
[0026] 3. Dual-indicator joint monitoring: Utilizing the time-series law of the fat-tail index decreasing before the Gram matrix log determinant decrease, which was first discovered in this invention, a three-level early warning rule is designed to achieve earlier and more accurate early warning.
[0027] 4. Theoretical-driven threshold: Based on the Kesten-Goldie theorem, the critical value of the fat-tailed index κ is derived to be 1.5. Based on the distribution hypothesis test, a 2σ / 3σ differential threshold is designed, which has theoretical depth and avoids empirical parameter tuning. Attached Figure Description
[0028] Figure 1 This is a structural diagram of the module of the present invention; Figure 2 This is a flowchart of the adaptive tail selection algorithm of the present invention; Figure 3 This is a flowchart of the joint early warning and dynamic threshold generation process of the present invention; Figure 4 This is a comparison of the number of initial warning steps for different methods of the present invention on different models; Figure 5 This is a comparison of the false alarm rate and false negative rate of different methods of the present invention; Figure 6 This is a comparative ablation experiment of the present invention; Figure 7 This is a parameter sensitivity analysis of the present invention; Figure 8 This is a comparison of the ROC curves of this invention; Figure 9 This invention relates to the trend of the two indicators changing over time. Detailed Implementation
[0029] The embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0030] Example 1 In the process of recursively training large language models using self-generated data, the model faces a new type of collapse risk—recursive training collapse on self-generated data. This occurs when the model is repeatedly trained on datasets containing self-generated data, causing the representation space to gradually shrink, the distribution tails to thin, and ultimately leading to a loss of generalization ability. Existing monitoring methods, such as validation loss or perplexity, detect problems when the model has already irreversibly degraded. Single-metric monitoring methods, such as HTSR theory, Dohare covariance monitoring, or Gram matrix entropy monitoring, all suffer from delayed warnings or high false alarm rates. To address these technical issues, this application provides a large language model recursive training collapse early warning method based on dual-metric joint monitoring.
[0031] A method for early warning of recursive training collapse of a large language model based on joint monitoring of two indicators includes the following steps: Data acquisition: During the recursive training of the large language model, the weight matrix of at least one fully connected layer and the embedding matrix of the model output layer are periodically collected; First indicator calculation: Singular value decomposition is performed on the weight matrix, and a first indicator is calculated based on the singular value distribution to characterize the thickness of the tail of the model weights; Second indicator calculation: The Gram matrix of the embedding matrix is calculated, and a second indicator is calculated based on the eigenvalues of the Gram matrix to characterize the volume of the model representation space; Threshold generation: Based on the historical sliding window statistics of the first indicator and the second indicator, a first dynamic threshold corresponding to the first indicator and a second dynamic threshold corresponding to the second indicator are generated respectively; Joint early warning: The changing trends of the first indicator and the second indicator are monitored. When the first indicator drops below the first dynamic threshold and the second indicator has not yet dropped below the second dynamic threshold, a first early warning signal is generated; when the first indicator drops below the first dynamic threshold and the second indicator drops below the second dynamic threshold at the same time, a second early warning signal is generated.
[0032] Specifically, in the data acquisition step, during the recursive training of the large language model, the training system performs a data acquisition operation every fixed number of training steps (e.g., every 100 training steps). The acquired data includes the weight matrix of at least one fully connected layer and the embedding matrix of the model's output layer. The fully connected layer is a key component of the Transformer architecture, and the distribution characteristics of its weight matrix reflect the model's learning state. The embedding matrix of the output layer records the model's representation information of the input sequence, and its geometric structure reflects the diversity of the representation space. In practical applications, the weight matrices of the last three fully connected layers can be selected because deep networks are more sensitive to model degradation; the dimension of the embedding matrix can be set to d×n, where n is the number of sampled tokens (e.g., 1024) and d is the embedding dimension (e.g., 4096). This application does not limit this.
[0033] Specifically, in the first metric calculation step, singular value decomposition (SVD) is performed on the collected weight matrix to obtain a set of singular values arranged in descending order. Singular value decomposition is a matrix factorization method that decomposes the weight matrix into a product of singular values and singular vectors, where the magnitude of the singular values reflects the energy distribution of the matrix in different directions. Based on the distribution characteristics of these singular values, a first metric can be calculated to characterize the thickness of the tail of the model weights. During normal training, the singular value distribution of the weight matrix exhibits a thick tail, indicating that the model has learned rich long-tail features; as the model begins to degenerate, the tail gradually thins, and the first metric decreases accordingly.
[0034] Specifically, in the second index calculation step, the Gram matrix is calculated for the collected embedding matrix, which is the product of the embedding matrix and its transpose. The geometric meaning of the Gram matrix is to represent the inner product between vectors in the space; its diagonal elements reflect the magnitude of each vector, and its off-diagonal elements reflect the angle between vectors. Based on the eigenvalues of the Gram matrix, a second index can be calculated to characterize the volume of the model's representation space. Specifically, the product of the Gram matrix's eigenvalues (i.e., the determinant) reflects the volume of the hypercube spanned by the representation space; taking the logarithm yields the logarithmic determinant. The larger this index, the richer and more diverse the representation space; when the model degenerates, the representation space shrinks, and the second index decreases accordingly.
[0035] Specifically, in the threshold generation step, a historical queue of the first and second indicators for the most recent preset number of data collection times is maintained, for example, data from the most recent 500 data collection times. Based on this historical queue, the moving average and moving standard deviation of the first and second indicators are calculated respectively. Then, the moving average minus a multiple of the moving standard deviation is used as the corresponding dynamic decreasing threshold. This dynamic threshold generation method can adapt to the normal fluctuations of the model state during training, avoiding the problem of fixed thresholds becoming invalid at different training stages.
[0036] Specifically, in the joint early warning step, the system monitors the changing trends of the first and second indicators in real time. When the first indicator falls below the first dynamic threshold, while the second indicator has not yet fallen below the second dynamic threshold, a first early warning signal is generated. At this point, the model's weight distribution has begun to degrade, but the representation space has not yet shrunk significantly, providing a valuable window for early intervention. When the first indicator falls below the first dynamic threshold, and the second indicator simultaneously falls below the second dynamic threshold, a second early warning signal is generated. At this point, the model has entered a more severe degradation stage, requiring stronger intervention measures.
[0037] Working principle This method achieves tiered early warning by jointly monitoring a first indicator at the weight level and a second indicator at the representation level, leveraging the difference in their decline timing before model collapse (i.e., the first indicator declines before the second indicator). The first warning signal captures early degradation signals, while the second warning signal confirms a severe degradation state.
[0038] This application achieves earlier and more accurate crash warnings than existing single-indicator monitoring methods. By leveraging the temporal differences between the two indicators, it can issue early warning signals before the model enters irreversible degradation, providing a sufficient time window for intervention. The introduction of dynamic thresholds improves the robustness of the warnings and reduces the false alarm rate.
[0039] Example 2 Based on the method described in Example 1, it is necessary to further clarify the specific meaning and calculation method of the first indicator. Although the concept of fat-tailed index exists in the prior art, it is usually calculated using a fixed tail ratio, resulting in inconsistent sensitivity at different training stages. Therefore, this application further defines the specific form of the first indicator and its calculation method.
[0040] Specifically, the first indicator is the fat-tailed index κ, and the step of calculating the first indicator based on the singular value distribution includes: performing singular value decomposition on the weight matrix to obtain a descending sequence of singular values σ1≥σ2≥ …≥σ r The fat-tail index κ is calculated using the Hill estimator:
[0041] Where r is the total number of singular values, p is the preset tail ratio, which means selecting the k smallest singular values as the tail.
[0042] In this embodiment, the first indicator is specifically the fat-tailed index κ. The fat-tailed index is an important parameter in statistics used to measure the thickness of the tail of a probability distribution; a smaller value indicates a thicker tail, and vice versa. In the field of deep learning, the tail thickness of the singular value distribution of the weight matrix reflects the richness of the long-tailed features learned by the model. Normally trained models have thicker tails (smaller κ), while degenerate models have thinner tails (larger κ).
[0043] To calculate the fat-tailed exponent κ, we first perform singular value decomposition on the weight matrix, obtaining a descending sequence of singular values σ1≥σ2≥ … ≥ σ r , where r equals the smaller of the number of rows and columns in the weight matrix. Then, the number of tail singularities is determined according to the preset tail proportion p. This means rounding down. The preset tail ratio p can be 10%, which means selecting the smallest 10% of singular values as the tail.
[0044] Next, the fat-tailed exponent κ is calculated using the Hill estimator. The Hill estimator is a classic method in extreme value theory for estimating tail exponents. In the formula, the numerator part... The calculation is the logarithmic mean of the last k singular values, minus The κ value is obtained by taking the reciprocal of the logarithm of the singular values at the tail region boundary. Since the tail singular values reflect the directions with lower energy in the weight matrix, these directions correspond to the fine features learned by the model. Therefore, monitoring changes in these singular values can effectively provide early warning of model degradation.
[0045] Working principle This computational method extracts tail singular values representing the model's fine-grained features by performing singular value decomposition on the weight matrix. It then uses the Hill estimator to compress this tail information into a single fat-tailed index, κ. When the model begins to degenerate, the tail singular values decrease, leading to an increase in the κ value (thinning of the tail), thus triggering an early warning.
[0046] The fat-tailed exponent κ is calculated using the Hill estimator, which can accurately quantify the tail thickness of the singular value distribution of the weight matrix, providing a reliable quantitative indicator for early warning of model degradation. This method has a statistical theoretical basis, high computational efficiency, and is suitable for real-time monitoring during training.
[0047] Example 3 Based on the method described in Example 2, fixing the tail ratio p may lead to instability in the calculation of the fat-tailed index κ at different training stages. For example, the tail characteristics of the singular value distribution may differ significantly between the early and late stages of training, and the fixed tail ratio cannot adapt to this change. To address this, this application further provides an adaptive tail selection algorithm.
[0048] Specific implementation method Specifically, the calculation of the fat-tailed index κ employs an adaptive tail selection algorithm, which includes: traversing the range of candidate tail proportions, calculating the corresponding κ value for each candidate tail proportion, smoothing the κ value sequence, and searching for a region with stable values. If a stable region exists, the κ value corresponding to that region is taken; otherwise, the median of the κ values corresponding to all candidate tail proportions is taken as the final κ value.
[0049] In this embodiment, to overcome the problem of fixed tail ratio failing at different training stages, an adaptive tail selection algorithm is used to dynamically determine the optimal tail ratio. The specific steps are as follows: The first step is to determine the range of candidate tail proportions. For example, from 5% to 20%, iterate through the range in increments of 1%, resulting in 16 candidate tail proportion values p1, p2, ..., p 16 .
[0050] The second step is to determine the tail proportion p for each candidate.i Calculate the corresponding κ(p) according to the method described in Example 2. i ) values, to obtain the κ value sequence.
[0051] The third step is to smooth the κ value sequence, for example, by using a Savitzky-Golay filter with a window length of 5 and a polynomial order of 2, to eliminate fluctuations caused by noise. For the boundary points at both ends of the sequence, mirror padding can be used.
[0052] The fourth step is to calculate the adjacent differences d of the smoothed sequence. i = |κ(p i+1 ) - κ(p i Then, we search for numerically stable regions. The criterion for a stable region is: there exists a certain p. i Make d i < 0.1·κ(p i Furthermore, the condition is satisfied for three consecutive subsequent points. The existence of this stable region indicates that the κ value is not sensitive to changes in the tail proportion within this tail proportion range, suggesting that the κ value corresponding to this range is robust.
[0053] Fifth step: If such a stable region exists, then take the κ(p) corresponding to that region. i The final fat-tail index κ is taken as the ratio of the tail proportions. If no stable region is found after traversing all candidate proportions, then the κ(p) corresponding to the tail proportions of all candidate proportions is taken. i The median of the α-threshold is used as the final fat-tailed index κ. Using the median as a backoff strategy can effectively avoid the interference of extreme values.
[0054] Working principle This algorithm iterates through different tail ratios to find the region where the κ value is least sensitive to changes in the tail ratio, and selects the corresponding κ value in this region as the final result. This allows for automatic selection of the most suitable tail ratio at different training stages, ensuring the stability and reliability of the κ index.
[0055] The adaptive tail selection algorithm effectively solves the problem of fixed tail ratios failing at different training stages, improving the robustness and accuracy of fat-tailed index κ calculation. This algorithm can automatically adapt to changes in the training process, ensuring that the κ index accurately reflects the model state throughout the entire training process.
[0056] Example 4 Based on the method described in Example 1, it is necessary to further clarify the specific meaning and calculation method of the second index. The Gram matrix of the embedded matrix can effectively characterize the geometric structure of the representation space, but its direct calculation suffers from numerical instability. Therefore, this application further defines the specific form of the second index and its calculation method.
[0057] Specifically, the second index is the log determinant L of the Gram matrix, and the step of calculating the second index based on the eigenvalues of the Gram matrix includes: obtaining the embedding matrix M, M∈R d×n Calculate the Gram matrix G = M·M T After adding the regularization term ε, the eigenvalues of the Gram matrix are calculated. Calculate the logarithmic determinant: And L is smoothed by exponential moving average.
[0058] In this embodiment, the second metric is specifically the log determinant L of the Gram matrix. The log determinant of the Gram matrix is an important metric used in information theory and geometry to measure the volume of a point cloud. Its size reflects the volume of the hypercube spanned by the embedding representation in the representation space. The larger the volume, the richer and more diverse the representation space.
[0059] The specific calculation process is as follows: First, obtain the embedding matrix M, which has a dimension of d×n, where d is the embedding dimension (e.g., 4096) and n is the number of sampled tokens (e.g., 1024). In practical applications, the embedding matrix of the last output layer can be selected because the representation of the last layer is closest to the model's output decision and best reflects the model's generalization ability.
[0060] Then, calculate the Gram matrix G = M·M T This yields a d×d square matrix. Each element of the Gram matrix is the inner product of two embedding vectors, thus containing information about the angles and lengths between all vectors in the representation space.
[0061] Next, add a regular expression term ε (e.g., with a value of 10). {-8} Then calculate the eigenvalues of the Gram matrix. The regularization term is added to avoid the logarithm from zero eigenvalues leading to infinity, and also to enhance numerical stability. In practical applications, since the rank of the Gram matrix is at most n (usually n is much smaller than d), only n non-zero eigenvalues need to be calculated. Stochastic numerical linear algebra methods (such as stochastic SVD or Nyström approximation) can be used to approximate the log determinant to improve computational efficiency.
[0062] Next, calculate the log determinant L = Σlog(λ) j + ε), which means summing the logarithms of all eigenvalues. Since the determinant is equal to the product of the eigenvalues, summing the logarithms avoids numerical overflow.
[0063] Finally, L is smoothed using an exponential moving average: Initial value Smoothing can eliminate noise fluctuations caused by single sampling, making the trend of change clearer. In practical applications, the first 10 sampling steps can be used as a warm-up period, during which no warnings are triggered to ensure that the smoothed values are fully established.
[0064] Working principle This method quantifies the volume of the representation space within the embedding space by calculating the eigenvalues of the embedding matrix Gram and then its log determinant. When the model degenerates, the representation space shrinks, and the embedding vectors of different samples tend to be similar, resulting in smaller eigenvalues of the Gram matrix and a corresponding decrease in the log determinant L.
[0065] The log determinant L is an effective indicator of spatial volume, and its changing trend can accurately reflect the degradation process of the model's generalization ability. The addition of a regularization term ensures the numerical stability of the calculation, and the exponential moving average smoothing eliminates noise fluctuations, improving the reliability of the indicator.
[0066] Example 5 Based on the method described in Example 1, the specific method for generating the dynamic threshold needs further clarification. Existing technologies typically use fixed thresholds, which cannot adapt to the natural fluctuations in the model's state during training, resulting in a high false positive rate. Therefore, this application further specifies the method for generating the dynamic threshold.
[0067] Specifically, the dynamic threshold is generated as follows: maintain historical queues of the first indicator and the second indicator at the most recent preset number of collection times, calculate the moving average and moving standard deviation of each indicator respectively, and subtract a multiple of the moving standard deviation from the moving average as the corresponding dynamic decreasing threshold; wherein, the multiple of the second indicator is greater than the multiple of the first indicator, in order to adapt to the left-skewed distribution of the second indicator.
[0068] In this implementation, the dynamic threshold is generated based on historical sliding window statistics. Specifically, the system maintains a historical queue of capacity T (e.g., T=500) to store the first and second index values from the most recent T data collection times.
[0069] For the first indicator, calculate its moving average μ. κ(t) and sliding standard deviation σ κ(t) :
[0070] Then, subtracting 'a' times the moving standard deviation from the moving mean is used as the first dynamic descent threshold: thresh κ = μ κ -a·σ κ Where 'a' is a positive number, for example, a value of 2.
[0071] For the second indicator, a similar calculation method is used, but with a different multiple b (b > a): thresh L = μ L - b·σ L This differentiated fold design is intended to accommodate the left-skewed distribution of the second indicator. Statistical analysis shows that the distribution of the second indicator (log determinant L) is left-skewed, meaning it has a long left tail. Therefore, a larger fold (e.g., b=3, corresponding to a significance level of approximately 0.3%) is needed to improve specificity and reduce the false alarm rate. The first indicator, on the other hand, approximately follows a normal distribution, and a smaller fold (e.g., a=2, corresponding to a significance level of approximately 2.5%) is sufficient to achieve a good early warning effect.
[0072] When the number of data collection points is less than T, the moving average and standard deviation can be calculated using existing data. Once enough data has been accumulated, the full historical window can be enabled.
[0073] Working principle This method dynamically calculates the decline threshold using sliding window statistics, allowing the threshold to adapt to the normal fluctuation range of the model's state during training. When the current value of either the first or second indicator deviates significantly from its historical mean (exceeding a certain multiple of the standard deviation), it is judged as an abnormal decline, triggering an alert. The design of the differential multiple takes into account the different statistical distribution characteristics of the two indicators.
[0074] The dynamic threshold generation method can adapt to changes in the training process, avoiding the problem of fixed thresholds becoming ineffective at different stages. The design of differentiated multiples (using a larger multiple for the second metric) effectively reduces the false alarm rate and improves the accuracy of early warnings.
[0075] Example 6 Building upon the methods described above, it is necessary to further clarify the specific value of the differentiation factor. Theoretical analysis and experimental verification show that different factor values affect the sensitivity and specificity of the early warning system. Therefore, this application further specifies the exact value of the factor.
[0076] Specifically, the multiple of the first indicator is 2, and the multiple of the second indicator is 3, that is, the first dynamic threshold thresh κ = μ κ - 2σ κ The second dynamic threshold thresh L = μ L - 3σ L , where μ κ and σ κ These are the moving mean and moving standard deviation of the first indicator, respectively, μ L and σ L These are the moving mean and moving standard deviation of the second indicator, respectively.
[0077] In this embodiment, the multiple of the first indicator is 2, and the multiple of the second indicator is 3. This value is based on the following theoretical basis and experimental verification: For the first metric (fat-tailed index κ), statistical analysis shows that it approximately follows a normal distribution during normal training. Based on the properties of a normal distribution, the probability that a data point falls below the mean minus two standard deviations is approximately 2.5%. Therefore, the first dynamic threshold is set to μ. κ - 2σ κ It can detect abnormal declines at a significance level of approximately 2.5%, ensuring both the sensitivity of the early warning system and minimizing false alarms.
[0078] For the second indicator (log determinant L), statistical analysis shows that its distribution exhibits a left-skewed characteristic, meaning it has a long left tail. Therefore, using the same multiple as the first indicator would lead to a high false alarm rate. Through theoretical analysis and experimental verification, setting the multiple to 3 can reduce the significance level to approximately 0.3%, thereby effectively reducing the false alarm rate. Experimental results show that with a 2σ / 3σ differential multiple setting, the false alarm rate of this invention can be reduced to below 2%.
[0079] In practical applications, the value of the multiplier can be adjusted within a certain range. For example, the multiplier for the first indicator can be selected between 1.5σ and 2.5σ, and the multiplier for the second indicator can be selected between 2.5σ and 3.5σ, both of which can achieve good early warning effects. This application does not limit this aspect.
[0080] Working principle By setting different threshold multiples for the first and second indicators, and utilizing the different statistical distribution characteristics of the two indicators, differentiated anomaly detection standards are achieved: the first indicator uses a more lenient standard (2σ) to ensure the sensitivity of early warning, while the second indicator uses a more stringent standard (3σ) to reduce the false alarm rate.
[0081] The 2σ / 3σ differential threshold setting is one of the key parameters of this invention. Experimental verification shows that it can keep the false alarm rate at an extremely low level (below 2%) while ensuring a high recall rate, thus achieving the optimal balance between sensitivity and specificity.
[0082] Example 7 Building upon the methods described above, when model degradation worsens, higher-level early warning signals are needed to address emergencies. Current technologies lack multi-level early warning mechanisms and cannot implement tiered responses based on the degree of degradation. Therefore, this application further provides a third early warning signal.
[0083] Specifically, the joint early warning step further includes: when the first indicator drops below 1.5 and the second indicator shows a continuous downward trend, a third early warning signal is generated, wherein the level of the third early warning signal is higher than that of the second early warning signal.
[0084] In this embodiment, in addition to the first and second warning signals, a third warning signal is added, which is the highest level and indicates that the model is in a seriously dangerous state.
[0085] The triggering conditions for the third warning signal consist of two parts: the first condition is that the first indicator (fat-tail index κ) drops below 1.5; the second condition is that the second indicator (log determinant L) shows a continuous downward trend.
[0086] The threshold of 1.5 in the first condition has important theoretical basis. According to the Kesten-Goldie theorem, when the Lyapunov exponent of a random matrix product is zero, the corresponding critical fat-tailed exponent value is 1.5. Experimental verification shows that when the fat-tailed exponent κ drops below 1.5, the model's generalization ability will decrease sharply, entering the most dangerous stage before collapse. Therefore, 1.5 is a theoretically significant critical value.
[0087] The second condition requires the second indicator to show a continuous downward trend, reflecting a continuous contraction of the representation space. The determination of a continuous downward trend can be achieved in various ways, such as comparing the L values at multiple consecutive data collection times and counting whether the number of decreases reaches a preset proportion. Specific determination rules will be further defined in Example 8.
[0088] When both conditions are met simultaneously, a third warning signal is generated. This signal is of a higher level than the second warning signal, indicating that the most urgent intervention measures need to be taken immediately, such as stopping training and notifying the administrator for manual diagnosis.
[0089] Working principle This method achieves a tiered response to model degradation by adding a third warning level to the existing two-level warning system. The third warning signal is triggered when the model enters a critical collapse state, at which point the model is at its highest risk and requires the most urgent intervention.
[0090] The three-tiered early warning mechanism forms a complete early warning system, from "early warning" (Level 1) to "confirmation warning" (Level 2) and then to "emergency warning" (Level 3). It can take corresponding response measures according to different degrees of model degradation, minimizing the losses caused by model collapse. The critical value of κ=1.5 derived from the Kesten-Goldie theorem provides solid theoretical support for the third early warning signal.
[0091] Example 8 Building upon the methods described above, it is necessary to further clarify the specific rules for determining whether the "second indicator shows a continuous downward trend." Different rules will affect the timing and accuracy of the third warning signal. Therefore, this application further defines the specific determination parameters.
[0092] According to the above method, the rule for determining that the second indicator is in a continuous downward trend is: in the most recent 100 collection times, the number of collection times that satisfy the condition that the value of the second indicator at the current time is less than the value of the second indicator at the previous time is not less than 80.
[0093] In this implementation, the determination of a continuous downward trend uses a window statistical method. Specifically, the system maintains a sequence of second index values L1, L2, …, L for the most recent 100 data collection times. 100 For each acquisition time i in the sequence (from 2 to 100), determine L. i Is it less than L? {i-1} This involves determining whether the value of the second indicator at the current moment is less than the value at the previous moment. The number of data collection moments that satisfy this condition is counted and denoted as the number of decreases, N.
[0094] If N ≥ 80, meaning the number of decreases is no less than 80, then the second indicator is judged to be showing a continuous downward trend.
[0095] The rationale behind this parameter setting is that 100 data collection points correspond to 10,000 training steps (calculated at one collection point every 100 steps), and 80 decreases correspond to an 80% decrease rate. This means that in the most recent 10,000 training steps, the L value has been continuously decreasing for over 80% of the time, fully demonstrating the persistence and stability of the downward trend. This parameter setting has been experimentally verified and can ensure timely warnings while avoiding false triggers caused by short-term fluctuations.
[0096] In practical applications, the window size can be adjusted between 50 and 200 acquisition times, and the ratio threshold can be adjusted between 70% and 90%, both of which can achieve good judgment results. This application does not limit these aspects.
[0097] Working principle This method determines whether there is a continuous downward trend by statistically analyzing the proportion of the second indicator that continues to decrease within a preset window. This avoids misjudging a continuous trend due to a single or small decrease, and ensures the reliability of the third warning signal triggering.
[0098] By employing a judgment rule of 100 data collection points and an 80% decrease rate, the continuous downward trend of the second indicator can be accurately identified, ensuring that the third warning signal is triggered in a timely manner when the model truly enters a critical dangerous state, while avoiding false triggering due to short-term fluctuations.
[0099] Example 9 To put the above methods into practice, a corresponding system needs to be built to implement the early warning method. Existing technologies lack a systematic module design specifically for early warning of recursive training crashes in large language models. Therefore, this application provides a corresponding early warning system.
[0100] A large language model recursive training crash early warning system based on dual-index joint monitoring includes: a data acquisition module for periodically acquiring the weight matrix of at least one fully connected layer and the embedding matrix of the model output layer during the recursive training of the large language model; a first index calculation module for performing singular value decomposition on the weight matrix and calculating a first index to characterize the tail thickness of the model weights based on the singular value distribution; a second index calculation module for calculating the Gram matrix of the embedding matrix and calculating a second index to characterize the volume of the model representation space based on the eigenvalues of the Gram matrix; a threshold generation module for generating a first dynamic threshold corresponding to the first index and a second dynamic threshold corresponding to the second index based on the historical sliding window statistics of the first index and the second index; and a joint early warning module for monitoring the changing trends of the first index and the second index, generating a first early warning signal when the first index drops below the first dynamic threshold and the second index has not yet dropped below the second dynamic threshold, and generating a second early warning signal when the first index drops below the first dynamic threshold and the second index simultaneously drops below the second dynamic threshold.
[0101] In this embodiment, the data acquisition module is deployed within the training framework and runs in parallel with the model training process. When the training steps reach a preset interval (e.g., every 100 steps), this module reads the weight matrix of the specified fully connected layer and the embedding matrix of the output layer from the model parameter storage area and passes them to subsequent modules. In practical applications, the data acquisition module can run asynchronously to avoid impacting the performance of the main training process.
[0102] The first indicator calculation module receives the weight matrix from the data acquisition module, performs singular value decomposition on it, and then calculates the first indicator (such as the fat-tailed index κ) based on the singular value distribution. This module can employ the specific calculation method described in claim 2 or 3, including the Hill estimator and the adaptive tail selection algorithm. The calculated first indicator value is stored in a historical queue for use by the threshold generation module.
[0103] The second indicator calculation module receives the embedding matrix from the data acquisition module, calculates its Gram matrix, and then calculates the second indicator (such as the log determinant L) based on the eigenvalues of the Gram matrix. This module can employ the specific calculation method described in claim 4, including regularization term addition, eigenvalue calculation, log determinant calculation, and exponential moving average smoothing. The calculated second indicator value is stored in a historical queue for use by the threshold generation module.
[0104] The threshold generation module maintains historical queues for the first and second indicators, and calculates the moving average, moving standard deviation, and dynamic threshold based on the method described in Example 5 or 6. This module updates the dynamic threshold in real time and makes it available for querying by the joint early warning module.
[0105] The joint early warning module monitors the current values of the first and second indicators in real time, compares them with the dynamic thresholds provided by the threshold generation module, and generates corresponding early warning signals according to the early warning rules described in claims 1, 7, or 8. The early warning signals can be output to the intervention execution module or directly to the training system for response.
[0106] Working principle This system employs a modular design, mapping the aforementioned methods and steps into corresponding functional modules. The data acquisition module is responsible for acquiring raw data, the first and second indicator calculation modules are responsible for feature extraction, the threshold generation module is responsible for dynamic threshold calculation, and the joint early warning module is responsible for early warning determination. These modules work together to form a complete early warning system.
[0107] This system successfully implements the aforementioned methods in engineering practice. Each module has a clear function and well-defined responsibilities, facilitating deployment and maintenance. The modular design also gives the system good scalability, allowing individual modules to be replaced or upgraded as needed.
[0108] Example 10 To facilitate the deployment and distribution of the aforementioned early warning method, it needs to be stored in a medium as a computer program for installation and execution on various computing devices. Therefore, this application provides a computer-readable storage medium.
[0109] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of embodiments 1-8.
[0110] In this embodiment, the computer-readable storage medium can be any medium capable of storing data, including but not limited to: hard disk drive (HDD), solid-state drive (SSD), read-only memory (ROM), random access memory (RAM), optical disc (CD-ROM, DVD), magneto-optical disc, magnetic tape, flash memory card, USB flash drive, etc. This medium can be a physical medium or a virtual medium such as cloud storage.
[0111] The computer program stored on the storage medium contains a series of instructions that, when executed by a processor (such as a CPU, GPU, TPU, or other dedicated processor), cause the computing device to perform the early warning method according to any one of claims 1 to 8. Specifically, when the program instructions are executed, they perform the following functions: periodically collecting data during the recursive training of a large language model, calculating a first indicator and a second indicator, generating a dynamic threshold, and generating a graded early warning signal based on the changing trends of the two indicators.
[0112] In practical applications, this storage medium can be sold as a standalone product or integrated into a model training system as a system component. Users can install the program from the storage medium into their own training environment to obtain the early warning capabilities provided by this application. Other forms of storage media can also be used in practical applications, and this application does not limit the specific types.
[0113] Working principle This storage medium, by storing executable computer programs, enables the early warning method to exist and spread independently of a specific hardware environment. When the program is loaded into a computing device and executed by a processor, it achieves all the functions of the aforementioned method.
[0114] By storing the method in the form of a computer program on a medium, the efficiency of dissemination and the ease of deployment of the technical solution are greatly improved. Users can easily access and use the early warning function without having to implement the entire algorithm process from scratch. At the same time, the claims regarding the storage medium also expand the scope of patent protection, covering various scenarios in which the invention is implemented in software.
[0115] Example 11: Comparison and verification of the number of initial warning steps for different methods To verify the advantages of this invention over existing technologies in terms of early warning timeliness, this embodiment conducted comparative experiments on five large language models of different scales. The experimental results are as follows: Figure 4 As shown.
[0116] Experimental setup: Five models were selected: Llama-2-7B, Mistral-7B, Llama-2-13B, GPT-2-1.5B, and Qwen-7B. Comparison methods included: the method of this invention, individual fat-tail index monitoring (fixed 10% tail proportion), individual Gram matrix log determinant monitoring, Dohare covariance monitoring, and CN202410123456A entropy monitoring. Each experiment was repeated 5 times, and the mean and standard deviation were recorded.
[0117] Experimental results: such as Figure 4 As shown, the method of this invention significantly earlier than existing methods in the first warning step on all five models. Taking Llama-2-7B as an example, the method of this invention provides the first warning at approximately 4380 steps, which is approximately 1970 steps earlier than monitoring the fat-tailed index alone (6350 steps), approximately 3740 steps earlier than monitoring the Gram matrix alone (8120 steps), approximately 3300 steps earlier than monitoring the Dohare covariance (7680 steps), and approximately 3570 steps earlier than monitoring the CN patent entropy (7950 steps). Error bars show that the warning step count of the method of this invention fluctuates less and its stability is better than the comparative methods.
[0118] Conclusion: This experiment directly verifies the technical advantage of the invention, which is "early warning thousands of steps ahead". It shows that the dual-indicator joint monitoring utilizes the time-series law that the fat-tailed index decreases before the Gram matrix log determinant decreases, thus achieving true early warning.
[0119] Example 12: Comparison and verification of false alarm rate and false negative rate To verify the advantages of this invention in terms of early warning accuracy, this embodiment uses the Llama-2-7B model as the test object, comparing the false alarm rate and false negative rate of five methods. The experimental results are as follows: Figure 5 As shown.
[0120] Experimental setup: Based on the actual crash point of the model, a warning is considered valid if it occurs within 5000 steps before the crash, and a false alarm is considered if it occurs after the crash or more than 5000 steps before the crash; if the model crashes without any warning, it is considered a missed alarm.
[0121] Experimental results: such as Figure 5 As shown, the false positive rate of the method of this invention is only 1.8%, and the false negative rate is 0%. In contrast, the false positive rate of monitoring the fat-tailed index alone is as high as 14.2%, and the false negative rate is 4.8%; the false positive rate of monitoring the Gram matrix alone is 7.6%, and the false negative rate is 9.2%; the false positive rate of monitoring the Dohare covariance is 9.8%, and the false negative rate is 7.5%; and the false positive rate of monitoring the CN patent entropy is 11.3%, and the false negative rate is 6.8%.
[0122] Conclusion: This experiment demonstrates that the present invention maintains a high recall rate (0% false negative rate) while keeping the false positive rate at an extremely low level (below 2%). This is thanks to the design of differentiated dynamic thresholds (2σ / 3σ), which ensures the sensitivity of early warnings while avoiding frequent false triggers, significantly reducing the waste of computing power.
[0123] Example 13: Ablation Experiment Verification To verify the technical contributions of the dynamic threshold and the three-level early warning mechanism in this invention, an ablation experiment was conducted in this embodiment, comparing three configurations: the complete method of this invention, a fixed threshold (non-dynamic) configuration, and a configuration without a three-level early warning mechanism. The experimental results are as follows: Figure 6 As shown.
[0124] Experimental setup: The experiment was conducted on the Llama-2-7B model, keeping other parameters the same. The fixed threshold configuration used pre-defined fixed thresholds (κ threshold set to 2.0, L threshold set to 4.0); the configuration without level 3 warnings retained only level 1 and level 2 warnings, removing level 3 warnings and their decision logic.
[0125] Experimental results: such as Figure 6 As shown, the complete method of this invention has the earliest initial warning steps (4380 steps) and the lowest false alarm rate (1.8%). With a fixed threshold configuration, the initial warning steps are delayed to 5410 steps, and the false alarm rate soars to 21.3%. Without a three-level warning configuration, the initial warning steps are delayed to 5680 steps, and the false alarm rate rises to 16.7%.
[0126] Conclusion: This experiment confirms the key contributions of the dynamic threshold and the three-level early warning mechanism: the dynamic threshold ensures the accuracy of the early warning timing and can adapt to statistical fluctuations during training; the three-level early warning provides graded response capabilities, enabling differentiated intervention strategies based on the degree of model degradation. Both are indispensable and together constitute the core technical solution of this invention.
[0127] Example 14: Parameter sensitivity analysis verification To verify the robustness of the key parameters of this invention, this embodiment conducted a systematic sensitivity analysis on the five key parameters, and the experimental results are as follows: Figure 7 As shown.
[0128] Experimental setup: The experiment was conducted on the Llama-2-7B model, with only one parameter changed each time, while other parameters remained at their optimal values. The evaluation metric was a performance degradation score, which was a weighted sum of the increase in warning delay and the increase in false alarm rate; a lower score indicated better performance.
[0129] Experimental results: such as Figure 7 As shown, the five subplots respectively illustrate the sensitivity analysis results for the five key parameters: (1) κ critical value: The optimal value is 1.5, and the stable region is 1.4-1.6. When the κ critical value varies between 1.4 and 1.6, the performance score remains at a low level, indicating that κ=1.5 has a theoretical basis (based on the Kesten-Goldie theorem) and is not sensitive to parameter fluctuations.
[0130] (2) κ decrease threshold multiple: the optimal value is 2.0σ, and the stable region is 1.8σ-2.2σ.
[0131] (3) The L descent threshold multiple: the optimal value is 3.0σ, and the stable region is 2.8σ-3.2σ. The multiple of L is greater than the multiple of κ, which verifies the rationality of the differentiated threshold design.
[0132] (4) Decline determination window: The optimal value is 100 acquisition time, and the stable region is 80-120 acquisition time.
[0133] (5) Decrease threshold: The optimal value is 80%, and the stable range is 75%-85%.
[0134] Conclusion: This experiment demonstrates that the key parameters of this invention have a wide stability region, the method is robust, and it is easy to deploy in practice. The theoretical basis for the parameter values (κ=1.5 based on the Kesten-Goldie theorem, 2σ / 3σ based on distribution hypothesis testing) has been experimentally verified.
[0135] Example 15: ROC curve comparison and verification To evaluate the discriminative ability of the early warning model of this invention from a statistical learning perspective, this embodiment plotted the ROC curves of five methods. The experimental results are as follows: Figure 8 As shown.
[0136] Experimental setup: Positive samples were those issued within 5000 steps before the crash, and negative samples were those issued as false alarms. The true positive rate and false positive rate were calculated under different warning thresholds, ROC curves were plotted, and AUC values were calculated.
[0137] Experimental results: such as Figure 8 As shown, the method of this invention has an AUC as high as 0.96, with a false positive rate of only 5% at a recall rate (true positive rate) of 95%. In comparison, the AUC of monitoring with fat tail index alone is 0.82, with a false positive rate of 28% at 95% recall; the AUC of monitoring with Gram matrix alone is 0.79, with a false positive rate of 32% at 95% recall; the AUC of monitoring with Dohare covariance is 0.84, with a false positive rate of 24% at 95% recall; and the AUC of monitoring with CN patent entropy is 0.81, with a false positive rate of 30% at 95% recall.
[0138] Conclusion: The ROC curve comprehensively demonstrates the superior performance of the early warning model of this invention: it achieves an extremely low false positive rate while maintaining a high recall rate, verifying the statistical superiority of joint monitoring and differentiated threshold design. The AUC value is close to 1.0, indicating that the early warning judgment of this invention has near-perfect discrimination capability.
[0139] Example 16: Verification of the Time-Series Change Trend of Two Indicators To visually demonstrate the temporal pattern of "fat-tailed exponent decreasing before Gram matrix log determinant decreasing," which was first discovered in this invention, this embodiment records the changing trends of the two indices with the number of training steps during the recursive training of the Llama-2-7B model. The experimental results are as follows: Figure 9 As shown.
[0140] Experimental setup: Following the monitoring configuration described in Example 1, the values of the fat-tailed exponent κ and the log determinant L of the Gram matrix were recorded every 100 steps until the model crashed.
[0141] Experimental results: such as Figure 9 As shown, both κ and L remain stable during the initial training phase (κ≈2.0, L≈5.0). Around step 4500, κ begins to decrease and falls below the dynamic threshold, while L has not yet decreased significantly, triggering a Level 1 warning. Around step 7000, both κ and L simultaneously fall below their respective thresholds, triggering a Level 2 warning. Around step 9000, κ drops below 1.5 and L shows a continuous downward trend (decreasing at least 80 times in the last 100 steps), triggering a Level 3 warning. The actual model collapse occurs around step 10090, verifying the progressively earlier nature of the Level 3 warnings.
[0142] There is approximately a 5500-step safety intervention window between the first-level warning and the actual collapse, providing ample adjustment time for the training system. The figure clearly illustrates the temporal pattern of κ decreasing before L, which is the core basis for designing the hierarchical warning mechanism in this invention.
[0143] Conclusion: This experiment directly verifies the temporal pattern discovered for the first time in this invention, and demonstrates how the three-level early warning mechanism can utilize this pattern to achieve a complete early warning system from "early warning" (level 1) to "confirmation warning" (level 2) and then to "emergency warning" (level 3).
[0144] The embodiments described above are merely illustrative of specific implementations of the present invention, and while the descriptions are detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.
Claims
1. A method for early warning of recursive training crashes in large language models based on joint monitoring of dual indicators, characterized in that, Includes the following steps: Data collection: During the recursive training of the large language model, the weight matrix of at least one fully connected layer and the embedding matrix of the model output layer are periodically collected. First index calculation: Perform singular value decomposition on the weight matrix, and calculate the first index to characterize the thickness of the tail of the model weights based on the singular value distribution; Second index calculation: Calculate the Gram matrix of the embedding matrix, and calculate the second index to characterize the spatial volume of the model representation based on the eigenvalues of the Gram matrix; Threshold generation: Based on the historical sliding window statistics of the first indicator and the second indicator, a first dynamic threshold corresponding to the first indicator and a second dynamic threshold corresponding to the second indicator are generated respectively; Joint early warning: Monitor the changing trends of the first indicator and the second indicator. When the first indicator drops below the first dynamic threshold and the second indicator has not yet dropped below the second dynamic threshold, a first early warning signal is generated. When the first indicator drops below the first dynamic threshold and the second indicator drops below the second dynamic threshold at the same time, a second early warning signal is generated.
2. The method according to claim 1, characterized in that, The first indicator is the fat-tailed index κ. The step of calculating the first indicator based on the singular value distribution includes: performing singular value decomposition on the weight matrix to obtain a descending sequence of singular values σ1≥σ2≥ …≥σ r The fat-tail index κ is calculated using the Hill estimator: ; Where r is the total number of singular values, p is the preset tail ratio, which means selecting the k smallest singular values as the tail.
3. The method according to claim 2, characterized in that, The calculation of the fat-tailed index κ employs an adaptive tail selection algorithm, which includes: traversing the range of candidate tail proportions, calculating the corresponding κ value for each candidate tail proportion, smoothing the κ value sequence, and searching for a region with stable values. If a stable region exists, the κ value corresponding to that region is taken; otherwise, the median of the κ values corresponding to all candidate tail proportions is taken as the final κ value.
4. The method according to claim 1, characterized in that, The second index is the log determinant L of the Gram matrix. The step of calculating the second index based on the eigenvalues of the Gram matrix includes: obtaining the embedding matrix M, M∈R. d×n Calculate the Gram matrix G = M·M T After adding the regularization term ε, the eigenvalues of the Gram matrix are calculated. Calculate the logarithmic determinant: And L is smoothed by exponential moving average.
5. The method according to claim 1, characterized in that, The dynamic threshold is generated as follows: maintain historical queues of the first indicator and the second indicator at the most recent preset number of collection times, calculate the moving average and moving standard deviation of each indicator respectively, and subtract the moving standard deviation by a multiple of the moving average as the corresponding dynamic decreasing threshold; wherein, the multiple of the second indicator is greater than the multiple of the first indicator, in order to adapt to the left-skewed distribution of the second indicator.
6. The method according to claim 5, characterized in that, The first indicator is multiplied by 2, and the second indicator is multiplied by 3, which is the first dynamic threshold thresh. κ = μ κ - 2σ κ The second dynamic threshold thresh L = μ L - 3σ L , where μ κ and σ κ These are the moving mean and moving standard deviation of the first indicator, respectively, μ L and σ L These are the moving mean and moving standard deviation of the second indicator, respectively.
7. The method according to claim 1, characterized in that, The joint early warning step further includes: when the first indicator drops below a preset absolute threshold and the second indicator shows a continuous downward trend, a third early warning signal is generated, wherein the level of the third early warning signal is higher than that of the second early warning signal.
8. The method according to claim 7, characterized in that, The preset absolute threshold is 1.5; the rule for determining that the second indicator shows a continuous downward trend is: in the most recent preset number of collection times, the number of collection times that satisfy the condition that the value of the second indicator at the current time is less than the value of the second indicator at the previous time reaches a preset proportion threshold.
9. A large language model recursive training crash early warning system based on dual-index joint monitoring, characterized in that, include: The data acquisition module is used to periodically collect the weight matrix of at least one fully connected layer and the embedding matrix of the model output layer during the recursive training process of the large language model. The first index calculation module is used to perform singular value decomposition on the weight matrix and calculate a first index to characterize the thickness of the tail of the model weights based on the singular value distribution. The second index calculation module is used to calculate the Gram matrix of the embedding matrix and calculate a second index to characterize the spatial volume of the model based on the eigenvalues of the Gram matrix. The threshold generation module is used to generate a first dynamic threshold corresponding to the first indicator and a second dynamic threshold corresponding to the second indicator based on the historical sliding window statistical values of the first indicator and the second indicator, respectively. The joint early warning module is used to monitor the changing trends of the first indicator and the second indicator. When the first indicator drops below the first dynamic threshold and the second indicator has not yet dropped below the second dynamic threshold, a first early warning signal is generated; when the first indicator drops below the first dynamic threshold and the second indicator drops below the second dynamic threshold at the same time, a second early warning signal is generated.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the method described in any one of claims 1 to 8.
Citation Information
Patent Citations
Waterproof block chain shell and use method thereof
CN117769188A