An intelligent code generation and compilation system based on AI big model
Through an intelligent code generation and compilation system based on AI big model, the automated code style is solved, and the efficiency and code quality of software development are improved.
Patent Information
- Application Number
- CN202411251049.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-09-06
Smart Images

Figure CN118760428B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of information processing systems, and in particular, relates to an intelligent code generation and compilation system based on an AI big model. Background Art
[0002] In the field of software development, teamwork is the key to completing large projects. However, team members often face the problem of inconsistent coding styles, especially when multiple programming languages and personal programming habits are involved. Such differences often make code reading, maintenance, and integration complicated and time-consuming. Traditional solutions rely on strict coding standards and code review processes, but these methods often increase the burden of development and reduce the work efficiency of the team.
[0003] With the development of artificial intelligence technology, especially the application of machine learning and deep learning, new solutions are provided. By utilizing AI big models, the code can be automatically analyzed and converted to adapt to the team's programming style while maintaining the functionality and optimized structure of the code. This technology can not only reduce the review and modification process involving manual participation, but also improve the overall efficiency and quality of software development while maintaining code consistency.
[0004] According to the relevant public technologies, the technical solution with publication number CN105404509B proposes a method for visually generating code based on ExtJS UI. Through the visual operation interface, programmers can perform code writing operations more conveniently and intuitively, reducing the difficulty of programming operations; the technical solution with publication number WO2021169426A1 proposes a method for generating an application. By examining the goals that the preset application needs to achieve, the corresponding methods are automatically found from the program method library and combined to achieve automated code writing; the technical solution with publication number US20220121554A1 proposes a system and method for automatically resolving errors during the compilation of a data segment. The solution detects one or more errors to be resolved associated with the data segment, determines the error type of each of the one or more errors from predefined error types based on neuron activation and code logic derived from the data segment, arranges the one or more errors in a solution sequence, predicts a solution for each of the one or more errors, and sequentially resolves the one or more errors to generate an error-free data segment.
[0005] The above technical solutions all propose various automated solutions for program writing or compilation review, but the technologies applied are still mechanical automatic generation technologies. At the same time, for the application scenarios of assisting in generating program codes in large teams, more intelligent code generation and compilation technical solutions are still needed.
[0006] The foregoing discussion of the background art is intended only to facilitate an understanding of the present invention. This discussion does not acknowledge or admit that any of the material referred to is part of the common general knowledge. Summary of the invention
[0007] The purpose of the present invention is to provide an intelligent code generation and compilation system based on an AI big model to improve the collaboration efficiency and code quality in software development; the generation and compilation system includes: a code acquisition module for collecting personal code texts of development team members; a code analysis module responsible for deep semantic analysis of the code and extracting the structure, function and style features of the code; a normalization module that constrains feature vectors according to a preset team style and generates a code feature vector of a unified style; a code reconstruction module that uses an artificial intelligence model to generate team code texts based on normalized feature vectors. The generation and compilation system uses automated tools to reduce the time spent by team members on code review and integration, ensure the consistency of code style, and thus significantly improve the efficiency of project development and the overall quality of the code.
[0008] The present invention adopts the following technical solution: an intelligent code generation and compilation system based on an AI large model, the generation and compilation system comprising:
[0009] Code acquisition module: configured to acquire individual code texts submitted by multiple members of the development team, thereby providing the generation and compilation system with original code data to support subsequent parsing and processing;
[0010] Code analysis module: It is designed to perform deep semantic analysis on the input personal code text, extract the structural, functional and semantic style features of the code, and convert them into the personal code text feature vector corresponding to each team member;
[0011] The normalization module is configured to perform team style constraints on the individual code text feature vector based on the preset team style, and generate a code feature vector that conforms to the team code style;
[0012] Code Refactoring Module: Input the code feature vector that conforms to the team's code style into the AI big model, and the AI big model generates the team's code text;
[0013] The personal code text includes the program code written by the members and the corresponding comments on the program code; the team code text includes the program code generated by the artificial intelligence big model and the corresponding comments on the program code;
[0014] Preferably, the code analysis module includes:
[0015] A code preprocessing unit is used to preprocess the acquired personal code text, including but not limited to performing the following steps: performing word segmentation on the personal code text; removing non-critical elements in the code; converting the word segmented vocabulary units into word embedding vectors, thereby obtaining a personal code text word embedding vector sequence;
[0016] A code deconstruction unit, used for performing semantic coding deconstruction on the personal code text word embedding vector sequence to obtain a personal code text feature vector;
[0017] Preferably, the code deconstruction unit comprises: passing the personal code text word embedding vector sequence through a context encoder based on a neural transformer model to obtain the personal code text feature vector;
[0018] Preferably, the normalization module comprises:
[0019] A feature suppression unit, used for smoothing the distribution of personal style features of the personal code text feature vector to reduce the influence of the personal style features and form a neutral code text feature vector;
[0020] A style determination unit, in which the style of the team code text is set by the user, and a team code style feature vector having the team style is generated according to the set team code style;
[0021] A feature fusion unit, used for fusing the neutralized code text feature vector and the team code style feature vector to obtain a personal code text feature vector under the team code style constraint;
[0022] Preferably, the training process of the neural transformer model includes:
[0023] Pre-training the neural transformer model using an unsupervised training data set; the unsupervised training data set includes personal code texts from multiple team members; wherein the personal code texts include method signatures and method bodies of a programming language;
[0024] Fine-tune the pre-trained Neural Transformer model using a supervised training dataset, by taking different combinations of method signatures and method bodies and adding prefixes to indicate the target task in the supervised training dataset, thereby improving the model's ability to learn the relationship between these features;
[0025] Preferably, the neural transformer model comprises one or more encoders; wherein the encoder comprises a multi-head attention layer and a feed-forward neural network;
[0026] Furthermore, an intelligent code generation and compilation method based on an AI big model is proposed, and the generation and compilation method is applied to the generation and compilation system; the generation and compilation method comprises the following steps:
[0027] S100: through the code acquisition module, automatically obtain the personal code texts submitted by multiple members from the development team, including program codes and corresponding code comments, as raw data input;
[0028] S200: Performing deep semantic analysis on the input personal code text, extracting the structural, functional and semantic style features of the code, and converting them into a personal code text feature vector corresponding to each team member;
[0029] S300: Based on the preset team style, perform team style constraints on the individual code text feature vector to generate a code feature vector that conforms to the team code style;
[0030] S400: Input the code feature vector that conforms to the team code style into the artificial intelligence big model, and the artificial intelligence big model generates the team code text.
[0031] The beneficial effects achieved by the present invention are:
[0032] The generation and compilation system of this technical solution automatically analyzes and adjusts the code style to ensure that the code style written by each member of the team is unified; this unified processing not only improves the readability of the code, but also facilitates subsequent maintenance and expansion, greatly reducing the maintenance cost of the project;
[0033] The generation and compilation system of this technical solution reduces the time team members spend on code review and manual style adjustment through automated processing; by automating these tasks, developers can focus more time and energy on the development of core functions, thereby improving overall development efficiency;
[0034] The generation and compilation system of this technical solution uses the latest artificial intelligence technology, especially the neural transformer model in deep learning and the artificial intelligence language large model, to handle the code analysis and generation tasks; by continuously updating and training the artificial intelligence model, the system can use the current optimized model to work and maintain the technological leading edge;
[0035] The software and hardware parts of the generation and compilation system of the present technical solution adopt a modular design. The various working modules and components of the hardware part of the system, as well as the instructions, parameters, and algorithms of the software part can be conveniently replaced and / or upgraded later, thereby reducing the construction cost and maintenance cost of the present system. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The present invention can be further understood from the following description in conjunction with the accompanying drawings. The components in the figures are not necessarily drawn to scale, but the emphasis is placed on illustrating the principles of the embodiments. In different views, the same reference numerals designate corresponding parts.
[0037] Description of the accompanying drawings: 10-code acquisition module; 20-code analysis module; 22-code preprocessing unit; 24-code deconstruction unit; 30-normalization module; 40-code reconstruction module; 200-neural transformer model; 202-encoder; 206-personal code text word embedding vector sequence; 208-position embedding operation; 209-context tensor; 210-multi-head attention component; 212-A normalization component; 214-feedforward neural network; 216-B normalization component; 217-hidden representation; 32-feature suppression unit; 34-style determination unit; 36-feature fusion unit; 500-computer device; 502-bus; 504-processor; 506-main memory; 508-read-only memory; 510-storage device; 512-display; 514-input device; 516-cursor control device; 518-network device;
[0038] Figure 1 A schematic diagram of the architecture of the generation and compilation system described in an embodiment of the present invention;
[0039] Figure 2 is a schematic diagram of the code analysis module described in an embodiment of the present invention;
[0040] Figure 3 is a schematic diagram of the normalization module described in an embodiment of the present invention;
[0041] Figure 4 is a schematic diagram of a neural converter model in an embodiment of the present invention;
[0042] Figure 5 It is a schematic diagram of the framework of a computer device used in the generation and compilation system in an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with its embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. For those skilled in the art, after reviewing the following detailed description, other systems, methods and / or features of the present embodiment will become apparent. It is intended that all such additional systems, methods, features and advantages are included in this specification. Included within the scope of the present invention and protected by the appended claims. Additional features of the disclosed embodiments are described in the following detailed description, and these features will be apparent from the following detailed description.
[0044] The same or similar reference numerals in the drawings of the embodiments of the present invention correspond to the same or similar components; in the description of the present invention, it should be understood that if there are terms such as "upper", "lower", "left", "right" and the like indicating the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, it is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or component referred to must have a specific orientation. The invention is constructed and operated in a specific orientation, so the terms describing the positional relationship in the drawings are only used for exemplary description and cannot be understood as a limitation of this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to the specific circumstances.
[0045] Embodiment 1: Exemplarily, an intelligent code generation and compilation system based on an AI big model is proposed, and the generation and compilation system includes:
[0046] Code acquisition module 10: configured to acquire individual code texts submitted by multiple members of the development team, thereby providing the generation and compilation system with original code data to support subsequent parsing and processing;
[0047] Code analysis module 20: designed to perform deep semantic analysis on the input personal code text, extract the structural, functional and semantic style features of the code, and convert it into a personal code text feature vector corresponding to each team member;
[0048] The normalization module is configured to perform team style constraints on the individual code text feature vector based on the preset team style, and generate a code feature vector that conforms to the team code style;
[0049] Code Refactoring Module: Input the code feature vector that conforms to the team's code style into the AI big model, and the AI big model generates the team's code text;
[0050] The personal code text includes the program code written by the members and the corresponding comments on the program code; the team code text includes the program code generated by the artificial intelligence big model and the corresponding comments on the program code;
[0051] Preferably, as attached Figure 2 As shown, the code analysis module 20 includes:
[0052] The code preprocessing unit 22 is used to preprocess the acquired personal code text, including but not limited to performing the following steps: performing word segmentation on the personal code text; removing non-critical elements in the code; converting the word segmented vocabulary units into word embedding vectors, thereby obtaining a personal code text word embedding vector sequence;
[0053] A code deconstruction unit 24, used for performing semantic coding deconstruction on the personal code text word embedding vector sequence to obtain a personal code text feature vector;
[0054] Preferably, the code deconstruction unit 24 further comprises implementing the following operations: passing the personal code text word embedding vector sequence through a context encoder based on a neural transformer model to obtain the personal code text feature vector;
[0055] Preferably, as attached Figure 3 As shown, the normalization module 30 includes:
[0056] A feature suppression unit 32, used for smoothing the distribution of personal style features of the personal code text feature vector to reduce the influence of the personal style features and form a neutral code text feature vector;
[0057] The style determination unit 34 is configured to set the style of the team code text by the user, and to generate a team code style feature vector having the team style according to the set team code style;
[0058] A feature fusion unit 36, configured to fuse the neutralized code text feature vector and the team code style feature vector to obtain a personal code text feature vector under the team code style constraint;
[0059] Preferably, the training process of the neural transformer model includes:
[0060] Pre-training the neural transformer model using an unsupervised training data set; the unsupervised training data set includes personal code texts from multiple team members; wherein the personal code texts include method signatures and method bodies of a programming language;
[0061] Fine-tune the pre-trained Neural Transformer model using a supervised training dataset, by taking different combinations of method signatures and method bodies and adding prefixes to indicate the target task in the supervised training dataset, thereby improving the model's ability to learn the relationship between these features;
[0062] Preferably, the neural transformer model comprises one or more encoders; wherein the encoder comprises a multi-head attention layer and a feed-forward neural network;
[0063] Furthermore, an intelligent code generation and compilation method based on an AI big model is proposed, and the generation and compilation method is applied to the generation and compilation system; the generation and compilation method comprises the following steps:
[0064] S100: through the code acquisition module, automatically obtain the personal code texts submitted by multiple members from the development team, including program codes and corresponding code comments, as raw data input;
[0065] S200: Performing deep semantic analysis on the input personal code text, extracting the structural, functional and semantic style features of the code, and converting them into a personal code text feature vector corresponding to each team member;
[0066] S300: Based on the preset team style, perform team style constraints on the individual code text feature vector to generate a code feature vector that conforms to the team code style;
[0067] S400: inputting the code feature vector that conforms to the team code style into the artificial intelligence big model, and the artificial intelligence big model generates the team code text;
[0068] In a preferred embodiment, the preprocessing operation performed by the code preprocessing unit on the personal code text includes:
[0069] Code standardization: Automatically format source code to ensure that the code complies with unified coding standards and styles; this includes adjusting indentation, spacing, bracket style, etc., thereby eliminating code style differences and reducing the complexity of subsequent processing;
[0070] Lexical element extraction: Decompose the source code into lexical elements, such as keywords, identifiers, operators, literals, etc. This step converts the code from plain text to a more structured form to facilitate further grammatical and semantic analysis;
[0071] Comment and docstring removal: Clean up comments and docstrings in the code to avoid them interfering with the actual logic analysis of the code, which helps reduce the amount of data processed and focus on the functional parts of the code;
[0072] Dependency analysis: Identify and resolve external dependencies in source code, such as library references and module imports; this information is critical for compiling the code and configuring the runtime environment;
[0073] Precompilation instruction processing: execute precompilation instructions in the code, such as macro definitions and conditional compilation instructions, to ensure that the correct code version is received during the code analysis and generation phases;
[0074] Unified character encoding: Convert all text in the source code into a unified character encoding to prevent inconsistent encoding in a multi-language development environment;
[0075] The data preprocessing unit ensures that the source code input to the compiler or code generator is clean, standardized and easy to parse through the above preprocessing operations, thereby creating conditions for generating high-quality and high-performance machine code;
[0076] In a preferred embodiment, the main function of the code deconstruction unit is to perform deep semantic analysis and encoding of the word embedding vector sequence of the personal code text; the code deconstruction unit realizes the semantic understanding and structured representation of the code through the following steps:
[0077] Sequence modeling: This unit uses a sequence model, such as a recurrent neural network (RNN) or a Transformer model, to process the word embedding vector sequence of the personal code text to capture the contextual relationship in the code sequence and effectively understand the logical and functional connections between the code snippets;
[0078] Feature extraction: Through the processing of the sequence model, key semantic features are extracted from the hidden state of each code segment; these feature vectors contain information about the structure, function, and style of the code, and are the basis for further generating unified style code;
[0079] Dimension compression: In order to improve processing efficiency and reduce computing resource consumption, the code deconstruction unit performs dimension compression on the extracted feature vector, thereby optimizing the data processing flow and efficiency and reducing computing resource consumption;
[0080] Through the above operations, the code deconstruction unit can convert personal code text into word embedding vector sequences, and further perform in-depth analysis and encoding of these sequences, and finally extract code text feature vectors that can represent the coding intention and logic of each developer, providing accurate input for the normalization and code reconstruction modules of the entire system;
[0081] Further, the code deconstruction unit includes inputting the personal code text word embedding vector sequence into a context encoder based on a neural transformer model to obtain the personal code text feature vector;
[0082] In a preferred embodiment, an exemplary structure of a neural transformer model based on a multi-encoder structure is proposed; Figure 4 As shown, the neural transformer model 200 includes one or more encoders 202; the initial input of the encoder 202 is the personal code text word embedding vector sequence 206; in order to preserve the order of the tokens in the personal code text word embedding vector sequence 206, a position embedding operation 208 is added to the personal code text word embedding vector sequence 206 to form a context tensor 209;
[0083] Among them, in neural networks, especially when processing sequence data such as natural language or code, positional embeddings play a critical role. Positional embeddings are designed to provide the model with information about the position of each element in the sequence. This is especially important in models that do not have natural sequence perception capabilities, such as the Transformer model. The role of positional embeddings includes:
[0084] Providing position information: Transformer models and many other types of sequence processing models are usually based on self-attention mechanisms, which do not inherently process the order of input elements; position embedding ensures that the model can understand not only individual elements (such as words, code tokens, etc.), but also their position in the entire sequence;
[0085] Enhanced sequence relationship understanding: By adding position embeddings to the input embeddings, such as the sequence of personal code text word embedding vectors 206), the model is better able to learn the relative or absolute positional relationships between elements in the sequence, which is crucial for understanding rule-based languages (such as programming languages) or natural languages with strict grammatical structure;
[0086] Maintaining element order: When processing sequential data such as text or code, the order of elements often carries important semantic information; position embedding ensures that the order of elements is preserved and correctly understood even in highly parallelized processing, such as the Transformer's self-attention mechanism;
[0087] Preferably, the encoder 202 includes two working layers; the first layer includes a multi-head attention component 210 arranged at the front end and an A normalization component 212 at the back end; preferably, the second layer includes a feedforward neural network 214 arranged at the front end and a B normalization component 216 at the back end; the context tensor 209 is input to the multi-head attention component 210 of the encoder 202, and is connected to the A normalization component 212 through a residual; the output of the A normalization component 212 is further input to the feedforward neural network 214, and is connected to the B normalization component 216 through another residual; the output of the encoder 202 is a set of hidden representations 217; preferably, if the encoder is configured with multiple, the set of hidden representations 217 can be sent through an additional encoder;
[0088] In the above process, the context tensor 209 is first input to the multi-head attention component 210, and the input tensor is processed in parallel using different attention heads, each head focusing on different parts of the input, so that information can be obtained from multiple subspaces at the same time, enhancing the model's understanding of each part of the input data; and the multi-head attention component 210 uses the context tensor 209 and weighs the relevance of each sub-token represented in the context tensor 209 by generating an attention weight for each sub-token in the input embedding 206;
[0089] In order to reduce the training time of the neural transformer, layer normalization is used between layers; the layer normalization component performs normalization calculation on the input between features; the mean and standard deviation are calculated across feature dimensions; therefore, a normalization component A 212 located before the feedforward neural network 214 and a normalization component B 216 located after the feedforward neural network 214 are set; the data processed by the normalization component A 212 are then passed to the feedforward neural network 214; the feedforward neural network 214 usually includes one or more densely connected layers, which performs nonlinear transformation on the output of the previous layer to enhance the expression ability of the model; the output obtained from the feedforward neural network 214 enters the normalization component B 216 through another residual connection; similar to normalization A, normalization B further normalizes the data to ensure the numerical stability of the data during the transmission process;
[0090] Through the above-mentioned layer-by-layer processing, the hidden representation 217 finally output by the encoder 202 contains rich contextual information and feature details, which are necessary for subsequent modules such as the normalization module 30 or other application processing; the hidden representation 217 not only carries important information of the original input, but also enhances the association and expression ability between features through deep processing of the network, providing the necessary deep semantic features for the final task execution (such as code generation, semantic understanding, etc.).
[0091] Embodiment 2: This embodiment should be understood to include at least all the features of any of the above embodiments, and further improve upon them;
[0092] By way of example, the implementation of the normalization module 30 is described;
[0093] Among them, the feature suppression unit 32 is used to balance and adjust the individual code text feature vector to suppress the significant personal style features therein; the process involves not only adjusting the weight of the feature, but also scaling and translating the feature value to ensure that the code style of each team member can be better integrated into the overall team style, thereby reducing the difficulty of understanding and maintenance caused by differences in code style;
[0094] Preferably, the following calculation formula can be used to perform feature reduction of the personal code text feature vector:
[0095] ;
[0096] In the above formula, S is the personal code text feature vector, L is the length of the personal code text feature vector, s i is the eigenvalue of the ith position of the personal code text feature vector, ||S||^2 represents the square of the bi-norm of the personal code text feature vector, a is a weighted hyperparameter, s i ´ is the feature value of the i-th position of the neutralized code text feature vector;
[0097] Specifically, the feature suppression unit 32 uses an algorithm to dynamically analyze the feature vectors of individual code texts and identify features that are contrary to the team standard style; for example, if a programmer tends to use complex logical structures, while the team standard advocates concise and clear code, the unit will adjust the feature distribution of the code text by reducing the weights of these complex structure features and possibly enhancing the weights of simplified structure features;
[0098] In addition, the feature suppression unit is also responsible for performing dimensionality compression, which not only helps to improve processing efficiency, but also eliminates redundant and unnecessary feature representations, so that the processed code feature vector is more compact and efficient while maintaining necessary information; in this way, the feature suppression unit 32 ensures that each member's code is more in line with the team's coding standards while retaining its functionality, which helps to improve the overall quality of the code and the team's collaboration efficiency;
[0099] In a preferred exemplary embodiment, the style determination unit 34 is responsible for standardizing the team's programming style and applying it to the code generation process; the user can define the team's programming preferences and style by directly inputting the desired team style attributes, such as code conciseness, comment detail, naming conventions, etc.; these attributes can be predefined, such as "high readability", "compact", "strong scalability", etc., or more specific technical requirements, such as variable naming using specific prefixes or suffixes, loop structure priority, etc.; the style determination unit 34 sets the corresponding team style label according to these input attributes; the team style label is used as metadata of the programming style to guide the generation of feature vectors; the unit contains a series of algorithms that can convert user-defined style attributes into an operational mathematical expression, namely, the team code style feature vector; these feature vectors capture the core elements of the team style, ensuring that the subsequently generated code not only meets the requirements in terms of function, but also is consistent with other codes of the team in terms of style;
[0100] In a preferred exemplary embodiment, the feature fusion unit 36 is used to effectively fuse the neutralized code text feature vector with the team code style feature vector to generate a personal code text feature vector that meets the team style constraints; wherein the operation includes:
[0101] Fusion feature vectors: fuse the individual code text feature vector after feature suppression with the team code style feature vector generated by the style determination unit; the fusion strategy can be weighted summation, concatenation or other advanced fusion techniques, which can ensure balanced extraction of information from the two feature vectors to form a comprehensive feature vector that better reflects the team style;
[0102] Consider style constraints: The feature fusion unit ensures that the fused code feature vector strictly adheres to the team's programming style standards; in this way, the fusion unit helps ensure that the generated code not only meets the requirements at the technical level, but also is consistent with the code of other team members in style; the feature suppression unit optimizes the code text feature vector by suppressing overly prominent personal style, the style determination unit is responsible for generating feature vectors that conform to the preset team style, and the feature fusion unit merges these processed vectors to form the final code text feature vector that conforms to the team style. This process ensures code consistency and efficient team collaboration;
[0103] In a preferred exemplary embodiment, the code refactoring module 40 is responsible for inputting the individual code text feature vector under the team code style constraint into the artificial intelligence based big model to generate the team code text; the artificial intelligence big model refers to a deep learning model with large-scale parameters and training data, which can understand and generate structured code text; these models learn the structure and semantic rules of programming languages from a large amount of code data through deep learning technology, such as neural networks, so as to generate code that conforms to grammatical and logical specifications;
[0104] The application of artificial intelligence big models in the field of code generation includes tasks such as code automatic completion, code optimization, and error detection; these models can generate code text that conforms to the team style based on the input code feature vectors and the team's programming style constraints; in the code reconstruction module, the individual code text feature vectors under the team code style constraints are input into the artificial intelligence model, and the model uses its generation ability to generate reconstructed team code text; this process not only ensures the functionality and structure of the code, but also ensures the consistency of the code style and the team's collaboration efficiency; by using artificial intelligence big models, the code reconstruction module 40 can generate high-quality code text consistent with the team style based on the code feature vectors generated by the team style constraints, thereby improving the maintainability of the code and the collaboration of the team.
[0105] Embodiment 3: This embodiment should be understood to include at least all the features of any of the above embodiments, and further improve upon them;
[0106] For example, as shown in the attached Figure 5 As shown, an implementation of a computer device 500 used in the generation and compilation system is described; the computer device 500 can be applied to the data storage, calculation and result output process of each working module in the system;
[0107] Illustratively, the computer device 500 includes a bus 502 or other communication mechanism for communicating information, one or more processors 504 coupled to the bus 502 for processing information; the processor 504 may be, for example, one or more general-purpose microprocessors;
[0108] The computer apparatus 500 also includes a main memory 506, such as a random access memory (RAM), a cache, and / or other dynamic storage device, coupled to the bus 502 for storing information and instructions to be executed by the processor 504; the main memory 506 may also be used to store temporary variables or other intermediate information during the execution of instructions to be executed by the processor 504; these instructions, when stored in a storage medium accessible to the processor 504, present the computer apparatus 500 as a special-purpose machine customized to perform the operations specified in the instructions;
[0109] The computer device 500 may also include a read-only memory (ROM) 508 or other static storage device coupled to the bus 502 for storing static information and instructions for the processor 504; a storage device 510 such as a disk, an optical disk, or a USB drive (flash drive) will be coupled to the bus 502 for storing information and instructions;
[0110] And further, coupled to the bus 502 may also include a display 512 for displaying various information, data, media, etc., an input device 514 for allowing a user of the computer device 500 to control, manipulate, and / or interact with the computer device 500;
[0111] A preferred way to interact with the management system may be through a cursor control device 516, such as a computer mouse or similar control / navigation mechanism;
[0112] Furthermore, the computer device 500 may also include a network device 518 coupled to the bus 502; wherein the network device 518 may include, for example, a wired network card, a wireless network card, a switching chip, a router, a switch, and other components;
[0113] In general, the terms "engine", "component", "system", "database", etc., as used herein, may refer to logic embodied in hardware or firmware, or to a collection of software instructions, possibly with entry and exit points, written in a programming language such as Java, C, or C++; software components may be compiled and linked into executable programs, installed in a dynamic link library, or may be written in an interpreted programming language (e.g., BASIC, Perl, or Python); it should be understood that software components may be callable from other components or from themselves, and / or may be called in response to detected events or interrupts;
[0114] Software components configured to execute on a computing device may be provided on a computer-readable medium, such as a compact disc, digital video disc, flash drive, diskette, or any other tangible medium, or as a digital download (and may be initially stored) in a compressed or installable format that requires installation, decompression, or decryption prior to execution); such software code may be stored in part or in whole on a memory device of the executing computing device for execution by the computing device; software instructions may be embedded in firmware, such as an EPROM; it is also understood that hardware components may be composed of connected logic units (such as gates and flip-flops), and / or may be composed of programmable units (such as programmable gate arrays or processors);
[0115] The computer apparatus 500 includes a computer system that can implement the techniques described herein using custom hard-wired logic, one or more ASICs or FPGAs, firmware, and / or program logic that, in combination with a computer system, renders the computer apparatus 500 a special-purpose computing device;
[0116] According to one or more embodiments, the techniques herein may be performed by computer apparatus 500 in response to processor 504 executing one or more sequences of one or more instructions contained in main memory 506; such instructions may be read into main memory 506 from another storage medium, such as storage device 510; execution of the sequences of instructions contained in main memory 506 causes processor 504 to perform the process steps described herein; in alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions;
[0117] As used herein, the term "non-transitory media" and similar terms refer to any media that store data and / or instructions that cause a machine to operate in a specific manner; such non-transitory media may include non-volatile media and / or volatile media; non-volatile media include, for example, optical or magnetic disks, such as storage device 510; volatile media include dynamic memory, such as main memory 506;
[0118] Among them, common forms of non-transitory media include, for example, floppy disks, diskettes, hard disks, solid-state drives, magnetic tapes or any other magnetic data storage medium, CD-ROMs, any other optical data storage medium, any physical medium having a pattern of holes, RAM, PROM and EPROM, FLASH-EPROM, NVRAM, any other memory chip or cartridge, and networked versions thereof;
[0119] Non-transient media are distinct from transmission media but may be used in conjunction with transmission media; transmission media participate in the transmission of information between non-transient media; for example, transmission media include coaxial cables, copper wires, and optical fibers, including the wires that make up bus 502; transmission media may also take the form of sound waves or light waves, such as radio waves and infrared data communications.
[0120] Although the present invention has been described above with reference to various embodiments, it should be understood that many changes and modifications may be made without departing from the scope of the present invention. That is, the methods, systems and devices discussed above are examples. Various configurations may appropriately omit, replace or add various processes or components. For example, in alternative configurations, the method may be performed in an order different from the order described, and / or various components may be added, omitted and / or combined. Moreover, the features described with respect to certain configurations may be combined in various other configurations, such as different aspects and elements of the configurations may be combined in a similar manner. In addition, the elements therein may be updated as the technology develops, i.e., many elements are examples and do not limit the scope of the present disclosure or claims.
[0121] Specific details are given in the specification to provide a thorough understanding of the exemplary configurations including implementations. However, the configurations may be practiced without these specific details. For example, well-known circuits, processes, algorithms, structures, and techniques have been shown without unnecessary details to avoid obscuring the configurations. This description provides only example configurations and does not limit the scope, applicability, or configurations of the claims. On the contrary, the foregoing description of the configurations will provide those skilled in the art with an enabling description for implementing the described techniques. Various changes may be made to the functions and arrangements of the elements without departing from the spirit or scope of the present disclosure.
[0122] In summary, it is intended that the above detailed description is considered to be illustrative rather than restrictive, and it should be understood that the above embodiments should be understood to be only used to illustrate the present invention and not to limit the scope of protection of the present invention. After reading the contents of the present invention, the technician can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. An intelligent code generation and compilation system based on AI big model, characterized in that: The generation and compilation system comprises: Code acquisition module: configured to acquire individual code texts submitted by multiple members of the development team, thereby providing the generation and compilation system with original code data to support subsequent parsing and processing; Code analysis module: It is designed to perform deep semantic analysis on the input personal code text, extract the structural, functional and semantic style features of the code, and convert them into the personal code text feature vector corresponding to each team member; The normalization module is configured to perform team style constraints on the individual code text feature vector based on the preset team style, and generate a code feature vector that conforms to the team code style; Code Reconstruction Module: Input the code feature vector that conforms to the team code style into the artificial intelligence big model, and generate the team code text by the artificial intelligence big model; the personal code text includes the program code written by the members and the corresponding comments on the program code; the team code text includes the program code generated by the artificial intelligence big model and the corresponding comments on the program code; Wherein, the code analysis module includes: A code preprocessing unit is used to preprocess the acquired personal code text, including but not limited to performing the following steps: performing word segmentation on the personal code text; removing non-critical elements in the code; converting the word segmented vocabulary units into word embedding vectors, thereby obtaining a personal code text word embedding vector sequence; A code deconstruction unit, used for performing semantic coding deconstruction on the personal code text word embedding vector sequence to obtain a personal code text feature vector; A neural transformer model, wherein the neural transformer model includes one or more encoders, and one or more decoders; the encoder includes a multi-head attention layer and a feedforward neural network; the decoder includes a masked multi-head attention layer, an encoder-decoder multi-head attention layer and a feedforward neural network; The normalization module includes: A feature suppression unit, used for smoothing the distribution of personal style features of the personal code text feature vector to reduce the influence of the personal style features and form a neutral code text feature vector; A style determination unit, in which the style of the team code text is set by the user, and a team code style feature vector having the team style is generated according to the set team code style; A feature fusion unit, used for fusing the neutralized code text feature vector and the team code style feature vector to obtain a personal code text feature vector under the team code style constraint; The training process of the neural transformer model includes: Pre-training the neural transformer model using an unsupervised training data set; the unsupervised training data set includes personal code texts from multiple team members; wherein the personal code texts include method signatures and method bodies of a programming language; We fine-tune the pre-trained Neural Transformer model using a supervised training dataset by adopting different combinations of method signatures and method bodies and adding prefixes to indicate the target task in the supervised training dataset to improve the model's ability to learn the relationship between these features.
2. The generation and compilation system as claimed in claim 1, characterized in that: The code deconstruction unit also includes inputting the personal code text word embedding vector sequence into a context encoder based on a neural transformer model to obtain the personal code text feature vector.
3. An intelligent code generation and compilation method based on AI big model, characterized in that: The generation and compilation method is applied to the generation and compilation system as claimed in claim 2; the generation and compilation method comprises the following steps: S100: through the code acquisition module, automatically obtain the personal code texts submitted by multiple members from the development team, including program codes and corresponding code comments, as raw data input; S200: Performing deep semantic analysis on the input personal code text, extracting the structural, functional and semantic style features of the code, and converting them into a personal code text feature vector corresponding to each team member; S300: Based on the preset team style, perform team style constraints on the individual code text feature vector to generate a code feature vector that conforms to the team code style; S400: Input the code feature vector that conforms to the team code style into the artificial intelligence big model, and the artificial intelligence big model generates the team code text.
Citation Information
Patent Citations
A method for generating code based on ExtJS UI visualization
CN105404509B
System and method for auto resolution of errors during compilation of data segments
US20220121554A1
Application program generating method and apparatus
WO2021169426A1
Code automatic generation method, device and equipment, and computer readable storage medium
CN114035803A
Code submission optimization method and related device
CN115390893A
