Task processing method, code completion method, code processing model training method, information processing method based on code processing model, and model training platform

By training the code processing model through hierarchical sampling of sample code data, the problem of long prediction time and low accuracy of large models in code processing is solved, and efficient and accurate code block prediction is achieved.

WO2025194984A1PCT designated stage Publication Date: 2025-09-25ALIBABA (CHINA) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/071534
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-03-21
Filing Date
2025-01-09
Publication Date
2025-09-25

AI Technical Summary

Technical Problem

Large models need to predict a long amount of content at a time during code processing, resulting in long prediction times and low accuracy.

Method used

By performing hierarchical sampling on sample code data, the code processing model is trained to make predictions in units of code blocks, and hierarchical sampling technology is used to construct training data to adapt to various code processing scenarios.

Benefits of technology

The prediction content is shortened, the task processing efficiency and accuracy of the code processing model are improved, it adapts to various code processing scenarios, and accurately predicts various types of code blocks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025071534_25092025_PF_FP_ABST
    Figure CN2025071534_25092025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a task processing method, a code completion method, a code processing model training method, an information processing method based on a code processing model, and a model training platform. The task processing method comprises: acquiring code data to be processed of a target task; inputting said code data into a code processing model, and obtaining a code processing result of the target task, wherein the code processing model is obtained by means of performing training on the basis of a plurality of sample processing results and sample code block data respectively corresponding to the plurality of sample processing results, and the sample processing results and the sample code block data are obtained on the basis of performing hierarchical sampling on sample code data. Since a code processing model is obtained by means of performing training on the basis of sample code block data, prediction in units of code blocks is realized, thereby reducing prediction content; moreover, by means of hierarchical sampling, the code processing model can adapt to various code processing scenarios, such that various types of code blocks are accurately predicted, thereby improving the efficiency and accuracy of task processing.
Need to check novelty before this filing date? Find Prior Art

Description

Task processing method, code completion method, code processing model training method, information processing method based on code processing model and model training platform

[0001] This disclosure claims priority to the Chinese patent application filed with the Patent Office of China on March 21, 2024, with application number 202410331805.8 and application name “Task processing method, code completion method, code processing model training method, information processing method based on code processing model and model training platform”, the entire contents of which are incorporated by reference in this disclosure. Technical Field

[0002] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a task processing method, a code completion method, a code processing model training method, an information processing method based on a code processing model, and a model training platform. Background Art

[0003] With the advancement of computer technology, large models have begun to shine. Their remarkable capabilities in language understanding, generation, interaction, and reasoning have led to their widespread application in natural language processing fields such as dialogue, translation, and code processing. For example, in the field of code processing, large models can provide developers with intelligent capabilities such as code completion and code annotation, making this a growing research focus.

[0004] Currently, large models are often used to directly process the target task's code text to obtain the code processing results. However, in these methods, large models need to predict a long amount of content at a time, resulting in excessively long prediction times and low accuracy. Therefore, an efficient and accurate task processing solution is urgently needed. Summary of the Invention

[0005] In view of this, embodiments of the present disclosure provide a task processing method. One or more embodiments of the present disclosure also relate to a code completion method, a code processing model training method, an information processing method based on a code processing model, a task processing device, a code completion device, a code processing model training device, an information processing device based on a code processing model, a model training platform, a computing device, a computer-readable storage medium, and a computer program product, to address the technical defect in the prior art that "large models need to predict a long amount of content at a time, resulting in excessively long prediction times and low accuracy."

[0006] According to a first aspect of an embodiment of the present disclosure, there is provided a task processing method, comprising:

[0007] Get the pending code data of the target task;

[0008] The code data to be processed is input into the code processing model to obtain the code processing result of the target task, wherein the code processing model is trained based on multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and sample code block data are obtained based on hierarchical sampling of the sample code data.

[0009] According to a second aspect of an embodiment of the present disclosure, a code completion method is provided, including:

[0010] Get the code data to be completed for the code completion task;

[0011] The code data to be completed is input into the code completion model to obtain the code completion result of the code completion task, wherein the code completion model is trained based on multiple sample completion results and sample code block data corresponding to the multiple sample completion results, and the sample completion results and sample code block data are obtained based on hierarchical sampling of the sample code data.

[0012] According to a third aspect of an embodiment of the present disclosure, a code processing model training method is provided, comprising:

[0013] Acquire a sample set, wherein the sample set includes a plurality of sample code data;

[0014] Performing hierarchical sampling on a plurality of sample code data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results;

[0015] Inputting a plurality of sample code block data into a code processing model to obtain prediction processing results corresponding to the plurality of sample code block data respectively;

[0016] The code processing model is trained based on the sample processing results and the predicted processing results to obtain a trained code processing model.

[0017] According to a fourth aspect of an embodiment of the present disclosure, there is provided an information processing method based on a code processing model, comprising:

[0018] receiving a task generation request, wherein the task generation request includes request information;

[0019] Based on the request information, a code processing model is obtained, wherein the code processing model is trained based on a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results, and the sample processing results and the sample code block data are obtained based on hierarchical sampling of the sample code data;

[0020] Based on the code processing model, task information is generated, wherein the task information is used to execute the target task.

[0021] According to a fifth aspect of an embodiment of the present disclosure, there is provided a task processing device, including:

[0022] A first acquisition module is configured to acquire code data to be processed of a target task;

[0023] The first input module is configured to input the code data to be processed into the code processing model to obtain the code processing result of the target task, wherein the code processing model is trained based on multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and sample code block data are obtained based on hierarchical sampling of the sample code data.

[0024] According to a sixth aspect of an embodiment of the present disclosure, a code completion device is provided, including:

[0025] A second acquisition module is configured to acquire code data to be completed for a code completion task;

[0026] The second input module is configured to input the code data to be completed into the code completion model to obtain the code completion result of the code completion task, wherein the code completion model is trained based on multiple sample completion results and sample code block data corresponding to the multiple sample completion results, and the sample completion results and sample code block data are obtained based on hierarchical sampling of the sample code data.

[0027] According to a seventh aspect of an embodiment of the present disclosure, a code processing model training device is provided, comprising:

[0028] A third acquisition module is configured to acquire a sample set, wherein the sample set includes a plurality of sample code data;

[0029] a sampling module configured to perform hierarchical sampling on a plurality of sample code data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results;

[0030] a third input module configured to input a plurality of sample code block data into the code processing model to obtain prediction processing results corresponding to the plurality of sample code block data;

[0031] The training module is configured to train the code processing model according to the sample processing results and the prediction processing results to obtain a trained code processing model.

[0032] According to an eighth aspect of an embodiment of the present disclosure, there is provided an information processing device based on a code processing model, comprising:

[0033] A first receiving module is configured to receive a task generation request, wherein the task generation request includes request information;

[0034] a fourth acquisition module configured to acquire a code processing model based on the request information, wherein the code processing model is trained based on a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results, the sample processing results and the sample code block data being obtained based on hierarchical sampling of the sample code data;

[0035] The generation module is configured to generate task information based on the code processing model, wherein the task information is used to execute the target task.

[0036] According to a ninth aspect of an embodiment of the present disclosure, there is provided a model training platform, comprising a request interface unit and a model unit;

[0037] A request interface unit, configured to receive a model training request, wherein the model training request includes request information;

[0038] A model unit is used to obtain a code processing model; based on the request information, the code processing model is trained to obtain a trained code processing model, wherein the request information includes multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and the sample code block data are obtained based on hierarchical sampling of the sample code data.

[0039] According to a tenth aspect of an embodiment of the present disclosure, there is provided a computing device, including:

[0040] memory and processor;

[0041] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the method provided in the first aspect, the second aspect, the third aspect, or the fourth aspect are implemented.

[0042] According to the eleventh aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the method provided in the first aspect, the second aspect, the third aspect or the fourth aspect are implemented.

[0043] According to the twelfth aspect of the embodiments of the present disclosure, a computer program product is provided, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method provided in the first aspect, the second aspect, the third aspect, or the fourth aspect.

[0044] One embodiment of the present disclosure provides a task processing method, comprising: obtaining code data to be processed for a target task; and inputting the code data to be processed into a code processing model to obtain a code processing result for the target task. The code processing model is trained based on multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and sample code block data are obtained by hierarchical sampling of the sample code data. Because the code processing model is trained based on sample code block data, prediction is performed on a code block basis, shortening the prediction content. Furthermore, through hierarchical sampling, the code processing model can be adapted to various code processing scenarios, thereby accurately predicting various types of code blocks and improving task processing efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] FIG1 is an architecture diagram of a task processing system provided by one embodiment of the present disclosure;

[0046] FIG2 is an architecture diagram of another task processing system provided by an embodiment of the present disclosure;

[0047] FIG3 is a flowchart of a task processing method provided by one embodiment of the present disclosure;

[0048] FIG4 is a flowchart of a code completion method provided by one embodiment of the present disclosure;

[0049] FIG5 is a flowchart of a code processing model training method provided by one embodiment of the present disclosure;

[0050] FIG6 is a flowchart of a process of a code processing model training method provided by one embodiment of the present disclosure;

[0051] FIG7 is a flowchart of an information processing method based on a code processing model provided by one embodiment of the present disclosure;

[0052] FIG8 is a schematic structural diagram of a model training platform provided by one embodiment of the present disclosure;

[0053] FIG9 is a schematic structural diagram of a task processing device provided by one embodiment of the present disclosure;

[0054] FIG10 is a schematic structural diagram of a code completion device provided by an embodiment of the present disclosure;

[0055] FIG11 is a schematic structural diagram of a code processing model training device provided by one embodiment of the present disclosure;

[0056] FIG12 is a schematic structural diagram of an information processing device based on a code processing model provided by one embodiment of the present disclosure;

[0057] FIG13 is a structural block diagram of a computing device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0058] The following description sets forth many specific details to facilitate a full understanding of the present disclosure. However, the present disclosure can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of the present disclosure. Therefore, the present disclosure is not limited to the specific implementations disclosed below.

[0059] The terms used in one or more embodiments of the present disclosure are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present disclosure. The singular forms "a", "the", and "the" used in one or more embodiments of the present disclosure and the appended claims are also intended to include plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present disclosure refers to and includes any or all possible combinations of one or more associated listed items.

