Code auditing model optimization method and device, computer equipment and storage medium
By using the target audit results to optimize the initial code audit model, the problem of poor optimization effect of the code audit model in the existing technology is solved, and a higher quality and safe code audit model is realized to adapt to the rapidly changing audit environment.
Patent Information
- Application Number
- CN202411940633.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-15
AI Technical Summary
The optimization methods of existing code audit models are poor, and it is difficult to adapt to the rapidly changing audit environment, resulting in poor model optimization quality.
By obtaining multiple audit results and model inference data output by the initial code audit model for each communication code audit request, the target audit result is used to optimize the initial model to obtain the optimized code audit model.
It improves the optimization quality of the code audit model, improves the code quality and security, and can adapt to the rapidly changing audit environment.
Smart Images

Figure CN119829406A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to an optimization method, device, computer equipment, computer-readable storage medium and computer program product for a code audit model. Background Art
[0002] With the development of communication technology, a technology that uses artificial intelligence technology to audit communication codes has emerged to replace manual audits of communication codes. For example, the user can input the communication code that needs to be audited into a large model for code auditing, and the large model outputs the audit results of the communication code. Compared with manual audits of communication codes, the audit of communication codes implemented by the large model is more efficient and can detect more comprehensive code problems.
[0003] In traditional technology, when using the code audit model, it is usually necessary to optimize the above code audit model. The current optimization method is mainly to optimize the audit matching information. However, this optimization method may lead to poor results in improving code quality and security, and it is difficult to adapt to the rapidly changing audit environment. Therefore, the model optimization quality of the current code audit model optimization method is poor. Summary of the invention
[0004] Based on this, it is necessary to provide a code audit model optimization method, device, computer equipment, computer-readable storage medium and computer program product that can improve the optimization quality of the code audit model in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for optimizing a code audit model, comprising:
[0006] Acquire multiple audit results output by the initial code audit model for each communication code audit request, and model inference data of the initial code audit model for each communication code audit request; the multiple audit results are obtained by combining different model parameters of the initial code audit model;
[0007] When the model inference data satisfies a preset condition, obtaining a target audit result associated with each of the communication code audit requests from a plurality of audit results associated with each of the communication code audit requests;
[0008] The initial code audit model is optimized using each of the target audit results to obtain a target code audit model; the target code audit model is used to obtain an optimized code audit model.
[0009] In one of the embodiments, the method of obtaining multiple audit results output by the initial code audit model for each communication code audit request includes: in response to a current communication code audit request, obtaining a code to be audited associated with the current communication code audit request, and code audit intention information of the current communication code audit request; the current communication code audit request is any one of the communication code audit requests; based on the code to be audited and the code audit intention information, generating a prompt word template corresponding to the current communication code audit request; inputting the prompt word template into the initial code audit model, and obtaining multiple audit results corresponding to the current communication code audit request through different model parameter combinations of the initial code audit model.
[0010] In one of the embodiments, the prompt word template corresponding to the current communication code audit request is generated based on the code to be audited and the code audit intention information, including: when the code to be audited meets the preset standard code condition and the code length of the code to be audited does not exceed the preset code length threshold, the prompt word template is generated according to the code to be audited and the code audit intention information; when the code to be audited does not meet the preset standard code condition, or the code length exceeds the preset code length threshold, the code to be audited is preprocessed, and the prompt word template is generated according to the preprocessed code to be audited and the code audit intention information.
[0011] In one embodiment, the different model parameter combinations of the initial code audit model include a default model parameter combination; after obtaining multiple audit results corresponding to the current communication code audit request through the different model parameter combinations of the initial code audit model, it also includes: obtaining the predicted audit result output by the default model parameter combination of the initial code audit model; and using the predicted audit result as the request response result corresponding to the current communication code audit request.
[0012] In one embodiment, the different model parameter combinations of the initial code audit model include a default model parameter combination; the use of each of the target audit results to perform model optimization on the initial code audit model to obtain a target code audit model includes: inputting each of the communication code audit requests into the initial code audit model, and obtaining a predicted audit result corresponding to each of the communication code audit requests through the default model parameter combination of the initial code audit model; optimizing and training the model parameters of the initial code audit model according to the differences between each of the predicted audit results and each of the target audit results to obtain the target code audit model; after the use of each of the target audit results to perform model optimization on the initial code audit model to obtain the target code audit model, it also includes: when the audit performance of the target code audit model is better than that of the initial code audit model, using the target code audit model as the optimized code audit model.
[0013] In one embodiment, the model inference data includes the inference accuracy data and request feedback duration data of the initial code audit model for each communication code audit request; when the model inference data meets the preset conditions, the target audit result associated with each communication code audit request is obtained from the multiple audit results associated with each communication code audit request, including: when the inference accuracy data indicates that the number of inference errors of the initial code audit model for each communication code audit request is greater than a preset number threshold, the target audit result associated with each communication code audit request is obtained from the multiple audit results associated with each communication code audit request; and / or when the request feedback duration data indicates that the request feedback duration of the initial code audit model for any communication code audit request is greater than a preset request duration threshold, the target audit result associated with each communication code audit request is obtained from the multiple audit results associated with each communication code audit request.
[0014] In one of the embodiments, when the audit performance of the target code audit model is better than that of the initial code audit model, before using the target code audit model as the optimized code audit model, it also includes: inputting sample communication code audit requests into the initial code audit model and the target code audit model respectively, obtaining first model inference data of the initial code audit model for the sample communication code audit requests, and second model inference data of the target code audit model for the sample communication code audit requests; when the audit performance represented by the second model inference data is better than the audit performance represented by the first model inference data, using the target code audit model as the optimized code audit model.
[0015] In a second aspect, the present application also provides an optimization device for a code audit model, including:
[0016] An audit data acquisition module, used to acquire multiple audit results output by the initial code audit model for each communication code audit request, and model inference data of the initial code audit model for each communication code audit request; the multiple audit results are obtained by combining different model parameters of the initial code audit model;
[0017] A target result acquisition module, used for acquiring a target audit result associated with each of the communication code audit requests from a plurality of audit results associated with each of the communication code audit requests when the model inference data meets a preset condition;
[0018] The audit model optimization module is used to optimize the initial code audit model using the target audit results to obtain a target code audit model; the target code audit model is used to obtain an optimized code audit model.
[0019] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method described in any embodiment of the first aspect are implemented.
[0020] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in any embodiment of the first aspect are implemented.
[0021] In a fifth aspect, the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in any embodiment of the first aspect.
[0022] The optimization method, device, computer equipment, computer-readable storage medium and computer program product of the above-mentioned code audit model obtain multiple audit results output by the initial code audit model for each communication code audit request, as well as model inference data of the initial code audit model for each communication code audit request; the multiple audit results are obtained by combining different model parameters of the initial code audit model; when the model inference data meets the preset conditions, the target audit result associated with each communication code audit request is obtained from the multiple audit results associated with each communication code audit request; the initial code audit model is optimized using each target audit result to obtain a target code audit model; the target code audit model is used to obtain the optimized code audit model. The present application obtains multiple audit results corresponding to different model parameter combinations output by the initial code audit model for each communication code audit request, as well as model reasoning data for each communication code audit request. When the model reasoning data meets preset conditions, the application can obtain the target audit result associated with each communication code audit request from the multiple audit results, thereby optimizing the code audit model using the target audit result. In this way, the model reasoning capability of the code audit model itself is optimized, which can improve the code quality and security effects, and can adapt to the rapidly changing audit environment, thereby improving the optimization quality of the code audit model. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 A schematic diagram of a flow chart of a method for optimizing a code audit model in one embodiment;
[0025] Figure 2 A schematic diagram of a process for obtaining multiple audit results in one embodiment;
[0026] Figure 3 A schematic diagram of a flow chart of an optimized code audit model in one embodiment;
[0027] Figure 4 It is a schematic diagram of the architecture of a communication code audit self-optimization system based on a large model in one embodiment;
[0028] Figure 5 A schematic diagram of a self-optimization process of communication code audit based on a large model in one embodiment;
[0029] Figure 6 A schematic diagram of a model module architecture in an embodiment;
[0030] Figure 7 A schematic diagram of a self-optimization module architecture in one embodiment;
[0031] Figure 8 A structural block diagram of an optimization device for a code audit model in one embodiment;
[0032] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0034] In one embodiment, Figure 1 As shown, a method for optimizing a code audit model is provided. This embodiment uses the method applied to a server as an example for illustration. It is understandable that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0035] Step S101, obtaining multiple audit results output by the initial code audit model for each communication code audit request, and model inference data of the initial code audit model for each communication code audit request; the multiple audit results are obtained by combining different model parameters of the initial code audit model.
[0036] Among them, the initial code audit model refers to a code audit model that may need to be optimized during use, and the communication code audit request is a request for triggering the initial code audit model to audit the communication code. The audit request may be that the initial code audit model refers to the audit result obtained by the user during use. The multiple audit results are audit results obtained by outputting different model parameter combinations of the initial code audit model. The initial code audit model in this embodiment can realize parameter self-adjustment, so multiple groups of model parameter combinations can be obtained, and each group of model parameter combinations can generate an audit result based on each communication code audit request. For example, the communication code audit request includes: request A, request B and request C, and the model parameter combination includes parameter combination 1, parameter combination 2 and parameter combination 3, then for request A, three audit results can be generated, namely result A1, result A2 and result A3, for request B, three audit results can be generated, namely result B1, result B2 and result B3, and for request C, three audit results can be generated, namely result C1, result C2 and result C3. The model reasoning data refers to the data related to the model reasoning process of the initial code audit model for the communication code audit request, which may include, for example, the reasoning time and reasoning accuracy, etc.
[0037] Specifically, after the initial code audit model is put into use, when a user initiates a communication code audit request, the server can perform model inference based on different parameter combinations of the initial code audit model to obtain multiple audit results, and the server can also obtain the model inference data associated with the above communication code audit request.
[0038] Step S102, when the model inference data meets the preset conditions, the target audit result associated with each communication code audit request is obtained from the multiple audit results associated with each communication code audit request.
[0039] The target audit result is the audit result selected from multiple audit results associated with each communication code audit request. The target audit result can be used to represent the best audit result for each communication code audit request, and can be selected by the user from multiple audit results. For example, the three audit results generated for request A are result A1, result A2, and result A3. The user can select the best audit result as result A1, and then result A1 is used as the target audit result for request A. The preset conditions are the pre-set conditions for optimizing the code audit model. When the model inference data meets the above conditions, it indicates that the code audit model needs to be optimized, so the target audit result needs to be obtained.
[0040] Specifically, when the server determines that the collected model inference data for each communication code audit request meets the preset conditions, it can further feedback the multiple audit results output by each communication code audit request, and the user can filter out the target audit result from the multiple audit results of each communication code audit request.
[0041] Step S103, using each target audit result to optimize the initial code audit model to obtain a target code audit model; the target code audit model is used to obtain the optimized code audit model.
[0042] The target code model is a code audit model obtained after optimizing the initial code audit model. After the server screens out the target audit results corresponding to each communication code audit request, it can use the target audit results to optimize the initial code audit model to obtain the target code audit model. The target code audit model can be used to obtain the optimized code audit model. For example, when the performance of the target code audit model is better, it can be used as the optimized code audit model.
[0043] In the optimization method of the above-mentioned code audit model, multiple audit results output by the initial code audit model for each communication code audit request and model inference data of the initial code audit model for each communication code audit request are obtained; multiple audit results are obtained by combining different model parameters of the initial code audit model; when the model inference data meets the preset conditions, the target audit result associated with each communication code audit request is obtained from the multiple audit results associated with each communication code audit request; the initial code audit model is optimized using each target audit result to obtain a target code audit model; the target code audit model is used to obtain the optimized code audit model. The present application obtains multiple audit results corresponding to different model parameter combinations output by the initial code audit model for each communication code audit request, as well as model reasoning data for each communication code audit request. When the model reasoning data meets preset conditions, the application can obtain the target audit result associated with each communication code audit request from the multiple audit results, thereby optimizing the code audit model using the target audit result. In this way, the model reasoning capability of the code audit model itself is optimized, which can improve the code quality and security effects, and can adapt to the rapidly changing audit environment, thereby improving the optimization quality of the code audit model.
[0044] In one embodiment, Figure 2 As shown, step S101 may further include:
[0045] Step S201, in response to the current communication code audit request, obtain the code to be audited associated with the current communication code audit request and the code audit intention information of the current communication code audit request; the current communication code audit request is any one of the communication code audit requests.
[0046] The current communication code audit request refers to the communication code audit request currently initiated by the user to the initial code audit model. This request can be one of the communication code audit requests, and the code to be audited refers to the code that needs to be audited. The code audit intention information refers to the user intention information corresponding to the current communication code audit request, and the intention information can be identified through the intention recognition function.
[0047] Specifically, when the user needs to perform a code audit on the communication code, he can initiate a current communication code audit request to the server, and the communication code will be used as the code to be audited. At the same time, the server can perform intent recognition on the current communication code audit request to obtain the code audit intent information of the current communication code audit request.
[0048] Step S202: Generate a prompt word template corresponding to the current communication code audit request according to the code to be audited and the code audit intention information.
[0049] The prompt word template is a prompt word template used to input the initial code audit model. In this embodiment, the initial code audit model can be a large model used to implement code auditing, and the prompt word template used can also be obtained according to the code to be audited and the code audit intention information. Specifically, after obtaining the code to be audited and the code audit intention information, the server can use the code to be audited and the code audit intention information to generate a corresponding prompt word template as the prompt word template corresponding to the current communication code audit request.
[0050] Step S203, inputting the prompt word template into the initial code audit model, and obtaining multiple audit results corresponding to the current communication code audit request through different model parameter combinations of the initial code audit model.
[0051] After obtaining the prompt word template, the prompt word template can be input into the initial code audit model, and different model parameter combinations of the initial code audit model can be used to output multiple audit results of the current communication code audit request.
[0052] In this embodiment, the initial code audit model can also be a large model used for code auditing, and the prompt word template used can be obtained based on the code to be audited and the identified code audit intention information. In this way, the accuracy of the audit result output can be improved.
[0053] Furthermore, step S202 may further include: when the code to be audited meets the preset standard code conditions and the code length of the code to be audited does not exceed the preset code length threshold, generating a prompt word template based on the code to be audited and the code audit intention information; when the code to be audited does not meet the preset standard code conditions, or the code length exceeds the preset code length threshold, preprocessing the code to be audited, and generating a prompt word template based on the preprocessed code to be audited and the code audit intention information.
[0054] Among them, the preset standard code condition is a judgment condition for determining whether the code to be audited is a standard code, and the preset code length threshold is a judgment threshold for determining whether the code to be audited is too long. In this embodiment, if the server determines that the code to be audited meets the preset standard code condition and the code length does not exceed the preset code length threshold, that is, the code to be audited is a standard code and the code length is not too long, then a prompt word template can be generated directly based on the code to be audited and the code audit intention information.
[0055] On the contrary, if the server determines that the code to be audited does not meet the preset standard code conditions, or the code length does not exceed the preset code length threshold, that is, the code to be audited does not belong to the standard code, for example, the code to be audited contains garbled characters or redundancy, etc., or the code length of the code to be audited is too long, the server needs to preprocess the code to be audited first. After obtaining the preprocessed code to be audited, the server can use the preprocessed code to be audited and the code audit intention information to generate a prompt word template.
[0056] In this embodiment, by setting standard code conditions and code length thresholds, different prompt word template generation methods can be determined using the above standard code conditions and code length thresholds. If the code to be audited meets the standard code conditions at the same time, and the code length does not exceed the preset code length threshold, the code to be audited and the code audit intention information can be directly used to generate the prompt word template. If the code to be audited does not meet the standard code conditions, or the code length exceeds the preset code length threshold, the code to be audited needs to be preprocessed first, and the preprocessed code to be audited and the code audit intention information are used to generate the prompt word template. In this way, the accuracy of prompt word template generation can be further improved.
[0057] In addition, different model parameter combinations of the initial code audit model include a default model parameter combination; after step S203, it can also include: obtaining the predicted audit result output by the default model parameter combination of the initial code audit model; and using the predicted audit result as the request response result corresponding to the current communication code audit request.
[0058] Among them, the default model parameters refer to the model parameters used by the initial code audit model to generate the response results corresponding to the received communication code audit requests. In this embodiment, the multiple groups of model parameter combinations of the initial code audit model may also include a default model parameter combination, which is used to output the request response results to feedback to the user.
[0059] Specifically, when the user initiates the current communication code audit request, the server can generate multiple audit results through different model parameter combinations of the initial code audit model, namely audit result 1, audit result 2 and audit result 3, which correspond to model parameter combination 1, model parameter combination 2 and model parameter combination 3. Among them, if the default model parameter combination is model parameter combination 1, then audit result 1 is returned to the user as the request response result corresponding to the current communication code audit request.
[0060] In this embodiment, a default model parameter combination can also be set in multiple groups of model parameter combinations, and the audit result output by the default model parameter combination can be used as the predicted audit result of the initial code audit model, that is, as the request response result corresponding to the current communication code audit request. In this way, the accuracy of the communication code audit request response can be improved.
[0061] In one embodiment, the different model parameter combinations of the initial code audit model include a default model parameter combination; Figure 3 As shown, step S103 may further include:
[0062] Step S301, input each communication code audit request into the initial code audit model, and obtain the predicted audit result corresponding to each communication code audit request through the default model parameter combination of the initial code audit model;
[0063] Step S302, based on the predicted audit results and the differences between the target audit results, the model parameters of the initial code audit model are optimized and trained to obtain the target code audit model.
[0064] In this embodiment, the method of optimizing the initial code audit model may be to use the target set results to optimize the model parameters of the initial code audit model, thereby optimizing the model performance of the code audit model itself.
[0065] Specifically, the server can input each communication code audit request into the initial code audit model, and obtain the predicted audit result corresponding to each communication code audit request by combining the default model parameters of the initial code audit model. The predicted audit result can be used as the predicted result of the initial code audit model to be optimized and trained. After that, the target audit result corresponding to each communication code audit request can be used as the label of the initial code audit model, so as to use the difference between the target audit result and the predicted audit result to optimize the model parameters of the initial code audit model, thereby obtaining the target code audit model.
[0066] After step S103, the following steps may also be included:
[0067] Step S303: When the audit performance of the target code audit model is better than that of the initial code audit model, the target code audit model is used as the optimized code audit model.
[0068] After obtaining the target code audit model after model parameter optimization training, the audit performance of the target code audit model can be further tested. If the performance test results indicate that the audit performance of the target code audit model is better than that of the initial code audit model, the target code audit model can be deployed as the optimized code audit model. If the performance test results indicate that the audit performance of the target code audit model is worse than that of the initial code audit model, the initial code audit model can continue to be deployed.
[0069] In this embodiment, the initial code audit model can also be input through each communication code audit request, and the predicted audit result can be obtained by the default model parameter combination of the initial code audit model, so as to use the difference between the predicted audit result and the target audit result to optimize the model parameters. The audit performance of the target code audit model after training can also be compared with the audit performance of the initial code audit model before training, and the target code audit model will only be used as the optimized code audit model when the audit performance is better. In this way, the model reasoning performance of the code audit model can be ensured.
[0070] Further, the model inference data includes the inference accuracy data and request feedback duration data of the initial code audit model for each communication code audit request; step S202 may further include: when the inference accuracy data indicates that the number of inference errors of the initial code audit model for each communication code audit request is greater than a preset number threshold, obtaining the target audit result associated with each communication code audit request from the multiple audit results associated with each communication code audit request; and / or when the request feedback duration data indicates that the request feedback duration of the initial code audit model for any communication code audit request is greater than a preset request duration threshold, obtaining the target audit result associated with each communication code audit request from the multiple audit results associated with each communication code audit request.
[0071] In this embodiment, the model reasoning data may include the following two types, namely, the reasoning accuracy data of the initial code audit model for each communication code audit request, and the request feedback duration data. The reasoning accuracy data represents the result accuracy of the audit results output by the initial code audit model for each communication code audit request, and the request feedback duration data represents the feedback duration of the audit results output by the initial code audit model for each communication code audit request.
[0072] If the reasoning accuracy data represents the number of reasoning errors of the initial code audit model for each communication code audit request, which is greater than the preset number threshold, that is, the number of erroneous audit results output by the initial code audit model is large, the server can determine that the initial code audit model needs to be optimized. Therefore, the target audit result associated with each communication code audit request can be obtained from the multiple audit results associated with each communication code audit request, so as to optimize the initial code audit model through the target audit result.
[0073] Similarly, if the request feedback duration data representing the request feedback duration of the initial code audit model for any communication code audit request is greater than the preset request duration threshold, that is, the audit result output by the initial code audit model is slow, the server can also determine that the initial code audit model needs to be optimized. Therefore, it can also obtain the target audit result associated with each communication code audit request from the multiple audit results associated with each communication code audit request, so as to optimize the initial code audit model through the target audit result.
[0074] In this embodiment, the model inference data may include the inference accuracy data and request feedback duration data of the initial code audit model for each communication code audit request, and when the inference accuracy data indicates that the number of erroneous audit results output by the initial code audit model is large, or the request feedback duration of the initial code audit model for any communication code audit request is long, the target audit result can be obtained to achieve the optimization of the initial code audit model. In this way, judgment can be made in combination with the model inference data, and feedback and iteration can be continuously performed to ensure that the model can sustainably adapt to the changing data of the audit scenario.
[0075] In one embodiment, before step S303, it may also include: inputting the sample communication code audit request into the initial code audit model and the target code audit model respectively, obtaining the first model inference data of the initial code audit model for the sample communication code audit request, and the second model inference data of the target code audit model for the sample communication code audit request; when the audit performance represented by the second model inference data is better than the audit performance represented by the first model inference data, the target code audit model is used as the optimized code audit model.
[0076] Among them, the sample communication code audit request is a communication code audit request used to test the audit performance of the audit model, and the first model reasoning data refers to the model reasoning data of the initial code audit model for the sample communication code audit request, for example, it may be the reasoning accuracy data and request feedback duration data of the initial code audit model for the sample communication code audit request, and the second model reasoning data refers to the model reasoning data of the target code audit model for the sample communication code audit request, for example, it may be the reasoning accuracy data and request feedback duration data of the target code audit model for the sample communication code audit request.
[0077] Specifically, when performing audit performance evaluation on the initial code audit model and the target code audit model, the server can input the sample communication code audit request into the initial code audit model and the target code audit model respectively, thereby obtaining the first model inference data of the initial code audit model for the sample communication code audit request and the second model inference data of the target code audit model for the sample communication code audit request respectively.
[0078] Afterwards, the first model inference data and the second model inference data can be used to compare the audit performance of the initial code audit model and the target code audit model. If the audit performance represented by the second model inference data is better than the audit performance represented by the first model inference data, the target code audit model will be used as the optimized code audit model.
[0079] For example, the first model inference data is the first inference accuracy data of the initial code audit model for the sample communication code audit request, and the second model inference data is the second inference accuracy data of the target code audit model for the sample communication code audit request. If the reasoning accuracy represented by the second reasoning accuracy data is higher than the reasoning accuracy represented by the first reasoning accuracy data, the target code audit model can be used as the optimized code audit model.
[0080] In addition, if the first model inference data is the first request feedback duration data of the initial code audit model for the sample communication code audit request, and the second model inference data is the second request feedback duration data of the target code audit model for the sample communication code audit request, if the request duration represented by the second request feedback duration data is shorter than the request duration represented by the first request feedback duration data, the target code audit model can also be used as the optimized code audit model.
[0081] In this embodiment, the performance difference between the initial code audit model and the target code audit model can be identified based on the audit performance represented by the first model inference data and the second model inference data by collecting the first model inference data and the second model inference data of the initial code audit model and the target code audit model for the sample communication code audit request. In this way, the accuracy of the audit performance acquisition of the code audit model can be improved.
[0082] In one embodiment, a communication code audit self-optimization system based on a large model is also provided. The system can realize automatic auditing of network configuration codes, support continuous self-optimization of models, ensure that the models can effectively adapt to new data environments, and guarantee model performance. The large model code audit self-optimization system proposed in this embodiment can also be applied to other auditing scenarios, and the large model liberalization function can be applied to different large model scenarios.
[0083] The communication code audit and self-optimization system based on the big model mainly includes four modules: classification and arrangement module, processing module, model module, and self-optimization module, which can realize automatic audit and full-process self-optimization of network codes. Figure 4 As shown, the system workflow can be as follows Figure 5 As shown, the specific steps include:
[0084] Step 1: The user sends a code audit request to the system, which is sent to the classification and orchestration module to identify the user's intention, classify the business and arrange the capabilities according to the user's needs, and determine which functions should be called subsequently.
[0085] Step 2: According to the capability arrangement plan sent by the classification and arrangement module, the relevant functions of the processing module are called. The code processing function can pre-process the code information sent by the user, including splitting, anomaly identification, matching, deduplication and other operations; the template selection and generation function selects a suitable template according to the user's intention, and generates a prompt template based on the comprehensive information and sends it to the model module. The arrangement plan is as follows:
[0086] Solution 1: The code information input is standardized and its length does not exceed the threshold. The user's needs are directly sent to the template selection and generation function to select and generate a prompt template.
[0087] Solution 2: The code information sent in is messy (garbled, redundant, etc.) and its length exceeds the threshold. The code is preprocessed first, and then the user requirements and code processing results are sent to the template selection and generation function to select and generate the prompt template.
[0088] Step 3: The large model receives the prompt template for code auditing, generates at least 2 results and sends them to the model evaluation module. When the judgment data reaches the threshold, the model optimization is started, and the process jumps to step 4. At the same time, the manual feedback evaluation data is notified. No optimization is required to continue executing the current step to collect new data, and the large model in the current environment can reason normally.
[0089] The model module provides an environment and tools for large model deployment and reasoning, as well as a formal environment and a test environment for formal reasoning and testing of large models. For details, see Figure 6 The deployed model is required to at least complete fine-tuning for code audit scenarios, and mainly provide the following functions:
[0090] (1) Content generation: Receives the prompt template sent by the preprocessing module and performs model inference. This module supports batch inference and generates text to provide data for subsequent model self-optimization.
[0091] (2) Merge deployment: Perform model and file merging before model deployment and inference, supporting the merging of multiple files and models;
[0092] (3) Parameter self-adjustment: adjust the inference parameter information to ensure the diversity of the inference results. The parameters are required to at least include diversity-related parameters such as temperature.
[0093] Step 4: Start model optimization. The self-optimization module receives the model optimization dataset from user feedback, starts merging the pre-trained model and documents, and starts model learning optimization based on the latest user feedback data (supports multiple optimizations. After the optimization is completed, the model can be deployed to the test environment of the model module to start model reasoning, data collection, and model comparison.
[0094] For details on the self-optimization module capabilities, see Figure 7 Perform the following functions:
[0095] (1) Data collection: Continuously receive the large model generation results and model inference data (such as inference time) deployed by the model module. After collecting a certain amount of data, send the data to the model evaluation function;
[0096] (2) Model evaluation: The model evaluation function analyzes the model inference data. When the model inference data exceeds the threshold, it determines that the model should be optimized. At the same time, the model generation result data is sent to the human. The human participates in data evaluation and feedback. The model evaluation module notifies the module to start the model learning optimization function; compares the optimized model with the current model generation effect, and notifies the model module to replace the model to the production environment;
[0097] (3) Model learning optimization: The model learning optimization function receives the model optimization data set fed back by the user and starts the model optimization task. The model supports multiple optimizations. Supervised learning methods such as reinforcement learning are used here. After the training is completed, the new model is fed back to the model module and deployed in the test environment, and the model is evaluated. When the model effect meets the requirements, the model is deployed in the production environment.
[0098] Step 5: Evaluate and compare the model generation effect. When the optimized model reasoning effect is better than the current model, notify the model module to deploy the new model to the production environment of the model module and perform the audit task. Otherwise, the current model will still be used.
[0099] The communication code audit self-optimization system based on the big model provided in this embodiment can propose a communication code audit self-optimization system based on the big model capabilities. The system can provide business classification and orchestration, code preprocessing, model reasoning, automatic evaluation, self-optimization and other capabilities to ensure that the model performance can effectively adapt to the new data environment, and the big model automatic evaluation and optimization architecture can be combined with the model reasoning data for judgment, and continuous feedback and iteration can ensure that the model can continuously adapt to the changing data of the audit scenario. At the same time, in order to ensure the model generation effect, the template is strongly bound to the user needs, and the model prompt template can be constructed according to different user needs. At the same time, the capability orchestration function is introduced to call different capabilities on demand.
[0100] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0101] Based on the same inventive concept, the embodiment of the present application also provides a device for optimizing a code audit model for implementing the optimization method of the code audit model involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the optimization device for one or more code audit models provided below can refer to the limitations of the optimization method for the code audit model above, and will not be repeated here.
[0102] In one embodiment, Figure 8 As shown, a device for optimizing a code audit model is provided, including: an audit data acquisition module 801, a target result acquisition module 802 and an audit model optimization module 803, wherein:
[0103] The audit data acquisition module 801 is used to obtain multiple audit results output by the initial code audit model for each communication code audit request, and model inference data of the initial code audit model for each communication code audit request; the multiple audit results are obtained by combining different model parameters of the initial code audit model;
[0104] The target result acquisition module 802 is used to acquire the target audit result associated with each communication code audit request from multiple audit results associated with each communication code audit request when the model inference data meets the preset conditions;
[0105] The audit model optimization module 803 is used to optimize the initial code audit model using each target audit result to obtain a target code audit model; the target code audit model is used to obtain an optimized code audit model.
[0106] In one embodiment, the audit data acquisition module 801 is further used to respond to the current communication code audit request, obtain the code to be audited associated with the current communication code audit request, and the code audit intention information of the current communication code audit request; the current communication code audit request is any one of the communication code audit requests; according to the code to be audited and the code audit intention information, generate a prompt word template corresponding to the current communication code audit request; input the prompt word template into the initial code audit model, and obtain multiple audit results corresponding to the current communication code audit request through different model parameter combinations of the initial code audit model.
[0107] In one embodiment, the audit data acquisition module 801 is further used to generate the prompt word template according to the code to be audited and the code audit intention information when the code to be audited meets the preset standard code conditions and the code length of the code to be audited does not exceed the preset code length threshold; when the code to be audited does not meet the preset standard code conditions, or the code length exceeds the preset code length threshold, preprocess the code to be audited and generate the prompt word template according to the preprocessed code to be audited and the code audit intention information.
[0108] In one embodiment, the different model parameter combinations of the initial code audit model include a default model parameter combination; the audit data acquisition module 801 is also used to obtain the predicted audit result output by the default model parameter combination of the initial code audit model; and use the predicted audit result as the request response result corresponding to the current communication code audit request.
[0109] In one embodiment, the different model parameter combinations of the initial code audit model include a default model parameter combination; the audit model optimization module 803 is further used to input each of the communication code audit requests into the initial code audit model, and obtain the predicted audit results corresponding to each of the communication code audit requests through the default model parameter combination of the initial code audit model; according to the differences between each of the predicted audit results and each of the target audit results, the model parameters of the initial code audit model are optimized and trained to obtain the target code audit model; when the audit performance of the target code audit model is better than that of the initial code audit model, the target code audit model is used as the optimized code audit model.
[0110] In one embodiment, the model reasoning data includes reasoning accuracy data and request feedback duration data of the initial code audit model for each communication code audit request; the target result acquisition module 802 is further used to obtain the target audit result associated with each communication code audit request from the multiple audit results associated with each communication code audit request when the reasoning accuracy data indicates that the number of reasoning errors of the initial code audit model for each communication code audit request is greater than a preset number threshold; and / or when the request feedback duration data indicates that the request feedback duration of the initial code audit model for any communication code audit request is greater than a preset request duration threshold, obtain the target audit result associated with each communication code audit request from the multiple audit results associated with each communication code audit request.
[0111] In one embodiment, the audit model optimization module 803 is also used to input the sample communication code audit request into the initial code audit model and the target code audit model respectively, obtain the first model inference data of the initial code audit model for the sample communication code audit request, and the second model inference data of the target code audit model for the sample communication code audit request; when the audit performance represented by the second model inference data is better than the audit performance represented by the first model inference data, the target code audit model is used as the optimized code audit model.
[0112] Each module in the optimization device of the above code audit model can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0113] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store audit result data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for optimizing a code audit model is implemented.
[0114] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0115] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0116] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0117] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0118] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0119] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0120] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0121] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for optimizing a code audit model, characterized in that: The method comprises: Acquire multiple audit results output by the initial code audit model for each communication code audit request, and model inference data of the initial code audit model for each communication code audit request; the multiple audit results are obtained by combining different model parameters of the initial code audit model; When the model inference data satisfies a preset condition, obtaining a target audit result associated with each of the communication code audit requests from a plurality of audit results associated with each of the communication code audit requests; The initial code audit model is optimized using each of the target audit results to obtain a target code audit model; the target code audit model is used to obtain an optimized code audit model.
2. The method according to claim 1, characterized in that The obtaining of multiple audit results output by the initial code audit model for each communication code audit request includes: In response to a current communication code audit request, obtaining a code to be audited associated with the current communication code audit request and code audit intention information of the current communication code audit request; the current communication code audit request is any one of the communication code audit requests; Generate a prompt word template corresponding to the current communication code audit request according to the code to be audited and the code audit intention information; The prompt word template is input into the initial code audit model, and multiple audit results corresponding to the current communication code audit request are obtained through different model parameter combinations of the initial code audit model.
3. The method according to claim 2, characterized in that The step of generating a prompt word template corresponding to the current communication code audit request according to the code to be audited and the code audit intention information includes: When the code to be audited meets the preset standard code condition and the code length of the code to be audited does not exceed the preset code length threshold, generating the prompt word template according to the code to be audited and the code audit intention information; When the code to be audited does not meet the preset standard code condition, or the code length exceeds the preset code length threshold, the code to be audited is preprocessed, and the prompt word template is generated based on the preprocessed code to be audited and the code audit intention information.
4. The method according to claim 2, characterized in that The different model parameter combinations of the initial code audit model include a default model parameter combination; after obtaining multiple audit results corresponding to the current communication code audit request through the different model parameter combinations of the initial code audit model, the method further includes: Obtaining a predicted audit result output by a combination of default model parameters of the initial code audit model; The predicted audit result is used as the request response result corresponding to the current communication code audit request.
5. The method according to claim 1, characterized in that The different model parameter combinations of the initial code audit model include a default model parameter combination; the model optimization of the initial code audit model using each of the target audit results to obtain a target code audit model includes: Inputting each of the communication code audit requests into the initial code audit model, and obtaining the predicted audit results corresponding to each of the communication code audit requests through the default model parameter combination of the initial code audit model; According to the predicted audit results and the differences between the target audit results, the model parameters of the initial code audit model are optimized and trained to obtain the target code audit model; After optimizing the initial code audit model by using each of the target audit results to obtain the target code audit model, the method further includes: When the audit performance of the target code audit model is better than that of the initial code audit model, the target code audit model is used as the optimized code audit model.
6. The method according to claim 5, characterized in that The model reasoning data includes reasoning accuracy data of the initial code audit model for each communication code audit request and request feedback duration data; When the model inference data satisfies a preset condition, obtaining a target audit result associated with each of the communication code audit requests from a plurality of audit results associated with each of the communication code audit requests includes: When the inference accuracy data indicates that the number of inference errors of the initial code audit model for each communication code audit request is greater than a preset number threshold, obtaining a target audit result associated with each communication code audit request from a plurality of audit results associated with each communication code audit request; and / or When the request feedback duration data indicates that the request feedback duration of the initial code audit model for any communication code audit request is greater than a preset request duration threshold, the target audit result associated with each communication code audit request is obtained from multiple audit results associated with each communication code audit request.
7. The method according to claim 6, characterized in that When the audit performance of the target code audit model is better than that of the initial code audit model, before using the target code audit model as the optimized code audit model, the method further includes: Inputting the sample communication code audit request into the initial code audit model and the target code audit model respectively, obtaining the first model inference data of the initial code audit model for the sample communication code audit request, and the second model inference data of the target code audit model for the sample communication code audit request; When the audit performance represented by the second model inference data is better than the audit performance represented by the first model inference data, the target code audit model is used as the optimized code audit model.
8. An optimization device for a code audit model, characterized in that: The device comprises: An audit data acquisition module, used to acquire multiple audit results output by the initial code audit model for each communication code audit request, and model inference data of the initial code audit model for each communication code audit request; the multiple audit results are obtained by combining different model parameters of the initial code audit model; A target result acquisition module, used for acquiring a target audit result associated with each of the communication code audit requests from a plurality of audit results associated with each of the communication code audit requests when the model inference data meets a preset condition; The audit model optimization module is used to optimize the initial code audit model using the target audit results to obtain a target code audit model; the target code audit model is used to obtain an optimized code audit model.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.