Code continuous writing model reasoning method and device, equipment and storage medium
By constructing an experience database and a learning network, the problem of insufficient generalization in large code continuation models was solved, enabling online autonomous incremental knowledge learning and improving code continuation efficiency and model adaptability.
Patent Information
- Application Number
- CN202410968751.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-11-08
AI Technical Summary
Existing code continuation models lack generalization ability when facing real-world projects, cannot fully utilize project experience information, and cannot conduct online self-incremental knowledge learning, resulting in low code continuation efficiency.
By constructing an experience database, and based on historical time data, code context data, and code reasoning data, a similarity function and learning network are established to achieve autonomous incremental knowledge learning and updating of code reasoning results.
It improves the generalization ability of the code continuation model, reduces the cost of manually constructing datasets and data annotation, and enhances the model's compatibility and interoperability.
Smart Images

Figure CN118916065A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of model training, and in particular to a code continuation model reasoning method, device, equipment and storage medium. Background Art
[0002] As the scale of projects in the information production process expands, the processes and techniques become more complex. Although there are operational benchmarks for handling various abnormal situations in the programming process of information projects, the trained code continuation model will have the problem of insufficient generalization when facing actual projects. In actual operation, it is necessary to rely on the rich experience mastered and accumulated by a large number of professional and technical personnel. In order to save these subjective expert experiences for various situations in a standardized format, systematically apply them to different computer project scenarios, and eliminate the accuracy of performance affected by differences in the level and cognition of ordinary programmers, as well as the flow of personnel, it is particularly important to extract and represent knowledge. Standardized extracted knowledge can greatly increase the knowledge reserve and generalization ability of the code continuation model, as well as the years of cognitive experience accumulation, respond quickly, and enhance the compatibility and interoperability of the code continuation model application.
[0003] However, the current knowledge extraction and representation in the production process of computer system projects has the following problems: (1) Project experience information is not fully utilized (2) Online autonomous incremental knowledge learning is not possible. Autonomous incremental knowledge extraction and representation methods based on online running reasoning scenarios for large language models for code continuation can reduce the precision and completeness of rule writing, reduce the cost of manually constructing data sets and data annotation, and automatically update and optimize as the code continuation reasoning system runs. Summary of the invention
[0004] The present disclosure provides a code continuation model reasoning method, device, equipment and storage medium to at least solve the above technical problems existing in the prior art.
[0005] According to a first aspect of the present disclosure, a code continuation model reasoning method is provided, comprising:
[0006] Acquire historical time data, code context data and code reasoning data based on the code continuation plug-in, and build an experience database based on the historical data, the code context data and the code reasoning data;
[0007] constructing a similarity function based on the experience database, calculating a code reasoning similar data vector based on the similarity function, and generating an initial parameter prediction estimate based on the code reasoning similar data vector;
[0008] Using the initial parameter prediction estimate as an input of the first learning network to generate a parameter prediction estimate;
[0009] The parameter prediction estimate and the time point at the next moment are used as model parameters, input into the similarity function and the first learning network, and the code inference result at the next moment is obtained.
[0010] In one possible implementation, the constructing an experience database based on the historical time data, the code context data and the code reasoning data includes:
[0011] Establishing a first contextual reasoning relationship database based on the historical time data, the code context data and the code reasoning data;
[0012] Merging the data formats in the first contextual reasoning relational database, filtering out duplicate information, and collecting the same type of code context data to obtain a second contextual reasoning relational database;
[0013] Acquire first historical filling information, second historical filling information and third historical filling information not adopted by the user at the user end, and merge the first historical filling information, the second historical filling information and the third historical filling information into a filling data set;
[0014] Based on the same time, the second contextual reasoning relationship database is associated with the filled data set respectively, a data association space is constructed, and an experience database is generated.
[0015] In one possible implementation, constructing a similarity function based on the experience database, and calculating a data vector with similar code reasoning based on the similarity function includes:
[0016] The basic information units of the data in the experience database include a context vector unit, a filling vector unit and a subjective strategy vector unit, and the current moment context vector is obtained based on the context vector unit;
[0017] Obtain a first hyperparameter and a second hyperparameter, and construct a similarity function based on the first hyperparameter, the second hyperparameter, the filling vector unit, the context vector unit, and the current context vector;
[0018] The context vector at the current moment is used as the input of the similarity function, the similarity between the context vector at the current moment and the data vector in the experience database is calculated, and at least one data vector similar to the context vector at the current moment is searched based on the similarity.
[0019] In one possible implementation, generating an initial parameter prediction estimate based on the code reasoning similar data vector includes:
[0020] A first weight coefficient is calculated based on the similarity function, and an initial parameter prediction estimate is calculated based on the first weight coefficient and the filling vector unit.
[0021] In one possible implementation, the generating of the parameter prediction estimate by using the initial parameter prediction estimate as an input of the first learning network includes:
[0022] Acquire the context vector at the current moment, use the context vector at the current moment and the initial parameter prediction estimate as parameters, input them into the first learning network, and generate the parameter prediction estimate based on the first learning network.
[0023] In one embodiment, the method further comprises:
[0024] Storing the code inference result at the next moment in the experience database in a network unit format to update the experience database;
[0025] Offline optimization and online optimization are performed on the first learning network based on the updated experience database.
[0026] According to a second aspect of the present disclosure, a code continuation model reasoning device is provided, the device comprising:
[0027] A database construction unit, used to obtain historical time data, code context data and code reasoning data based on the code continuation plug-in, and to construct an experience database based on the historical data, the code context data and the code reasoning data;
[0028] A similarity calculation unit, configured to construct a similarity function based on the experience database, calculate a code reasoning similar data vector based on the similarity function, and generate an initial parameter prediction estimate based on the code reasoning similar data vector;
[0029] A parameter prediction unit, configured to generate a parameter prediction estimate by taking the initial parameter prediction estimate as an input of the first learning network;
[0030] The inference unit is used to input the parameter prediction estimate and the time point of the next moment as model parameters into the similarity function and the first learning network to obtain the code inference result of the next moment.
[0031] In one embodiment, the device further comprises:
[0032] A data updating unit is used to store the code inference result at the next moment in the format of a network unit into the experience database to update the experience database; and to perform offline optimization and online optimization on the first learning network based on the updated experience database.
[0033] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0034] at least one processor; and
[0035] a memory communicatively connected to the at least one processor; wherein,
[0036] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.
[0037] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.
[0038] The disclosed code continuation model reasoning method, device, equipment and storage medium collect data to establish an experience database, construct a similarity calculation function based on the experience data, use the similarity calculation function and the first learning network to achieve inference prediction of the code at the next moment, and store the prediction results in the experience database for database update and first learning network update. It reduces the precision and completeness of rule writing, greatly improves the generalization of the model; reduces a large number of manually constructed data sets and data annotation costs; enables online autonomous incremental knowledge learning, and makes full use of project information to update the model and generate continuation knowledge.
[0039] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0041] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0042] Figure 1 The following is a schematic diagram showing the implementation process of a code continuation model reasoning method according to an embodiment of the present disclosure. Figure 1 ;
[0043] Figure 2 The following is a schematic diagram showing the implementation process of a code continuation model reasoning method according to an embodiment of the present disclosure. Figure 2 ;
[0044] Figure 3 A schematic diagram of a code continuation model reasoning device according to an embodiment of the present disclosure is shown;
[0045] Figure 4 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0046] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0047] Figure 1 The following is a schematic diagram showing the implementation process of a code continuation model reasoning method according to an embodiment of the present disclosure. Figure 1 ;like Figure 1 As shown, a code continuation model reasoning method in an embodiment of the present disclosure includes the following steps:
[0048] Step 101, based on the code continuation plug-in, historical time data, code context data and code reasoning data are obtained, and an experience database is constructed based on the historical data, the code context data and the code reasoning data.
[0049] In the disclosed embodiment, historical time data, code context data and code reasoning data are obtained based on a code continuation plug-in, wherein the historical time data is the trigger code continuation timing data according to the code writing habits, and the time of code continuation of different types and different locations can be distinguished according to the historical time data; the code context data is the context code of the current file and the file code of the related code file; the code reasoning data is the intermediate data generated during the continuation model reasoning, including the analysis data and attention data generated during the analysis of the context data; a first context reasoning relationship database is established based on the historical time data, the code context data and the code reasoning data; the data in the first context reasoning relationship database is preprocessed and normalized, including: merging the formats, filtering out duplicate information, And collect the same type of code context data to obtain a second context reasoning relationship database; obtain the first historical filling information, the second historical filling information and the third historical filling information that is not adopted by the user on the user side, and merge the first historical filling information, the second historical filling information and the third historical filling information into a filling data set, wherein the first historical filling information is the code entered by the user as the filling content, the second historical filling information is the code generated after the above-mentioned continuation model reasoning and adopted by the user as the filling content, and the third historical filling data is the waste code generated after the above-mentioned continuation model reasoning but not adopted by the user as the filling content; based on the same time, the second context reasoning relationship database is respectively associated with the filling data set to construct a data association space and generate an experience database, wherein.
[0050] Step 102: construct a similarity function based on the experience database, calculate code reasoning similarity data vectors based on the similarity function, and generate initial parameter prediction estimates based on the code reasoning similarity data vectors.
[0051] In the disclosed embodiment, the basic information unit of the data in the experience database includes a context vector unit, a filling vector unit and a subjective strategy vector unit, and the three units correspond to the above-mentioned code context data, the filling data set and the code reasoning data, respectively. Based on the context vector unit, the current moment is substituted to obtain the context vector at the current moment; the first hyperparameter and the second hyperparameter are obtained, wherein the first hyperparameter and the second hyperparameter can be set according to experience and modified by optimization, and a similarity function is constructed based on the first hyperparameter, the second hyperparameter, the filling vector unit, the context vector unit and the context vector at the current moment; the context vector at the current moment is used as the input of the similarity function, and the similarity between the context vector at the current moment and the data vector in the experience database is calculated, and at least one data vector similar to the context vector at the current moment is searched based on the similarity, that is, at least one data vector whose distance from the context vector at the current moment in the above-mentioned data association space is less than the similarity distance. A first weight coefficient is calculated based on the similarity function, and an initial parameter prediction estimate is calculated based on the first weight coefficient and the filling vector unit.
[0052] Step 103: Using the initial parameter prediction estimate as an input of the first learning network to generate a parameter prediction estimate.
[0053] In the embodiment of the present disclosure, the context vector at the current moment is obtained, the context vector at the current moment and the initial parameter prediction estimate are input as parameters to the first learning network, and the parameter prediction estimate is generated based on the first learning network. The first learning network adopts a value learning network.
[0054] Step 104: The parameter prediction estimate and the time point at the next moment are used as model parameters, input into the similarity function and the first learning network, and obtain the code inference result at the next moment.
[0055] In the disclosed embodiment, based on the similarity function and value learning network constructed as above, the parameter prediction estimate and the next time point are used as input to generate the code reasoning result corresponding to the next time point. The code reasoning result at the next moment is stored in the experience database in the format of network units to update the experience database; the first learning network is optimized offline and online based on the updated experience database. The format of the network unit is the format corresponding to the basic information unit of the data in the above experience database.
[0056] Figure 2 The following is a schematic diagram showing the implementation process of a code continuation model reasoning method according to an embodiment of the present disclosure. Figure 2 ;like Figure 2As shown, a code continuation model reasoning method in an embodiment of the present disclosure includes the following steps:
[0057] Step 201, data collection, obtains the trigger code continuation timing information data, previous data and reasoning status data in the complex code continuation reasoning process, and establishes an experience database.
[0058] In the disclosed embodiment, a code context reasoning relational database is established based on the information data, previous data and reasoning status data of the user triggering code continuation in the complex code continuation reasoning process; the original data collected in the code context reasoning relational database is preprocessed and normalized to remove useless and erroneous data and unify the data format, including: merging the formats, filtering out duplicate information, and collecting the same type of code previous data; for the different data after normalization, a context data set, a filling data set and a code continuation triggering time data set are established respectively, wherein the filling data set includes: the code entered by the user as the filling content, the code generated after the continuation model reasoning and adopted by the user as the filling content, and the waste code generated after the continuation model reasoning but not adopted by the user as the filling content. The data between the three data sets are associated, and the data in the code continuation context data set and the filling reasoning knowledge data set are associated according to the same time information, and the three data sets and the association relationship between them together constitute an experience database.
[0059] In the embodiment of the present disclosure, the basic information unit for storing data in the experience database is represented as follows:
[0060] Ф(i)=[S(i),V(i),P(i)],i=1,2,3,…,N
[0061] Among them, S(i) represents the code continuation scenario data, that is, the code context knowledge vector, V(i) represents the filling reasoning knowledge data, that is, the code continuation large model reasoning data, and P(i) represents the user-triggered continuation strategy knowledge data, that is, the subjective strategy vector.
[0062] Step 202, calculate the code continuation reasoning similarity data vector at the current moment, and obtain the initial prediction estimate of the context relationship parameter.
[0063] In the embodiment of the present disclosure, the method for obtaining the initial prediction estimate of the knowledge parameter specifically includes the following steps: based on the above-mentioned code context knowledge vector and the current moment as a parameter, a similarity function is designed to calculate the similarity between the current code continuation scenario context information vector and the experience information vector in the database, wherein the similarity function is designed as:
[0064] D(S(i),S(t))=kexp(-d(S(i),S(t)))+(1-k)cos(S(i),S(t))
[0065]
[0066] Where K and T l are hyperparameters set based on experience, T l Represents the weight value of each element in the code context knowledge vector. In the existing database information, find several knowledge information vectors with a distance less than d that are closest to the current code continuation context according to the calculated similarity value, and select the initial prediction estimate of the knowledge parameter according to the similarity calculated above and the weight coefficient, where the weight coefficient is calculated as follows:
[0067]
[0068] k represents the k most relevant empirical strategy vectors of the current system operation information vector obtained through empirical selection of the similarity function. The calculation method of the initial prediction estimate is:
[0069]
[0070] Step 203: Fusing similar vectors in the experience database to generate new initial parameter prediction estimates.
[0071] In the embodiment of the present disclosure, the initial parameter estimation value obtained by the similarity calculation and the similarity vector input value learning network are used to generate a new parameter prediction estimation value, specifically: the obtained knowledge parameter initial prediction estimation value Z old (t) and the current system operation information vector S(t) are input into the learning network, and the formula is expressed as:
[0072] Z new (t) = π(S(t), Z old (t))
[0073] Where π represents the value learning network, Z new (t) represents the new parameter estimation value of the fused experience database and context data. The new knowledge parameter estimation value of the fused experience is inferred from the value learning network, where the performance indicator formula of the value learning network is expressed as:
[0074]
[0075] where s t Represents the state of the network at time t, that is, the code continuation context information vector S(t) at the current time, a t Represents the inference vector selected at time t in the network, i.e., the initial predicted estimated value Z of the knowledge parameter old (t), It represents the maximum system information entropy obtained by selecting an action to be taken at time t.
[0076] Step 204, inferring based on the new parameter prediction estimate value to obtain the code continuation inference result at the next moment.
[0077] In the disclosed embodiment, the code continuation model reasoning is run according to the initial predicted estimated value of the new knowledge parameter, that is, the next moment (t+1) is taken as input, and the calculation is performed according to the above-mentioned similarity function and value learning network to obtain the code continuation context information vector S(t+1) at the next moment, that is, the code continuation reasoning result.
[0078] Step 205, storing the new data pair (the above data integrating the similar vectors in the experience database and the reasoning result of the large code model) into the experience database.
[0079] In the disclosed embodiment, new data pairs are stored in the experience database in the format of knowledge information units, i.e., Φ(t)=[S(t), V(t), Z(t)], where Z(t) is the new strategy vector of the fusion experience, i.e., the code continuation reasoning result vector.
[0080] Step 206, continue to run the above model reasoning process, repeating steps 202-205 until the code continuation scenario ends.
[0081] In the disclosed embodiment, the optimization of the database and the value learning network is performed after the system stops, wherein the data set used for optimization is the tuple information stored during the operation of the code continuation model, including: (S(t), S(t+1), Z(t), V(t)). As the system runs, the value learning network will be continuously optimized based on the accumulated tuple information, and the knowledge information vector in the experience database will be autonomously updated incrementally according to step 203, so that the code continuation model can continuously obtain high-quality code continuation data for offline training.
[0082] Figure 3 A schematic diagram of a code continuation model reasoning device according to an embodiment of the present disclosure is shown; Figure 3 As shown, a code continuation model reasoning device according to an embodiment of the present disclosure includes:
[0083] The database construction unit 301 is used to obtain historical time data, code context data and code reasoning data based on the code continuation plug-in, and to construct an experience database based on the historical data, the code context data and the code reasoning data.
[0084] The database construction unit 301 is also used to establish a first context reasoning relationship database based on the historical time data, the code context data and the code reasoning data; merge the data formats in the first context reasoning relationship database, filter out duplicate information, and collect the same type of code context data to obtain a second context reasoning relationship database; obtain the first historical filling information, the second historical filling information and the third historical filling information that are not adopted by the user at the user end, and merge the first historical filling information, the second historical filling information and the third historical filling information into a filling data set; associate the second context reasoning relationship database with the filling data set based on the same time, construct a data association space, and generate an experience database.
[0085] The similarity calculation unit 302 constructs a similarity function based on the experience database, calculates a code inference similar data vector based on the similarity function, and generates an initial parameter prediction estimate based on the code inference similar data vector.
[0086] The similarity calculation unit 302 is also used for: the basic information units of the data in the experience database include a context vector unit, a filling vector unit and a subjective strategy vector unit; obtaining the current moment context vector based on the context vector unit; obtaining a first hyperparameter and a second hyperparameter, and constructing a similarity function based on the first hyperparameter, the second hyperparameter, the filling vector unit, the context vector unit and the current moment context vector; using the current moment context vector as the input of the similarity function, calculating the similarity between the current moment context vector and the data vector in the experience database, and searching for at least one data vector similar to the current moment context vector based on the similarity. Calculating a first weight coefficient based on the similarity function, and calculating an initial parameter prediction estimate based on the first weight coefficient and the filling vector unit.
[0087] The parameter prediction unit 303 is used to generate a parameter prediction estimate value by using the initial parameter prediction estimate value as an input of the first learning network.
[0088] The parameter prediction unit 303 is also used to obtain the context vector at the current moment, input the context vector at the current moment and the initial parameter prediction estimate as parameters into the first learning network, and generate the parameter prediction estimate based on the first learning network.
[0089] The inference unit 304 is used to input the parameter prediction estimate and the time point at the next moment as model parameters into the similarity function and the first learning network to obtain the code inference result at the next moment.
[0090] The data updating unit 305 is used to store the code inference result at the next moment in the format of the network unit into the experience database to update the experience database; and to perform offline optimization and online optimization on the first learning network based on the updated experience database.
[0091] In an exemplary embodiment, the database construction unit 301, the similarity calculation unit 302, the parameter prediction unit 303, the reasoning unit 304, the data update unit 305, etc. can be implemented by one or more central processing units (CPU, Central Processing Unit), graphics processing units (GPU, Graphics Processing Unit), application specific integrated circuits (ASIC, Application Specific Integrated Circuit), DSP, programmable logic devices (PLD, Programmable Logic Device), complex programmable logic devices (CPLD, Complex Programmable Logic Device), field programmable gate arrays (FPGA, Field-Programmable Gate Array), general-purpose processors, controllers, microcontrollers (MCU, Micro Controller Unit), microprocessors (Microprocessors), or other electronic components.
[0092] Regarding the device in the above embodiment, the specific manner in which each module and unit performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0093] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0094] Figure 4 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0095] like Figure 4As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0096] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0097] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as a code continuation model reasoning method. For example, in some embodiments, a code continuation model reasoning method may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of a code continuation model reasoning method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute a code continuation model reasoning method in any other appropriate manner (eg, by means of firmware).
[0098] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0099] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0100] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0101] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0102] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0103] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0104] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0105] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0106] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A code continuation model reasoning method, characterized in that: The method comprises: Acquire historical time data, code context data and code reasoning data based on the code continuation plug-in, and build an experience database based on the historical data, the code context data and the code reasoning data; constructing a similarity function based on the experience database, calculating a code reasoning similar data vector based on the similarity function, and generating an initial parameter prediction estimate based on the code reasoning similar data vector; Using the initial parameter prediction estimate as an input of the first learning network to generate a parameter prediction estimate; The parameter prediction estimate and the time point at the next moment are used as model parameters, input into the similarity function and the first learning network, and the code inference result at the next moment is obtained.
2. The method according to claim 1, characterized in that The constructing of an experience database based on the historical time data, the code context data and the code reasoning data comprises: Establishing a first contextual reasoning relationship database based on the historical time data, the code context data and the code reasoning data; Merging the data formats in the first contextual reasoning relational database, filtering out duplicate information, and collecting the same type of code context data to obtain a second contextual reasoning relational database; Acquire first historical filling information, second historical filling information and third historical filling information not adopted by the user at the user end, and merge the first historical filling information, the second historical filling information and the third historical filling information into a filling data set; Based on the same time, the second contextual reasoning relationship database is associated with the filled data set respectively, a data association space is constructed, and an experience database is generated.
3. The method according to claim 1, characterized in that: The constructing a similarity function based on the experience database, and calculating a data vector with similar code reasoning based on the similarity function, comprises: The basic information units of the data in the experience database include a context vector unit, a filling vector unit and a subjective strategy vector unit, and the current moment context vector is obtained based on the context vector unit; Obtain a first hyperparameter and a second hyperparameter, and construct a similarity function based on the first hyperparameter, the second hyperparameter, the filling vector unit, the context vector unit, and the current context vector; The context vector at the current moment is used as the input of the similarity function, the similarity between the context vector at the current moment and the data vector in the experience database is calculated, and at least one data vector similar to the context vector at the current moment is searched based on the similarity.
4. The method according to claim 3, characterized in that The generating of initial parameter prediction estimation values based on the code reasoning similar data vectors comprises: A first weight coefficient is calculated based on the similarity function, and an initial parameter prediction estimate is calculated based on the first weight coefficient and the filling vector unit.
5. The method according to claim 1, characterized in that The step of using the initial parameter prediction estimate as an input of the first learning network to generate a parameter prediction estimate includes: Acquire the context vector at the current moment, use the context vector at the current moment and the initial parameter prediction estimate as parameters, input them into the first learning network, and generate the parameter prediction estimate based on the first learning network.
6. The method according to claim 1, characterized in that The method further comprises: Storing the code inference result at the next moment in the experience database in a network unit format to update the experience database; Offline optimization and online optimization are performed on the first learning network based on the updated experience database.
7. A code continuation model reasoning device, characterized in that: The device comprises: A database construction unit, used for acquiring historical time data, code context data and code reasoning data based on the code continuation plug-in, and constructing an experience database based on the historical data, the code context data and the code reasoning data; A similarity calculation unit, configured to construct a similarity function based on the experience database, calculate a code reasoning similar data vector based on the similarity function, and generate an initial parameter prediction estimate based on the code reasoning similar data vector; A parameter prediction unit, configured to generate a parameter prediction estimate by taking the initial parameter prediction estimate as an input of the first learning network; The inference unit is used to input the parameter prediction estimate and the time point of the next moment as model parameters into the similarity function and the first learning network to obtain the code inference result of the next moment.
8. The device according to claim 7, characterized in that The device also includes: A data updating unit is used to store the code inference result at the next moment in the format of a network unit into the experience database to update the experience database; and to perform offline optimization and online optimization on the first learning network based on the updated experience database.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1-6.
Citation Information
Patent Citations
Autonomous incremental knowledge extraction and representation method, terminal and medium
CN115374686A
Code completion method and device integrating uncertainty perception and user selection and medium
CN117492785A