[0060] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present disclosure, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of the present disclosure, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0061] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0062] In one or more embodiments of the present disclosure, a large model refers to a deep learning model with large-scale model parameters, which typically contains hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than ten trillion model parameters. A large model can also be called a cornerstone model / foundation model. The large model is pre-trained using large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks and has good generalization capabilities, such as a large-scale language model (LLM), a multi-modal pre-training model, etc.

[0063] When large models are used in practice, only a small number of samples are needed to fine-tune the pre-trained model and it can be applied to different tasks. Large models can be widely used in natural language processing (NLP), computer vision and other fields. Specifically, they can be applied to computer vision tasks such as visual question answering (VQA), image description (IC), image generation, as well as natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of large models include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.

[0064] First, the terms involved in one or more embodiments of the present disclosure are explained.

[0065] Intelligent Coding Assistant: By leveraging big model technology, it enhances programming tasks in the software development process and improves developers' coding efficiency. The main capabilities of the Intelligent Coding Assistant include automatic code completion, code Q&A, automatic generation of unit tests, automatic code optimization, etc.

[0066] Code auto-completion: Also known as code completion, it refers to the real-time prediction and suggestion of possible code completion items during the developer's coding process, improving the developer's coding speed and accuracy.

[0067] Abstract Syntax Tree (AST): It is an intermediate representation of source code, used to abstract and parse the structure of source code in a tree structure.

[0068] Fill-in-middle: A data pattern used to train large code models. This data organization is constructed to enable the model to understand the code context and predict the content of the code to be completed.

[0069] Code Metadata: It is the structured data of the code itself. It contains additional information describing the code components (such as classes, methods, properties, interfaces, file names, etc.). This information does not directly constitute the execution logic of the code, but is crucial for understanding, managing, and using the code.

[0070] Child Node: In the Abstract Syntax Tree (AST), all child nodes directly under a code block node are called child nodes of the code block. For example, in Java code, each statement or expression within a code block is a child node of the code block node.

[0071] Sibling Node: In AST, any two nodes with the same parent node are called sibling nodes.

[0072] In the field of software development, writing and maintaining code is a time-consuming and highly focused task. Intelligent coding assistants, through features like automatic code completion, syntax checking, and code generation, can significantly reduce developers' manual input time and accelerate development. Furthermore, intelligent coding assistants can learn programming standards and best practices based on extensive training data, helping developers avoid common errors and providing high-quality code suggestions that meet standards.

[0073] Taking code auto-completion as an example, currently, code auto-completion can usually be performed in the following two ways: First, the Fill-In-Middle method can be used to train the auto-completion capability of a large model. However, during the model training process, a simple random sampling method is used to randomly select the end position of the code prefix and the start position of the code suffix in the given source code, and then all the code between the two positions (middle) is used as the prediction result to construct<prefix,suffix,middle> However, in the above solution, the model does not process the predicted middle code in any way, causing it to predict a large amount of content at once, such as predicting five functions. This not only increases the prediction time but also disrupts the user's coding rhythm, seriously affecting the user experience of the intelligent coding assistant. The second solution is that the model mostly performs predictions in the form of single-line completion. However, in some cases, such as when a developer writes a function comment and wants to complete the development of the entire function, code auto-completion needs to be triggered multiple times, which significantly reduces user efficiency and experience.

[0074] In order to solve the above problems, the embodiment of the present disclosure proposes a method for training a code processing model of an intelligent coding assistant, which performs syntax parsing and hierarchical sampling on the original sample code data, and constructs it into training data that can train the model through the Fill-In-Middle mode, so that the model can perform code task processing based on the code data to be processed written by the user. Specifically, the code data to be processed of the target task can be obtained; the code data to be processed is input into the code processing model to obtain the code processing result of the target task, wherein the code processing model is trained based on multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and sample code block data are obtained based on hierarchical sampling of the sample code data.

[0075] It is worth noting that by applying the solution proposed in the embodiment of the present disclosure, the intelligent coding assistant can, based on advanced artificial intelligence technology, realize functions such as automatic code completion, code snippet recommendation, error detection and repair by deeply understanding the developer's programming intention and context information, thereby significantly improving the developer's coding efficiency. Since the code processing model is trained based on sample code block data, prediction is achieved in units of code blocks, shortening the prediction content, and, through hierarchical sampling, the code processing model can be adapted to various code processing scenarios (such as code completion scenarios, code recommendation scenarios, code comment generation scenarios, etc.), thereby accurately predicting various types of code blocks (such as classes, functions, logic blocks, comments, statements, etc.), improving task processing efficiency and accuracy.

[0076] In the present disclosure, a task processing method is provided. The present disclosure also involves a code completion method, a code processing model training method, an information processing method based on a code processing model, a task processing device, a code completion device, a code processing model training device, an information processing device based on a code processing model, a model training platform, a computing device, a computer-readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.

[0077] Referring to FIG1 , FIG1 shows an architecture diagram of a task processing system provided by an embodiment of the present disclosure. The task processing system may include a client 100 and a server 200;

[0078] The client 100 is used to send the code data to be processed of the target task to the server 200;

[0079] The server 200 is configured to input the code data to be processed into a code processing model to obtain a code processing result for a target task, wherein the code processing model is trained based on a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results, and the sample processing results and sample code block data are obtained by hierarchical sampling of the sample code data; and transmit the code processing result to the client 100;

[0080] The client 100 is also used to receive the code processing result sent by the server 200.

[0081] By applying the solution of the embodiments of the present disclosure, since the code processing model is trained based on sample code block data, prediction is achieved in units of code blocks, shortening the prediction content. Moreover, through hierarchical sampling, the code processing model can be adapted to various code processing scenarios, thereby accurately predicting various types of code blocks and improving task processing efficiency and accuracy.

[0082] Referring to Figure 2, Figure 2 shows an architecture diagram of another task processing system provided by one embodiment of the present disclosure. The task processing system may include multiple clients 100 and a server 200. The clients 100 may include end-side devices, and the server 200 may include cloud-side devices. Multiple clients 100 can establish communication connections through the server 200. In a task processing scenario, the server 200 is used to provide code processing services between multiple clients 100. Multiple clients 100 can act as senders or receivers, respectively, and communicate through the server 200.

[0083] Users can interact with the server 200 through the client 100 to receive data sent by other clients 100, or send data to other clients 100. In the task processing scenario, users can publish data streams to the server 200 through the client 100. The server 200 generates code processing results based on the data stream and pushes the code processing results to other clients with which communication has been established.

[0084] The client 100 and the server 200 are connected via a network. The network provides a medium for the communication link between the client 100 and the server 200. The network can include various connection types, such as wired or wireless communication links or fiber optic cables. The data transmitted by the client 100 may need to be encoded, transcoded, compressed, or other processing before being released to the server 200.

[0085] The client 100 can be a browser or an APP (Application) or a web application such as an H5 (HyperText Markup Language 5, Hypertext Markup Language 5) application or a light application (also known as a mini-program, a lightweight application) or a cloud application. The client 100 can be based on the software development kit (SDK) of the corresponding service provided by the server 200, such as developed based on the real-time communication (RTC) SDK. The client 100 can be deployed in an electronic device and needs to rely on the device to run or certain APPs in the device to run. For example, the electronic device can have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, tablet computer, personal computer, etc. Various other types of applications can also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0086] The server 200 may include servers that provide various services, such as servers that provide communication services to multiple clients, servers that provide background training to support models used on clients, and servers that process data sent by clients. It should be noted that the server 200 can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. The server can also be a server in a distributed system, or a server that is integrated with a blockchain. The server can also be a cloud server for 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, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0087] It is worth noting that the task processing methods provided in the embodiments of the present disclosure are generally executed by the server. However, in other embodiments of the present disclosure, the client may also have similar functions to the server and thus execute the task processing methods provided in the embodiments of the present disclosure. In other embodiments, the task processing methods provided in the embodiments of the present disclosure may also be executed jointly by the client and the server.

[0088] 3 , which shows a flowchart of a task processing method provided by an embodiment of the present disclosure, specifically comprising the following steps:

[0089] Step 302: Obtain the code data to be processed of the target task.

[0090] In one or more embodiments of the present disclosure, the code data to be processed of the target task can be obtained, and then the task processing method based on syntax parsing and hierarchical sampling of the code data to be processed is processed based on the target task to obtain the code processing result of the target task.

[0091] Specifically, the target task refers to a code processing task, and the target task includes but is not limited to a code completion task, a code recommendation task, and a code comment generation task. The code data to be processed can be code data in multiple languages, such as Python, Java, and the like. The code data to be processed can be code text data or code block data, and the specific selection is made according to the actual situation. The embodiment of the present disclosure does not impose any restrictions on this. Code block data can be called code block (Code Block) data. A code block refers to a relatively complete code semantic logic block, and a code block can be one line or multiple lines. Some code blocks will have block headers, such as the conditional statement of an if block and the method definition of a method definition block. The code block includes a coordinate range, which is convenient for intercepting block code from the original code. Some code block definitions have unique names, which is convenient for associating the reference party and the definition through a unique name when referencing restoration or test case association.

[0092] In practical applications, there are multiple ways to obtain the target task's pending code data, and the specific method is selected based on the actual situation. The embodiments of the present disclosure do not impose any restrictions on this. In one possible implementation of the present disclosure, the target task's pending code data can be received from a user. In another possible implementation of the present disclosure, the target task's pending code data can be read from other data acquisition devices or databases.

[0093] Step 304: Input the code data to be processed into the code processing model to obtain the code processing result of the target task, wherein the code processing model is trained based on multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and sample code block data are obtained based on hierarchical sampling of the sample code data.

[0094] In one or more embodiments of the present disclosure, after obtaining the code data to be processed of the target task, the code data to be processed may be further input into a code processing model to obtain a code processing result of the target task.

[0095] Specifically, the code processing model can be a large pre-trained code model, or a machine learning model trained on a large model based on multiple sample processing results and sample code block data corresponding to the multiple sample processing results. Code processing models include the Bidirectional Encoder Representations from Transformers (BERT) model and the Text-to-Text Transfer Transformer (T5) model. The task processing result corresponds to the target task. If the target task is a code completion task, the task processing result is the code completion result. If the target task is a code comment generation task, the task processing result is the code comment result.

