Software development verification method based on large model
Through the software development verification method based on large models, the problem that traditional software development models cannot fully cover all paths is solved, the code generation, security testing and model generalization capabilities are improved, and the security and development efficiency of the software system are improved. Enhanced model interpretability.
Patent Information
- Application Number
- CN202410864723.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-09-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
It is difficult for traditional software development models to fully cover all paths during testing, resulting in security risks in embedded software, which may have catastrophic consequences, especially in critical areas.
Adopt large model-based software development verification methods, including code generation, security testing, cross-validation, iterative training, and interpretive analysis, using Seq2Seq or Transform models, static code analysis tools, K-fold cross-validation, grid search hyperparameter optimization, and SHAP value and other technologies ensure code security and model generalization capabilities.
It improves the efficiency of software development, enhances the security and reliability of the software system, reduces the risk of model overfitting, improves the generalization ability and interpretability of the model, and enhances users' trust in the model.
Smart Images

Figure 00000000_0000
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software development, and in particular relates to a software development verification method based on a large model. Background Art
[0002] The software development model refers to the structural framework of the entire software development process, activities and tasks. Software development includes stages such as requirements, design, coding and testing, and sometimes also maintenance. The software development model can clearly and intuitively express the entire software development process, clearly define the main activities and tasks to be completed, and is used as the basis for software project work.
[0003] In recent years, with the reduction of hardware costs and the miniaturization of devices such as processors, embedded devices have become increasingly popular in people's production and life. How to ensure the security and reliability of software development models has become a focus of attention, especially in some key fields such as aerospace, medical, military, nuclear energy, etc. If there are program vulnerabilities in embedded software, it will cause the program to run abnormally, which often brings disastrous consequences.
[0004] Traditional software development models use software testing methods to ensure software security, reliability or other properties. Software testing measures the effectiveness of testing through the indicator of code coverage. Some modern large programs have millions of lines of code. Software testing cannot completely cover all paths. It can only test some key paths with high execution frequency. The paths that are not covered are often the source of security risks. Summary of the invention
[0005] The purpose of the present invention is to provide a software development verification method based on a large model to solve the problems raised in the above background technology.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] A software development verification method based on a large model, comprising:
[0008] S1. Software code generation based on large models, using large models for software code generation tasks, and the generated code conforms to the input and output formats;
[0009] S2. Code security testing: Perform security testing on the generated code to ensure that it has no common vulnerabilities. Use static code analysis tools and vulnerability scanner automation tools to perform security testing to ensure the security of the code.
[0010] S3, large model cross-validation, divide the training data set into a training set and a test set, evaluate the performance of the model on the test set, and evaluate the generalization ability and stability of the model through cross-validation;
[0011] S4, iterative training: according to the review results, the large model is iteratively trained to improve its performance;
[0012] S5. Deploy to the server. Deploy the selected large model to the server to ensure that the model can meet actual needs and has good performance and resource utilization;
[0013] S6. Secondary training: Use the deployed large model to conduct secondary training on the software code and test documents. By fine-tuning the model parameters or incremental training, perform explanatory analysis on the trained large model to understand its decision-making process and the credibility of the prediction results, so that the model can better adapt to the needs of specific fields.
[0014] Preferably, the large model in S1 is a Seq2Seq model or a Transform model, and a cross entropy loss function is used to measure the difference between the model's prediction result and the true label. By minimizing the cross entropy loss, the model can better fit the training data and improve the accuracy and generalization ability of the model, which is expressed as:
[0015]
[0016] Where N is the number of samples, C is the number of categories, and y i,j is the actual category label, p i,j is the probability value predicted by the model.
[0017] Preferably, the large model cross-validation in S3 adopts K-fold cross-validation and uses the F1 score evaluation indicator, which is expressed as:
[0018]
[0019] P stands for precision and R stands for recall.
[0020] Preferably, the iterative training in S4 adopts a grid search hyperparameter optimization method, using a gradient descent method, expressed as:
[0021]
[0022] Where θ is the model parameter, J(θ) is the loss function, and η is the learning rate.
[0023] Preferably, the explanatory analysis of the large model in S6 is expressed using SHAP values:
[0024]
[0025] S is a subset of all features except feature i;
[0026] n is the total number of features;
[0027] f(S) is the predicted value of the model on the feature subset S;
[0028] f(S∪{i})) is the prediction value of the model on the feature subset S plus feature i, calculating the contribution of feature i to the model prediction and its marginal effect among all feature combinations.
[0029] Preferably, the input and output formats include functions, classes or entire programs.
[0030] Preferably, the iterative training includes adjusting the model architecture and hyperparameter optimization steps.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] (1) The present invention adopts large-model code generation technology to accelerate the software development process, especially when a large amount of repetitive code is required, which can improve development efficiency and reduce the workload of manual coding. The code security testing technology can help discover and repair potential security risks, thereby enhancing the security and reliability of the software system, helping to prevent malicious attacks and data leakage, and protecting user privacy and asset security; large-model cross-validation and iterative training technology can help improve the generalization ability and stability of the model, making it more suitable for actual application scenarios, helping to reduce the risk of overfitting the model on new data, and improving the prediction accuracy of the model.
[0033] (2) The present invention performs explanatory analysis on the trained large model to enhance the interpretability and credibility of the model, help users understand the decision-making process of the model, and discover potential biases or errors in the model, which helps to improve the transparency and credibility of the model, thereby enhancing the user's trust in the model; the software development verification method based on the large model of the present invention can improve software development efficiency, enhance the security and reliability of the software system, and improve the generalization ability and interpretability of the model, which can further promote the development of software development and machine learning fields, and promote technological innovation and application. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A flowchart of a software development verification method based on a large model of the present invention;
[0035] Figure 2 It is a block diagram of the large model composition of the present invention;
[0036] Figure 3 It is a detailed flow chart of cross-validation of the large model of the present invention. DETAILED DESCRIPTION
[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] Embodiment 1:
[0039] See also Figures 1 to 3 As shown, a software development verification method based on a large model includes the following steps:
[0040] S1. Software code generation based on large models, using large models for software code generation tasks, the generated code conforms to the input and output formats, including functions, classes or the entire program;
[0041] S2. Code security testing: Perform security testing on the generated code to ensure that it has no common vulnerabilities. Use static code analysis tools and vulnerability scanner automation tools to perform security testing to ensure the security of the code.
[0042] S3, large model cross-validation, divide the training data set into a training set and a test set, evaluate the performance of the model on the test set, and evaluate the generalization ability and stability of the model through cross-validation;
[0043] S4, iterative training: according to the review results, iteratively train the large model to improve its performance, including adjusting the model architecture and hyperparameter optimization steps;
[0044] S5. Deploy to the server. Deploy the selected large model to the server to ensure that the model can meet actual needs and has good performance and resource utilization;
[0045] S6. Secondary training: Use the deployed large model to conduct secondary training on the software code and test documents. By fine-tuning the model parameters or incremental training, perform explanatory analysis on the trained large model to understand its decision-making process and the credibility of the prediction results, so that the model can better adapt to the needs of specific fields.
[0046] Specifically, the large model in S1 is a Seq2Seq model or a Transform model, which uses a cross entropy loss function to measure the difference between the model's prediction results and the true label. By minimizing the cross entropy loss, the model can better fit the training data and improve the accuracy and generalization ability of the model, which is expressed as:
[0047]
[0048] Where N is the number of samples, C is the number of categories, and y i,jis the actual category label, p i,j is the probability value predicted by the model.
[0049] Specifically, the large model cross-validation in S3 uses K-fold cross-validation and the F1 score evaluation indicator, which is expressed as:
[0050]
[0051] P represents precision, and R represents recall;
[0052] The F1 score is used to evaluate the performance of the model on the test set. The precision measures how many samples predicted by the model as positive are actually positive, and the recall measures how many positive samples the model can correctly predict. The F1 score takes into account both precision and recall and is a comprehensive performance indicator. Specifically, it includes the following steps:
[0053] Step 1: Dataset preparation: The dataset is used to train and verify the effectiveness of the model. Our dataset contains several samples that are pre-labeled into different categories (positive and negative). The dataset can be a file collection containing code snippets and their corresponding labels, which is used to train the model to generate or repair code.
[0054] Step 2: Divide the dataset into training set and test set: First, randomly divide the dataset into two parts: training set (80%) and test set (20%); the test set will be used to finally evaluate the performance of the model, and the training set will be used for model training and verification.
[0055] Step 3: K-fold cross-validation: further divide the training set into K equal parts, K is 5 or 10. In each iteration, one of the K subsets is selected as the validation set, and the remaining K-1 subsets are used as the training set.
[0056] Step 4: Use the validation set to evaluate the performance of the model using the F1 score, record the performance indicators of this iteration, and repeat this process K times, selecting a different subset as the validation set each time. After K iterations, K performance indicators are obtained. The overall performance of the model is evaluated by calculating the average of these indicators. After K-fold cross-validation, an independent test set is used to evaluate the performance of the model. Based on the evaluation results on the cross-validation and test sets, the parameters, structure, and training strategy of the model are adjusted to optimize the performance of the model.
[0057] Specifically, the iterative training in S4 adopts the grid search hyperparameter optimization method, using the gradient descent method, which is expressed as:
[0058]
[0059] Where θ is the model parameter, J(θ) is the loss function, and η is the learning rate;
[0060] The gradient descent method is used to optimize the model parameters to minimize the loss function. By iteratively updating the model parameters, the model can perform better on the training data and improve the generalization ability of the model.
[0061] Specifically, the explanatory analysis of the large model in S6 is expressed using SHAP values:
[0062]
[0063] S is a subset of all features except feature i;
[0064] n is the total number of features;
[0065] f(S) is the predicted value of the model on the feature subset S;
[0066] f(S∪{i})) is the prediction value of the model on the feature subset S plus feature i, calculating the contribution of feature i to the model prediction and its marginal effect among all feature combinations.
[0067] As can be seen from the above, the use of large model code generation technology can accelerate the software development process, especially when a large amount of repetitive code is required, which can improve development efficiency and reduce the workload of manual coding. The use of code security testing technology can help discover and fix potential security risks, thereby enhancing the security and reliability of the software system, helping to prevent malicious attacks and data leaks, and protecting user privacy and asset security;
[0068] Large model cross-validation and iterative training techniques can help improve the generalization ability and stability of the model, making it more suitable for practical application scenarios, helping to reduce the risk of overfitting the model on new data, and improving the prediction accuracy of the model;
[0069] Performing explanatory analysis on a trained large model can enhance the interpretability and credibility of the model, help users understand the decision-making process of the model, and discover potential biases or errors in the model, which helps to improve the transparency and credibility of the model, thereby enhancing the user's trust in the model; the software development verification method based on a large model of the present invention can improve software development efficiency, enhance the security and reliability of the software system, and improve the generalization ability and interpretability of the model, which can further promote the development of software development and machine learning fields, and promote technological innovation and application.
[0070] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0071] In the drawings of the embodiments disclosed in the present invention, only the structures related to the embodiments disclosed in the present invention are involved, and other structures can refer to the general design. In the absence of conflict, the same embodiment and different embodiments of the present invention can be combined with each other.
[0072] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A software development verification method based on a large model, characterized in that: The following steps are involved: S1. Software code generation based on large models, using large models for software code generation tasks, and the generated code conforms to the input and output formats; S2. Code security testing: Perform security testing on the generated code to ensure that it has no common vulnerabilities. Use static code analysis tools and vulnerability scanner automation tools to perform security testing to ensure the security of the code. S3, large model cross-validation, divide the training data set into a training set and a test set, evaluate the performance of the model through cross-validation on the test set, and evaluate the generalization ability and stability of the model; S4, iterative training: according to the review results, the large model is iteratively trained to improve its performance; S5. Deploy to the server. Deploy the selected large model to the server to ensure that the model can meet actual needs and has good performance and resource utilization; S6. Secondary training: Use software codes and test documents specific to the target task to iterate the existing dataset in small quantities, and perform secondary training on the deployed large model. By fine-tuning model parameters or incremental training, perform explanatory analysis on the trained large model to understand its decision-making process and the credibility of the prediction results, so that the model can better adapt to the needs of specific fields.
2. A software development verification method based on a large model according to claim 1, characterized in that: The large model in S1 is a Seq2Seq model or a Transform model. The cross entropy loss function is used to measure the difference between the model's prediction results and the true labels. By minimizing the cross entropy loss, the model can better fit the training data and improve the accuracy and generalization ability of the model, which is expressed as: Where N is the number of samples, C is the number of categories, and y i,j is the actual category label, p i,j is the probability value predicted by the model.
3. A software development verification method based on a large model according to claim 1, characterized in that: The large model cross-validation in S3 uses K-fold cross-validation and the F1 score evaluation indicator, which is expressed as: P stands for precision and R stands for recall.
4. The software development verification method based on a large model according to claim 1, characterized in that: In S4, iterative training uses a grid search hyperparameter optimization method using a gradient descent method, expressed as: θt+1=θt-η▽J(θt) Where θ is the model parameter, J(θ) is the loss function, and η is the learning rate.
5. The software development verification method based on a large model according to claim 1, characterized in that: The explanatory analysis of the large model in S6 is expressed using SHAP values: S is a subset of all features except feature i; n is the total number of features; f(S) is the predicted value of the model on the feature subset S; f(S∪{i})) is the prediction value of the model on the feature subset S plus feature i, calculating the contribution of feature i to the model prediction and its marginal effect among all feature combinations.
6. The software development verification method based on a large model according to claim 1, characterized in that: The input and output formats include functions, classes, or entire programs.
7. The software development verification method based on a large model according to claim 1 is characterized in that: The iterative training includes adjusting the model architecture and hyperparameter optimization steps.
Citation Information
Cited By
Equipment test model code generation method based on large model
CN119248238A
