Artificial intelligence-based self-adaptive code processing method, apparatus, and intelligent agent
The AI-based adaptive code processing method addresses the challenge of balancing diversity and performance in code evolution by iteratively cross-mutating codes with low similarity, ensuring efficient and diverse code generation.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-03-17
AI Technical Summary
Existing code generation and optimization technologies face challenges in balancing the diversity of evolution plans and performance optimization, leading to inefficiencies in code development.
An adaptive code processing method and apparatus using artificial intelligence to measure the similarity of entire codes and code slices, cross-mutate codes with low similarity, and iteratively refine the candidate code set to ensure evolved diversity and efficiency.
The method ensures evolved diversity and improves code generation efficiency by generating a target code set that serves as a data reference for automatic code generation, optimization, or repair, while avoiding local optima.
Smart Images

Figure 2026048883000001_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and particularly to technical fields such as intelligent agents, coding agents, assisted programming, large language models, deep learning, search-enhanced generation, etc. Specifically, it relates to an adaptive code processing method, apparatus, and intelligent agent based on artificial intelligence.
Background Art
[0002] The technologies of automatic code generation and optimization play an important role in improving development efficiency, reducing the technical threshold, and improving code quality. The evolution of program candidate solutions usually depends on the intersection and mutation of code slices. How to balance the diversity of evolution plans and the optimization of performance during search has become an important bottleneck restricting technological development.
Summary of the Invention
Problems to be Solved by the Invention
[0003] The present disclosure aims to solve at least one of the technical problems in the related art to some extent.
Means for Solving the Problems
[0004] Therefore, the objective of the present disclosure is to provide an adaptive code processing method, apparatus, and intelligent agent based on artificial intelligence, measure the similarity of the entire code and the slices in the code respectively, cross candidate code programs with low similarity, ensure the evolved diversity, and improve the code generation efficiency at the same time.
[0005] According to a first aspect of the present disclosure, an adaptive processing method based on artificial intelligence is provided. A step of obtaining a candidate code set, where the candidate code set includes a plurality of candidate codes, first description information corresponding to each candidate code, and second description information corresponding to each slice in the candidate code respectively. A step of determining the similarity between each pair of candidate codes in the candidate code set based on a plurality of first descriptive information and a plurality of second descriptive information, The steps include cross-mutating two candidate codes whose corresponding similarity is less than a first threshold to obtain a new set of candidate codes, The step includes, based on the new candidate code set, returning to the step of determining similarity and executing it until a target code set that satisfies the requirements is obtained.
[0006] According to the second aspect of this disclosure, an artificial intelligence-based self-adaptive code processing device is provided, A first acquisition module for obtaining a candidate code set, wherein the candidate code set includes a plurality of candidate codes, first description information corresponding to each of the candidate codes, and second description information corresponding to each slice in the candidate code. A first decision module for determining the similarity between each pair of candidate codes in the candidate code set based on a plurality of the first description information and a plurality of the second description information, A first processing module for obtaining a new set of candidate codes by cross-mutating two candidate codes whose corresponding similarity is less than a first threshold, The system includes a second processing module for returning to the step of determining similarity until a target code set that satisfies the requirements is obtained based on the aforementioned new candidate code set.
[0007] According to the third aspect of this disclosure, an intelligent agent is provided, An input module for receiving the code to be processed and / or the code processing instructions, Based on the code to be processed and / or the code processing instructions, a large-scale model is invoked and executed as follows: First Aspect Embodiment: A self-adaptive code processing method based on artificial intelligence, a processing module for obtaining a target code set, Includes an output module for outputting the aforementioned target code set.
[0008] According to the fourth aspect of this disclosure, providing an electronic device, At least one processor, Includes a memory that is communicably connected to at least one of the processors, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to cause the at least one processor to execute the self-adaptive code processing method based on artificial intelligence described in the first aspect.
[0009] According to a fifth aspect of this disclosure, a non-temporary computer-readable storage medium is provided in which computer instructions are stored, the computer instructions are used to cause the computer to execute the artificial intelligence-based self-adaptive code processing method described in the first aspect.
[0010] According to the sixth aspect of this disclosure, a computer program including computer instructions is provided, which, when executed by the computer instruction processor, realizes the steps of the artificial intelligence-based self-adaptive code processing method described in the first aspect. [Effects of the Invention]
[0011] The artificial intelligence-based self-adaptive coding processing method, apparatus, and intelligent agent provided herein have the following beneficial effects: This disclosure describes how the similarity between each pair of candidate codes can be measured based on the overall description and slice description information of each candidate code in the candidate code set, then two candidate codes with low similarity are selected and cross-mutated to obtain a new candidate code set and recalculate the similarity, and after multiple iterations a target code set that satisfies the requirements can be obtained. This ensures evolved diversity while improving the efficiency of code generation, as the target code set provides a data reference for automatic code generation, optimization, or repair.
[0012] Note that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present application will be more easily understood through the descriptions in the following specification.
Brief Description of the Drawings
[0013] The above and / or additional aspects and advantages of the present disclosure will be apparent and easily understood from the description of the embodiments in connection with the following attached drawings. The attached drawings do not constitute a limitation of the present disclosure and are used to better understand the present invention. [Figure 1] It is a flowchart of a self-adaptive code processing method based on artificial intelligence provided by an embodiment of the present disclosure. [Figure 2] It is a flowchart of a self-adaptive code processing method based on artificial intelligence provided by another embodiment of the present disclosure. [Figure 3] It is a flowchart of a self-adaptive code processing method based on artificial intelligence provided by another embodiment of the present disclosure. [Figure 4] It is a flowchart of a self-adaptive code processing method based on artificial intelligence provided by another embodiment of the present disclosure. [Figure 5] It is a schematic structural diagram of a self-adaptive code processing device based on artificial intelligence provided by an embodiment of the present disclosure. [Figure 6] It is a schematic structural diagram of an intelligent agent provided by an embodiment of the present disclosure. [Figure 7] It is a block diagram of an exemplary electronic device suitable for realizing the implementation manner of the present disclosure.
Modes for Carrying Out the Invention
[0014] Exemplary embodiments of the present application will be described below in combination with the drawings. For ease of understanding, various details of the embodiments of the present invention are included therein, which should be regarded as merely exemplary. Therefore, those skilled in the art can make various changes and modifications to the embodiments described herein without departing from the scope and spirit of the present invention. Also, for clarity and conciseness, the following description omits the description of well-known functions and structures.
[0015] Embodiments of the present disclosure relate to the field of artificial intelligence technologies such as intelligent agents, coding agents, assisted programming, large language models, deep learning, and search-enhanced generation.
[0016] Artificial Intelligence. Abbreviated as AI in English. It is a new technical science of theories, methods, technologies, and application systems that are researched and developed to simulate, expand, and augment human intelligence. Artificial intelligence is a branch of computer science that attempts to understand the nature of intelligence and produce new intelligent machines that react in a way similar to human intelligence.
[0017] An intelligent agent is a computer system or entity that can act autonomously, perceive the environment, make decisions, and interact with the environment. Usually, the decision-making and processing unit centered around a large language model has the ability to independently think about and call tools in order to gradually achieve specific goals.
[0018] A coding agent is an artificial intelligence tool that can automatically execute programming tasks. By understanding natural language instructions and converting them into effective code slices, the productivity of developers can be improved.
[0019] Programming assistance refers to technical approaches that provide developers with support at each stage of the software development lifecycle through tools, technologies, or services, thereby reducing the difficulty of programming, minimizing redundancy, avoiding errors, and improving development efficiency. It is not a complete replacement for artificial programming, but rather acts as a "partner" to the developer, covering the entire process from code creation and debugging to maintenance, and is particularly well-suited to resolving issues such as redundancy, grammatical conventions, and logical checking.
[0020] Large Language Models (LLMs) refer to deep learning models trained on massive amounts of text data, enabling them to generate natural language text and understand the meaning of linguistic text. By training on enormous datasets, these models can provide deep knowledge and language production on a variety of topics. Their core idea is to learn the modes and structures of natural language through large-scale, unsupervised training, thereby simulating, to some extent, the human language cognition and generation processes.
[0021] Deep learning involves learning the intrinsic laws and levels of representation of sample data. The information acquired during this learning process is useful for interpreting data such as text, images, and audio. The ultimate goal of deep learning is for machines to have analytical learning capabilities like humans, enabling them to identify data such as text, images, and audio.
[0022] Retrieval-augmented generation (RAG) is a method that incorporates language models and information retrieval techniques. Specifically, when a model needs to generate text or answer a question, it searches for relevant information from a vast set of documents, and then uses this retrieved information to guide text generation, improving the quality and accuracy of predictions.
[0023] In the technical scheme disclosed herein, all processing of relevant user personal information, including collection, storage, use, processing, transmission, provision, and disclosure, complies with the provisions of applicable laws and regulations and does not violate public order and morals.
[0024] The following describes, with reference to the drawings, an artificial intelligence-based self-adaptive code processing method, apparatus, and intelligent agent according to embodiments of this disclosure.
[0025] Here, the entity executing the AI-based self-adaptive code processing method of this embodiment is an AI-based self-adaptive code processing device, which can be implemented by software and / or hardware, and which can be configured on an electronic device, the electronic device including but not limited to terminals, servers, etc.
[0026] Figure 1 is a flowchart of an artificial intelligence-based self-adaptive code processing method provided by one embodiment of the present disclosure.
[0027] As shown in Figure 1, the self-adaptive code processing method based on artificial intelligence includes the following steps: S101: Retrieve the candidate code set.
[0028] A candidate code set includes multiple candidate codes, a first description corresponding to each candidate code, and a second description corresponding to each slice in the candidate code.
[0029] The first descriptive information may include information that describes the functionality, logic, and algorithm type of any code.
[0030] The second descriptive information may include information that describes the algorithm, data structure, input data, and output data corresponding to any code slice.
[0031] In embodiments of this disclosure, candidate code sets can be obtained in different ways based on user needs. For example, if a user inputs code and performs processing such as completion, optimization, or repair, all solutions generated during the evolution of the input code can be determined as candidate codes, and a candidate code set can be obtained. Alternatively, a code database collected in the history can be queried to identify codes relevant to the user's needs as candidate codes, and a candidate set can be obtained.
[0032] In the embodiments of this disclosure, each candidate code can be represented as several code slices, each slice can correspond to the solution of one subproblem, and second descriptive information corresponding to the slice can be determined based on the algorithm, data structure, input data, and output data of the subproblem.
[0033] S102: Based on multiple first descriptive information and multiple second descriptive information, the similarity between each pair of candidate codes in the candidate code set is determined.
[0034] In embodiments of this disclosure, for any two candidate codes in a candidate code set, the overall similarity can be determined by measuring the functional target and overall policy proximity between the two candidate codes using first descriptive information of the two candidate codes, and by measuring local differences in the slicing method, data structure, input / output, etc., between the two candidate codes using second descriptive information of the two candidate codes, and by determining local similarity. The similarity between each pair of candidate codes in the candidate code set can then be determined by fusing the similarities of these two aspects, for example, by addition or weighted addition, to obtain the similarity between the two candidate codes.
[0035] S103: Cross-mutate two candidate codes whose corresponding similarity is less than the first threshold to obtain a new set of candidate codes.
[0036] The first threshold may be a dynamically set threshold based on experience or actual needs. A small value for the first threshold is used to filter out candidate codes with less similarity in the candidate code set.
[0037] In the embodiments of this disclosure, the similarity between each pair of candidate codes in the candidate code set can be determined, and each obtained similarity is then compared to a first threshold. If the similarity between two candidate codes is less than the first threshold, it indicates that there are significant differences between these two candidate codes in terms of function, logic, and the type of algorithm employed. These two candidate codes can then be cross-mutated, for example by reconstructing a code slice, to generate a new code structure and obtain a new candidate code, thus avoiding being limited to a local optimal solution too early during processing. After all two candidate codes whose corresponding similarity is less than the first threshold have been cross-mutated, a new set of candidate codes, i.e., a new candidate code set, is obtained.
[0038] In the embodiments of this disclosure, cross-mutating two candidate codes with low similarity can expand the structural diversity of new candidate solutions and ensure diversity in coding processing.
[0039] S104: Based on the new candidate code set, return to the step of determining similarity until you obtain a target code set that meets the requirements.
[0040] In embodiments of this disclosure, after obtaining a new candidate code set, the candidate code set can be evaluated to determine whether the current candidate code set meets the requirements. For example, an evaluation tool can be used to score the quality of the candidate code set, and if it is determined that the quality score of the candidate code set is higher than a score threshold set by the user, the candidate code set can be determined to be a target code set that meets the requirements. Alternatively, other conditions can be set based on actual needs to determine whether a candidate code set is a target code set, and this disclosure is not limited thereto.
[0041] In embodiments of the present disclosure, if a new candidate code set is obtained and the candidate code set does not meet the requirements, the similarity is recalculated for each of two candidate codes in the candidate code set, then two candidate codes with a first threshold of low similarity are selected and cross-mutated, then a new candidate code set is obtained, and this can be repeated multiple times. If the newly obtained candidate code set meets the requirements, the iteration can be stopped and that candidate code set can be determined as the target code set.
[0042] In the embodiments of this disclosure, a target code set can be obtained, and then, based on the user's task needs, the code in the target code set can be used for code generation, code completion, or optimization, thereby significantly improving the efficiency and effectiveness of code generation and optimization.
[0043] In this embodiment, the similarity between each pair of candidate codes is measured based on the overall description information and slice description information of each candidate code in the candidate code set. Then, two candidate codes with low similarity are selected and cross-mutated to obtain a new candidate code set and recalculate the similarity. After multiple iterations, a target code set that satisfies the requirements is obtained. This ensures evolved diversity while simultaneously improving code generation efficiency, as the target code set provides data references for automatic code generation, optimization, or repair.
[0044] The AI-based self-adaptive code processing method provided in this disclosure can be applied to scenarios such as programming assistance, code auto-completion, code debugging and optimization, and automated vulnerability remediation and test case generation. For example, a developer can input a partial program into an Integrated Development Environment (IDE), use the code processing method of this disclosure to obtain a target code set, and recommend it for use by the developer. Alternatively, a user can input a code slice containing a defect, obtain a target code equivalent to the code slice but more secure or robust, and automatically generate a replacement or repaired version to improve system security.
[0045] Figure 2 is a flowchart of an artificial intelligence-based self-adaptive code processing method provided in other embodiments of this disclosure.
[0046] As shown in Figure 2, the self-adaptive code processing method based on artificial intelligence includes the following steps: S201: Retrieve the candidate code set.
[0047] The description of S201 can be found by referring specifically to the above-mentioned embodiment, and will not be explained further here.
[0048] S202: Based on each of the two first descriptive pieces of information, determine the overall similarity between the two corresponding candidate codes.
[0049] In this disclosure, overall similarity measures the proximity between the functional target and the overall policy of the candidate code, and may also be referred to as overall similarity, semantic similarity, etc.
[0050] In embodiments of the present disclosure, the first descriptive information can be converted into a semantic vector, and the overall similarity between candidate codes can be obtained by cosine similarity calculation; or keywords in the first descriptive information can be matched, and the overall similarity between candidate codes can be determined based on a matching scale; or other calculation methods can be used to determine and obtain the overall similarity between two candidate codes, etc., and the present disclosure is not limited thereto.
[0051] S203: Determine the local similarity between each pair of candidate codes based on the second descriptive information corresponding to each slice in each pair of candidate codes.
[0052] In this disclosure, local similarity measures local differences in the slicing method of candidate code, data structure, and input / output, such as the degree of matching of an abstract syntax tree or control flowchart, and may also be called substructure similarity.
[0053] In embodiments of the present disclosure, the second descriptive information can be converted into a semantic vector, the similarity between slices can be obtained by calculating cosine similarity, and then the similarity of all slices can be merged to obtain the local similarity between the two candidate codes, or the local similarity between the two candidate codes can be determined and obtained using other calculation methods, and the present disclosure is not limited thereto.
[0054] S204: Combines overall and local similarity to obtain the similarity between each pair of candidate codes.
[0055] In the embodiments of this disclosure, the method for merging the overall similarity and local similarity can be direct addition or weighted addition with certain weights.
[0056] For example, when weighting and summing the overall similarity and local similarity with a fixed weight, the similarity between two candidate codes can be expressed by the following equation (1):
[0057]
number
[0058] Selectively, if the similarity between any two candidate codes is greater than or equal to a first threshold, and the local similarity between some slices of any two candidate codes is less than a second threshold, then some slices of any two candidate codes can be cross-mutated to obtain a new candidate code.
[0059] The second threshold may be a dynamically set threshold based on experience or actual needs. A smaller value for the second threshold is used to filter out slices with less similarity in the candidate codes. The second threshold has a different target used for filtering than the first threshold: one candidate code, one slice of candidate code; therefore, no specific size relationship is established between the second threshold and the first threshold.
[0060] In the embodiments of this disclosure, if the similarity between any two candidate codes is greater than or equal to a first threshold, it can be determined that these two candidate codes are all relatively similar in terms of overall function, logic, etc. At this point, slices with relatively low similarity among the candidate codes can be further identified, and by performing cross-mutation on these slices, it is possible to introduce moderate differences and avoid falling into local optima.
[0061] In the embodiments of this disclosure, cross-mutation can be performed on two candidate codes whose corresponding similarity is less than a first threshold, while simultaneously performing cross-mutation on a portion of slices for two candidate codes whose corresponding similarity is greater than or equal to the first threshold and whose local similarity between some slices is less than a second threshold.
[0062] Alternatively, you can cross-mutate two candidate codes whose corresponding similarity is less than the first threshold, update the candidate code set a certain number of times, and then re-run the slice cross-mutation between candidate codes if the similarity between all candidate codes is greater than the first threshold.
[0063] In this embodiment, when the overall similarity of two candidate codes is relatively high, a new candidate code can be obtained by cross-mutating the corresponding slice with low local similarity, introducing a moderate difference and avoiding falling into a local optimum. This facilitates rapid convergence while maintaining diversity among candidate codes, avoiding the output of homogenized codes, and enabling the search for better solutions in complex problems.
[0064] S205: Cross-mutate two candidate codes whose corresponding similarity is less than the first threshold to obtain a new set of candidate codes.
[0065] S206: Based on the new candidate code set, return to the similarity determination step and execute until you obtain a target code set that meets the requirements.
[0066] The descriptions in S205 and S206 can be found by referring specifically to the above-described embodiment, and will not be explained further here.
[0067] In this embodiment, by measuring the similarity between candidate codes from two angles—overall and local—the target code determined based on this similarity not only ensures reliability at the grammatical level but also matches user needs at the functional and performance levels.
[0068] Figure 3 is a flowchart of an artificial intelligence-based self-adaptive code processing method provided in other embodiments of this disclosure.
[0069] As shown in Figure 3, the self-adaptive code processing method based on artificial intelligence includes the following steps: S301: Retrieve candidate code set.
[0070] Selectively, the code generated during the evolutionary process of the received code to be processed can be determined as a candidate code.
[0071] The code to be processed refers to the code provided by the user that needs to be optimized or supplemented.
[0072] In the embodiments of this disclosure, if the code to be processed undergoes multiple operations such as modification, optimization, extension, and restructuring during its evolution process, all code versions generated by all operations can be determined as candidate code. This candidate code can reflect information such as contextual logic and proposed problem-solving techniques in the historical evolution, which is advantageous for improving code quality.
[0073] Alternatively, candidate codes associated with the received code processing instruction can be obtained from the reference code library.
[0074] The reference code library may also be a database that stores historical codes.
[0075] In the embodiments of this disclosure, each reference code in the reference code library may correspond to a different function or algorithm type, and the user can clarify their needs by submitting code processing quality (e.g., what function code they need, what the application is, etc.), and obtain a set of candidate codes, which may be at least one candidate code associated with the code processing instruction received from the reference code library.
[0076] In this embodiment, candidate codes can be obtained using various methods and applied to different task scenes, thereby improving the adaptability of code processing.
[0077] S302: Based on multiple first descriptive information and multiple second descriptive information, the similarity between each pair of candidate codes in the candidate code set is determined.
[0078] The descriptions of S301 and S302 can be found by referring specifically to the above-described embodiment, and will not be explained further here.
[0079] S303: Cross-mutate two candidate codes whose corresponding similarity is less than the first threshold to obtain a new candidate code.
[0080] In the embodiments of this disclosure, the similarity between each pair of candidate codes in the candidate code set can be determined, and then each obtained similarity can be compared to a first threshold. If the similarity between two candidate codes is less than the first threshold, it indicates that there are significant differences between the two candidate codes in terms of function, logic, and the type of algorithm employed. These two candidate codes can then be cross-mutated, for example by reconstructing a code slice, to generate a new code structure and obtain a new candidate code.
[0081] S304: Determine the update policy for the candidate code set based on the type of code processing instruction and / or the first parameter in the code processing instruction.
[0082] The update policy is used to specify the parent code scale, number, and / or parent code filtering criteria to be included in the new candidate code set. A parent code refers to the code used to generate new candidate codes through crossover.
[0083] In the embodiments of this disclosure, different types of code processing instructions may use different update policies because the final retrieved code has a different role. For example, if the target of a code processing instruction generates new logic code, the update policy may discard the parent code. However, if the target generates more optimized code based on an existing framework, the update policy may retain the parent code. Alternatively, if the code processing instruction optimizes the code, some of the parent code may be retained to avoid losing better solutions within the parent code.
[0084] In addition, in the embodiments of this disclosure, the user can directly input the number of parent codes to retain, the scale, etc., when updating the candidate code set during use.
[0085] In the embodiments of this disclosure, the user can further input, during use, first parameters in the code processing instruction, such as the number and scale of parent codes to be retained when updating the candidate code set. This allows the update policy for the candidate code set to be determined based on the first parameters in the code processing instruction.
[0086] This disclosure also allows for determining a candidate code set update policy by integrating the type of code processing instruction and a first parameter in the code processing instruction.
[0087] S305: Retrieve the target parent code from the candidate code set based on the update policy.
[0088] In embodiments of this disclosure, a target parent code can be determined for a group of candidate codes for cross-mutation based on the parent code scale, number, and / or parent code filtering conditions specified in the update policy.
[0089] S306: Determine the new candidate code and target parent code as the new candidate code set.
[0090] In the embodiments of this disclosure, when generating a new code set through cross-mutation, the parent code is included in the new set, thereby maintaining stability and diversity in the code evolution process, preserving optimal solutions, and avoiding the loss of valuable information due to excessive generational changes.
[0091] S307: Based on the new candidate code set, return to the step of determining similarity until you obtain a target code set that meets the requirements.
[0092] The description of S307 can be found by referring specifically to the above-mentioned embodiment, and will not be explained further here.
[0093] Figure 4 is a flowchart of an artificial intelligence-based self-adaptive code processing method provided in other embodiments of this disclosure.
[0094] As shown in Figure 4, the self-adaptive code processing method based on artificial intelligence includes the following steps: S401: If the evaluation service in the system is selected, or if the received code processing instruction instructs the evaluation service to be invoked, the evaluation service is invoked based on the new candidate code set, and the evaluation results output by the evaluation service are retrieved.
[0095] The evaluation results include the evaluation value of the candidate code and / or the slices that should be updated in the candidate code.
[0096] In embodiments of this disclosure, if an evaluation service in the system is selected, or if an received code processing instruction instructs to invoke the evaluation service, the evaluation service can be invoked, and evaluation results can be obtained by using the expert knowledge in the evaluation service to provide feedback from both the whole and local perspectives.
[0097] In embodiments of this disclosure, the evaluation service can assess the overall optimization potential of a new set of candidate codes by scoring each candidate code and obtaining an evaluation value, which can be used to filter candidate codes that can be retained or eliminated from the set. For example, candidate codes with high evaluation values can be retained, and those with evaluation values below a certain value can be removed from the set. Alternatively, the evaluation service can evaluate slices in each candidate code, precisely position the slices that need to be replaced or adjusted, and determine which slices in the candidate code should be updated. Simultaneously, an evaluation value can be obtained for each candidate code, and the slices within it that should be updated can also be determined.
[0098] S402: Update the candidate code set based on the evaluation results.
[0099] In embodiments of this disclosure, after obtaining evaluation results, the update to the new set of candidate codes can be completed by deleting or retaining each candidate code based on the evaluation results, and by replacing or adjusting slices in the candidate codes.
[0100] In this embodiment, by using feedback from the evaluation service to drive a self-adaptive editing policy, redundant candidate solutions resulting from blind search can be significantly reduced, the convergence speed can be increased, and the product's responsiveness and user experience can be improved.
[0101] Selectively, when updating a new candidate code set, the process may include at least one of the following: deleting candidate codes in the new candidate code set whose evaluation value is less than the evaluation threshold, or updating the slices in the candidate codes that need updating to obtain new candidate codes.
[0102] The evaluation threshold may be a value set by the user based on experience or actual needs, and this disclosure is not limited thereto.
[0103] In the embodiments of this disclosure, updating the candidate code set from both a global and local perspective can improve the accuracy of code processing, which is advantageous for improving the quality of code generation.
[0104] Selectively, when updating a slice to be updated in a candidate code, the similarity between the second description of the slice to be updated and the third description of each code slice in the gene pool is determined first. Then, based on the similarity, the target slice or the target parent code containing the target slice can be obtained from the gene pool. Subsequently, the slice to be updated can be updated using the target slice or target parent code to obtain a new candidate code.
[0105] In embodiments of this disclosure, a gene pool of code slices can be constructed based on a vector database to store high-quality slices and their feature indexes, such as a third descriptive information. This allows for the retrieval-enhanced generation (RAG) technique to retrieve target slices or target parent codes from the gene pool, perform cross-enhancement or mutation enhancement on the slices to be updated, update the slices to be updated, and obtain new candidate codes. Cross-enhancement can provide additional parent codes or slices to the candidate codes, improving cross-enhancement diversity. Mutation enhancement can provide target slices that are at the slice location of feedback positioning, have similar functionality but better performance, and can reduce the invalid search space.
[0106] In embodiments of this disclosure, when updating a slice to be updated, it can be directly replaced, or it can be used to intersect the slice to be updated with a target slice or target parent code, replace the slice to be updated based on the intersection result, and obtain a new candidate code.
[0107] In the embodiments of this disclosure, high-quality slices are obtained from a gene pool, participate in the evolution process of candidate codes, eliminate low-quality or redundant slices, ensure that the updated candidate codes are more representative, and ensure the efficiency of coding.
[0108] Selectively, when retrieving a target parent code from the gene pool, if a control signal is received, the target slice or the target parent code containing the target slice can be retrieved from the gene pool based on the control signal and similarity. The control signal is used to instruct the search logic and / or the number of search results.
[0109] The search logic may include semantic similarity search, functional similarity search, or target algorithm search.
[0110] The number of search results is used to instruct the system to retrieve several target slices or target parent codes containing target slices and update the candidate codes.
[0111] In embodiments of this disclosure, by receiving control signals, the logic for searching the gene pool and the amount of data for updating candidate codes can be dynamically adjusted, allowing the user to autonomously adjust the candidate code update process, ensuring that the code update results better meet the user's needs and optimize the user experience.
[0112] Selectively, an index corresponding to a candidate code can be determined based on a first and / or second descriptive information associated with the candidate code whose evaluation value is greater than the evaluation threshold. The candidate codes and indices are then stored in association with the gene pool.
[0113] In the embodiments of this disclosure, by employing a dynamic renewal mechanism for the gene pool, the system continuously accumulates and screens high-quality slices during operation, forming a continuously improving positive feedback closed loop, and making the product increasingly intelligent over time.
[0114] Figure 5 is a schematic diagram of the structure of an artificial intelligence-based self-adaptive code processing device provided by one embodiment of the present disclosure.
[0115] As shown in Figure 5, the self-adaptive code processing device 50 based on artificial intelligence includes a first acquisition module 501, a first decision module 502, a first processing module 503, and a second processing module 504. The first acquisition module 501 is used to acquire a candidate code set, the candidate code set includes multiple candidate codes, first description information corresponding to each candidate code, and second description information corresponding to each slice in the candidate code. The first decision module 502 is used to determine the similarity between each pair of candidate codes in the candidate code set, based on a plurality of first descriptive information and a plurality of second descriptive information. The first processing module 503 is used to cross-mutate two candidate codes whose corresponding similarity is less than a first threshold in order to obtain a new set of candidate codes. The second processing module 504 is used to return to the similarity determination step and execute it again, based on the new candidate code set, until a target code set that meets the requirements is obtained.
[0116] Selectively, the first decision module 502 specifically, Based on each of the two first descriptive pieces of information, the overall similarity between the two corresponding candidate codes is determined. Based on the second descriptive information corresponding to each slice in each of the two candidate codes, the local similarity between each of the two candidate codes is determined. This method can be used to combine overall and local similarity to obtain the similarity between each pair of candidate codes.
[0117] Selectively, the first processing module 503 further, If the similarity between any two candidate codes is greater than or equal to a first threshold, and the local similarity between some slices of any two candidate codes is less than a second threshold, then some slices of any two candidate codes can be cross-mutated and used to obtain a new candidate code. Selectively, the first acquisition module 501 further, The process of determining candidate codes from the code evolution process that has been received and is to be processed. It can be used for at least one of the following: obtaining candidate codes associated with received code processing instructions from a reference code library.
[0118] Selectively, the first processing module 503 specifically, Cross-mutate two candidate codes whose corresponding similarity is less than the first threshold to obtain a new candidate code. Based on the type of code processing instruction and / or a first parameter in the code processing instruction, an update policy for the candidate code set is determined, and the update policy is used to specify the parent code scale, number, and / or parent code filter conditions to be included in the new candidate code set. Based on the update policy, retrieve the target parent code from the candidate code set. New candidate codes and target parent codes can be used to determine a new set of candidate codes.
[0119] Selectively, the first processing module 503 further, If the evaluation service in the system is selected, or if an received code processing instruction instructs the evaluation service to be invoked, the evaluation service is invoked based on the new candidate code set, and the evaluation results output by the evaluation service are obtained, which include the evaluation values of the candidate code and / or the slices to be updated in the candidate code. Based on the evaluation results, it can be used to update the candidate code set with a new one.
[0120] Selectively, the first processing module 503 further, Remove candidate codes in the new candidate code set whose evaluation value is less than the evaluation threshold. It can be used for at least one of the following: updating the slice that needs updating in the candidate code, and obtaining the new candidate code.
[0121] Selectively, the first processing module 503 specifically, Determine the similarity between the second descriptive information of the slice to be updated and the third descriptive information of each coding slice in the gene pool. Based on similarity, retrieve the target slice or the target parent code containing the target slice from the gene pool. A target slice or target parent code can be used to update the slice that needs updating and obtain a new candidate code.
[0122] Selectively, the first processing module 503 specifically, When a control signal is received, it can be used to retrieve a target slice or a target parent code containing the target slice from the gene pool based on the control signal and its similarity, and the control signal is used to instruct the search logic and / or the number of search results.
[0123] Selectively, the first processing module 503 further, Based on the first and / or second descriptive information associated with candidate codes whose evaluation value is greater than the evaluation threshold, the index corresponding to the candidate code is determined. Candidate codes and indices are used to store them in association with the gene pool.
[0124] The aforementioned explanation of the self-adaptive code processing method based on artificial intelligence also applies to the self-adaptive code processing device based on artificial intelligence in this embodiment, and therefore will not be explained further here.
[0125] In this embodiment, the similarity between each pair of candidate codes is measured based on the overall description information and slice description information of each candidate code in the candidate code set. Then, two candidate codes with low similarity are selected and cross-mutated to obtain a new candidate code set and recalculate the similarity. After multiple iterations, a target code set that satisfies the requirements is obtained. This ensures evolved diversity while simultaneously improving code generation efficiency, as the target code set provides data references for automatic code generation, optimization, or repair.
[0126] The embodiments of this disclosure further provide an intelligent agent. Figure 6 is a schematic diagram of the structure of the intelligent agent provided in the embodiments of this disclosure. As shown in Figure 6, the intelligent agent 60 may include an input module 601, a processing module 602, and an output module 603.
[0127] The input module 601 is used to receive the code to be processed and / or the code processing instructions; the processing module 602 is used to invoke a large-scale model based on the code to be processed and / or the code processing instructions received by the input module 601 to execute the self-adaptive code processing method based on the artificial intelligence described in the above embodiment and to obtain the target code set; and the output module 603 is used to output the target code set.
[0128] In the embodiments of this disclosure, a user can obtain a target code set output by the intelligent agent by simply calling the intelligent agent shown in Figure 5 and inputting information on at least one of the code to be processed and the code processing instruction. This provides data references for automatic code generation, optimization, or repair, assisting the user's programming and improving work efficiency.
[0129] Based on embodiments of the present disclosure, the present disclosure further provides electronic devices, readable storage media, and computer programs.
[0130] Figure 7 is a schematic block diagram of an exemplary apparatus 700 for performing an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, mobile phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the description herein and / or the implementation of the present disclosure as requested.
[0131] As shown in Figure 7, the device 700 includes a computing unit 701 capable of performing various appropriate operations and processes according to computer programs stored in read-only memory (ROM) 702 or computer programs loaded from storage unit 708 into random access memory (RAM) 703. RAM 703 may also store various programs and data necessary for the operation of the device 700. The computing unit 701, ROM 702, and RAM 703 are connected to each other via bus 704. An input / output (I / O) interface 705 is also connected to bus 704.
[0132] Multiple components of the device 700 are connected to the I / O interface 705, which includes input units 706 such as a keyboard and mouse, output units 707 such as various types of displays and speakers, storage units 708 such as magnetic disks and optical disks, and communication units 709 such as a network card, modem, and wireless communication transceiver. The communication units 709 enable the device 700 to exchange information / data with other devices via computer networks such as the Internet and / or various telegraph networks.
[0133] The computing unit 701 may be a variety of general-purpose and / or dedicated processing components having processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various machine driving learning model algorithm computing units, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs each of the methods and processes described in the preceding paragraph, for example, the speech synthesis method. For example, in some embodiments, the speech synthesis method can be implemented as a computer software program tangibly contained in a machine-readable medium such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed into the device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the speech synthesis method described in the preceding paragraph may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured by any other suitable method (e.g., via firmware) to perform the speech synthesis method.
[0134] Various embodiments of the systems and technologies described herein can be implemented as digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SOCs), complex-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include being implemented by one or more computer programs, which may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be an application-specific or general-purpose programmable processor, which may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0135] Program code for performing the methods of this disclosure can be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, a dedicated computer, or other programmable data processing device, so that when executed by the processor or controller, the functions / operations defined in the flowcharts and / or block diagrams are performed. The program code may run entirely on a machine, partially on a machine, or, as a standalone software package, partially on a machine, partially on a remote machine, or entirely on a remote machine or server.
[0136] In the context of this disclosure, a machine-readable medium may be a tangible medium that contains or can store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the above contents. More specific examples of machine-readable storage media include one or more line-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above contents.
[0137] To provide user interaction, the systems and technologies described herein can be implemented on a computer having a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor), a keyboard and pointing device (e.g., a mouse or trackball) to which the user can provide input to the computer. Other types of devices can also be used to provide user interaction, for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback), and input from the user may be received in any form (including acoustic, verbal, or tactile input).
[0138] Implementations of the systems and technologies described herein can be implemented in computing systems including backend components (e.g., data servers), computing systems including middleware components (e.g., application servers), or computing systems including frontend components (e.g., client computers having a graphical user interface or a web browser, through which users can interact with the systems and technical embodiments described herein), or in computing systems including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by digital data communication (e.g., communication networks) in any form or medium. Examples of communication networks include local area networks ("LANs"), wide area networks ("WANs"), and internetworks.
[0139] A computer system can include clients and servers. Clients and servers are generally geographically distant from each other and typically interact through a communication network. The client-server relationship arises from computer programs running on corresponding computers that have a client-server relationship with each other. A server may be a cloud server, also called a cloud computing server or cloud host, and is a host product within a cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS services (Virtual Private Server, abbreviated as "VPS"), which are difficult to manage and have limited scalability. A server may also be a server in a distributed system or a server that integrates blockchain technology.
[0140] It should be understood that the steps can be rearranged, added, or deleted using the various forms of flows described above. For example, each step described herein may be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution disclosed herein are achieved. This specification is not limited to these steps.
[0141] Furthermore, the terms “first” and “second” are used solely for descriptive purposes and should not be understood as indicating or implying relative importance or implicitly representing the number of designated technical features. Thus, features defining “first” and “second” may explicitly or implicitly include at least one feature. In the descriptions of this disclosure, “plural” means at least two, e.g., two, three, etc., unless otherwise specifically limited. In the descriptions of this disclosure, the terms “if” and “if” as used may be interpreted as “in the case of,” “when,” “in response to what has been decided,” or “on the occasion of.”
[0142] The specific embodiments described above do not limit the scope of protection of this disclosure. Those skilled in the art will understand that various modifications, combinations, sub-combinations, and substitutions are possible depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this disclosure.
Claims
1. A self-adaptive code processing method based on artificial intelligence, A step of obtaining a candidate code set, wherein the candidate code set includes a plurality of candidate codes, a first description information corresponding to each of the candidate codes, and a second description information corresponding to each slice in the candidate code. A step of determining the similarity between each pair of candidate codes in the candidate code set based on a plurality of first descriptive information and a plurality of second descriptive information, The steps include: cross-mutating two candidate codes whose corresponding similarity is less than a first threshold to obtain a new set of candidate codes; The step includes, based on the new candidate code set, returning to the step of determining similarity until a target code set that satisfies the requirements is obtained, A self-adaptive code processing method based on artificial intelligence, characterized by the following features.
2. The step of determining the similarity between each pair of candidate codes in the candidate code set based on the plurality of first descriptive information and the plurality of second descriptive information is: A step of determining the overall similarity between two corresponding candidate codes based on each of the two first descriptive pieces of information, A step of determining the local similarity between each of the two candidate codes based on second descriptive information corresponding to each slice in each of the two candidate codes, The steps include: fusing the overall similarity and the local similarity to obtain the similarity between each pair of candidate codes; The self-adaptive code processing method based on artificial intelligence as described in feature 1.
3. After determining the similarity between each pair of candidate codes in the aforementioned candidate code set, If the similarity between any two candidate codes is greater than or equal to the first threshold, and the local similarity between some slices in any two candidate codes is less than the second threshold, the method further includes the step of cross-mutating the some slices in any two candidate codes to obtain a new candidate code. The self-adaptive code processing method based on artificial intelligence as described in feature 1.
4. The step of obtaining the aforementioned candidate code set is: The steps include determining the code generated during the code evolution process to be processed as the candidate code, The steps include at least one of the following: obtaining candidate code associated with a received code processing instruction from a reference code library; The self-adaptive code processing method based on artificial intelligence as described in feature 1.
5. The step of obtaining a new candidate code set by cross-mutating two candidate codes whose corresponding similarity is less than a first threshold is: The steps include: cross-mutating two candidate codes whose corresponding similarity is less than a first threshold to obtain a new candidate code; A step of determining an update policy for a candidate code set based on the type of code processing instruction and / or a first parameter in the code processing instruction, wherein the update policy is used to specify the parent code scale, number, and / or filter conditions for the parent code to be included in the new candidate code set. Based on the aforementioned update policy, the steps include obtaining the target parent code from the candidate code set, The steps include determining the new candidate code and the target parent code as the new candidate code set, The self-adaptive code processing method based on artificial intelligence as described in feature 4.
6. After obtaining the aforementioned new candidate code set, If an evaluation service in the system is selected, or if an received code processing instruction instructs to call an evaluation service, the steps include calling the evaluation service based on the new candidate code set and obtaining the evaluation result output by the evaluation service, wherein the evaluation result includes the evaluation value of the candidate code and / or the slice to be updated in the candidate code; The steps include updating the new candidate code set based on the evaluation results, The self-adaptive code processing method based on artificial intelligence as described in feature 1.
7. The step of updating the new candidate code set based on the evaluation results is: The steps include: deleting candidate codes in the new set of candidate codes whose evaluation value is less than the evaluation threshold; The step of updating the slice to be updated in the candidate code and obtaining a new candidate code includes at least one of the following: The self-adaptive code processing method based on artificial intelligence as described in feature 6.
8. The step of updating the slice to be updated in the aforementioned candidate code and obtaining the new candidate code is: The steps include determining the similarity between the second descriptive information of the slice to be updated and the third descriptive information of each coding slice in the gene pool, The steps include obtaining a target slice or a target parent code containing the target slice from the gene pool based on the similarity, The steps include updating the slice to be updated using the target slice or the target parent code to obtain a new candidate code, The self-adaptive code processing method based on artificial intelligence as described in feature 7.
9. The step of obtaining a target slice or a target parent code containing the target slice from the gene pool based on the aforementioned similarity is: If a control signal is received, the step of obtaining a target slice or a target parent code containing the target slice from the gene pool based on the control signal and the similarity, wherein the control signal is used to indicate the search logic and / or the number of search results. The self-adaptive code processing method based on artificial intelligence as described in feature 8.
10. The aforementioned method, A step of determining an index corresponding to a candidate code based on first and / or second descriptive information associated with a candidate code whose evaluation value is greater than an evaluation threshold, The steps further include at least one of the following: storing the candidate code and the index in association with the gene pool, The self-adaptive code processing method based on artificial intelligence as described in feature 8.
11. An artificial intelligence-based self-adaptive code processing device, A first acquisition module for obtaining a candidate code set, wherein the candidate code set includes a plurality of candidate codes, first description information corresponding to each of the candidate codes, and second description information corresponding to each slice in the candidate code, A first determination module for determining the similarity between each pair of candidate codes in the candidate code set based on a plurality of the first descriptive information and a plurality of the second descriptive information, A first processing module for obtaining a new set of candidate codes by cross-mutating two candidate codes whose corresponding similarity is less than a first threshold, A second processing module for returning to the step of determining similarity until a target code set that satisfies the requirements is obtained based on the aforementioned new candidate code set, is included. A self-adaptive code processing device based on artificial intelligence, characterized by the following features.
12. An intelligent agent, An input module for receiving the code to be processed and / or the code processing instructions, A processing module for obtaining a target code set by calling a large model and executing the method described in any one of claims 1 to 10 based on the code to be processed and / or the code processing instructions, Includes an output module for outputting the aforementioned target code set, An intelligent agent characterized by the following features.
13. It is an electronic device, At least one processor, Includes a memory that is communicably connected to at least one of the processors, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to cause the at least one processor to execute the artificial intelligence-based self-adaptive code processing method described in any one of claims 1 to 10. An electronic device characterized by the following features.
14. A non-temporary, computer-readable storage medium in which computer instructions are stored, The computer instruction is used to cause the computer to execute the artificial intelligence-based self-adaptive code processing method described in any of claims 1 to 10. A non-temporary, computer-readable storage medium characterized by the following features.
15. It is a computer program, When the computer program is executed by a processor, the steps of the self-adaptive code processing method based on artificial intelligence according to any one of claims 1 to 10 are realized. A computer program characterized by the following features.