[0096] It should be noted that the code processing model consists of an encoding unit and a decoding unit. When the code data to be processed is input into the code processing model, the encoding unit first uses a self-attention mechanism to capture the complex dependencies between the elements within the code data to be processed. It then gradually converts the code data to a high-level semantic embedding representation, resulting in an encoding vector. The decoding unit then uses a self-attention and masking mechanism to gradually decode the encoding vector provided by the encoding unit to obtain the code processing result.

[0097] In an optional embodiment of the present disclosure, before inputting the code data to be processed into the code processing model and obtaining the code processing result of the target task, the code data to be processed can also be parsed to obtain multiple code block data to be processed. Further, the multiple code block data to be processed can be input into the code processing model to obtain the code processing result of the target task.

[0098] By applying the solution of the embodiments of the present disclosure, since the code processing model is trained based on sample code block data, prediction is achieved in units of code blocks, shortening the prediction content. Moreover, through hierarchical sampling, the code processing model can be adapted to various code processing scenarios, thereby accurately predicting various types of code blocks and improving task processing efficiency and accuracy.

[0099] In practical applications, when inputting code data to be processed into a code processing model, the code data can be directly input into the code processing model to obtain the code processing results of the target task. Furthermore, to ensure that the code processing model can accurately process the code data to be processed, processing prompt information of the code processing model can be obtained and used to standardize the code data to be processed.

[0100] In an optional embodiment of the present disclosure, the step of inputting the code data to be processed into the code processing model to obtain the code processing result of the target task may include the following steps:

[0101] Get the processing prompt information of the code processing model;

[0102] Input the processing prompt information and the code data to be processed into the code processing model to obtain the code processing result of the target task.

[0103] Specifically, the processing prompt information is used to prompt the code processing model to process the code data to be processed. The processing prompt information may include code metadata, such as the code file name. The processing prompt information is set according to the actual situation and is not limited in this embodiment of the present disclosure. The code file name can enable the code processing model to understand the language type of the code data to be processed, so that the code data to be processed can be accurately processed based on the grammatical information corresponding to the language type.

[0104] In practical applications, there are multiple ways to obtain processing prompt information for a code processing model, and the specific method to be selected depends on the actual situation. The embodiments of the present disclosure do not impose any restrictions on this. In one possible implementation of the present disclosure, processing prompt information for a code processing model sent by a user can be received. In another possible implementation of the present disclosure, processing prompt information for a code processing model can be read from other data acquisition devices or databases.

[0105] Using the solution of the disclosed embodiments, processing prompt information is obtained from the code processing model; the processing prompt information and the code data to be processed are input into the code processing model to obtain the code processing result of the target task. By inputting the processing prompt information into the code processing model, the code processing model has a better understanding of the code data to be processed, ensuring the accuracy of the code processing result.

[0106] In an optional embodiment of the present disclosure, after inputting the code data to be processed into the code processing model and obtaining the code processing result of the target task, the following steps may be further included:

[0107] Send code processing results to front-end users;

[0108] Receive result feedback information sent by the front-end user, wherein the result feedback information is information that provides feedback on the code processing result based on the task information of the target task;

[0109] Based on the feedback information from the results, build a model to optimize the data;

[0110] Use model optimization data to adjust parameters of the code processing model.

[0111] Specifically, result feedback information can include feedback on the content, quality, and completeness of the code processing results, reflecting the front-end user's true feelings and expectations about the code processing results. Result feedback information includes, but is not limited to, result quality evaluation information, corrected and accurate code processing results, and areas of model optimization. Model optimization data refers to accurate optimization sample data used to optimize the code processing model.

[0112] In practical applications, there are multiple ways to construct model optimization data based on the result feedback information, and the specific method to be selected depends on the actual situation. The embodiments of this disclosure do not impose any restrictions on this. In one possible implementation of this disclosure, model optimization data can be constructed directly based on the result feedback information. In another possible implementation of this disclosure, optimization prompt information can be generated based on the result feedback information, and model optimization data sent by the front-end user based on the optimization prompt information can be received.

[0113] It should be noted that, taking the construction of model optimization data directly based on the result feedback information as an example, if the result feedback information is an accurate and corrected code processing result, the model optimization data can be constructed based on the to-be-processed code data of the target task and the corrected accurate code processing result. If the result feedback information is the optimization field of the model, such as the XXX field, the sample code data of the XXX field can be obtained, and the sample code data of the XXX field can be determined as the model optimization data. Among them, the process of adjusting the parameters of the code processing model using the model optimization data is the same as the training process of the code processing model, and the embodiments of the present disclosure will not be repeated.

[0114] Using the solution of the disclosed embodiments, the code processing results are sent to the front-end user; feedback information is received from the front-end user, where the feedback information is based on the task information of the target task and provides feedback on the code processing results; model optimization data is constructed based on the feedback information; and the model optimization data is used to adjust the parameters of the code processing model. By collecting and utilizing the feedback information, the performance of the code processing model is continuously optimized to more accurately meet the actual needs of the front-end user and improve the quality and accuracy of the final code processing results.

[0115] In an optional embodiment of the present disclosure, constructing the model optimization data based on the result feedback information may include the following steps:

[0116] Generate optimization prompt information based on the result feedback information, wherein the optimization prompt information is used to guide the front-end user to send model optimization data for optimizing the code processing model;

[0117] Send optimization prompt information to front-end users, and receive model optimization data sent by front-end users based on the optimization prompt information.

[0118] It should be noted that there are multiple ways to generate optimization prompt information based on the result feedback information, and the specific selection should be made according to the actual situation. The embodiments of the present disclosure do not impose any limitations on this.

[0119] In one possible implementation of the present disclosure, preset prompt information can be directly obtained, and the result feedback information can be added to the preset prompt information to obtain optimized prompt information. For example, the preset prompt information is "I am very sorry for providing you with inaccurate information. Please point out the specific inaccuracies or provide the correct answers to relevant questions. I will correct and optimize my answers as soon as possible to better serve you." If the result feedback information is "the result is inaccurate," the optimized prompt information is "Regarding your feedback on the inaccurate results, I am very sorry for providing you with inaccurate information. Please point out the specific inaccuracies or provide the correct answers to relevant questions. I will correct and optimize my answers as soon as possible to better serve you."

[0120] In another possible implementation of the present disclosure, the result feedback information may be type-identified to determine the information type of the result feedback information, and the information type may be further matched with the prompt type of each prompt information in the prompt information library, and the prompt information having the same prompt type as the information type may be determined as the optimized prompt information.

[0121] Applying the solution of the disclosed embodiment, optimization prompt information is generated based on the result feedback information. The optimization prompt information is used to guide the front-end user to send model optimization data for optimizing the code processing model. The optimization prompt information is sent to the front-end user, and the model optimization data sent by the front-end user based on the optimization prompt information is received. Obtaining model optimization data through interactive guidance improves interactivity with users and increases user satisfaction.

[0122] In an optional embodiment of the present disclosure, after inputting the code data to be processed into the code processing model and obtaining the code processing result of the target task, the following steps may be further included:

[0123] Mark the key information in the code processing results to obtain updated code processing results;

[0124] Send the updated code processing results to the front-end user.

[0125] Specifically, key information refers to information in the code processing results that helps users understand, debug, and maintain the code, such as functions, classes, objects, etc.

[0126] In actual applications, the key information in the code processing results is marked, and before obtaining the updated code processing results, the code processing results can be identified for key information to determine the key information in the code processing results. There are many ways to identify key information in the code processing results, and the specific selection is made according to the actual situation. The embodiments of the present disclosure do not impose any restrictions on this. In one possible implementation of the present disclosure, the code processing results can be matched with preset key information, and the information that appears in the code processing results and is the same as the preset key information is determined as key information. In another possible implementation of the present disclosure, the code processing results can be input into a key information identification model to obtain key information, wherein the key information identification model is trained based on multiple training code data and key information labels of each training code data.

[0127] It should be noted that when marking key information in the code processing results, the key text information can be bolded, highlighted, italicized, bordered, etc. The marking method of the key information is selected according to the actual situation, and the embodiments of the present disclosure do not impose any restrictions on this.

[0128] By applying the solution of the embodiment of the present disclosure, key information in the code processing result is marked to obtain an updated code processing result; the updated code processing result is sent to the front-end user so that the front-end user can view the result, thereby improving the user experience.

[0129] In an optional embodiment of the present disclosure, after inputting the code data to be processed into the code processing model and obtaining the code processing result of the target task, the following steps may be further included:

[0130] Send code processing results to front-end users;

[0131] Receive modification information sent by front-end users, where the modification information is used to modify the code processing results;

[0132] According to the modification information, the code processing result is modified to obtain the modified code processing result.

[0133] Specifically, modification information is used to describe the front-end user's modification requirements for the code processing results. Modification requirements include, but are not limited to, requirements for adding comments and generating test information. Furthermore, modification information can also be information about modification requirements for key information in the code processing results.

[0134] In actual applications, there are many ways to modify the code processing results based on the modification information, and the specific selection is based on the actual situation. The embodiments of the present disclosure do not impose any restrictions on this. In one possible implementation of the present disclosure, a code modification tool (such as a text editor) can be called to modify the code processing results based on the modification information. In another possible implementation of the present disclosure, the task processing results and the modification information can be input into a modification content generation model to obtain the modification content corresponding to the modification information, and the code processing results can be updated using the modification content to obtain the modified code processing results, wherein the modification content generation model is trained based on multiple sample codes and sample modification information and real modification results of each sample code.

[0135] Using the solution of the disclosed embodiments, the code processing results are sent to a front-end user; modification information sent by the front-end user is received, wherein the modification information is used to modify the code processing results; and the code processing results are modified based on the modification information to obtain a modified code processing result. By modifying the code processing results based on the modification information sent by the front-end user, human-computer interaction is enhanced, and the adaptability and flexibility of task processing are improved.

[0136] In an optional embodiment of the present disclosure, a method for training a code processing model is described. That is, before inputting the code data to be processed into the code processing model and obtaining the code processing result of the target task, the following steps may be further included:

