Code generation method and device, electronic equipment and readable storage medium
By generating multiple initial codes on the code generation model, cross-reorganization and code scoring and filtering, the problem of poor accuracy of automatic code generation is solved, and higher quality code generation is achieved.
Patent Information
- Application Number
- CN202411660980.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-07
AI Technical Summary
In the prior art, the accuracy of automatic code generation is poor, and it is difficult to meet the needs of complex systems, and there may be logical errors or failure to meet the actual functions.
By generating multiple initial codes based on the code generation model, cross-reorganization and code scoring and filtering, the target code corresponding to the target requirements is determined.
Improve the accuracy and quality of automatic code generation, ensure that the quality of next-generation code does not decrease, and increase the chance of generating better code.
Smart Images

Figure CN119576296A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data processing technology, and in particular relates to a code generation method, device, electronic equipment and readable storage medium. Background Art
[0002] With the increasing complexity and efficiency of software development, code generation technology is becoming more and more important in modern software engineering. Code generation technology refers to the technology of generating executable code or code fragments in an automated way according to specific rules, models or requirements.
[0003] In related technologies, a large amount of sample code data and corresponding sample requirement information are usually used to train a code generation model based on a large language model. When automatic code generation is required, the code requirements are first clarified, a code requirement document is generated, and then the code requirement document is input into the code generation model to obtain the target code output by the code generation model.
[0004] However, due to the limitations of the code generation model, the automatically generated code often fails to meet the needs of complex systems. For example, there may be logical errors or the code may not conform to the actual functions, resulting in poor accuracy of the automatically generated code in related technologies. Summary of the invention
[0005] The present invention provides a code generation method, device, electronic device and readable storage medium to solve the technical problem that the accuracy of automatically generated codes in the related art is poor.
[0006] In a first aspect, the present invention provides a code generation method, the method comprising:
[0007] Generate a plurality of first codes corresponding to the target requirements based on the code generation model;
[0008] Cross-recombining the first code to obtain a second code;
[0009] Screening the plurality of first codes based on the code scores of the first codes to obtain a third code;
[0010] Based on the code score of the second code and the code score of the third code, a target code corresponding to the target requirement is determined from the second code and the third code.
[0011] Optionally, the generating a plurality of first codes corresponding to the target requirements based on the code generation model includes:
[0012] Acquire a plurality of first inference parameter combinations for the code generation model;
[0013] The target requirement is input into the code generation model configured with the first reasoning parameter combination to obtain the plurality of first codes output by the code generation model.
[0014] Optionally, cross-recombining the first code to obtain a second code includes:
[0015] Selecting a code to be reorganized from the first code to obtain a code pair to be reorganized consisting of the code to be reorganized;
[0016] Obtaining semantic features corresponding to a plurality of code segments in the code pair to be reorganized;
[0017] Based on the similarity between the semantic features, determining the cross-code segment from the to-be-reorganized codes of the to-be-reorganized code pair;
[0018] Based on the cross code segment, the code pair to be reorganized is cross-reorganized to obtain a second code.
[0019] Optionally, the selecting a code to be reorganized from the first code includes:
[0020] Based on the code scores of the first codes, calculating the selection probabilities corresponding to the first codes respectively;
[0021] Based on the selection probability, calculating the cumulative probabilities that the first codes respectively correspond to in the code sequence formed by the first codes;
[0022] According to the cumulative probability and the random number sequence, a code to be reorganized corresponding to the random number sequence is selected from the multiple first codes.
[0023] Optionally, the method further comprises:
[0024] Obtaining a plurality of second inference parameter combinations for the code scoring model;
[0025] Inputting the first code into the code scoring model configured with the second reasoning parameter combination, and obtaining a plurality of original scores corresponding to the first code output by the code scoring model;
[0026] A code score for the first code is calculated based on the plurality of raw scores.
[0027] Optionally, the determining the target code corresponding to the target requirement from the second code and the third code based on the code score of the second code and the code score of the third code includes:
[0028] When the code score of the second code and the code score of the third code are both less than or equal to the target score, generating a fourth code and a fifth code based on the second code and the third code;
[0029] In the case where a code score of the second code and a code score of the third code is greater than the target score, the code having the largest code score between the second code and the third code is determined as the target code.
[0030] Optionally, generating a fourth code and a fifth code based on the second code and the third code includes:
[0031] Cross-recombining the offspring codes in the offspring code set formed by the second code and the third code to obtain a fourth code;
[0032] The set of child codes is screened based on the code scores of the child codes to obtain a fifth code.
[0033] In a second aspect, the present invention provides a code generation device, the device comprising:
[0034] A generation module, used to generate a plurality of first codes corresponding to the target requirements based on the code generation model;
[0035] A cross module, used for cross-recombining the first code to obtain a second code;
[0036] A selection module, configured to screen the plurality of first codes based on the code scores of the first codes to obtain a third code;
[0037] A target code module is used to determine a target code corresponding to the target requirement from the second code and the third code based on a code score of the second code and a code score of the third code.
[0038] Optionally, the generating module includes:
[0039] An inference parameter submodule, used to obtain a plurality of first inference parameter combinations for the code generation model;
[0040] The first code generation submodule is used to input the target requirement into the code generation model configured with the first reasoning parameter combination to obtain the multiple first codes output by the code generation model.
[0041] Optionally, the cross-connect module includes:
[0042] A to-be-reorganized code pair submodule, used for selecting to-be-reorganized codes from the first codes to obtain a to-be-reorganized code pair consisting of the to-be-reorganized codes;
[0043] A semantic feature submodule, used for obtaining semantic features respectively corresponding to a plurality of code segments in the code pair to be reorganized;
[0044] A cross-code segment submodule, used for determining a cross-code segment from the to-be-reorganized codes of the to-be-reorganized code pair based on the similarity between the semantic features;
[0045] The second code generation submodule is used to cross-reorganize the code pairs to be reorganized based on the cross-code segments to obtain second codes.
[0046] Optionally, the code pair submodule to be reorganized includes:
[0047] A selection probability unit, used for calculating the selection probabilities corresponding to the first codes respectively based on the code scores of the first codes;
[0048] A cumulative probability unit, used for calculating the cumulative probabilities of the first codes respectively corresponding to the code sequence composed of the first codes based on the selection probability;
[0049] The to-be-reorganized code selection unit is used to select the to-be-reorganized code corresponding to the random number sequence from the multiple first codes according to the cumulative probability and the random number sequence.
[0050] Optionally, the device further comprises:
[0051] An inference parameter combination module, used to obtain a plurality of second inference parameter combinations for the code scoring model;
[0052] an original scoring module, configured to input the first code into the code scoring model configured with the second reasoning parameter combination, and obtain a plurality of original scores corresponding to the first code output by the code scoring model;
[0053] A code scoring module is used to calculate a code score of the first code based on the multiple original scores.
[0054] Optionally, the target code module includes:
[0055] A third code generating submodule is used to generate a fourth code and a fifth code based on the second code and the third code when the code score of the second code and the code score of the third code are both less than or equal to the target score;
[0056] a target code determination submodule, for determining the code with the largest code score between the second code and the third code as the target code when there is a code score greater than the target score between the code score of the second code and the code score of the third code.
[0057] Optionally, the third code generation submodule includes:
[0058] a code cross-recombination unit, configured to cross-recombine the child codes in the child code set formed by the second code and the third code to obtain a fourth code;
[0059] The code screening unit is used to screen the child code set based on the code score of the child code to obtain a fifth code.
[0060] In a third aspect, the present invention provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned code generation method when executing the program.
[0061] In a fourth aspect, the present invention provides a readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the above-mentioned code generation method.
[0062] In an embodiment of the present invention, it includes: generating multiple first codes corresponding to the target requirements based on the code generation model; cross-recombining the first codes to obtain the second code; screening the multiple first codes based on the code scores of the first codes to obtain the third code; and determining the target code corresponding to the target requirements from the second code and the third code based on the code scores of the second code and the code scores of the third code. It is possible to generate multiple codes corresponding to the target requirements, and process the multiple codes in combination with advantage screening and cross-recombination to generate the next generation of codes, so that the next generation of codes can contain variant code individuals and advantage individuals of the previous generation, thereby ensuring that the quality of the next generation of codes will not decline, helping to increase the probability of better individuals appearing in the next generation of codes, and thus improving the code quality of the target code selected therefrom. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0064] Figure 1 is a flowchart of a code generation method provided by an embodiment of the present invention;
[0065] Figure 2 is a flowchart of another code generation method provided by an embodiment of the present invention;
[0066] Figure 3 It is a schematic diagram of a code generation process provided by an embodiment of the present invention;
[0067] Figure 4 is a structural diagram of a code generating device provided by an embodiment of the present invention;
[0068] Figure 5 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0069] 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 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.
[0070] Reference Figure 1 , Figure 1 1 is a flow chart of the steps of a code generation method provided by an embodiment of the present invention. Figure 1 As shown, the method may include:
[0071] Step 101: Generate a plurality of first codes corresponding to target requirements based on a code generation model.
[0072] In the embodiment of the present invention, the target requirement may include any information or file that can indicate the code requirement, and the target requirement may include but is not limited to a text description of the requirement, a voice description of the requirement, a requirement document, a code logic diagram, etc. The target requirement may be provided directly by the user, or may be obtained by mining multimodal information such as meeting records and conversations, which is not specifically limited in the embodiment of the present invention.
[0073] The code generation model represents a model capable of generating code, and the code generation model can generate the corresponding first code according to the input target requirements. The code generation model may include but is not limited to a large language model (LLM) based on neural network technology, a hybrid model, etc., and may also include other machine learning models, which are not specifically limited in the embodiments of the present invention.
[0074] In an embodiment of the present invention, multiple code generation models can be set, and then the target requirements are respectively input into these code generation models to obtain multiple first codes output by the multiple code generation models, and each first code is used to achieve the target requirements. The above-mentioned multiple code generation models may include different types of code generation models, and may also include code generation models of the same type but trained using different training methods and training data, and may also include the same code generation model using different reasoning parameters. Among them, the reasoning parameters may include one or more hyperparameters of the code generation model, for example, one or more of temperature (Temperature), truncation (Top-k / Top-p), penalty coefficient (Repetition Penalty), maximum length (MaxTokens), etc.; the reasoning parameters may also include parameters set based on prompt words, such as one or more of code conciseness parameters, code style parameters, etc., which are not specifically limited in the implementation of the present invention.
[0075] Through the above operations, different versions of the first code can be generated according to the target requirements, so that subsequent selection operations can be performed according to the multiple versions of the first code to obtain a more accurate target code.
[0076] Step 102: cross-recombining the first codes to obtain a second code.
[0077] In an embodiment of the present invention, the first code may be cross-recombined to obtain a second code. Specifically, a first code pair consisting of multiple first codes may be selected from the first code, and for each first code pair, one or more intersection points may be selected from each first code of the first code pair, and two first codes in the first code pair may be cross-recombined based on the intersection points to obtain one or more second codes. The above-mentioned cross-recombination method may include but is not limited to single-point crossover, multi-point crossover, uniform crossover, arithmetic crossover, etc., which is not specifically limited in the embodiment of the present invention.
[0078] The above-mentioned first code pair can be randomly selected and matched from all first codes, or can be selected and matched based on certain rules; the intersection point can be a code line, a code character, a code module, etc. For example, the 50th line in the first code can be determined as an intersection point, or the 1000th character in the first code can be set as an intersection point. The above-mentioned intersection point can be randomly selected from the first code, or can be selected based on certain rules, and the embodiment of the present invention does not make specific limitations.
[0079] For example, if there is a first code x i and the first code x j As a first code pair, for the first code x i and the first code x jPerforming a single-point crossover based on the crossover point k, the following second code x can be obtained: new1 and the second code x new2 :
[0080] x new1 =(x i1 , x i2 , ..., x ik , x j(k+1) , ..., x jn );
[0081] x new2 =(x j1 , x j2 , ..., x jk , x i(k+1) , ..., x in );
[0082] Among them, x i1 , x i2 , ..., x ik Represents the intersection point k from the first code x i The code before the intersection k selected from j(k+1) , ..., x jn Represents the intersection point k from the first code x j The code selected from the intersection point k can be cross-combined into the second code x new1 ;x j1 , x i2 , ..., x jk Represents the intersection point k from the first code x j The code before the intersection k selected from i(k+1) , ..., x in Represents the intersection point k from the first code x i The code selected from the intersection point k can be cross-combined into the second code x new2 .
[0083] It should be noted that the two cross-recombined first codes can generate one second code or two second codes through a set of cross points, or can generate multiple second codes through multiple sets of cross points. The total amount of the second codes obtained by crossing the first codes can be equal to the total amount of the first codes, or can be greater than the total amount of the first codes or less than the total amount of the first codes, which is not specifically limited in the embodiment of the present invention.
[0084] Step 103: Screen the multiple first codes based on the code scores of the first codes to obtain a third code.
[0085] In the embodiment of the present invention, a code score corresponding to each first code can be obtained, and a first code that meets the requirements can be selected from all first codes through the code score as the third code. The code score can be output by a code scoring model, can be scored manually, or can be scored based on the running result of the first code, which is not specifically limited in the embodiment of the present invention.
[0086] Specifically, in one embodiment, the first code can be input into a code scoring model to obtain a code score corresponding to the first code output by the code scoring model. The code scoring model may include but is not limited to a large language model, a hybrid scoring model, etc., wherein the large language model can directly output the score of the first code according to the input first code and the corresponding prompt word; the hybrid scoring model may include multiple scoring modules, such as a style scoring module, a readability scoring module, a time complexity scoring module, etc. The hybrid scoring model can average or weighted average the sub-scores of the first code output by multiple scoring modules to obtain the code score of the first code. It should be noted that in the case where the code generation model and the code scoring model are both large language models, the code generation model and the code scoring model can be the same general large language model, or different large language models that are trained and fine-tuned for the code generation task and the code scoring task, which is not specifically limited in the embodiment of the present invention.
[0087] In another embodiment, the first code may be run to obtain the running result of the first code, and the running result of the first code may be input into the code scoring model to obtain the code score of the first code. The above-mentioned running result may include but is not limited to at least one of error and exception information, code running log, code running output (such as text, graphics, files, etc.), user interface content, running time, resource consumption, etc. In addition, the first code and the above-mentioned running result may be input into the code scoring model together, so that the code scoring model outputs a more accurate code score based on richer information.
[0088] In the embodiment of the present invention, the code scores can be arranged in descending order, and the first codes corresponding to the top preset number (e.g., 40) of code scores are selected as the third code, that is, the preset number of first codes with the largest code scores are selected as the third code; the first codes corresponding to the top preset proportion (e.g., 30%) of code scores can also be selected as the third code. All first codes with code scores exceeding a preset score (e.g., 90) can also be selected from the first codes as the third code, which is not specifically limited in the embodiment of the present invention.
[0089] Step 104: determine a target code corresponding to the target requirement from the second code and the third code based on the code score of the second code and the code score of the third code.
[0090] In an embodiment of the present invention, a second code and a third code can be obtained through a first code, wherein the second code is obtained by cross-recombination of the first code, and the third code is a high-quality first code. Based on the code score of the second code and the code score of the third code, a target code corresponding to the target requirement can be determined from the second code and the third code.
[0091] In one embodiment, the code scores of all second codes and the code scores of all third codes can be obtained, and the code with the highest code score among the second code and the third code is determined as the target code. In another embodiment, it can be determined whether there is a code with a code score greater than or equal to the target score in the second code and the third code. If there is, the code greater than or equal to the target score is determined as the target code. If not, the above method can be continued to generate the fourth code and the fifth code of the next generation according to the second code and the third code, and so on, until the target code can be selected or the termination condition is reached. Among them, the above termination condition may include but is not limited to one or more of the number of generations of generated codes reaching the target number of generations (for example, 20 generations), the highest code score in this generation is equal to the highest code score in the previous generation, and the highest code score of multiple consecutive generations has not increased, etc., which is not specifically limited in the embodiment of the present invention.
[0092] In summary, a code generation method provided by an embodiment of the present invention includes: generating multiple first codes corresponding to target requirements based on a code generation model; cross-recombining the first codes to obtain a second code; screening multiple first codes based on the code scores of the first codes to obtain a third code; and determining a target code corresponding to the target requirement from the second code and the third code based on the code scores of the second code and the code scores of the third code. It is possible to generate multiple codes corresponding to the target requirements, and process the multiple codes in combination with advantage screening and cross-recombination to generate the next generation of codes, so that the next generation of codes can contain variant code individuals and advantage individuals of the previous generation, thereby ensuring that the quality of the next generation of codes will not decline, helping to increase the probability of better individuals appearing in the next generation of codes, and thus improving the code quality of the target code selected therefrom.
[0093] Reference Figure 2 , Figure 2 FIG. 1 is a flowchart of another code generation method provided by an embodiment of the present invention. Figure 2 As shown, the method may include:
[0094] Step 201: Generate a plurality of first codes corresponding to target requirements based on a code generation model.
[0095] This step can refer to the above-mentioned step 101, and will not be described in detail in this embodiment of the present invention.
[0096] Optionally, step 201 may include:
[0097] Sub-step 2011, obtaining a plurality of first reasoning parameter combinations for the code generation model.
[0098] In an embodiment of the present invention, a plurality of first reasoning parameter combinations may be set for a code generation model, and the number of first reasoning parameter combinations may correspond to the number of first codes to be generated (e.g., 100). Each first reasoning parameter combination may include a plurality of parameters, and there may be at least one parameter difference between different first reasoning parameter combinations. Specifically, the first reasoning parameter combination may be set by a technician based on experience, or may be randomly generated, and the embodiment of the present invention does not specifically limit this.
[0099] Optionally, in order to improve the quality of the first code, a matching first reasoning parameter interval can be determined according to the target requirements, so that when the first reasoning parameter is set in the first reasoning parameter interval, the resulting code quality is higher. For example, for the target requirements of the back-end algorithm class, the corresponding parameter interval of the simplicity parameter can be set to a higher level, so that the code generation model can output relatively concise code for the target requirements, thereby improving the running efficiency of the code on the back-end.
[0100] Specifically, multiple demand types and first reasoning parameter categories can be preset, and different first reasoning parameter intervals can be set for first reasoning parameter categories corresponding to different demand types. When applied, the corresponding target demand category is determined according to the target demand, and the target first reasoning parameter interval corresponding to each first reasoning parameter category of the target demand category is directly obtained. Then, a random value is taken in the target first reasoning parameter interval to obtain multiple first reasoning parameter combinations corresponding to the target demand.
[0101] Sub-step 2012: inputting the target requirement into the code generation model configured with the first reasoning parameter combination to obtain the plurality of first codes output by the code generation model.
[0102] In an embodiment of the present invention, a code generation model can be configured according to a first reasoning parameter combination, and the target requirement can be input into the code generation model configured with the first reasoning parameter combination to obtain a first code corresponding to the first reasoning parameter combination output by the code generation model. By configuring and running the code generation model multiple times, the first code corresponding to each first reasoning parameter combination can be obtained.
[0103] It should be noted that the above process of generating the first code can be performed serially or in parallel, that is, multiple code generation models are set up and configured separately to generate the first code in parallel, thereby improving the generation efficiency of the first code.
[0104] By obtaining multiple first reasoning parameter combinations for the code generation model; inputting the target requirements into the code generation model configured with the first reasoning parameter combination, and obtaining multiple first codes output by the code generation model, a single code generation model can be used to generate multiple different versions of the first code using different reasoning parameter combinations. Since these first codes are generated from the same model and have certain similarities, cross-recombination of these first codes helps to improve the probability of obtaining high-quality code offspring.
[0105] Step 202: Select a to-be-reorganized code from the first code to obtain a to-be-reorganized code pair consisting of the to-be-reorganized code.
[0106] In the embodiment of the present invention, the code to be reorganized can be selected from the first code to obtain multiple pairs of codes to be reorganized, each pair of codes to be reorganized can include two different codes to be reorganized. Each first code can be selected as the code to be reorganized, or part of the first code can be selected as the code to be reorganized, which is not specifically limited in the embodiment of the present invention.
[0107] Specifically, a first number of first codes or a first proportion of first codes may be randomly selected from all first codes as codes to be recombined, and then the codes to be recombined are randomly combined to obtain a plurality of pairs of codes to be recombined.
[0108] Optionally, step 202 may include:
[0109] Sub-step 2021, based on the code scores of the first codes, calculating the selection probabilities corresponding to the first codes respectively.
[0110] In order to improve the quality of the selected codes to be reorganized and make the selection of the codes to be reorganized have a certain degree of randomness, the code score of the first code can be used to select the first code to obtain the codes to be reorganized.
[0111] Specifically, the code scores of each first code can be obtained first, and the selection probabilities corresponding to the first codes can be calculated according to the code scores of the first codes. The higher the code score of the first code, the greater the selection probability corresponding to the first code. The selection probability can be calculated based on the following formula 1:
[0112]
[0113] Among them, p(x i ) represents the probability of selecting the i-th first code, f(x i ) represents the code score of the i-th first code, f(x j ) represents the code score of the jth first code, and N represents the total number of first codes.
[0114] Sub-step 2022, based on the selection probability, calculate the cumulative probabilities corresponding to the first code in the code sequence composed of the first code.
[0115] After obtaining the selection probability of the first code, the selection probability of the first code can be directly applied to randomly select the first code to obtain the code to be reorganized. The cumulative probability corresponding to the first code in the code sequence composed of the first code can also be further calculated based on the selection probability.
[0116] Specifically, a code sequence may be generated first, and the position of the first code in the code sequence is not limited. After the code sequence is obtained, the cumulative probability corresponding to each first code in the code sequence may be calculated using the following formula 2:
[0117]
[0118] Among them, q(x i ) represents the cumulative probability corresponding to the i-th first code in the above code sequence, p(x j ) represents the selection probability corresponding to the jth first code in the code sequence.
[0119] Sub-step 2023, selecting a code to be reorganized corresponding to the random number sequence from the multiple first codes according to the cumulative probability and the random number sequence.
[0120] In an embodiment of the present invention, a random number sequence can be generated, and the random numbers in the random number sequence can be arranged in ascending order, and the value interval of the random numbers in the random number sequence is the same as the value interval of the above-mentioned cumulative probability. For example, if the value interval of the cumulative probability is [0, 1], then the random numbers in the random number sequence also belong to [0, 1].
[0121] For the above random number sequence, we can start from the i=0th sequence and find that if the cumulative probability q(x i ) is greater than or equal to the random number m in the random number sequence i , then the first code x in the code sequence i is selected; if the cumulative probability q(x i ) is less than the random number m in the random number sequence i , then compare the next random number m in the random number sequence i+1 The next first code x in the code sequence i+1 The cumulative probability q(x i+1 ) until a first code is selected to obtain a code to be reorganized.
[0122] M random number sequences may be generated, and the above selection operation may be performed using each random number sequence to obtain M codes to be reorganized.
[0123] By calculating the selection probabilities corresponding to the first codes respectively based on the code scoring of the first codes; based on the selection probabilities, calculating the cumulative probabilities corresponding to the first codes in the code sequences composed of the first codes; according to the cumulative probabilities and the random number sequences, the codes to be reorganized corresponding to the random number sequences are selected from multiple first codes. The codes can be selected according to probability, and the first codes with high code scores have a higher probability of being selected, but the first codes with low code scores also have a chance to be selected, which is conducive to maintaining the diversity of the selected codes to be reorganized and helps to improve the possibility of generating the globally optimal target code through the first codes.
[0124] Optionally, in order to improve the diversity of the second code generated by the code pair to be reorganized, the code pair to be reorganized can be constructed according to the differences between the first reasoning parameter combinations corresponding to the codes to be reorganized, and two codes to be reorganized with larger differences in the first reasoning parameter combinations can be regarded as a code pair to be reorganized.
[0125] Specifically, each code to be reorganized can be traversed, and the average parameter difference between the first inference parameter combination of the code to be reorganized and the first inference parameter combination of each other code to be reorganized can be calculated, and the other code to be reorganized with the largest average parameter difference and the code to be reorganized can be used as a pair of codes to be reorganized. The average parameter difference between every two codes to be reorganized can also be calculated, and the combination probability between every two codes to be reorganized can be determined according to the average parameter difference. The larger the average parameter difference, the greater the combination probability, and vice versa. Based on the combination probability between every two codes to be reorganized, the codes to be reorganized are randomly combined to obtain the required pair of codes to be reorganized.
[0126] Step 203: Obtain semantic features corresponding to the plurality of code segments in the code pair to be reorganized.
[0127] In the embodiment of the present invention, since the code needs to maintain certain rules and logic to be usable, in order to improve the quality of the second code obtained by cross-recombination and reduce the proportion of invalid code in the second code, the semantic features of the code segment can be used to determine the intersection point.
[0128] Specifically, the code to be reorganized can be divided into multiple code segments by preset segmentation rules. The code segments can be code lines, code function modules, function modules, etc. Each code segment can be input into a semantic extraction model to obtain semantic features corresponding to each code segment. The semantic extraction model can include but is not limited to a large language model, a word vector model (Word Embedding Models), etc., which is not specifically limited in the embodiment of the present invention.
[0129] In addition, the determination of the above code segment can also be determined based on an Abstract Syntax Tree (AST). Specifically, the standard library of the programming language used by the code to be reorganized (such as Python's AST module) or other parsing tools can be used to parse the code to be reorganized into AST, and each node in the AST can be determined as a code segment.
[0130] Step 204: determining cross-code segments from the to-be-reorganized codes of the to-be-reorganized code pair based on the similarity between the semantic features.
[0131] In an embodiment of the present invention, the semantic similarity between the code segments of two codes to be reorganized in the code pair to be reorganized can be calculated based on the semantic features of the above-mentioned code segments, and the code segment with the highest semantic similarity can be determined as the cross-code segment, or the cross-code segment can be randomly selected from the code segments whose semantic similarity exceeds the similarity threshold.
[0132] Exemplarily, there is a pair of codes to be reorganized including code A to be reorganized {a1, b1, c1, d1} and code B to be reorganized {a2, b2, c2, d2, e2}, wherein, if the semantic similarity between code segment c1 of code to be reorganized A and code segment d2 of code segment B to be reorganized is the highest, then the above c1 and d2 can be selected as cross-code segments, that is, used to cross-reorganize the intersection of the above code A to be reorganized and code B to be reorganized.
[0133] In addition, following the above example, b1 in the code A to be reorganized can be directly selected as a cross-code segment, and the semantic similarity between b1 and each code segment in the code B to be reorganized can be obtained, and the code segment with the highest semantic similarity in the code B to be reorganized (for example, c2) can be determined as the cross-code segment of the code B to be reorganized, so that b1 in the code A to be reorganized and c2 in the code B to be reorganized can be used as their respective intersections for cross-reorganization.
[0134] It should be noted that if the crossing mode is single-point crossing, a group of crossing code segments are determined in each pair of codes to be reorganized; if the crossing mode is multi-point crossing, multiple groups of crossing code segments can be determined in each pair of codes to be reorganized, which is not specifically limited in the embodiment of the present invention.
[0135] Step 205: Based on the cross code segment, cross-reorganize the code pair to be reorganized to obtain a second code.
[0136] In the embodiment of the present invention, the cross code segment can be used as a cross point to cross-recombine the code pair to be recombined to obtain a second code. If a single-point crossover is performed, a code pair to be recombined can be cross-recombined to obtain one or two second codes, and if a multi-point crossover is performed, the code pair to be recombined can be cross-recombined to obtain multiple second codes, which is not specifically limited in the embodiment of the present invention.
[0137] By selecting codes to be reorganized from a first code, a code pair to be reorganized consisting of the codes to be reorganized is obtained; semantic features corresponding to a plurality of code segments in the code pair to be reorganized are obtained; based on the similarity between the semantic features, a cross-code segment is determined from the codes to be reorganized of the code pair to be reorganized; based on the cross-code segment, the code pair to be reorganized is cross-reorganized to obtain a second code, which can improve the quality of the second code obtained by the cross-reorganization, reduce the proportion of invalid codes in the second code, and help improve the quality of the target code obtained subsequently.
[0138] Step 206: Screen the multiple first codes based on the code scores of the first codes to obtain a third code.
[0139] This step can refer to step 103, and will not be described in detail in this embodiment of the present invention.
[0140] Optionally, when the code scoring model is a large language model, a scoring prompt word model can also be constructed, and multiple first codes and target requirements are filled into corresponding positions of the scoring prompt word model to obtain code scoring input information, and the code scoring input information is input into the code scoring model as a whole, so as to obtain the code score output by the code scoring model for each first code at one time, thereby improving the efficiency of obtaining code scores.
[0141] For example, a code scoring input information may be as follows:
[0142] You are a senior code engineer. You are given a problem description for generating code and multiple codes generated. You can rate each code on a scale of 0-100, where 0 means the generated code is of the worst quality and cannot be used, and 100 means the generated code is of the highest quality and can be used and run directly.
[0143] Requirement description for generated code: {target requirement}
[0144] Generate code 1: {first code 1}
[0145] Generate code 2: {first code 2} ......
[0147] Generate code N: {first code N}
[0148]
[0149] Optionally, the code score can be determined based on the following steps A1 to A3:
[0150] Step A1: Obtain multiple second reasoning parameter combinations for the code scoring model.
[0151] In an embodiment of the present invention, for a code scoring model, multiple second reasoning parameter combinations can be set, and the number of second reasoning parameter combinations can correspond to the number of original scores to be generated (for example, 10). Each second reasoning parameter combination can contain multiple parameters, and there is at least one parameter difference between different second reasoning parameter combinations. Specifically, the second reasoning parameter combination can be set by a technician based on experience, or it can be randomly generated, and the embodiment of the present invention does not specifically limit it. Among them, the code scoring model can be a fusion scoring model including multiple scoring sub-models, and the above-mentioned scoring sub-models can include but are not limited to a code correctness scoring sub-model, a time complexity scoring sub-model, a space complexity scoring sub-model (used to evaluate the efficiency of code operation on storage space utilization), a code readability scoring sub-model, a code security scoring sub-model, etc., and accordingly, the second reasoning parameter can include but is not limited to a plurality of code correctness scoring weights, time complexity scoring weights, space complexity scoring weights, code readability scoring weights, and code security scoring weights.
[0152] Optionally, in order to improve the quality of the original score, a matching second reasoning parameter interval can be determined according to the target requirements, that is, when the second reasoning parameter is set in the second reasoning parameter interval, the quality of the original score obtained is higher. For example, for the target requirements of the back-end algorithm class, the corresponding parameter interval of the space complexity score weight can be set to a higher level, so that the code scoring model can focus more on the space utilization efficiency of the code when outputting the original score.
[0153] Specifically, multiple demand types and second reasoning parameter categories can be preset, and different second reasoning parameter intervals can be set for second reasoning parameter categories corresponding to different demand types. When applied, the corresponding target demand category is determined according to the target demand, and the target second reasoning parameter interval corresponding to each second reasoning parameter category of the target demand category is directly obtained, and then a value is randomly selected in the target second reasoning parameter interval to obtain multiple second reasoning parameter combinations corresponding to the target demand.
[0154] Step A2: input the first code into the code scoring model configured with the second reasoning parameter combination, and obtain multiple original scores corresponding to the first code output by the code scoring model.
[0155] In an embodiment of the present invention, a code scoring model can be configured according to a second reasoning parameter combination, and a first code can be input into the code scoring model configured with the second reasoning parameter combination to obtain an original score corresponding to the second reasoning parameter combination output by the code scoring model. By configuring the code scoring model multiple times, the original score corresponding to the first code under each second reasoning parameter combination configuration can be obtained.
[0156] It should be noted that the above process of generating raw scores can be performed serially or in parallel, that is, multiple code scoring models are set up and configured separately to generate raw scores in parallel, thereby improving the efficiency of generating raw scores.
[0157] Step A3: calculating a code score of the first code based on the multiple original scores.
[0158] In the embodiment of the present invention, the code score corresponding to the first code may be calculated according to the multiple original scores corresponding to the first code. Specifically, the multiple original scores are accumulated to obtain the code score of the first code, or the multiple original scores are averaged to obtain the code score of the first code, which is not specifically limited in the embodiment of the present invention.
[0159] It should be noted that all code scoring in the embodiment of the present invention can be performed in the same or similar manner as the code scoring for determining the first code described above, and the embodiment of the present invention will not be described in detail.
[0160] By obtaining multiple second reasoning parameter combinations for a code scoring model; inputting the first code into a code scoring model configured with the second reasoning parameter combination to obtain multiple original scores corresponding to the first code output by the code scoring model; and calculating the code score of the first code based on the multiple original scores, a more accurate code score can be generated for the code, which helps to improve the accuracy of determining the target code for the target requirement based on the code score.
[0161] Step 207: When the code score of the second code and the code score of the third code are both less than or equal to the target score, a fourth code and a fifth code are generated based on the second code and the third code.
[0162] In an embodiment of the present invention, it can be determined whether there is a code in the second code and the third code whose code score is greater than or equal to the target score. If so, the code greater than or equal to the target score is determined as the target code. If not, the above method can be continued to generate the next generation of the fourth code and the fifth code based on the second code and the third code.
[0163] Optionally, step 207 may include:
[0164] Sub-step 2071, cross-recombining the offspring codes in the offspring code set composed of the second code and the third code to obtain a fourth code.
[0165] In the embodiment of the present invention, the second code and the third code can be used as the child codes of the first code to form a child code set of the first code, and the child codes in the child code set are cross-recombined to obtain a fourth code. It should be noted that the specific process can be the same or similar to the above-mentioned process of cross-recombining the first code to obtain the second code, and the embodiment of the present invention will not be repeated.
[0166] Sub-step 2072, screening the set of child codes based on the code scores of the child codes to obtain a fifth code.
[0167] In the embodiment of the present invention, the descendant code set can be screened based on the code score of the descendant code to obtain the fifth code. The specific process can be the same or similar to the process of screening the first code to obtain the third code, and the embodiment of the present invention will not be repeated.
[0168] Step 208: When a code score of the second code and a code score of the third code is greater than the target score, the code with the largest code score between the second code and the third code is determined as the target code.
[0169] In the embodiment of the present invention, the code scores of all fourth codes and the code scores of fifth codes may be obtained, and the code with the highest code score among the fourth code and the fifth code is determined as the target code.
[0170] Furthermore, it is also possible to determine whether there is a code in the fourth code and the fifth code whose code score is greater than or equal to the target score. If so, the code greater than or equal to the target score is determined as the target code. If not, the above method can be continued to generate the next generation of child codes based on the fourth code and the fifth code, and this process continues until the target code can be selected or the termination condition is reached.
[0171] A fourth code is obtained by cross-recombining the child codes in the child code set composed of the second code and the third code, and a fifth code is obtained by screening the child code set based on the code scores of the child codes, and a target code corresponding to the target requirement is determined from the fourth code and the fifth code based on the code scores of the fourth code and the fifth code. New codes can be continuously generated in each generation through cross-recombination, and high-quality codes of the previous generation can be retained in each generation, so that the code quality of each generation will not deteriorate, which helps to obtain better target codes through multiple rounds of iterations and improves the accuracy of target codes generated according to target requirements.
[0172] Exemplarily, in the first step, 100 first reasoning parameter combinations can be configured, and the first reasoning parameter combinations are used to call the large language model multiple times to generate code to obtain 100 first codes; in the second step, a code scoring model (which can be a large language model) is used to determine the code score corresponding to each first code, and the score range can be 0-100. The higher the quality of the generated code, the higher the score; in the third step, 60 first codes are selected from the 100 first codes, and 30 pairs of codes to be reorganized are obtained by combining them. These 30 pairs of codes to be reorganized are subjected to single-point cross-reorganization to obtain 60 second codes. For example, a pair of codes to be reorganized contains code A and code B. Code A has 30 lines and code B has 50 lines. The intersection point is 0.5 (i.e., the center position of the code). Then, the first 15 lines of code A and the first 25 lines of code B are exchanged to generate the next generation of code A. new Code and B new code; the fourth step, sorting the above 100 first codes from high to low according to the code score, taking the first 40 first codes and directly copying them to obtain 40 third codes, and the 40 third codes and the above 60 second codes together constitute 100 child codes of the above first code; the fifth step, judging whether the termination condition is met, if so, selecting the code with the highest code score as the target code output, if the termination condition is not met, repeating the above steps 2 to 5.
[0173] Reference Figure 3 , Figure 3 A schematic diagram of a code generation process provided by an embodiment of the present invention is shown. Figure 3 As shown, the user demand can be input into the large language model to obtain the first code output by the large language model, and then the code score is determined. According to the code score, it is determined whether to terminate the loop. If the determination result is no, the first code is cross-reorganized and advantaged to obtain the child code, and the code score is re-determined. This cycle is repeated until the termination condition is met, and the optimal code is selected from the current child code and output as the target code required by the user.
[0174] In summary, another code generation method provided by an embodiment of the present invention includes: generating multiple first codes corresponding to target requirements based on a code generation model; cross-recombining the first codes to obtain a second code; screening multiple first codes based on the code scores of the first codes to obtain a third code; and determining a target code corresponding to the target requirement from the second code and the third code based on the code scores of the second code and the code scores of the third code. It is possible to generate multiple codes corresponding to the target requirements, and process the multiple codes in combination with advantage screening and cross-recombination to generate the next generation of codes, so that the next generation of codes can contain variant code individuals and advantage individuals of the previous generation, thereby ensuring that the quality of the next generation of codes will not decline, helping to increase the probability of better individuals appearing in the next generation of codes, and thus improving the code quality of the target code selected therefrom.
[0175] Reference Figure 4 , Figure 4 40 is a structural diagram of a code generating device provided by an embodiment of the present invention. The code generating device 40 may include:
[0176] A generating module 41, configured to generate a plurality of first codes corresponding to target requirements based on a code generation model;
[0177] A cross module 42, used for cross-recombining the first code to obtain a second code;
[0178] A selection module 43, configured to screen the plurality of first codes based on the code scores of the first codes to obtain a third code;
[0179] The target code module 44 is used to determine the target code corresponding to the target requirement from the second code and the third code based on the code score of the second code and the code score of the third code.
[0180] Optionally, the generating module includes:
[0181] An inference parameter submodule, used to obtain a plurality of first inference parameter combinations for the code generation model;
[0182] The first code generation submodule is used to input the target requirement into the code generation model configured with the first reasoning parameter combination to obtain the multiple first codes output by the code generation model.
[0183] Optionally, the cross-connect module includes:
[0184] A to-be-reorganized code pair submodule, used for selecting to-be-reorganized codes from the first codes to obtain a to-be-reorganized code pair consisting of the to-be-reorganized codes;
[0185] A semantic feature submodule, used for obtaining semantic features respectively corresponding to a plurality of code segments in the code pair to be reorganized;
[0186] A cross-code segment submodule, used for determining a cross-code segment from the to-be-reorganized codes of the to-be-reorganized code pair based on the similarity between the semantic features;
[0187] The second code generation submodule is used to cross-reorganize the code pairs to be reorganized based on the cross-code segments to obtain second codes.
[0188] Optionally, the code pair submodule to be reorganized includes:
[0189] A selection probability unit, used for calculating the selection probabilities corresponding to the first codes respectively based on the code scores of the first codes;
[0190] A cumulative probability unit, used for calculating the cumulative probabilities of the first codes respectively corresponding to the code sequence composed of the first codes based on the selection probability;
[0191] The to-be-reorganized code selection unit is used to select the to-be-reorganized code corresponding to the random number sequence from the multiple first codes according to the cumulative probability and the random number sequence.
[0192] Optionally, the device further comprises:
[0193] An inference parameter combination module, used to obtain a plurality of second inference parameter combinations for the code scoring model;
[0194] an original scoring module, configured to input the first code into the code scoring model configured with the second reasoning parameter combination, and obtain a plurality of original scores corresponding to the first code output by the code scoring model;
[0195] A code scoring module is used to calculate a code score of the first code based on the multiple original scores.
[0196] Optionally, the target code module includes:
[0197] A third code generating submodule is used to generate a fourth code and a fifth code based on the second code and the third code when the code score of the second code and the code score of the third code are both less than or equal to the target score;
[0198] a target code determination submodule, for determining the code with the largest code score between the second code and the third code as the target code when there is a code score greater than the target score between the code score of the second code and the code score of the third code.
[0199] Optionally, the third code generation submodule includes:
[0200] a code cross-recombination unit, configured to cross-recombine the child codes in the child code set formed by the second code and the third code to obtain a fourth code;
[0201] The code screening unit is used to screen the child code set based on the code score of the child code to obtain a fifth code.
[0202] In summary, the code generation device provided by the embodiment of the present invention can generate multiple codes corresponding to the target requirements, and process the multiple codes in combination with advantage screening and cross-recombination to generate the next generation of codes, so that the next generation of codes can contain variant code individuals and advantaged individuals of the previous generation, thereby ensuring that the quality of the next generation of codes will not decline, helping to increase the probability of better individuals appearing in the next generation of codes, and further improving the code quality of the target code selected therefrom.
[0203] Reference Figure 5 , the present invention also provides a structural diagram of an electronic device, such as Figure 5 As shown, it includes: a processor 1101, a memory 1102, and a computer program 11021 stored in the memory and executable on the processor, and the code generation method of the aforementioned embodiment is implemented when the processor executes the program.
[0204] The present invention also provides a readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the code generation method of the aforementioned embodiment.
[0205] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0206] It should be noted that the various information and data obtained in the embodiments of the present invention are all obtained with the authorization of the information / data holder.
[0207] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the description of the above specific languages is for disclosing the best mode of the present invention.
[0208] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0209] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0210] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0211] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present invention. The present invention may also be implemented as a device or apparatus program for executing part or all of the methods described herein. Such a program for implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0212] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
[0213] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0214] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
[0215] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A code generation method, characterized in that: The method comprises: Generate a plurality of first codes corresponding to the target requirements based on the code generation model; Cross-recombining the first code to obtain a second code; Screening the plurality of first codes based on the code scores of the first codes to obtain a third code; Based on the code score of the second code and the code score of the third code, a target code corresponding to the target requirement is determined from the second code and the third code.
2. The method according to claim 1, characterized in that The generating a plurality of first codes corresponding to the target requirements based on the code generation model includes: Obtaining a plurality of first inference parameter combinations for the code generation model; The target requirement is input into the code generation model configured with the first reasoning parameter combination to obtain the plurality of first codes output by the code generation model.
3. The method according to claim 1, characterized in that The cross-recombining of the first code to obtain the second code includes: Selecting a code to be reorganized from the first code to obtain a code pair to be reorganized consisting of the code to be reorganized; Obtaining semantic features corresponding to a plurality of code segments in the code pair to be reorganized; Based on the similarity between the semantic features, determining the cross-code segment from the to-be-reorganized codes of the to-be-reorganized code pair; Based on the cross code segment, the code pair to be reorganized is cross-reorganized to obtain a second code.
4. The method according to claim 3, characterized in that The step of selecting a code to be reorganized from the first code comprises: Based on the code scores of the first codes, calculating the selection probabilities corresponding to the first codes respectively; Based on the selection probability, calculating the cumulative probabilities that the first codes respectively correspond to in the code sequence formed by the first codes; According to the cumulative probability and the random number sequence, a code to be reorganized corresponding to the random number sequence is selected from the multiple first codes.
5. The method according to claim 1, characterized in that The method further comprises: Obtaining a plurality of second inference parameter combinations for the code scoring model; Inputting the first code into the code scoring model configured with the second reasoning parameter combination, and obtaining a plurality of original scores corresponding to the first code output by the code scoring model; A code score for the first code is calculated based on the plurality of raw scores.
6. The method according to claim 1, characterized in that The determining, based on the code score of the second code and the code score of the third code, the target code corresponding to the target requirement from the second code and the third code comprises: When the code score of the second code and the code score of the third code are both less than or equal to the target score, generating a fourth code and a fifth code based on the second code and the third code; In the case where a code score of the second code and a code score of the third code is greater than the target score, the code having the largest code score between the second code and the third code is determined as the target code.
7. The method according to claim 6, characterized in that The generating a fourth code and a fifth code based on the second code and the third code comprises: Cross-recombining the offspring codes in the offspring code set formed by the second code and the third code to obtain a fourth code; The set of child codes is screened based on the code scores of the child codes to obtain a fifth code.
8. A code generating device, characterized in that: The device comprises: A generation module, used to generate a plurality of first codes corresponding to the target requirements based on the code generation model; A cross module, used for cross-recombining the first code to obtain a second code; A selection module, configured to screen the plurality of first codes based on the code scores of the first codes to obtain a third code; A target code module is used to determine a target code corresponding to the target requirement from the second code and the third code based on a code score of the second code and a code score of the third code.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the program.
10. A readable storage medium, characterized in that: When the instructions in the readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the methods described in claims 1-7.
Citation Information
Cited By
Self-adaptive code processing method and device based on artificial intelligence and intelligent agent
CN120909565A