Code automatic generation method and device, electronic equipment and storage medium
Through the automatic code generation method, the fusion processing of large language models and modal target representation vectors is used to generate high-quality visual codes, which solves the problem of high technical requirements for users of traditional data visualization methods and improves the accuracy and convenience of generating codes. sex.
Patent Information
- Application Number
- CN202410600716.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2024-08-23
AI Technical Summary
Traditional data visualization methods place high technical requirements on users, including programming capabilities and proficiency in visualization tools, making it difficult for experts in many fields and individuals with non-technical backgrounds to generate efficient and accurate visualization code, and to manually write and debug visualizations. The code is time consuming and inefficient.
An automatic code generation method is proposed. By obtaining intention description information, parsing and processing, the modal target representation vector is generated. After fusion processing, it is input into a pre-trained large language model to generate an initial code sequence, and the generation is optimized according to preset constraints. A sequence of target code, displayed in the user interface.
It improves the accuracy and convenience of visually generated code, reduces the time and effort of manually writing code, is suitable for different types of intent description information, generates high-quality code, and displays it intuitively in the user interface.
Smart Images

Figure CN118535137A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method and device for automatically generating code, an electronic device, and a storage medium. Background Art
[0002] At present, with the development of artificial intelligence technology, especially the use of large language models, the traditional model of software development by programmers has been overturned, forming code generation technology. Since large language models are usually obtained by training based on massive text data, they may not fully conform to programming specifications and logic. In the face of the rapidly developing data era, it is particularly important to extract valuable information from large amounts of data efficiently and accurately. This requires not only professional skills in data analysis, but also strong data visualization capabilities to transform abstract data into intuitive and easy-to-understand visual representations.
[0003] However, traditional data visualization methods often place high technical requirements on users, including programming skills and proficiency in visualization tools, which poses a substantial barrier for experts in many fields and individuals with non-technical backgrounds. In addition, even for data scientists and developers with relevant skills, manually writing and debugging visualization code is a time-consuming and inefficient process. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a method and device for automatic code generation, an electronic device and a storage medium, aiming to improve the accuracy and convenience of visual code generation.
[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes a method for automatically generating code, the method comprising:
[0006] Get intent description information;
[0007] Parsing the intention description information to obtain a target data set and at least one modality target representation vector;
[0008] Determining, according to the type of the modal target representation vector, a first target vector corresponding to the modal target representation vector;
[0009] Inputting the first target vector and the target data set into a pre-trained large language model to obtain an initial code sequence, wherein the initial code sequence includes at least one target element;
[0010] Each target element in the initial code sequence is optimized according to preset constraints to generate a target code sequence, and the target code sequence is displayed in a user interface.
[0011] In some embodiments, the intention description information is language text information, graphic text description information, or a combination of language text information and graphic text description information; the modal target representation vector includes a text target representation vector and / or an image target representation vector; the target data set includes a text data set and a graphic text data set;
[0012] The parsing of the intent description information to obtain a target data set and at least one modality target representation vector includes:
[0013] Performing keyword recognition and phrase recognition on the language text information to determine the text target representation vector and the text data set; and / or
[0014] Graphic segmentation and recognition are performed on the graphic description information to determine the image target representation vector and the graphic data set.
[0015] In some embodiments, the fusing the modal target representation vectors according to the types of the modal target representation vectors to obtain the first target vector includes:
[0016] When the type of the modal target representation vector includes any one of the text target representation vector or the image target representation vector, taking the text target representation vector or the image target representation vector as the first target vector;
[0017] When the types of the modality target representation vector include the text target representation vector and the image target representation vector, respectively obtaining a first weight and a second weight about the target text representation vector and the target image representation vector;
[0018] The target text representation vector and the target image representation vector are fused according to the first weight and the second weight to obtain a first target vector.
[0019] In some embodiments, after the step of fusing the modal target representation vectors according to the types of the modal target representation vectors to obtain the first target vector, the method further includes:
[0020] Inputting the first target vector into a preset encoder, and generating a second target vector based on the dependency relationship of each feature in the first target vector and the context relationship between the features through the preset encoder;
[0021] The step of inputting the first target vector and the target data set into a pre-trained large language model, optimizing each generated target element using preset constraints, and generating a target code sequence includes:
[0022] The second target vector and the target data set are input into a pre-trained large language model, and each generated target element is optimized using preset constraints to generate a target code sequence.
[0023] In some embodiments, inputting the first target vector and the target data set into a pre-trained large language model to obtain an initial code sequence includes:
[0024] Inputting the second target vector and the target data set into a pre-trained large language model, and sequentially generating each target element of each element sequence position in the code sequence constituting the model output based on the second target vector and the target data set by the pre-trained large language model to obtain the initial code sequence;
[0025] Wherein, the initial code sequence includes target elements corresponding to multiple element sequence positions, and the target element corresponding to each element sequence position is selected and generated according to the joint probability of the candidate elements at the respective element sequence positions, and the joint probability of each candidate element is determined by each candidate element and the generated target element before the current element sequence position; wherein, the target element at the first element sequence position of the initial code sequence is selected and generated by the joint probability of the candidate elements at the first element sequence position.
[0026] In some embodiments, the large language model is trained according to the following steps:
[0027] Obtaining sample description information and a sample code sequence corresponding to the training description information;
[0028] Parsing the training description information to obtain a training data set and at least one modality training representation vector;
[0029] The modality training representation vector is fused to obtain a first training fusion vector;
[0030] Inputting the first training fusion vector and the training data set into a large language model of the training data set to obtain a predicted code sequence, wherein the predicted code sequence includes at least one predicted target element;
[0031] Optimizing each prediction target element in the prediction code sequence according to preset constraints to generate a code sequence to be confirmed;
[0032] A target loss is determined according to the code sequence to be confirmed and the sample code sequence, and parameters of the large language model are adjusted according to the target loss until the loss value meets a preset threshold.
[0033] In some embodiments, determining a target loss according to the code sequence to be confirmed and the sample code sequence, and adjusting parameters of the large language model according to the target loss until the loss value meets a preset threshold, includes:
[0034] Create a first low-rank matrix and a second low-rank matrix;
[0035] Fine-tuning the first low-rank matrix and the second low-rank matrix according to the difference between the code sequence to be confirmed and the sample code sequence;
[0036] According to the new first low-rank matrix, the second low-rank matrix and the original parameters of the large language model, the code sequence to be confirmed and the sample code sequence are calculated to determine a target loss until the target loss meets a preset threshold;
[0037] The original parameters of the large language model are updated according to the first low-rank matrix and the second low-rank matrix when the loss value is minimized.
[0038] In some embodiments, after the step of optimizing each predicted target element in the predicted code sequence according to the preset constraint conditions to generate a code sequence to be confirmed, the method further includes:
[0039] Using a preset reward function to evaluate each training element in the code sequence to be confirmed, to obtain a score value for each training element;
[0040] Calculate the expected value of the gradient of the corresponding code sequence to be confirmed according to the joint probability of each training element and the corresponding score value;
[0041] The parameters of the large language model are updated according to the gradient expected value.
[0042] In some embodiments, after the step of displaying the target code sequence in the user interface, the method further includes: modifying the target code sequence in response to a user adjustment request, and re-displaying the modified target code sequence in the user interface.
[0043] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a device for automatically generating a code, the device comprising:
[0044] An acquisition unit, used for acquiring intention description information;
[0045] A parsing unit, configured to parse the intent description information to obtain a target data set and at least one modality target representation vector;
[0046] a determining unit, configured to determine a first target vector corresponding to the modal target representation vector according to the type of the modal target representation vector;
[0047] A generating unit, configured to input the first target vector and the target data set into a pre-trained large language model to obtain an initial code sequence, wherein the initial code sequence includes at least one target element;
[0048] The optimization unit is used to optimize each target element in the initial code sequence according to preset constraints, generate a target code sequence, and display the target code sequence in a user interface.
[0049] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0050] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0051] The code automatic generation method and device, electronic device and storage medium proposed in the present application obtain the intention description information input by the user, and there may be multiple intention description information. Therefore, after parsing the intention description information, at least one modal target representation vector and a target data set to be processed are obtained. In order to generate code for the user's intention better in the future, multiple different modal target representation vectors are fused according to the type of the modal target representation vector to obtain a first target vector. The purpose of fusion is to integrate information from different modalities into a unified representation, so as to generate the features corresponding to the target code more comprehensively and accurately in the future. Then the first target is input into the pre-trained large language model, which has a strong text generation capability, thereby generating an initial code sequence containing multiple target elements. In addition, for the initial code sequence, the system will optimize each generated target element according to the preset constraints, such as optimizing the code syntax correctness, code style, and code efficiency, to ensure that the generated target code sequence not only meets the user's intention, but also has high-quality code attributes. Finally, the system displays the generated target code sequence in the user interface for the user to view and use. In the technical solution provided in the present application, users can express their needs and intentions more intuitively, and different modal target representation vectors can be generated according to different types of user intention description information. Through the automated code generation method, users can obtain code that meets their needs more quickly, reducing the time and effort of manual code writing, thereby improving the convenience of visual code generation, and improving the accuracy of visual code generation by fusing the modal target representation vectors and imposing constraints on the generation of target code sequences. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 is a flowchart of the code automatic generation method provided in an embodiment of the present application;
[0053] Figure 2 yes Figure 1 Flow chart of step S120 in FIG.
[0054] Figure 3 yes Figure 1 Flow chart of step S130 in FIG.
[0055] Figure 4 yes Figure 1 The flowchart after step S130 in FIG.
[0056] Figure 5 yes Figure 4 Flow chart of step S430 in FIG.
[0057] Figure 6 yes Figure 1 Flowchart of the large language model training method in ;
[0058] Figure 7 yes Figure 6 Flowchart of step S660 in FIG.
[0059] Figure 8 yes Figure 6 The flowchart after step S650 in FIG.
[0060] Fig. 9 yes Figure 1 The flowchart after step S140 in FIG.
[0061] Fig.10 It is a structural diagram of a code automatic generation device provided in an embodiment of the present application;
[0062] Fig.11 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0064] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0065] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0066] First, some nouns involved in this application are analyzed:
[0067] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robots, language recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0068] Large Language Model (LLM): A large language model is a deep learning model trained on massive text data. It can not only generate natural language text, but also deeply understand the meaning of the text and handle various natural language tasks such as text summarization, question answering, translation, etc.
[0069] BERT model (Bidirectional Encoder Representations from Transformers): It is a pre-trained language model based on the Transformer architecture. It captures deep bidirectional representations of language through pre-training on large-scale text data, and then fine-tunes it for different natural language processing tasks. The BERT model has a wide range of applications in the field of natural language processing and provides a powerful pre-training model foundation for a variety of language understanding tasks.
[0070] ViT model (Vision Transformer): This model applies the Transformer model based on the self-attention mechanism in the NLP field to image tasks. Compared with the traditional convolutional neural network model in image tasks, the ViT model has stronger effects and more cost-effectiveness than convolutional networks on large data sets.
[0071] Transformer Encoder: Transformer encoder uses a technique called "self-attention" that allows the model to focus on the relationship between specific input elements while ignoring irrelevant information. The role of the encoder is to convert the input data into a set of fixed-length vectors that capture the semantic and contextual information of the input data.
[0072] At present, with the development of artificial intelligence technology, especially the application of large language models, the traditional model of software development by programmers has been overturned, and code generation technology has been formed. Since large language models are usually obtained by training based on massive text data, they may not be able to fully comply with programming specifications and logic. In the face of the rapidly developing data era, it is particularly important to extract valuable information from large amounts of data efficiently and accurately. This requires not only professional skills in data analysis, but also strong data visualization capabilities to transform abstract data into intuitive and easy-to-understand visual representations. However, traditional data visualization methods often place high technical requirements on users, including programming skills and proficiency in visualization tools, which poses a substantial obstacle for experts in many fields and individuals with non-technical backgrounds. In addition, even for data scientists and developers with relevant skills, manually writing and debugging visualization code is a time-consuming and inefficient process.
[0073] Information Extraction: A text processing technology that extracts specified types of entity, relationship, event and other factual information from natural language text and forms structured data output. Information extraction is a technology that extracts specific information from text data. Text data is composed of some specific units, such as sentences, paragraphs, and chapters. Text information is composed of some small specific units, such as characters, words, phrases, sentences, paragraphs, or a combination of these specific units. Extracting noun phrases, names, place names, etc. from text data are all text information extraction. Of course, the information extracted by text information extraction technology can be various types of information.
[0074] Based on this, the embodiments of the present application provide a method and device for automatic code generation, an electronic device and a storage medium, aiming to improve the accuracy and convenience of visual code generation.
[0075] The code automatic generation method and device, electronic device and storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the code automatic generation method in the embodiments of the present application is described.
[0076] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0077] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0078] The automatic code generation method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The automatic code generation method provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the automatic code generation method, etc., but is not limited to the above forms.
[0079] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0080] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with the relevant laws, regulations, and standards of the relevant countries and regions. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0081] Figure 1 is an optional flowchart of the code automatic generation method provided in the embodiment of the present application, Figure 1 The method may include but is not limited to steps S110 to S140.
[0082] Step S110, obtaining intention description information;
[0083] Step S120, parsing the intent description information to obtain a target data set and at least one modality target representation vector;
[0084] Step S130, determining a first target vector corresponding to the modal target representation vector according to the type of the modal target representation vector;
[0085] Step S140, inputting the first target vector and the target data set into a pre-trained large language model to obtain an initial code sequence, where the initial code sequence includes at least one target element.
[0086] Step S150, optimizing each target element in the initial code sequence according to preset constraints, generating a target code sequence, and displaying the target code sequence in a user interface.
[0087] In step S110, the most direct way is to receive user input through a user interface (UI) to obtain intent description information. This can be a text box in which users enter their intent descriptions, or draw sketches of intent descriptions, or a speech recognition system in which users can enter their intents by voice. In addition, for users who are not familiar with the operating system, a question-and-answer system can be designed to guide users to describe their intentions through a series of questions. Intent description information can also be extracted from existing text materials such as documents, emails, chat records, etc. The present application does not specifically limit the method and type of obtaining intent description information.
[0088] Steps S110 to S150 shown in the embodiment of the present application, by obtaining the intention description information input by the user, there may be multiple intention description information, so after parsing the intention description information, at least one modal target representation vector and a target data set to be processed are obtained. In order to better generate code for the user's intention in the future, multiple different modal target representation vectors are fused according to the type of modal target representation vector to obtain a first target vector. The purpose of the fusion is to integrate information from different modalities into a unified representation, so as to generate the features corresponding to the target code more comprehensively and accurately in the future. The first target is then input into the pre-trained large language model, which has a powerful text generation capability, thereby generating an initial code sequence containing multiple target elements. In addition, for the initial code sequence, the system will optimize each generated target element according to the preset constraints, such as optimizing the code syntax correctness, code style, and code efficiency, to ensure that the generated target code sequence not only meets the user's intention, but also has high-quality code attributes. Finally, the system displays the generated target code sequence in the user interface for the user to view and use. In the technical solution provided in the present application, users can express their needs and intentions more intuitively, and different modal target representation vectors can be generated according to different types of user intention description information. Through the automated code generation method, users can obtain code that meets their needs more quickly, reducing the time and effort of manual code writing, thereby improving the convenience of visual code generation, and improving the accuracy of visual code generation by fusing the modal target representation vectors and imposing constraints on the generation of target code sequences.
[0089] The adaptive multimodal fusion and conditional generation framework combines the multimodal fusion and conditional generation framework with the adaptive multimodal feature fusion technology, aiming to process and understand the comprehensive input of natural language descriptions, hand-drawn sketches, and raw data. By using the attention mechanism and adaptive algorithm to dynamically adjust the weights of different modal features in the fusion process, this framework generates a unified and informative multimodal fusion representation, providing richer and more accurate context information for conditional code generation.
[0090] The details of steps S120 to S150 will be described in detail below.
[0091] See also Figure 2 In some embodiments, the intention description information is language text information, graphic text description information, or a combination of language text information and graphic text description information; the modal target representation vector includes a text target representation vector and / or an image target representation vector; and the target data set includes a text data set and a graphic text data set. In step S120, the following steps may be included but are not limited to:
[0092] Step S210: Perform keyword recognition and phrase recognition on the language text information to determine the text target representation vector and text data set.
[0093] and / or,
[0094] Step S220: perform graphic segmentation and recognition on the graphic description information to determine the image target representation vector and the graphic data set.
[0095] In step S210 of some embodiments, the language text information is specifically input into a preset BERT model to process natural language input, identify keywords and phrases, which may correspond to specific programming concepts, functional requirements or design elements, and convert the extracted keywords and phrases into vector form. These vectors can capture the semantic information in the text, thereby determining the text target representation vector T and the target data set D.
[0096] Language text information is the user's intention expressed in natural language (such as text or voice). It describes the function, purpose or requirement that the user wants the code to achieve. For example, the user may enter: "Create a login page for me, requiring username and password input boxes, and a login button". The language text information is input into the BERT model for natural language processing to extract keywords and phrases, such as "login page", "user name", "password input box", and "login button". These keywords and phrases are converted into vectors to form a text target representation vector T, and they are mapped to a high-dimensional space using, for example, Word2Vec technology. Then a text target dataset D is created, which contains the design elements and functional requirements of the login page, such as "user name input box required", "password input box required", "login button required", etc.
[0097] In step S220 of some embodiments, the graphic description information uploaded by the user in the form of a sketch is parsed, the graphics and layout are identified to assist in the generation of visualization code, and the ViT model is used to perform image segmentation and target detection and extract the image target representation vector V and target data set D of the layout elements.
[0098] Graphical description information describes user intent in the form of sketches, graphics, or images. Users may not be good at or willing to describe their needs in words, but instead draw sketches to show what they want. For example, a user may draw a simple login page sketch containing several input boxes and a button. The graphic description information is input into the ViT model for processing, and the sketch is segmented into different areas using image processing technology to identify two input boxes and a button. The identified graphic elements are converted into image target representation vectors V, such as describing the shape, size, and position of the input box, and the shape and position of the button. Create a target dataset D containing the design attributes of the login page, such as the position and size of the input box, the shape of the button, etc.
[0099] See also Figure 3 In some embodiments, step S130 may include but is not limited to the following steps:
[0100] Step S310: when the type of the modal target representation vector includes any one of the text target representation vector and the image target representation vector, taking the text target representation vector or the image target representation vector as the first target vector;
[0101] Step S320: When the types of the modal target representation vector include the text target representation vector and the image target representation vector, respectively obtain a first weight and a second weight about the target text representation vector and the target image representation vector.
[0102] Step S330: According to the first weight and the second weight, the target text representation vector and the target image representation vector are fused to obtain a first target vector.
[0103] In step S310, when there is only one modality target representation vector, no complex fusion processing is required, which simplifies the processing flow and reduces the computational complexity and resource consumption. On the other hand, directly using the vector as the fusion result can ensure the integrity and accuracy of the original information, avoid the loss or deformation of the information during the fusion process, help maintain data consistency, and improve the efficiency of data processing.
[0104] In step S320 to step S330, the target text representation vectors of different modalities are fused to create a comprehensive representation vector, called the first target vector. The first weight and the second weight are set for the target text representation vector and the target image representation vector, respectively, which can balance the importance of the two modalities and create a more comprehensive and richer data representation, thereby helping the model to better understand tasks and data.
[0105] In an embodiment of the present application, the fused feature vector M can be expressed as: M = αT + (1-α) V, where α is the attention weight, which can be learned through training and is used to control the importance of text and image features. If, in the code requirement, the description of the text part is more important, α can be set to a value greater than 0.5; if the description of the image part is more important, α can be set to a value less than 0.5. In addition to the weighted fusion method proposed in this embodiment, it can also include more complex fusion techniques, such as a fusion network based on deep learning, which is not limited in this application.
[0106] See also Figure 4 In some implementations, after step S130, the following steps are also included but not limited to:
[0107] Step S410: Input the first target vector to a preset encoder, and generate a second target vector based on the dependency relationship between each feature in the first target vector and the contextual relationship between the features through the preset encoder.
[0108] Correspondingly, step S140 may include but is not limited to the following steps:
[0109] Step S420: Input the second target vector and the target data set into the pre-trained large language model to obtain an initial code sequence.
[0110] In step S410, the first target vector M is input into a preset encoder. Specifically, the encoder is a transformer model. By capturing the dependency of each feature in the first target vector, a second target vector M'=transformer(M) is obtained. In the first target vector, although the features of different modalities have been fused, there may still be complex dependencies between them. Through the Transformer model, these relationships can be further mined so that the model can better understand the intrinsic structure of the data. The multi-layer structure and attention mechanism in the Transformer model can perform multi-level feature extraction and enhancement on the input first target vector M, thereby generating a richer and more expressive second target vector M', which not only contains local feature information, but also incorporates global context information, thereby helping to improve the performance of subsequent tasks. After optimization, the second target vector M' is obtained. Through step S420, the second target vector M' is used as the input data of the large language model, so that the target code sequence that meets user needs can be generated more accurately.
[0111] See also Figure 5 In some embodiments, step S420 includes but is not limited to the following steps:
[0112] Step S510: Input the second target vector and the target data set into the pre-trained large language model, and use the pre-trained large language model to sequentially generate each target element of the sequential position of each element in the code sequence that constitutes the model output based on the second target vector and the target data set to obtain an initial code sequence.
[0113] Among them, the initial code sequence contains target elements corresponding to multiple element sequence positions, and the target element corresponding to each element sequence position is selected and generated according to the joint probability of the candidate elements at the respective element sequence positions, and the joint probability of each candidate element is determined by each candidate element and the generated target element before the current element sequence position; wherein, the target element at the first element sequence position of the initial code sequence is selected and generated by the joint probability of the candidate elements at the first element sequence position.
[0114] In the above steps, a large-scale pre-trained language model is used as the basic model, such as OPT-2.7B or LLaMA-7B and other GPT architecture large models. The second target vector M' and the target data set D are input into the large language model to generate a visualized target code sequence y = LLM (M', D), where the target code sequence consists of multiple target elements, each target element is generated in sequence, and multiple candidate elements are generated before each target element is generated. The large language model is used to select the most likely target element from the multiple candidate elements as the final selected target element.
[0115] In step S510, multiple candidate elements of the first target element are generated by the second target vector M' and the target data set D. In order to select a candidate element with the greatest possibility as the first target element, the joint probability p of each candidate element is calculated. The calculation method of the joint probability is not limited to the process of decomposing the joint probability into a series of product of conditional probabilities in combination with the context. The joint probability can also be approximated by using the Monte Carlo method, which is not limited here. Before calculating the joint probability of the candidate elements, some candidate elements can be excluded by constraints. This method can exclude some low-quality candidate elements to improve the confirmation efficiency of the target elements.
[0116] After generating the first target element, when generating subsequent target elements, the relationship with the already generated target elements needs to be considered. That is, according to the second target vector and the target dataset, multiple candidate elements corresponding to the next target element are regenerated. It is necessary to combine the already generated target elements to generate the joint probability p(y|M') corresponding to each candidate element, where p(y|M') = ∏p(y_t|y_<t,M'+D). Here, y_t represents the t-th target element token of the sequence y, y_<t represents the first t - 1 target element tokens of y, that is, y_1, y_2,..., y_t-1, and M’ is the input second fusion feature vector. p(y|M') represents the probability of predicting the t-th token y_t under the condition of knowing the previous tokens y_<t and the fusion feature M', and ∏ represents the product of the conditional probabilities of all tokens. The goal of the model is to maximize this joint probability p(y|M'), that is, to generate the most likely and high-quality visualization code sequence y. That is, when calculating the joint probability of the candidate elements generated by the third target element, the first and second target elements that have already been generated need to be considered.
[0117] In step S150, after generating the initial code sequence, a constraint condition R(y) is added for restriction. Thus, under the premise of meeting the constraint condition, the candidate element with the maximum joint probability is selected as the target element. The specific selection formula for the target element is y* = argmax p(y|M') s.t. R(y), where y* is the best candidate element and is the finally selected target element, p(y|M’) is the joint probability of each element y. By the above formula, the target code sequence y* that maximizes the generated joint probability p(y|M') is found, but at the same time, it needs to satisfy (subject to, s.t.) the set of constraint conditions R(y).
[0118] Please refer to Figure 6 , in some embodiments, the large language model in step S140 is trained by the following method steps:
[0119] Step S610: Obtain the sample description information and the sample code sequence corresponding to the training description information;
[0120] Step S620: Parse and process the training description information to obtain the training dataset and at least one modal training representation vector;
[0121] Step S630: Perform fusion processing on the modal training representation vectors to obtain the first training fusion vector;
[0122] Step S640: Input the first training fusion vector and the training dataset into the large language model of the training dataset to obtain the predicted code sequence, and the predicted code sequence includes at least one predicted target element;
[0123] Step S650: optimizing each predicted target element in the predicted code sequence according to preset constraints to generate a code sequence to be confirmed;
[0124] Step S660: Determine the target loss according to the code sequence to be confirmed and the sample code sequence, and adjust the parameters of the large language model according to the target loss until the loss value meets the preset threshold.
[0125] In step S610, different from the normal process used by the user, that is, different from step S110, the user can use the web crawler and API to obtain public data visualization projects in advance. It should be noted that the data obtained by the crawler needs to be screened and filtered by the user to ensure that only content related to the training objectives is retained. For example, if the user's goal is to train a model that generates data visualization code from a functional description, then they should only retain those projects that contain functional descriptions and corresponding visualization codes. Thereby, multiple different types of training description information and sample code sequences corresponding to each training description information are obtained, and the training description information should at least include training description information expressed in natural language and described in sketch form.
[0126] Subsequently, the execution process of step S620 to step S650 is similar to the execution process of step S120 to step S150. For details, please refer to the above description of step S120 to step S150, and no further space will be wasted to repeat them here.
[0127] In step S660, the parameters of the large language model are adjusted according to the calculated target loss. By continuously adjusting the model parameters and monitoring the convergence of the loss value, the training process can more effectively utilize data resources, improve training efficiency and reduce resource waste. In addition, through in-depth analysis of training description information and fusion of multimodal information, the model can generate code sequences that better meet actual needs, thereby improving the quality and practicality of the code.
[0128] See also Figure 7 In some embodiments, step S660 may specifically include the following steps:
[0129] Step S710: creating a first low-rank matrix and a second low-rank matrix;
[0130] Step S720: fine-tuning the first low-rank matrix and the second low-rank matrix according to the difference between the code sequence to be confirmed and the sample code sequence;
[0131] Step S730: Calculate the loss values of the code sequence to be confirmed and the sample code sequence according to the new first low-rank matrix, the second low-rank matrix and the original parameters of the large language model until the loss value meets the preset threshold;
[0132] Step S740: Update the original parameters of the large language model according to the first low-rank matrix and the second low-rank matrix when the loss value is minimized.
[0133] In step S710 to step S740, the model training efficiency is improved by introducing the LoRA (low rank adaptation) algorithm. Specifically, a first low-rank matrix α and a second low-rank matrix β are created. The use of low-rank matrices helps to reduce computational complexity, speed up calculations, and may improve the generalization ability of the model. According to the difference between the code sequence to be confirmed and the sample code sequence, the first low-rank matrix and the second low-rank matrix are fine-tuned to find the first low-rank matrix and the second low-rank matrix with the smallest loss value. In this process, there is no need to change the original parameters of the large language model. The use of low-rank matrices can reduce computational complexity and speed up training.
[0134] Specifically, the parameters are optimized through the following LoRA algorithm formula, θ*=argminL(θ_pre+Δθ_α,β), where θ_pre is the original parameter of the pre-trained large language model, and Δθ is a low-rank matrix composed of two small-size matrices α and β, which is used to efficiently fine-tune the model. L is the loss function, which measures the gap between the prediction and the true label under the current parameters. argmin means to find the parameter value that minimizes the loss function L. During the fine-tuning process, only α and β are updated, while the pre-trained parameters θ_pre are kept unchanged. The goal is to find the optimal values of α and β so that the loss function L under θ_pre+Δθ_α,β is minimized. In this way, LoRA only needs to update a small number of parameters α and β to adapt to new downstream tasks, avoiding the high computational cost of completely retraining the large model.
[0135] See also Figure 8 In some embodiments, after step S650, the following steps may also be included but not limited to:
[0136] Step S810: using a preset reward function to evaluate each training element in the code sequence to be confirmed, and obtaining a score value for each training element;
[0137] Step S820: Calculate the expected gradient value of the corresponding code sequence to be confirmed according to the joint probability of each training element and the corresponding score value;
[0138] Step S830: Update the parameters of the large language model according to the gradient expectation value.
[0139] In steps S810 to S830, the reward function Q(y) can also be called a scoring function, which assigns a score value to each training element according to specific criteria or rules. This score value can be based on the correctness, readability, efficiency, innovation or any other relevant metric of the code. Combining the joint probability of each training element and the score value they obtain through the reward function, by calculating the expected value of the gradient, we can understand how to adjust the model parameters to maximize the expected reward. This is basically an optimization problem, in which the model tries to find the best parameter settings that can generate code sequences with high score values. That is, a reinforcement learning mechanism is established to optimize and adjust the initially generated code to ensure code quality and execution efficiency, including layout optimization, style adjustment, etc.
[0140] Specifically, in this step, the reward function Q(y) can be any scoring function that measures the quality of the code, such as a code quality metric based on a syntax tree. The reinforcement learning process is defined as The quality of the visualized target code sequence y is modeled as a reward function Q(y). The goal is to obtain high-quality code output by maximizing the expected reward. Q(y) is a scoring function for the quality of the visualized target code sequence y. The larger the value, the better the code quality. π(y|M') is the probability distribution of generating the target code sequence y, which is the output of the language model. is the gradient of logarithmic probability, indicating how to fine-tune the model to increase the probability of a certain y, and E represents the expectation of all possible y. The goal is to maximize J so that the model tends to generate high-quality (Q(y) large) code sequences y. We use the policy gradient method in reinforcement learning, according to This gradient estimate is used to update the model parameters θ: Where λ is the learning rate. In practice, multiple samples of y are obtained through Monte Carlo sampling, and the quality score Q(y) and log probability gradient of each y are calculated. And take the average approximate expectation Through this policy gradient ascent method, the model can continuously learn to generate higher quality code until it converges to a state with optimal generation performance.
[0141] See also Fig. 9 In some embodiments, after the step of displaying the target code sequence in the user interface in step S140, the process further includes but is not limited to the following steps:
[0142] Step S910: In response to a user adjustment request, the target code sequence is modified, and the modified target code sequence is re-displayed in the user interface.
[0143] In step S910, by displaying the modified code in real time, the user can find and correct errors in the code in a timely manner. This helps to reduce the time and cost of code debugging and improve development efficiency. In addition, the user can adjust the code at any time according to their needs and preferences, and immediately see the display effect of the modified code in the user interface. The user can preview the visualization effect, which helps the user to more intuitively understand the impact of code changes on the final output, and download or further edit it.
[0144] See also Fig.10 The embodiment of the present application further provides a device 1000 for automatically generating a code, which can implement the above-mentioned method for automatically generating a code, and the device includes:
[0145] An acquisition unit 1010 is used to acquire intention description information;
[0146] A parsing unit 1020 is used to parse the intention description information to obtain a target data set and at least one modality target representation vector;
[0147] A determining unit 1030 is used to fuse the modal target representation vectors according to the types of the modal target representation vectors to obtain a first target vector;
[0148] A generating unit 1040 is used to input the first target vector and the target data set into a pre-trained large language model to obtain an initial code sequence, where the initial code sequence includes at least one target element;
[0149] The optimization unit 1050 is used to optimize each target element in the initial code sequence according to preset constraints, generate a target code sequence, and display the target code sequence in a user interface.
[0150] The specific implementation of the automatic code generation device is basically the same as the specific implementation of the automatic code generation method described above, and will not be repeated here.
[0151] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned code automatic generation method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0152] See also Fig.11 , Fig.11 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0153] The processor 1101 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0154] The memory 1102 may be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1102 may store an operating system and other application programs. When the technical solution provided in the embodiments of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1102, and the processor 1101 calls and executes the code automatic generation method of the embodiments of this application;
[0155] Input / output interface 1103, used to implement information input and output;
[0156] The communication interface 1104 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WI FI, Bluetooth, etc.);
[0157] A bus 1105 that transmits information between various components of the device (e.g., the processor 1101, the memory 1102, the input / output interface 1103, and the communication interface 1104);
[0158] The processor 1101 , the memory 1102 , the input / output interface 1103 and the communication interface 1104 are connected to each other in communication within the device via the bus 1105 .
[0159] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned code automatic generation method is implemented.
[0160] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0161] The automatic code generation method and device, electronic device and storage medium provided in the embodiments of the present application obtain the intention description information input by the user. There may be multiple intention description information. Therefore, after parsing the intention description information, at least one modal target representation vector and a target data set to be processed are obtained. In order to better generate code for the user's intention in the future, multiple different modal target representation vectors are fused to obtain a first target vector. The purpose of the fusion is to integrate information from different modalities into a unified representation, so as to generate features corresponding to the target code more comprehensively and accurately in the future. The first target is then input into a pre-trained large language model, which has a powerful text generation capability. In the process of generating a code sequence, the system will optimize each generated target element according to preset constraints, such as optimizing the code syntax correctness, code style, and code efficiency, to ensure that the generated target code sequence not only meets the user's intention, but also has high-quality code attributes. Finally, the system displays the generated target code sequence in the user interface for the user to view and use. In the technical solution provided in the present application, users can express their needs and intentions more intuitively, and different modal target representation vectors can be generated according to different types of user intention description information. Through the automated code generation method, users can obtain code that meets their needs more quickly, reducing the time and effort of manual code writing, thereby improving the convenience of visual code generation, and improving the accuracy of visual code generation by fusing the modal target representation vectors and imposing constraints on the generation of target code sequences.
[0162] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0163] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0164] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0165] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0166] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0167] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0168] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0169] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0170] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0171] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0172] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A method for automatic code generation, characterized in that: include: Get intent description information; Parsing the intention description information to obtain a target data set and at least one modality target representation vector; Determining, according to the type of the modal target representation vector, a first target vector corresponding to the modal target representation vector; Inputting the first target vector and the target data set into a pre-trained large language model to obtain an initial code sequence, wherein the initial code sequence includes at least one target element; Each target element in the initial code sequence is optimized according to preset constraints to generate a target code sequence, and the target code sequence is displayed in a user interface.
2. The method for automatic code generation according to claim 1, characterized in that: The intention description information is language text information, graphic and text description information, or a combination of language text information and graphic and text description information; the modal target representation vector includes a text target representation vector and / or an image target representation vector; the target data set includes a text data set and a graphic and text data set; The parsing of the intent description information to obtain a target data set and at least one modality target representation vector includes: Performing keyword recognition and phrase recognition on the language text information to determine the text target representation vector and the text data set; and / or Graphic segmentation and recognition are performed on the graphic description information to determine the image target representation vector and the graphic data set.
3. The method for automatic code generation according to claim 2, characterized in that: The determining, according to the type of the modal target representation vector, a first target vector corresponding to the modal target representation vector includes: When the type of the modal target representation vector includes any one of the text target representation vector or the image target representation vector, taking the text target representation vector or the image target representation vector as the first target vector; When the types of the modality target representation vector include the text target representation vector and the image target representation vector, respectively obtaining a first weight and a second weight about the target text representation vector and the target image representation vector; The target text representation vector and the target image representation vector are fused according to the first weight and the second weight to obtain a first target vector.
4. The method for automatically generating code according to claim 1, characterized in that: After the step of fusing the modal target representation vectors according to the types of the modal target representation vectors to obtain the first target vector, the method further includes: Inputting the first target vector into a preset encoder, and generating a second target vector based on the dependency relationship of each feature in the first target vector and the context relationship between the features through the preset encoder; The step of inputting the first target vector and the target data set into a pre-trained large language model to obtain an initial code sequence includes: The second target vector and the target data set are input into a pre-trained large language model to obtain an initial code sequence.
5. The method for automatic code generation according to claim 4, characterized in that: The step of inputting the second target vector and the target data set into a pre-trained large language model to obtain an initial code sequence comprises: Inputting the second target vector and the target data set into a pre-trained large language model, and sequentially generating each target element of each element sequence position in the code sequence constituting the model output based on the second target vector and the target data set by the pre-trained large language model to obtain the initial code sequence; Wherein, the initial code sequence includes target elements corresponding to multiple element sequence positions, and the target element corresponding to each element sequence position is selected and generated according to the joint probability of the candidate elements at the respective element sequence positions, and the joint probability of each candidate element is determined by each candidate element and the generated target element before the current element sequence position; wherein, the target element at the first element sequence position of the initial code sequence is selected and generated by the joint probability of the candidate elements at the first element sequence position.
6. The method for automatic code generation according to claim 1, characterized in that: The large language model is trained according to the following steps: Obtaining sample description information and a sample code sequence corresponding to the training description information; Parsing the training description information to obtain a training data set and at least one modality training representation vector; The modality training representation vector is fused to obtain a first training fusion vector; Inputting the first training fusion vector and the training data set into a large language model of the training data set to obtain a predicted code sequence, wherein the predicted code sequence includes at least one predicted target element; Optimizing each prediction target element in the prediction code sequence according to preset constraints to generate a code sequence to be confirmed; A target loss is determined according to the code sequence to be confirmed and the sample code sequence, and parameters of the large language model are adjusted according to the target loss until the loss value meets a preset threshold.
7. The method for automatic code generation according to claim 6, characterized in that: The step of determining a target loss according to the code sequence to be confirmed and the sample code sequence, and adjusting parameters of the large language model according to the target loss until the loss value meets a preset threshold, includes: Create a first low-rank matrix and a second low-rank matrix; Fine-tuning the first low-rank matrix and the second low-rank matrix according to the difference between the code sequence to be confirmed and the sample code sequence; According to the new first low-rank matrix, the second low-rank matrix and the original parameters of the large language model, the code sequence to be confirmed and the sample code sequence are calculated to determine a target loss until the target loss meets a preset threshold; The original parameters of the large language model are updated according to the first low-rank matrix and the second low-rank matrix when the loss value is minimized.
8. The method for automatic code generation according to claim 6, characterized in that: After the step of optimizing each predicted target element in the predicted code sequence according to the preset constraint conditions to generate a code sequence to be confirmed, the method further includes: Using a preset reward function to evaluate each training element in the code sequence to be confirmed, to obtain a score value for each training element; Calculate the expected value of the gradient of the corresponding code sequence to be confirmed according to the joint probability of each training element and the corresponding score value; The parameters of the large language model are updated according to the gradient expected value.
9. The method for automatic code generation according to claim 1, characterized in that: After the step of displaying the target code sequence in the user interface, the method further comprises: In response to a user adjustment request, the target code sequence is modified, and the modified target code sequence is re-displayed in the user interface.
10. A code automatic generation device, characterized in that: include: An acquisition unit, used for acquiring intention description information; A parsing unit, configured to parse the intent description information to obtain a target data set and at least one modality target representation vector; a determining unit, configured to determine a first target vector corresponding to the modal target representation vector according to the type of the modal target representation vector; A generating unit, configured to input the first target vector and the target data set into a pre-trained large language model to obtain an initial code sequence, wherein the initial code sequence includes at least one target element; The optimization unit is used to optimize each target element in the initial code sequence according to preset constraints, generate a target code sequence, and display the target code sequence in a user interface.
11. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the code automatic generation method according to any one of claims 1 to 9 when executing the computer program.
12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the code automatic generation method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Method, medium and equipment based on AI agent and low-code generation model
CN119088378A
Junior middle school English listening audio intelligent generation method based on large model
CN119380697A
Large code model self-evolution method based on Monte Carlo tree search
CN119398173A
Training method of code generation model, code generation method, equipment and medium
CN119902749A
Code generation model training method, code generation method, device, and medium
CN119902749B