[0137] Acquire a sample set, wherein the sample set includes a plurality of sample code data;

[0138] Performing hierarchical sampling on a plurality of sample code data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results;

[0139] Inputting a plurality of sample code block data into a code processing model to obtain prediction processing results corresponding to the plurality of sample code block data respectively;

[0140] The code processing model is trained based on the sample processing results and the predicted processing results to obtain a trained code processing model.

[0141] Specifically, the training method of the code processing model is supervised training, that is, the sample code block data carries the real processing label (sample processing result), and the sample processing result is the generation target of the code processing model, which is used to guide the training process of the code processing model. The sample code block data may include the code block context and the code block context of the sample processing result. Through the sample code block data, the model can predict the sample processing result. The code processing model can be a pre-trained large model or an untrained natural language neural network model. The sample code data can be called source code data. The sample code data involves a variety of programming languages ​​and fields. This allows the model to learn from rich source code data, so that the data seen during the training process is close to the developer's real development scenario, while improving the model's knowledge density and generalization ability, and can provide valuable code processing suggestions in any development scenario for any developer.

[0142] It's worth noting that in real-world code processing scenarios, code blocks are nested. For example, the SortAlgorithm class contains two functions, the first of which contains two statements and a logic block. The data features between these nested code blocks belong to different levels. These data features can be considered as variables, each of which may require various combinations. When sampling, these variables and their combinations should be considered as much as possible to simulate richer contextual scenarios and improve the generalization of the sampled model training data.

[0143] Therefore, in order to allow the model to provide valuable code processing suggestions in various development scenarios, the embodiment of the present disclosure proposes a hierarchical sampling method, that is, hierarchical sampling is performed based on the data features of different code levels to construct model training data (sample code block data and sample processing results) in various languages ​​and context scenarios. During hierarchical sampling, random sampling can be performed for data features at different levels, or targeted sampling can be performed based on the actual needs of the user. The model training data obtained after sampling can be used as<prefix+suffix,middle> For continuous model training, the data is output in the form of data. For example, data features at different levels include processing topics and context scenarios. When performing hierarchical sampling on multiple sample code data, you can first randomly sample code processing topics. Then, regardless of which code processing topic, you need to find a code block data as the model generation target (sample processing result). That is, under the sampled code processing topic, you can randomly sample context scenarios to determine the model generation target.

[0144] Furthermore, after hierarchical sampling is performed on multiple sample code data to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results, the multiple sample code block data can be directly input into the code processing model to obtain the prediction processing results corresponding to the multiple sample code block data. The sample processing results and the sample code block data corresponding to the sample processing results can also be organized into model training data according to a preset format, and the code processing model can be continuously trained using these model training data, and then the trained code processing model can be deployed to the intelligent coding assistant. Among them, the preset format is such as " <filename>Code file name<fim_prefix> Code block above<fim_suffix> Code block below<fim_middle> The target code block is the sample code block data, and the target code block is the sample processing result.

[0145] It should be noted that there are multiple ways to obtain a sample set, and the specific method to be selected depends on the actual situation. The embodiments of this disclosure do not impose any restrictions on this. In one possible implementation of this disclosure, a large amount of sample code data can be read from other data acquisition devices or databases (such as The Stack dataset, which contains source code data of projects in various languages). In another possible implementation of this disclosure, a large amount of sample code data can be crawled from the Internet.

[0146] In practical applications, when training a code processing model based on sample processing results and prediction processing results, the loss value can be calculated based on the sample processing results and prediction processing results, and the model parameters of the code processing model can be adjusted based on the loss value until the training process meets the preset stop conditions, thereby obtaining a trained code processing model. Among them, there are many functions for calculating loss values, such as cross entropy loss function, L1 norm loss function, maximum loss function, mean square error loss function, logarithmic loss function, etc., which are selected according to actual conditions, and the embodiments of the present disclosure do not impose any restrictions on this. The preset stopping conditions include but are not limited to the loss value being less than or equal to the preset threshold and the number of iterations reaching the preset number of iterations, wherein the preset threshold and the preset number of iterations are selected according to actual conditions, and the embodiments of the present disclosure do not impose any restrictions on this.

[0147] In one possible implementation of the present disclosure, after calculating the loss value, the loss value is compared with a preset threshold. Specifically, if the loss value is greater than the preset threshold, it indicates that the difference between the sample processing result and the predicted processing result is large, and the code processing model has poor predictive ability for the sample code block data. In this case, the model parameters of the code processing model can be adjusted, and the process returns to the step of inputting multiple sample code block data into the code processing model to obtain the predicted processing results corresponding to the multiple sample code block data. The code processing model is then trained until the loss value is less than or equal to the preset threshold, indicating that the difference between the sample processing result and the predicted processing result is small, and a preset stopping condition is met, thereby obtaining a fully trained code processing model.

[0148] In another possible implementation of the present disclosure, in addition to comparing the loss value with a preset threshold, the number of iterations can also be used to determine whether the current code processing model has been trained. Specifically, if the loss value is greater than the preset threshold, the model parameters of the code processing model are adjusted, and the process returns to the step of inputting multiple sample code block data into the code processing model to obtain prediction processing results corresponding to the multiple sample code block data. The code processing model is then trained until the preset number of iterations is reached, at which point iterations are terminated to obtain a fully trained code processing model.

[0149] By applying the solution of the disclosed embodiments, a code processing model is trained based on sample processing results and predicted processing results. If a preset stopping condition is not met, the code processing model is trained until the preset stopping condition is met, completing the training and obtaining the code processing model. By continuously adjusting the model parameters of the code processing model, the resulting code processing model can be made more accurate.

[0150] In practical applications, there are many ways to perform hierarchical sampling on multiple sample code data, which can be selected based on actual conditions. The embodiments of the present disclosure do not impose any restrictions on this. In one possible implementation of the present disclosure, hierarchical sampling can be directly performed on the sample code data to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results. In another possible implementation of the present disclosure, in order to ensure that hierarchical sampling can be performed in units of code blocks, hierarchical sampling can be performed on multiple candidate code block data to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results, wherein the multiple candidate code block data are obtained based on grammatical parsing of the sample code data.

[0151] In an optional embodiment of the present disclosure, performing hierarchical sampling on a plurality of sample code data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results may include the following steps:

[0152] performing syntax analysis on the first sample code data to obtain a plurality of candidate code block data, wherein the first sample code data is any one of the plurality of sample code data;

[0153] Hierarchical sampling is performed on multiple candidate code block data to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results.

[0154] Specifically, syntax parsing is used to identify multiple code blocks within the code data. Code blocks allow the model to understand which code block represents a class, a function, or a logical block, among other things. It also allows the model to understand the syntax tree of the generated results, clarifying the granularity of the generated content.

[0155] In practical applications, there are multiple ways to perform syntax parsing on the first sample code data to obtain multiple candidate code block data. The specific method to be selected depends on the actual situation, and the embodiments of the present disclosure do not impose any restrictions on this. In one possible implementation of the present disclosure, the first sample code data can be matched with the preset code block data, and the data that appears in the first sample code data and is identical to the preset code block data is determined as the candidate code block data. In another possible implementation of the present disclosure, the first sample code data can be parsed using an AST parsing tool to obtain multiple candidate code block data, wherein an abstract syntax tree is a structured representation of the source code of a programming language.

[0156] It should be noted that when performing hierarchical sampling on multiple candidate code block data, a context-aware hierarchical sampling method can be used to sample multiple candidate code block data involving different topics, context scenarios, completeness, and completion granularity to obtain sample processing results and sample code block data corresponding to each sample processing result.

[0157] By applying the solution of the embodiment of the present disclosure, for first sample code data, syntax parsing is performed on the first sample code data to obtain multiple candidate code block data, wherein the first sample code data is any one of the multiple sample code data; hierarchical sampling is performed on the multiple candidate code block data to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results. By using a method based on syntax parsing and hierarchical sampling with rich scenarios, model training data in various languages ​​and various context scenarios is constructed, so that the model training data is more in line with real development scenarios.

[0158] In an optional embodiment of the present disclosure, a hierarchical sampling method divided into code processing topics and code sampling strategies is used as an example to illustrate the specific implementation process of hierarchical sampling. That is, performing hierarchical sampling on multiple candidate code block data to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results may include the following steps:

[0159] Sampling the target code processing subject from the code processing subject, wherein the code processing subject includes at least one of a code block processing subject, a code block content processing subject, a code block partial content processing subject, and a code block empty content processing subject;

[0160] Under the target code processing theme, according to the code sampling strategy, multiple candidate code block data are sampled to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results.

[0161] Specifically, a code sampling strategy refers to a sampling strategy based on code context scenarios. A code context scenario refers to a scenario consisting of code context content. A code processing topic refers to the processing topic of the code data sampled each time. A code processing topic can be used to describe the target processing scope of the model for code data. Taking the code completion topic as an example, a code completion topic includes at least one of the following: code block completion topic, code block content completion topic, code block partial content completion topic, and code block empty content completion topic.

[0162] The Code Block Processing topic indicates that the model's target processing scope is a single code block. For example, in the Code Block Completion topic, the model's goal is to complete a complete code block, such as a complete function or a complete logic block.

[0163] The Code Block Content Processing theme indicates that the model's target scope is the complete content within a single code block. For example, in the Code Block Content Completion theme, the model's goal is to fully complete the content within a code block. For example, it can complete a statement with the middle section removed, ultimately completing the entire code block.

[0164] The "Code Block Partial Content Processing" topic describes a model's scope of processing the partial content within a single code block. For example, in the "Code Block Partial Content Completion" topic, the model's goal is to complete the partial content within a code block. For example, if the incomplete statement is "arr[]," only the content within the brackets ("arr[]") is completed; the content outside the brackets ("arr[]") remains uncompleted.

[0165] The "Empty Code Block Content Handling" topic indicates that the model's target scope is empty content, meaning it doesn't process anything. For example, in the "Empty Code Block Content Completion" topic, the model's target is to complete nothing within a complete context. For example, if the current statement is "result = sort.bubble_sort(arr)", when the cursor is after "arr" and before ")", the model predicts that the empty content should be completed.

[0166] Applying the solution of the disclosed embodiment, a target code processing topic is sampled from a code processing topic. Within the target code processing topic, multiple candidate code block data are sampled according to a code sampling strategy to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results. Through a rich scenario-based hierarchical sampling method, model training data is constructed, including data in different languages ​​(such as Python and Java) and different contexts, making the model training data more consistent with real-world development scenarios.

[0167] In practical applications, under the target code processing theme, when sampling multiple sample processing results and sample code block data corresponding to the multiple sample processing results from multiple candidate code block data according to a code sampling strategy, at least one strategy can be randomly selected from the multiple code sampling strategies, and the selected strategy can be used to sample the multiple sample processing results and the sample code block data corresponding to the multiple sample processing results from the multiple candidate code block data. Furthermore, to ensure the accuracy of the sampled sample processing results and sample code block data, the code sampling strategies can be divided into a result sampling strategy for sampling and obtaining the sample processing results, and a code block sampling strategy for sampling and obtaining the sample code block data. Thus, at least one strategy can be randomly selected from each of the result sampling strategy and the code block sampling strategy, and the selected strategy can be used to sample and obtain the sample processing results and sample code block data, respectively.

[0168] In an optional embodiment of the present disclosure, a code sampling strategy includes a result sampling strategy and a code block sampling strategy. The result sampling strategy includes at least one of a category sampling strategy, a previous category sampling strategy, a next category sampling strategy, a child node sampling strategy, and a completeness sampling strategy. The code block sampling strategy includes at least one of a previous content sampling strategy and a next content sampling strategy. Under the above-mentioned target code processing theme, sampling from multiple candidate code block data according to the code sampling strategy to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results may include the following steps:

[0169] Under the target code processing theme, according to the result sampling strategy, multiple sample processing results are sampled from multiple candidate code block data, and according to the code block sampling strategy, multiple sample code block data corresponding to the multiple sample processing results are sampled from the multiple candidate code block data.

[0170] A categorical sampling strategy is a strategy for sampling sample processing results based on categorical variables. Categories include classes, functions, logic blocks, comments, statements, and so on. Using a categorical sampling strategy, a code block of a specific category can be selected from multiple candidate code blocks as the sample processing result.

[0171] The category sampling strategy described above samples the results of sample processing based on the categorical variables of the previous code block. This strategy allows us to select, from multiple candidate code blocks, the code block whose previous code block belongs to a certain category as the sample processing result. For example, if the previous code block is a comment and the sample processing result is a function, this represents a coding scenario where the user writes a function comment and then needs to write the corresponding complete function.

[0172] The context-specific sampling strategy samples processing results based on the categorical variables of the subsequent code block. This strategy selects a code block whose subsequent code block is of a certain category from multiple candidate code blocks as the sample processing result. For example, if the sample processing result is a comment and the subsequent code block is a class, this represents a coding scenario where the user has already written a class and wants to add documentation comments to it.

[0173] The child node sampling strategy refers to a strategy for sampling sample processing results based on whether or not a code block contains child nodes or the number of child nodes it contains. Through the child node sampling strategy, code blocks that contain child nodes, do not contain child nodes, or have a number of child nodes greater than a preset number can be selected from multiple candidate code block data as sample processing results. For example, some code blocks contain child nodes, while some code blocks do not contain child nodes. In this case, these two situations can be distinguished during sampling so that each situation has model training data. Furthermore, the number of child nodes contained in a code block may be different. The more child nodes a code block contains, the greater the difficulty, while the fewer child nodes a code block contains, the less difficult it is. For example, some functions may only contain a return statement, while some functions may contain dozens of child nodes such as various logic blocks, statements, and comments. Their difficulty is different, and both simple and complex code blocks can be sampled during sampling.

[0174] The completeness sampling strategy refers to a strategy for sampling sample processing results based on the completeness of code blocks. This completeness sampling strategy allows code blocks of varying completeness to be selected from multiple candidate code block data as sample processing results. For example, when the completed sample processing result is a function, the following three situations may occur: First, the user does not enter any content for the function to be completed; second, the user enters an indent (tab) for the function to be completed; and third, the user enters partial content for the function to be completed. Developers may encounter various situations while coding, so code blocks of varying completeness can be sampled as sample processing results.

[0175] The context sampling strategy refers to a strategy for sampling sample code block data based on the context of the sample processing result. The context of the sample processing result can include the following: the original context of the sample code data; the context of the last K child nodes of the sample processing result; the context of the last K sibling nodes of the sample processing result; and an empty context. Using different contexts, different sample code block data can be sampled for the same sample processing result. K is a positive integer.

[0176] The context sampling strategy refers to the strategy for sampling sample code block data based on the context of the sample processing result. The context of the sample processing result can include the following: the original context of the sample code data; the context of the last K child nodes of the sample processing result; the context of the last K sibling nodes of the sample processing result; and an empty context. Using different contexts, different sample code block data can be sampled for the same sample processing result.

[0177] Applying the solution of the embodiment of the present disclosure, under the target code processing theme, according to the result sampling strategy, multiple sample processing results are sampled from multiple candidate code block data, and according to the code block sampling strategy, sample code block data corresponding to the multiple sample processing results are sampled from multiple candidate code block data. The category sampling strategy refers to a strategy for sampling sample processing results based on category variables. Categories include classes, functions, logic blocks, comments, statements, and the like. Through the category sampling strategy, a certain category of code blocks can be selected from multiple candidate code block data as sample processing results. Through the target code processing theme, different processing ranges in the code processing scenario can be simulated. Through the result sampling strategy, richer sample processing results that are more in line with the actual development scenario can be sampled. Through the code block sampling strategy, richer sample code block data that are more in line with the actual development scenario can be sampled, thereby making the model training data more in line with the actual development scenario.

[0178] The following is a further description of the task processing method provided by the present disclosure, taking the application of the task processing method in the code automatic completion scenario as an example, in conjunction with Figure 4. Figure 4 shows a flowchart of a code completion method provided by an embodiment of the present disclosure, which specifically includes the following steps:

[0179] Step 402: Obtain code data to be completed for the code completion task.

[0180] Step 404: Input the code data to be completed into the code completion model to obtain the code completion result of the code completion task, wherein the code completion model is trained based on multiple sample completion results and sample code block data corresponding to the multiple sample completion results, and the sample completion results and sample code block data are obtained based on hierarchical sampling of the sample code data.

[0181] It should be noted that the implementation method of steps 402 to 404 is the same as the implementation method of steps 302 to 304. The relevant descriptions of the code data to be completed and the code completion model can refer to the relevant descriptions of the above-mentioned code data to be processed and the code processing model, and will not be repeated in the embodiments of this disclosure.

[0182] By applying the solution of the embodiments of the present disclosure, model training data is constructed based on a hierarchical sampling method based on code syntax analysis and rich scenarios to meet the capabilities that the code completion model needs to meet, and the code completion model is trained using the model training data. In this way, the code completion model can accurately predict the various types of code blocks (which may be a class, function, logic block, comment, statement, etc.) that the user wants to enter next based on the code context, code context, and some code metadata written by the user in various real development scenarios, thereby improving the user's coding efficiency and experience.

[0183] In an optional embodiment of the present disclosure, before obtaining the code data to be completed for the code completion task, the following steps may be further included:

[0184] Sending completion prompt information to the front-end user, wherein the completion prompt information is used to guide the front-end user to send the code data to be completed for code completion task processing;

[0185] Receive the code data to be completed for the code completion task sent by the front-end user based on the completion prompt information.

[0186] It's important to note that when a code completion task begins, a completion prompt can be sent to the front-end user. This prompt allows the user to understand the task's process flow or requirements, allowing them to enter code data that better reflects their needs. For example, the code completion message could read, "Hello, I'm your intelligent coding assistant. I'm ready to complete various types of code for you. Please enter the code data you wish to complete."

[0187] Furthermore, after sending the completion prompt information to the front-end user, the code data to be completed of the code completion task sent by the front-end user based on the completion prompt information can be received, the code data to be completed can be input into the code completion model, and the code completion result of the code completion task can be obtained.

[0188] Using the solution of the embodiments of the present disclosure, a completion prompt is sent to a front-end user, wherein the completion prompt is used to guide the front-end user to send the code data to be completed for the code completion task. The front-end user receives the code data to be completed for the code completion task based on the completion prompt. The completion prompt guides the front-end user to enter the code data to be completed, thereby enhancing human-computer interaction and ensuring that the code data to be completed accurately reflects the user's actual needs.

[0189] In an optional embodiment of the present disclosure, after inputting the code data to be completed into the code completion model and obtaining the code completion result of the code completion task, the following steps may be further included:

[0190] Send code completion results to front-end users;

[0191] Receive result feedback information sent by the front-end user, wherein the result feedback information is information providing feedback on the code completion result based on the task information of the code completion task;

[0192] The result feedback information is sent to the model training platform, where the model training platform is used to adjust the parameters of the code completion model using the result feedback information.

[0193] Specifically, the model training platform can be deployed on a terminal device or on a cloud device, and the specific settings are based on actual conditions. The embodiments of the present disclosure do not impose any restrictions on this. The model training platform provides large-scale data processing and high-performance computing resources for training, optimizing and deploying various machine learning models, especially deep learning models. On the model training platform, users can upload data, select or customize algorithm models, and efficiently train and verify models through distributed computing capabilities. The model training platform can receive task generation requests from terminal devices, obtain the corresponding code processing model based on the request information, and generate task information based on the code processing model. The model training platform can also quickly respond to the needs of different tasks, call appropriate code processing models for task processing, and ultimately generate high-quality code processing results.

[0194] In actual applications, after receiving result feedback information from the front-end user, the result feedback information can be sent to the model training platform. The model training platform can then adjust the parameters of the code completion model based on the result feedback information. The method for the model training platform to adjust the parameters of the code completion model based on the result feedback information can be referred to the implementation method of "constructing model optimization data based on the result feedback information; using the model optimization data to adjust the parameters of the code processing model" described above, and will not be further described in this embodiment.

[0195] By applying the solution of the embodiment of the present disclosure, the parameters of the code completion model are adjusted based on the result feedback information through the model training platform, which can reduce the model training cost while ensuring the accuracy and training efficiency of the code completion model, and provide users with convenient and efficient model training services.

[0196] 5 , which shows a flowchart of a code processing model training method provided by one embodiment of the present disclosure, specifically comprising the following steps:

[0197] Step 502: Acquire a sample set, wherein the sample set includes a plurality of sample code data.

[0198] Step 504: performing hierarchical sampling on the plurality of sample code data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results.

[0199] Step 506: Input the plurality of sample code block data into the code processing model to obtain prediction processing results corresponding to the plurality of sample code block data.

[0200] Step 508: Train the code processing model based on the sample processing results and the predicted processing results to obtain a trained code processing model.

[0201] It should be noted that the implementation method of steps 502 to 508 can refer to the training method of the above-mentioned code processing model, and will not be described in detail in this embodiment of the present disclosure.

[0202] In actual applications, after obtaining the trained code processing model, the model parameters of the trained code processing model can be sent to the terminal device. The front-end user can build the code processing model locally based on the model parameters and use the code processing model to perform tasks such as code completion.

[0203] By applying the solution of the disclosed embodiments, a code processing model is trained based on sample processing results and predicted processing results. If a preset stopping condition is not met, the code processing model is trained until the preset stopping condition is met, completing the training and obtaining the code processing model. By continuously adjusting the model parameters of the code processing model, the resulting code processing model can be made more accurate.

[0204] 6 , which shows a flowchart of a code processing model training method according to an embodiment of the present disclosure, specifically including:

[0205] Collecting source code data: Collecting source code data from various programming languages ​​and domains as sample code data allows the model to learn from rich source code data, ensuring that the data seen during model training is close to the user's actual development scenarios. This also improves the model's knowledge density and generalization capabilities, enabling it to provide valuable completion suggestions for any developer in any development scenario.

[0206] Perform AST syntax parsing on the source code data: For the first sample code data, perform syntax parsing on the first sample code data to obtain multiple candidate code block data, where the first sample code data is any one of the multiple sample code data. By performing syntax parsing on the source code data, the model can understand which block of code in the code data is a class, which block of code is a function, and which block of code is a logic block, and has syntax tree perception of the generated results, and clearly understands the granularity of the generated content, so as to only predict the content of the next code block (a function or logic block or a statement), so that the predicted content is greatly shortened and accurately meets the user's needs, while not interfering with the user's coding rhythm, giving the user more valuable code processing suggestions;

[0207] Multi-scenario hierarchical sampling to construct training data: sampling from code processing topics to obtain target code processing topics, wherein the code processing topics include at least one of code block processing topics, code block content processing topics, code block partial content processing topics, and code block empty content processing topics; under the target code processing topic, according to the result sampling strategy, sampling from multiple candidate code block data to obtain multiple sample processing results, and according to the code block sampling strategy, sampling from multiple candidate code block data to obtain sample code block data corresponding to the multiple sample processing results, wherein the result sampling strategy includes at least one of a category sampling strategy, a previous category sampling strategy, a following category sampling strategy, a child node sampling strategy, and a completeness sampling strategy, and the code block sampling strategy includes at least one of a previous content sampling strategy and a following content sampling strategy; through a hierarchical sampling method, sampling the multiple candidate code block data obtained after grammatical parsing to construct model training data in various languages ​​and context scenarios;

[0208] Training model: Input multiple sample code block data into the code processing model to obtain the predicted processing results corresponding to the multiple sample code block data; train the code processing model based on the sample processing results and the predicted processing results to obtain a trained code processing model.

[0209] By applying the solution of the embodiment of the present disclosure, through AST syntax parsing and hierarchical sampling methods, it is possible to accurately predict the type of logic block that the user wants to process in different topics and context scenarios, so that the model can predict the code content of various granularities such as a complete class, function, logic block, comment, statement, etc.

[0210] 7 , which shows a flowchart of an information processing method based on a code processing model provided by an embodiment of the present disclosure, specifically comprising the following steps:

[0211] Step 702: Receive a task generation request, wherein the task generation request includes request information.

[0212] Specifically, the information processing method based on the code processing model can be applied to terminal devices or to model training platforms. The task generation request is used to request the generation of task information for the target task. The task generation request usually includes the task type, the expected output format, and the request information. For example, when the user selects the "code completion" function on the front-end interface of the model training platform and uploads the code data, a task generation request can be constructed. The task generation request includes information such as code data, task type (i.e., code completion), and the language type of the code data. The request information refers to the parameters or descriptive information related to the target task carried in the task generation request. The request information includes but is not limited to the task scenario identifier of the target task, the task model identifier, or the model training data of the target task.

[0213] Step 704: Based on the request information, a code processing model is obtained, wherein the code processing model is trained based on multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and the sample code block data are obtained based on hierarchical sampling of the sample code data.

[0214] In an optional embodiment of the present disclosure, the request information includes a task scenario identifier of the target task, or a task model identifier; and obtaining the code processing model based on the request information may include the following steps:

[0215] Based on the task scenario identifier, a target scenario template is determined from a plurality of preset scenario templates, and based on the target scenario template, a code processing model is searched from a model library, wherein the model library stores a plurality of processing models;

[0216] or,

[0217] Based on the task model identifier, the code processing model is searched from the model library.

[0218] Specifically, the task scenario identifier refers to a unique or specific label used to distinguish different task application scenarios. In the embodiment of the present disclosure, the task scenario identifier is part of the request information. Through the task scenario identifier, a target scenario template that matches the request information can be selected from a series of preset scenario templates to generate task information. For example, if the task scenario identifier is "code completion", it means that the front-end user wants to perform code completion on the uploaded code data, and then the code completion scenario template can be selected from multiple preset scenario templates according to the task scenario identifier.

[0219] Preset scenario templates are predefined standard configuration scenario templates for different task application scenarios. Each template contains model information and task processing flow that matches the task application scenario. Using a series of preset scenario templates, you can quickly respond to task generation requests for different scenarios. Different preset scenario templates correspond to different task types, model information, and processing flows. For example, one of the preset scenario templates may be specifically for code completion, which contains the model information and processing flow of a pre-trained code completion model.

[0220] The target scenario template is the scenario template that matches the task scenario identifier. When parsing a task generation request, the corresponding target scenario template is located based on the task scenario identifier. Based on the model information included in the target scenario template, the corresponding code processing model and other related configuration information are selected from the model library. For example, if the task scenario identifier is "Code Completion," the target scenario template is the template that contains the model information and related configuration parameters for the code completion model.

[0221] The model library is a centralized repository for deep learning models, which have been trained and optimized to solve different processing tasks. The processing models stored in the model library include, but are not limited to, code completion models, code comment generation models, and code recommendation models. Furthermore, the processing models in the model library can be divided into different versions based on their applicable scenarios. For example, the model library may contain multiple versions of code completion models, such as a code completion model for Python and a code completion model for Java.

[0222] A task model identifier is a unique or specific label used to distinguish models applicable to different tasks. For example, the task model identifier could be "code completion." Based on the task model identifier, you can search the model library for a code completion model that is applicable to the code completion task.

[0223] Using the solution of the disclosed embodiments, a target scenario template is determined from multiple preset scenario templates based on a task scenario identifier. Based on the target scenario template, a code processing model is searched from a model library, which stores multiple processing models. Alternatively, a code processing model is searched from the model library based on a task model identifier. By using predefined task scenario templates, task model identifiers, and model library resources, the process of acquiring code processing models becomes more flexible, efficient, and standardized.

[0224] In another optional embodiment of the present disclosure, in addition to selecting a pre-trained code processing model from a model library, a code processing model can be obtained by targeted training based on model training data in the request information. That is, the request information includes multiple sample code data of the target task. The above-mentioned acquisition of the code processing model based on the request information may include the following steps:

[0225] Based on multiple sample code data, the code processing model corresponding to the target task is trained to obtain a trained code processing model.

[0226] It should be noted that the implementation method of "training the code processing model corresponding to the target task based on multiple sample code data to obtain a trained code processing model" is the same as the training method of the above-mentioned code processing model, and will not be repeated in the embodiment of this disclosure.

[0227] By applying the solution of the embodiment of the present disclosure, the code processing model corresponding to the target task is trained based on multiple sample code data to obtain a trained code processing model, thereby ensuring that the code processing model better meets user needs and the accuracy of the code processing model.

[0228] Step 706: Generate task information based on the code processing model, where the task information is used to execute the target task.

[0229] Specifically, the task information includes the model configuration and processing flow required to execute the target task. Based on the task information, the terminal device or other server-side components can correctly use the code processing model to process the target task.

[0230] It should be noted that when generating task information based on a code processing model, the code processing model can be directly packaged to obtain the task information. Alternatively, the model information of the code processing model can be obtained and used to construct task information based on the model information. This model information includes model parameter configuration, input data processing methods, expected output specifications, possible intermediate steps involved, and other auxiliary information.

[0231] For example, in a code completion task, the task information may include the address information of the selected code completion model, the storage location of the input code data, the target path of the output completion result, and other parameters such as the environment configuration required for the code completion model to run. This information enables the code completion model to be correctly loaded on the local or remote server and the code completion task to be executed.

[0232] By applying the solution of the embodiment of the present disclosure, by generating task information of the target task, it is possible to reduce system deployment and operation and maintenance costs while ensuring the quality and efficiency of target task processing, and provide users with convenient and efficient task processing services.

[0233] 8 , which shows a schematic structural diagram of a model training platform provided by an embodiment of the present disclosure. The model training platform includes a request interface unit 802 and a model unit 804 ;

[0234] The request interface unit 802 is configured to receive a model training request, wherein the model training request includes request information;

[0235] Model unit 804 is used to obtain a code processing model; based on the request information, the code processing model is trained to obtain a trained code processing model, wherein the request information includes multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and the sample code block data are obtained based on hierarchical sampling of the sample code data.

[0236] It should be noted that the processing method of the request interface unit and the model unit is the same as the training method of the above-mentioned code processing model, and will not be repeated in this embodiment of the present disclosure.

[0237] In an optional embodiment of the present disclosure, the model training platform further includes a model library;

[0238] The model unit is also used to store the trained code processing model in the model library.

[0239] It should be noted that the model unit trains the code processing model based on the request information. After obtaining the trained code processing model, the trained code processing model can also be stored in the model library, so that the trained code processing model can be directly obtained from the model library later without repeated training. Among them, the method of obtaining the trained code processing model from the model library can refer to the above-mentioned "based on the task scenario identification, determining the target scene template from multiple preset scene templates, and based on the target scene template, searching for the code processing model from the model library, wherein the model library stores multiple processing models; or, based on the task model identification, searching for the code processing model from the model library" implementation method, which will not be repeated in detail in the embodiments of the present disclosure.

[0240] Corresponding to the above-mentioned task processing method embodiment, the present disclosure also provides a task processing device embodiment. FIG9 shows a schematic diagram of the structure of a task processing device provided by one embodiment of the present disclosure. As shown in FIG9 , the device includes:

[0241] A first acquisition module 902 is configured to acquire code data to be processed of a target task;

[0242] The first input module 904 is configured to input the code data to be processed into the code processing model to obtain the code processing result of the target task, wherein the code processing model is trained based on multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and sample code block data are obtained based on hierarchical sampling of the sample code data.

[0243] Optionally, the first input module 904 is further configured to obtain processing prompt information of the code processing model; input the processing prompt information and the code data to be processed into the code processing model to obtain the code processing result of the target task.

[0244] Optionally, the device also includes: a first sending module, configured to send the code processing results to a front-end user; receiving result feedback information sent by the front-end user, wherein the result feedback information is information that provides feedback on the code processing results based on task information of the target task; constructing model optimization data based on the result feedback information; and using the model optimization data to adjust parameters of the code processing model.

[0245] Optionally, the first sending module is further configured to generate optimization prompt information based on the result feedback information, wherein the optimization prompt information is used to guide the front-end user to send model optimization data for optimizing the code processing model; send the optimization prompt information to the front-end user, and receive the model optimization data sent by the front-end user based on the optimization prompt information.

[0246] Optionally, the device further includes: a marking module configured to mark key information in the code processing result to obtain an updated code processing result; and send the updated code processing result to a front-end user.

[0247] Optionally, the device also includes: a second sending module, configured to send the code processing result to a front-end user; receive modification information sent by the front-end user, wherein the modification information is used to modify the code processing result; modify the code processing result according to the modification information to obtain a modified code processing result.

[0248] Optionally, the device also includes: a fifth acquisition module, configured to acquire a sample set, wherein the sample set includes multiple sample code data; perform hierarchical sampling on the multiple sample code data to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results; input the multiple sample code block data into the code processing model to obtain predicted processing results corresponding to the multiple sample code block data; train the code processing model according to the sample processing results and the predicted processing results to obtain a trained code processing model.

[0249] Optionally, the fifth acquisition module is further configured to perform syntax parsing on the first sample code data to obtain multiple candidate code block data, wherein the first sample code data is any one of the multiple sample code data; perform hierarchical sampling on the multiple candidate code block data to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results.

[0250] Optionally, the fifth acquisition module is further configured to sample from the code processing subject to obtain a target code processing subject, wherein the code processing subject includes at least one of a code block processing subject, a code block content processing subject, a code block partial content processing subject, and a code block empty content processing subject; under the target code processing subject, according to the code sampling strategy, sample from multiple candidate code block data to obtain multiple sample processing results and sample code block data corresponding to the multiple sample processing results.

[0251] Optionally, the code sampling strategy includes a result sampling strategy and a code block sampling strategy, the result sampling strategy includes at least one of a category sampling strategy, a previous category sampling strategy, a following category sampling strategy, a child node sampling strategy and a completeness sampling strategy, and the code block sampling strategy includes at least one of a previous content sampling strategy and a following content sampling strategy; the fifth acquisition module is further configured to, under the target code processing subject, sample from multiple candidate code block data according to the result sampling strategy to obtain multiple sample processing results, and sample from multiple candidate code block data according to the code block sampling strategy to obtain sample code block data corresponding to the multiple sample processing results.

[0252] By applying the solution of the embodiments of the present disclosure, since the code processing model is trained based on sample code block data, prediction is achieved in units of code blocks, shortening the prediction content. Moreover, through hierarchical sampling, the code processing model can be adapted to various code processing scenarios, thereby accurately predicting various types of code blocks and improving task processing efficiency and accuracy.

[0253] The above is a schematic scheme of a task processing device of this embodiment. It should be noted that the technical scheme of the task processing device and the technical scheme of the task processing method described above are of the same concept. For details not described in detail in the technical scheme of the task processing device, please refer to the description of the technical scheme of the task processing method described above.

[0254] Corresponding to the above-mentioned code completion method embodiment, the present disclosure also provides a code completion device embodiment. FIG10 shows a schematic diagram of the structure of a code completion device provided by an embodiment of the present disclosure. As shown in FIG10 , the device includes:

[0255] The second acquisition module 1002 is configured to acquire code data to be completed for the code completion task;

[0256] The second input module 1004 is configured to input the code data to be completed into the code completion model to obtain the code completion result of the code completion task, wherein the code completion model is trained based on multiple sample completion results and sample code block data corresponding to the multiple sample completion results, and the sample completion results and sample code block data are obtained based on hierarchical sampling of the sample code data.

[0257] Optionally, the device also includes: a second receiving module, configured to send completion prompt information to the front-end user, wherein the completion prompt information is used to guide the front-end user to send the code data to be completed for code completion task processing; and receive the code data to be completed for the code completion task sent by the front-end user based on the completion prompt information.

[0258] Optionally, the device also includes: a third receiving module, configured to send the code completion result to the front-end user; receive result feedback information sent by the front-end user, wherein the result feedback information is information that provides feedback on the code completion result based on the task information of the code completion task; and send the result feedback information to the model training platform, wherein the model training platform is used to use the result feedback information to adjust the parameters of the code completion model.

[0259] By applying the solution of the embodiments of the present disclosure, model training data is constructed based on a hierarchical sampling method based on code syntax analysis and rich scenarios to meet the capabilities that the code completion model needs to meet, and the code completion model is trained using the model training data. In this way, the code completion model can accurately predict the various types of code blocks (which may be a class, function, logic block, comment, statement, etc.) that the user wants to enter next based on the code context, code context, and some code metadata written by the user in various real development scenarios, thereby improving the user's coding efficiency and experience.

[0260] The above is a schematic diagram of a code completion device according to this embodiment. It should be noted that the technical solution of the code completion device and the technical solution of the above-mentioned code completion method are based on the same concept. For details not described in detail in the technical solution of the code completion device, please refer to the description of the technical solution of the above-mentioned code completion method.

[0261] Corresponding to the above-mentioned code processing model training method embodiment, the present disclosure also provides a code processing model training device embodiment. Figure 11 shows a schematic structural diagram of a code processing model training device provided by one embodiment of the present disclosure. As shown in Figure 11, the device includes:

[0262] The third acquisition module 1102 is configured to acquire a sample set, wherein the sample set includes a plurality of sample code data;

[0263] The sampling module 1104 is configured to perform hierarchical sampling on a plurality of sample code data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results;

[0264] The third input module 1106 is configured to input a plurality of sample code block data into the code processing model to obtain prediction processing results corresponding to the plurality of sample code block data respectively;

[0265] The training module 1108 is configured to train the code processing model according to the sample processing results and the prediction processing results to obtain a trained code processing model.

[0266] By applying the solution of the disclosed embodiments, a code processing model is trained based on sample processing results and predicted processing results. If a preset stopping condition is not met, the code processing model is trained until the preset stopping condition is met, completing the training and obtaining the code processing model. By continuously adjusting the model parameters of the code processing model, the resulting code processing model can be made more accurate.

[0267] The above is a schematic diagram of a code processing model training device according to this embodiment. It should be noted that the technical solution of the code processing model training device and the technical solution of the code processing model training method described above are based on the same concept. For details not described in detail in the technical solution of the code processing model training device, please refer to the description of the technical solution of the code processing model training method described above.

[0268] Corresponding to the above-mentioned method embodiment, the present disclosure also provides an embodiment of an information processing device based on a code processing model. FIG12 shows a schematic diagram of the structure of an information processing device based on a code processing model provided by one embodiment of the present disclosure. As shown in FIG12 , the device includes:

[0269] The first receiving module 1202 is configured to receive a task generation request, wherein the task generation request includes request information;

[0270] A fourth acquisition module 1204 is configured to acquire a code processing model based on the request information, wherein the code processing model is trained based on a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results, and the sample processing results and the sample code block data are obtained based on hierarchical sampling of the sample code data;

[0271] The generating module 1206 is configured to generate task information based on the code processing model, wherein the task information is used to execute the target task.

[0272] Optionally, the request information includes a task scenario identifier of the target task, or a task model identifier; the fourth acquisition module 1204 is further configured to determine a target scenario template from multiple preset scenario templates based on the task scenario identifier, and based on the target scenario template, search for a code processing model from a model library, wherein the model library stores multiple processing models; or, based on the task model identifier, search for a code processing model from the model library.

[0273] Optionally, the request information includes multiple sample code data of the target task; the fourth acquisition module 1204 is further configured to train the code processing model corresponding to the target task based on the multiple sample code data to obtain a trained code processing model.

[0274] By applying the solution of the embodiment of the present disclosure, by generating task information of the target task, it is possible to reduce system deployment and operation and maintenance costs while ensuring the quality and efficiency of target task processing, and provide users with convenient and efficient task processing services.

[0275] The above is a schematic diagram of an information processing device based on a code processing model according to this embodiment. It should be noted that the technical solution of the information processing device based on the code processing model and the technical solution of the information processing method based on the code processing model are based on the same concept. For details not described in detail in the technical solution of the information processing device based on the code processing model, please refer to the description of the technical solution of the information processing method based on the code processing model.

[0276] Figure 13 shows a block diagram of a computing device according to an embodiment of the present disclosure. Components of the computing device 1300 include, but are not limited to, a memory 1310 and a processor 1320. The processor 1320 is connected to the memory 1310 via a bus 1330, and a database 1350 is used to store data.

[0277] The computing device 1300 also includes an access device 1340 that enables the computing device 1300 to communicate via one or more networks 1360. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 1340 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0278] In one embodiment of the present disclosure, the aforementioned components of the computing device 1300 and other components not shown in FIG13 may also be connected to each other, for example, via a bus. It should be understood that the block diagram of the computing device structure shown in FIG13 is for illustrative purposes only and does not limit the scope of the present disclosure. Those skilled in the art may add or replace other components as needed.

[0279] Computing device 1300 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, personal digital assistant, laptop computer, notebook computer, netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or personal computer (PC). Computing device 1300 may also be a mobile or stationary server.

[0280] Among them, the processor 1320 is used to execute computer programs / instructions, which, when executed by the processor, implement the steps of the above-mentioned task processing method or code completion method or code processing model training method or information processing method based on the code processing model.

[0281] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of this computing device and the technical schemes of the task processing method, code completion method, code processing model training method, and code processing model-based information processing method described above are based on the same concept. For details not described in detail in the technical scheme of the computing device, please refer to the description of the technical scheme of the task processing method, code completion method, code processing model training method, or code processing model-based information processing method described above.

[0282] An embodiment of the present disclosure also provides a computer-readable storage medium storing a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned task processing method, code completion method, code processing model training method, or information processing method based on a code processing model.

[0283] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of this storage medium and the technical schemes of the task processing method, code completion method, code processing model training method, and information processing method based on the code processing model described above are based on the same concept. For details not described in detail in the technical scheme of the storage medium, please refer to the description of the technical scheme of the task processing method, code completion method, code processing model training method, or information processing method based on the code processing model described above.

[0284] An embodiment of the present disclosure also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the above-mentioned task processing method or code completion method or code processing model training method or information processing method based on the code processing model.

[0285] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of this computer program product and the technical schemes of the task processing method, code completion method, code processing model training method, and code processing model-based information processing method described above are based on the same concept. For details not described in detail in the technical scheme of the computer program product, please refer to the description of the technical scheme of the task processing method, code completion method, code processing model training method, or code processing model-based information processing method described above.

[0286] The foregoing description describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0287] The computer instructions include computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media does not include electric carrier signals and telecommunication signals.

[0288] It should be noted that for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present disclosure are not limited by the order of the actions described, because according to the embodiments of the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present disclosure.

[0289] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0290] The preferred embodiments of the present disclosure disclosed above are only used to help illustrate the present disclosure. The optional embodiments do not describe all details in detail, nor do they limit the invention to only the specific embodiments described. Obviously, many modifications and variations can be made based on the content of the embodiments of the present disclosure. The present disclosure selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present disclosure, so that those skilled in the art can better understand and utilize the present disclosure. The present disclosure is limited only by the claims and their full scope and equivalents.< / filename>

Claims

1. A task processing method, comprising: Get the pending code data of the target task; The code data to be processed is input into a code processing model to obtain a code processing result of the target task, wherein the code processing model is trained based on multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and the sample code block data are obtained based on hierarchical sampling of the sample code data.

2. The method according to claim 1, wherein inputting the code data to be processed into a code processing model to obtain the code processing result of the target task comprises: Obtaining processing prompt information of the code processing model; The processing prompt information and the code data to be processed are input into the code processing model to obtain the code processing result of the target task.

3. The method according to claim 1 or 2, further comprising: after inputting the code data to be processed into a code processing model and obtaining the code processing result of the target task; Sending the code processing result to the front-end user; Receive result feedback information sent by the front-end user, wherein the result feedback information is information that provides feedback on the code processing result based on the task information of the target task; Building a model to optimize data based on the result feedback information; The model optimization data is used to adjust parameters of the code processing model.

4. The method according to claim 3, wherein constructing a model optimization data based on the result feedback information comprises: Generate optimization prompt information according to the result feedback information, wherein the optimization prompt information is used to guide the front-end user to send model optimization data for optimizing the code processing model; The optimization prompt information is sent to the front-end user, and the model optimization data sent by the front-end user based on the optimization prompt information is received.

5. The method according to any one of claims 1 to 4, further comprising: after inputting the code data to be processed into a code processing model to obtain the code processing result of the target task; Marking key information in the code processing result to obtain an updated code processing result; The updated code processing result is sent to the front-end user.

6. The method according to any one of claims 1 to 5, further comprising: after inputting the code data to be processed into a code processing model and obtaining the code processing result of the target task; Sending the code processing result to the front-end user; receiving modification information sent by the front-end user, wherein the modification information is used to modify the code processing result; The code processing result is modified according to the modification information to obtain a modified code processing result.

7. The method according to any one of claims 1 to 6, before inputting the code data to be processed into a code processing model to obtain the code processing result of the target task, further comprising: Acquire a sample set, wherein the sample set includes a plurality of sample code data; Performing hierarchical sampling on the plurality of sample code data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results; Inputting a plurality of sample code block data into a code processing model to obtain prediction processing results corresponding to the plurality of sample code block data respectively; The code processing model is trained according to the sample processing result and the prediction processing result to obtain a trained code processing model.

8. The method according to claim 7, wherein performing hierarchical sampling on the plurality of sample code data to obtain a plurality of sample processing results and the sample code block data corresponding to the plurality of sample processing results respectively comprises: performing syntax analysis on first sample code data to obtain a plurality of candidate code block data, wherein the first sample code data is any one of the plurality of sample code data; Hierarchical sampling is performed on the plurality of candidate code block data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results.

9. The method according to claim 8, wherein performing hierarchical sampling on the plurality of candidate code block data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results respectively comprises: Sampling a target code processing subject from the code processing subject, wherein the code processing subject includes at least one of a code block processing subject, a code block content processing subject, a code block partial content processing subject, and a code block empty content processing subject; Under the target code processing theme, according to a code sampling strategy, a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results are sampled from the plurality of candidate code block data.

10. The method according to claim 9, wherein the code sampling strategy comprises a result sampling strategy and a code block sampling strategy, wherein the result sampling strategy comprises at least one of a category sampling strategy, a previous category sampling strategy, a next category sampling strategy, a child node sampling strategy, and a completeness sampling strategy, and the code block sampling strategy comprises at least one of a previous content sampling strategy and a next content sampling strategy; The method of sampling the target code processing subject and obtaining a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results from the plurality of candidate code block data according to a code sampling strategy includes: Under the target code processing theme, according to the result sampling strategy, multiple sample processing results are sampled from the multiple candidate code block data, and according to the code block sampling strategy, sample code block data corresponding to the multiple sample processing results are sampled from the multiple candidate code block data.

11. A code completion method, comprising: Get the code data to be completed for the code completion task; The code data to be completed is input into a code completion model to obtain a code completion result of the code completion task, wherein the code completion model is trained based on multiple sample completion results and sample code block data corresponding to the multiple sample completion results, and the sample completion results and the sample code block data are obtained based on hierarchical sampling of the sample code data.

12. The method according to claim 11, before obtaining the code data to be completed for the code completion task, further comprising: Sending completion prompt information to the front-end user, wherein the completion prompt information is used to guide the front-end user to send the code data to be completed for code completion task processing; Receive the code data to be completed of the code completion task sent by the front-end user based on the completion prompt information.

13. The method according to claim 11 or 12, further comprising: after inputting the code data to be completed into a code completion model and obtaining a code completion result for the code completion task; Sending the code completion result to the front-end user; receiving result feedback information sent by the front-end user, wherein the result feedback information is information providing feedback on the code completion result based on the task information of the code completion task; The result feedback information is sent to a model training platform, wherein the model training platform is used to adjust parameters of the code completion model using the result feedback information.

14. A code processing model training method, comprising: Acquire a sample set, wherein the sample set includes a plurality of sample code data; Performing hierarchical sampling on the plurality of sample code data to obtain a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results; Inputting a plurality of sample code block data into a code processing model to obtain prediction processing results corresponding to the plurality of sample code block data respectively; The code processing model is trained according to the sample processing result and the prediction processing result to obtain a trained code processing model.

15. An information processing method based on a code processing model, comprising: receiving a task generation request, wherein the task generation request includes request information; Based on the request information, a code processing model is obtained, wherein the code processing model is trained based on a plurality of sample processing results and sample code block data corresponding to the plurality of sample processing results, wherein the sample processing results and the sample code block data are obtained by performing hierarchical sampling on the sample code data; Based on the code processing model, task information is generated, wherein the task information is used to execute a target task.

16. The method according to claim 15, wherein the request information includes a task scenario identifier of the target task, or a task model identifier; The acquiring of a code processing model based on the request information includes: Based on the task scenario identifier, determining a target scenario template from a plurality of preset scenario templates, and based on the target scenario template, searching for a code processing model from a model library, wherein the model library stores a plurality of processing models; or, Based on the task model identifier, a code processing model is searched from the model library.

17. The method according to claim 15, wherein the request information includes a plurality of sample code data of a target task; The acquiring of a code processing model based on the request information includes: Based on the multiple sample code data, the code processing model corresponding to the target task is trained to obtain a trained code processing model.

18. A model training platform, comprising a request interface unit and a model unit; The request interface unit is used to receive a model training request, wherein: The model training request includes request information; The model unit is used to obtain a code processing model; based on the request information, the code processing model is trained to obtain a trained code processing model, wherein the request information includes multiple sample processing results and sample code block data corresponding to the multiple sample processing results, and the sample processing results and the sample code block data are obtained based on hierarchical sampling of the sample code data.

19. The model training platform according to claim 18, further comprising a model library; The model unit is further used to store the trained code processing model in the model library.

20. A computing device comprising: memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method described in any one of claims 1 to 10 or any one of claims 11 to 13 or claim 14 or any one of claims 15 to 17 are implemented.

21. A computer-readable storage medium storing a computer program / instruction, which, when executed by a processor, implements the steps of the method described in any one of claims 1 to 10 or any one of claims 11 to 13 or claim 14 or any one of claims 15 to 17.

22. A computer program product comprising a computer program / instructions, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 10 or any one of claims 11 to 13 or claim 14 or any one of claims 15 to 17.

Citation Information

Patent Citations

  • Machine learning model training method and device and sample processing method and device

    CN111340233A

  • Code processing model training method and device, electronic equipment and storage medium

    CN116820429A

  • Task processing method, code completion method, code question and answer method and task processing model training method

    CN117648079A

  • Task processing method, code completion method, code processing model training method, information processing method based on code processing model and model training platform

    CN118363601A

  • Automatic and predictive source code generation

    US11507655B1