WO2022126909A1 - 一种代码补全方法、装置以及相关设备 - Google Patents

一种代码补全方法、装置以及相关设备 Download PDF

Info

Publication number
WO2022126909A1
WO2022126909A1 PCT/CN2021/083488 CN2021083488W WO2022126909A1 WO 2022126909 A1 WO2022126909 A1 WO 2022126909A1 CN 2021083488 W CN2021083488 W CN 2021083488W WO 2022126909 A1 WO2022126909 A1 WO 2022126909A1
Authority
WO
WIPO (PCT)
Prior art keywords
local
model parameters
local model
code
node
Prior art date
Application number
PCT/CN2021/083488
Other languages
English (en)
French (fr)
Inventor
王健宗
李泽远
何安珣
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022126909A1 publication Critical patent/WO2022126909A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a code completion method, apparatus, and related equipment.
  • Code completion is one of the most important functions of Integrated Development Environments (IDEs). Code completion can reduce the workload of programmers and speed up the process of software development.
  • IDEs Integrated Development Environments
  • the code completion method mainly obtains a large amount of data from open source code bases (such as open source projects on github) or open source communities as a deep learning corpus, and uses a code parser to process the source code.
  • the source code is converted into a Token sequence or into an abstract syntax tree, and then a suitable deep neural network is selected or designed to train on the data in the corpus.
  • the datasets are public datasets, which usually lack data privacy protection, and cannot provide personalized code completion services according to the programming habits of IDEs users.
  • the present application provides a code completion method, device and related equipment, which can effectively solve the problem that the data set used in the previous code completion process is an open data set, which lacks data privacy protection and cannot provide personalized code completion services.
  • the problem is a code completion method, device and related equipment, which can effectively solve the problem that the data set used in the previous code completion process is an open data set, which lacks data privacy protection and cannot provide personalized code completion services. The problem.
  • the present application provides a code completion method, which is applied to a first participant, where the first participant is any participant in a system including an aggregation server and multiple participants, including: acquiring a local data set and The initial model parameters sent by the aggregation server, where the local data set includes multiple source codes; the local model is trained according to the initial model parameters and the local data set to obtain local model parameters; the local model parameters are encrypted and sent to the aggregation server for aggregation
  • the server aggregates the local model parameters sent by multiple participants to obtain the global model parameters; obtains the global model parameters, updates the local model according to the global model parameters and the local model parameters, and obtains the trained code completion model; obtains the code input by the user , enter the code into the code completion model to get the target code.
  • an embodiment of the present application provides a code completion apparatus, including: an acquisition unit configured to acquire a local data set and initial model parameters sent by an aggregation server, wherein the local data set includes multiple source codes; local training The unit is used to train the local model according to the initial model parameters and the local data set to obtain the local model parameters; the sending unit is used to encrypt and send the local model parameters to the aggregation server, so that the aggregation server can send the local model according to the local model sent by multiple participants.
  • the parameters are aggregated to obtain the global model parameters; the update unit is used to obtain the global model parameters, and the local model is updated according to the global model parameters and the local model parameters to obtain the trained code completion model; the processing unit is used to obtain the code input by the user, Enter the code into the code completion model to get the target code.
  • an embodiment of the present application provides a code completion device, including: a processor and a memory, the processor executes the code in the memory and executes a code completion method, the code completion method includes: acquiring a local data set and an aggregation server The initial model parameters sent, where the local data set includes multiple source codes; the local model is trained according to the initial model parameters and the local data set, and the local model parameters are obtained; the local model parameters are encrypted and sent to the aggregation server for the aggregation server to use.
  • the local model parameters sent by multiple participants are aggregated to obtain the global model parameters; the global model parameters are obtained, the local model is updated according to the global model parameters and the local model parameters, and the trained code completion model is obtained; the code input by the user is obtained, and the The code is input into the code completion model to get the target code.
  • an embodiment of the present application provides a computer-readable storage medium, including instructions, and when the instructions are run on a computer, the computer executes a code completion method, the code completion method comprising: acquiring a local data set and an aggregation server The initial model parameters sent, where the local data set includes multiple source codes; the local model is trained according to the initial model parameters and the local data set, and the local model parameters are obtained; the local model parameters are encrypted and sent to the aggregation server for the aggregation server to use.
  • the local model parameters sent by multiple participants are aggregated to obtain the global model parameters; the global model parameters are obtained, the local model is updated according to the global model parameters and the local model parameters, and the trained code completion model is obtained; the code input by the user is obtained, and the The code is input into the code completion model to get the target code.
  • an efficient code completion model can be trained together while ensuring that the codes of each participant are not disclosed.
  • the code completion service can meet various needs in the development and programming process and further speed up the software development process.
  • FIG. 1 is a federated learning system provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of a code completion provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a partial model framework provided by an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a code completion device provided by an embodiment of the present application.
  • FIG. 7 is a structural block diagram of an electronic device provided by an embodiment of the present application.
  • the technical solutions of the present application may relate to the field of artificial intelligence technology, such as machine learning technology, to implement code completion.
  • information such as data sets and/or target codes involved in this application may be stored in a database, or may be stored in a blockchain, such as distributed storage through a blockchain, which is not limited in this application.
  • Figure 1 is a schematic diagram of a federated learning system architecture.
  • the system shown in FIG. 1 includes an aggregation server and multiple parties. Among them, each participant has its own local data set and local model, each participant has the same local model, and each participant's local data set can be partially the same or completely different.
  • each of the above-mentioned participants first trains a local model according to the local data set and parameters sent by the aggregation server to obtain local model parameters, and then sends the local model parameters to the aggregation server.
  • the aggregation server aggregates the local model parameters of the above-mentioned multiple participants to obtain global model parameters, and sends the global model parameters to each participant.
  • Each participant receives the global model parameters, updates the local model according to the global model parameters and local model parameters, obtains a new local model, and then sends the new local model parameters to the aggregation server for aggregation, and the aggregation server sends the data to multiple participants.
  • the new local model parameters are aggregated to obtain new global model parameters, and the new global model parameters are sent to each participant.
  • the number of interactions between the aggregation server and each participant does not reach the preset number of times, repeat the above steps for the interaction between the aggregation server and each participant, and stop when the number of interactions between the aggregation server and each participant reaches the preset number of times Train to get the trained code completion model.
  • FIG. 2 is a flowchart of a code completion method provided by an embodiment of the present application, and the method includes:
  • the aggregation server randomly generates initial model parameters W, and then sends the initial model parameters W to n participants.
  • each participant has a local model M i
  • n participants have models M 1 , M 2 ,..., Mn respectively
  • each model M i has m model parameters
  • the ith model has parameters
  • the number of initial model parameters W is consistent with the number of parameters in each local model, that is, m parameters are included.
  • Each participant has a local data set, and n participants have data sets D 1 , D 2 ,..., D n respectively.
  • the data sets of different participants can be partially the same or all different, wherein the local data set includes source code
  • each participant data set can be partially the same or completely different.
  • the 4 participants have M 1 , M 2 , M 3 , M 4 and local datasets D 1 , D 2 , D 3 , D 4 respectively, if each model has 3 model parameters, then the first model (ie, the first participant) M 1 has parameters and dataset D 1 ; similarly, the second model (ie, the second party) M 2 has parameters and dataset D 2 ; the 3rd model (i.e. the 3rd party) M 3 has parameters and dataset D 3 ; the 4th model (i.e. the 4th party) M 4 has parameters and dataset D 4 , the initial model parameters W include 3 parameters.
  • the convergence condition is that the number of iterations is equal to the preset number of iterations or the loss function value is smaller than the preset value.
  • S103 Encrypt and send the local model parameters to the aggregation server, so that the aggregation server can perform aggregation according to the local model parameters sent by multiple participants to obtain global model parameters.
  • each participant performs homomorphic encryption based on the parameters Wi obtained after the convergence of the local model Mi training to obtain [W i ] , and then sends [W i ] to the aggregation server.
  • the aggregation server aggregates the local model parameters sent by each participant to obtain the global model parameters.
  • the specific implementation process is as follows: for the jth parameter of each local model The aggregation server averages it to get the global model parameters
  • homomorphic encryption is a cryptographic technology based on the computational complexity theory of mathematical problems. Processing the homomorphically encrypted data to obtain an output, decrypting this output yields the same output as processing the unencrypted raw data in the same way.
  • the parameters of each participant can be effectively protected from being disclosed, and the privacy of each participant's data can be protected.
  • each participant receives the global model parameters sent by the aggregation server Afterwards, for the global model parameters Decrypt to get decrypted global parameters
  • Each participant performs a weighted average of the respective local model parameters and the decrypted global model parameters to obtain new local model parameters, where the jth local model parameter W i,j of the ith participant is updated as:
  • is a real number ranging from 0 to 1.
  • the local model is updated according to the respective local model parameters and global model parameters to obtain a new local model.
  • is a real number ranging from 0 to 1.
  • the embodiment of the present application can select to retain the features of the local local model by adjusting the value of ⁇ , and provide more personalized and accurate code completion according to the actual needs of the participants.
  • S105 Acquire the code input by the user, input the code into the code completion model, and obtain the target code.
  • the code to be predicted entered by the user is obtained, and the code completion model will automatically prompt and complete the code input by the user to obtain the target code.
  • the code input by the user can be the code shown in Figure 3.
  • the system will automatically prompt “config”, “contributes”, “contributors”, “publishConfig”, “categories” and other strings, when the user clicks one of the strings is detected, for example, when the system detects a touch operation on the string "config”, the system will automatically complete the code in response to the operation.
  • the code input by the user may be the following code:
  • the embodiments of the present application can jointly train an efficient code completion model under the condition that the codes of each participant are not disclosed, provide more accurate and personalized code completion services, and meet various needs in the development and programming process. Further speed up the process of software development.
  • the local data set D i is used to train its own local model Mi , and when the convergence conditions are met, the specific process of obtaining the local model parameter Wi is as follows:
  • each participant obtains the source code in the local data set Di, and establishes an abstract syntax tree (Abstract Syntax Tree, AST ) corresponding to the source code for each source code, and uses AST to represent the corresponding source code code.
  • an abstract syntax tree (Abstract Syntax Tree, AST ) corresponding to the source code for each source code, and uses AST to represent the corresponding source code code.
  • the abstract syntax tree is an abstract representation of the source code syntax structure.
  • the syntax structure of the programming language is represented in the form of a tree.
  • the abstract syntax tree includes multiple nodes, and each node on the tree represents a structure in the source code. S202, using the abstract syntax tree as the input of the local model, training the local model, and obtaining the target node element.
  • the local model includes two parallel models, a node value prediction model and a node type prediction model.
  • the node value prediction model is used to encode the abstract syntax tree and predict the value of the target node;
  • the node type prediction model is used to extract the hierarchical structure of the abstract syntax tree and predict the type of the target node.
  • FIG. 5 shows a schematic diagram of a partial model framework according to an embodiment of the present application.
  • Step 1 Perform depth-first traversal on the abstract syntax tree to obtain the node sequence, and use Path2root to save the hierarchical structure of the abstract syntax tree to obtain the Path2root hierarchical feature.
  • Path2root is an encoder
  • the input is the path from the current node to the root node in the AST
  • the types of all nodes on the path are encoded into a feature vector.
  • depth-first traversal is an algorithm used to traverse or search a tree or graph.
  • the algorithm searches the branches of the tree as deep as possible. When the edge of the node has been explored, the search will backtrack to the starting node of the edge where the node was found. This process continues until all nodes reachable from the source node have been discovered. If there are still undiscovered nodes, select one of them as the source node and repeat the above process. The whole process is repeated until all nodes are visited.
  • the node sequence in step 1 loses the AST hierarchy, so Path2root is used to save the AST hierarchy.
  • Step 2 Encode the AST separately, predict the value of the next node and the type of the next node.
  • the Transformer XL algorithm is used to encode the node sequence to obtain an abstract syntax tree vector, that is, an AST vector.
  • the Path2root hierarchical feature is encoded by the Recurrent Neural Network (RNN) algorithm, and the Path2root vector is obtained.
  • RNN Recurrent Neural Network
  • the Transformer XL algorithm is a language training model, which is an improvement of the Transformer algorithm.
  • the function SG( ) means to stop the gradient calculation; [h u ⁇ h v ] means to connect two hidden layer sequences; Represents an input that contains information about the previous code snippet; Represents the nth layer output of the ⁇ +1th code fragment, that is, the AST vector encoded by Transformer XL; w represents the model parameters.
  • the specific steps of the bidirectional RNN algorithm are: Assume that there are in Indicates the type of the i-th node in the path at the t-th time step.
  • the hidden layer state of a bidirectional RNN can be calculated as follows:
  • the embodiment of the present application solves the problem of long dependencies in the code sequence and the problem of different lengths of the code sequence by using the Transformer XL algorithm; at the same time, due to the depth-first traversal, the node sequence loses the hierarchical structure of the AST, and uses Path2root to save the hierarchical structure of the AST , making the model prediction more accurate.
  • the long dependency problem is that the distance between two highly related words is very far.
  • Step 3 Output the target element
  • the output vector from the other prediction model is concatenated with the output vector of the prediction model, respectively, and then the outputs of the two prediction models are calculated:
  • the softmax function is then used to generate the probability distribution of the output to select the final code completion result:
  • V represents the size of the dictionary
  • H represents the dimension of the AST encoding result
  • H p represents the dimension of the Path2root encoding result
  • k is 1 or 2, which are used to represent different prediction models.
  • the first loss function value Loss 1 is determined according to the value of the target node and the value of the actual node, and for the node type prediction model, the type of the target node and the type of the actual node determine the second loss function value Loss 2 .
  • the first loss function value Loss 1 and the second loss function value Loss 2 are weighted and averaged to obtain the loss function value Loss of the entire local model:
  • the initial value of ⁇ k is set to 0.5, and the value of ⁇ k will be updated as the model is updated.
  • the local model is updated according to the loss function value of the local model, and the stochastic gradient descent method is used to iterate the entire local model.
  • the node value prediction model traverses the abstract syntax tree preferentially to obtain the node sequence, and uses the Transformer XL algorithm to encode the node sequence to obtain the AST vector, which solves the problem of long dependencies in the code sequence and the problem of different lengths of the code sequence.
  • the node type prediction model uses Path2root to save the hierarchical structure of the AST, obtains the Path2root hierarchical feature, uses the Recurrent Neural Network (RNN) algorithm to encode the Path2root hierarchical feature, and obtains the Path2root vector, which can well capture the abstract syntax Tree structure information to provide more accurate code predictions. Finally, connect the AST vector with the Path2root vector to predict the output of the node value prediction model, and connect the AST vector with the Path2root vector to predict the output of the node type prediction model, which can more accurately predict the target code.
  • RNN Recurrent Neural Network
  • FIG. 6 is a schematic structural diagram of a code completion apparatus provided by an embodiment of the present application.
  • the apparatus 600 of this embodiment includes:
  • an acquisition unit 601 configured to acquire a local data set and initial model parameters sent by the aggregation server, wherein the local data set includes a plurality of source codes;
  • a processing unit 602 configured to train a local model according to the initial model parameters and the local data set, to obtain local model parameters
  • the updating unit 604 is used to obtain the global model parameters, and update the local model according to the global model parameters and the local model parameters to obtain a trained code completion model;
  • the processing unit 602 is further configured to obtain the code input by the user, input the code into the code completion model, and obtain the target code.
  • the specific operation of the acquisition unit 601 for acquiring the local data set and the initial model parameters sent by the aggregation server can refer to the relevant operations in the above S101, and details are not repeated here;
  • the specific operation of the unit 603 encrypting the local model parameters and sending it to the aggregation server can refer to the relevant operations in the above-mentioned S103, which will not be repeated here;
  • the specific operation of the above-mentioned updating unit 604 obtaining the trained code completion model can refer to the above-mentioned S104.
  • the related operations of S105 are not repeated here; the specific operations for obtaining the target code by the processing unit 602 may refer to the related operations in the above S105, which will not be repeated here.
  • the above-mentioned processing unit 602 is configured to train the local model according to the initial model parameters and the local data set, and the process of obtaining the local model parameters specifically includes:
  • the convergence condition is satisfied, the local model parameters corresponding to the updated local model are obtained, and the convergence condition is that the number of iterations is equal to the preset number of iterations or the loss function value is smaller than the preset value.
  • the above-mentioned processing unit 602 obtains the source code in the local data set, and the specific operation of parsing the source code into an abstract syntax tree can refer to the relevant operation in the above-mentioned S201, which will not be repeated here; the above-mentioned processing unit The specific operation of obtaining the target node element in 602 can refer to the relevant operation in the above-mentioned S202, which will not be repeated here; the specific operation of the above-mentioned processing unit 602 to determine the loss function value can refer to the related operation in the above-mentioned S203, which will not be repeated here; For the specific operation of the processing unit 602 updating the local model and obtaining the local model parameters corresponding to the updated local model, reference may be made to the relevant operations in S204 above, which will not be repeated here.
  • an embodiment of the present application provides an electronic device, which may include the code completion method of any of the foregoing embodiments of the present application.
  • the electronic device may be, for example, a device such as a terminal device or a server.
  • the embodiment of the present application also provides another electronic device, including:
  • a processor and a memory executes the code in the memory, thereby completing the operation of the code completion method in any of the foregoing embodiments of the present application.
  • FIG. 7 is a structural block diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device may be the above-mentioned code completion device.
  • the electronic device may include a memory and a processor.
  • the electronic device may further include a communication interface.
  • FIG. 7 shows a schematic structural diagram of an electronic device suitable for implementing a terminal device or a server according to an embodiment of the present application.
  • the electronic device includes: one or more processors 701 ; a communication interface 702 , and a memory 703 .
  • the above-mentioned processor 701 , communication interface 702 , and memory 703 are connected through a bus 704 .
  • the memory 703 is used for storing instructions
  • the processor 701 is used for executing the instructions stored in the memory 703 .
  • the processor 701 is configured to invoke program instructions to execute:
  • the local model parameters are encrypted and sent to the aggregation server, so that the aggregation server can aggregate the local model parameters sent by multiple participants to obtain the global model parameters;
  • the processor 701 may be a central processing unit (Central Processing Unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP) , Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the communication interface 702 can be a wired interface or a wireless interface for communicating with other modules or devices, the wired interface can be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface can be a cellular network interface or use Wireless LAN interface, etc.
  • the wired interface can be an Ethernet interface, a local interconnect network (LIN), etc.
  • the wireless interface can be a cellular network interface or use Wireless LAN interface, etc.
  • the memory 703 may be a non-volatile memory such as read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), Electrically Erasable Programmable Read Only Memory (electrically EPROM, EEPROM) or flash memory.
  • ROM read-only memory
  • PROM programmable read-only memory
  • EPROM erasable programmable read-only memory
  • EEPROM Electrically Erasable Programmable Read Only Memory
  • flash memory electrically Erasable Programmable Read Only Memory
  • the memory 1003 may also be volatile memory, which may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • the memory 703 can also be used to store instructions and data, so that the processor 701 can invoke the instructions stored in the memory 703 to implement the operations performed by the above-mentioned code completion apparatus.
  • the bus 704 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (extended industry standard architecture, EISA for short) bus or the like.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus 704 can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 7, but it does not mean that there is only one bus or one type of bus.
  • an input/output interface 705 may also be included, and the input/output interface 705 is connected with an input/output device for receiving input information and outputting operation results.
  • processor 701, the communication interface 702 described in the embodiments of the present application, and the implementations described in the various embodiments of the method and apparatus for performing code completion provided by the embodiments of the present application are not described herein. Repeat.
  • a computer-readable storage medium stores a computer program, the computer program includes program instructions, and when the program instructions are executed by a processor, implements: acquiring a local data set and an aggregation server The initial model parameters sent, where the local data set includes multiple source codes; the local model is trained according to the initial model parameters and the local data set, and the local model parameters are obtained; the local model parameters are encrypted and sent to the aggregation server for the aggregation server to use.
  • the local model parameters sent by multiple participants are aggregated to obtain the global model parameters; the global model parameters are obtained, the local model is updated according to the global model parameters and the local model parameters, and the trained code completion model is obtained; the code input by the user is obtained, and the The code is input into the code completion model to get the target code.
  • the storage medium involved in the present application such as a computer-readable storage medium, may be non-volatile or volatile.
  • the computer-readable storage medium may be an internal storage unit of the electronic device in any of the foregoing embodiments, such as a hard disk or a memory of a terminal.
  • the computer-readable storage medium may also be an external storage device of the terminal, such as a plug-in hard disk equipped on the terminal, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, and a flash memory card (Flash Card). )Wait.
  • the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device.
  • the computer-readable storage medium is used to store computer programs and other programs and data required by electronic devices.
  • the computer-readable storage medium can also be used to temporarily store data that has been or will be output.
  • the disclosed server, device and method may be implemented in other manners.
  • the server embodiments described above are only illustrative.
  • the division of the above units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solutions of the embodiments of the present application.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated units are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium.
  • the technical solutions of the present application are essentially or part of contributions to the prior art, or all or part of the technical solutions can be embodied in the form of software products, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Biophysics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Medical Informatics (AREA)
  • Telephonic Communication Services (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种代码补全方法、装置、设备及计算机可读存储介质。代码补全方法,包括:获取本地数据集和聚合服务器发送的初始模型参数(S101);根据初始模型参数和本地数据集训练局部模型,得到局部模型参数(S102);将局部模型参数加密并发送给聚合服务器,以供聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数(S103);获取全局模型参数,根据全局模型参数和局部模型参数更新局部模型,得到训练好的代码补全模型(S104);获取用户输入的代码,将代码输入至代码补全模型,得到目标代码(S105)。解决了以往代码补全过程中数据集采用的是公开的数据集缺乏数据隐私保护的问题,并且可以提供个性化的代码补全服务,加快软件开发的进程。代码补全装置、设备及计算机可读存储介质实现代码补全方法。

Description

一种代码补全方法、装置以及相关设备
本申请要求于2020年12月18日提交中国专利局、申请号为202011507517.1,发明名称为“一种代码补全方法、装置以及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,具体涉及一种代码补全方法、装置以及相关设备。
背景技术
随着计算机网络技术的日益普及,代码补全是集成开发环境(Integrated Development Environments,IDEs)最重要的功能之一,代码补全可以减少程序员的工作量,加快软件开发的进程。
发明人发现,目前,代码补全方法主要是首先从开源代码库(例如github上的开源项目)或者开源社区获得大量的数据作为深度学习的语料库,利用代码解析器对源代码进行处理,例如将源代码转化为Token序列或者转化为抽象语法树,然后选择或设计一个合适的深度神经网络对语料库中的数据进行训练。发明人意识到,在这个过程中,数据集采用的是公开的数据集,通常缺乏数据隐私保护,而且无法根据IDEs用户的编程习惯提供个性化的代码补全服务。
发明内容
本申请提供了一种代码补全方法、装置以及相关设备,能够有效地解决以往代码补全过程中数据集采用的是公开的数据集,缺乏数据隐私保护而且无法提供个性化的代码补全服务的问题。
第一方面,本申请提供一种代码补全方法,应用于第一参与方,第一参与方是包括聚合服务器和多个参与方的系统中的任意一个参与方,包括:获取本地数据集和聚合服务器发送的初始模型参数,其中,本地数据集包括多个源代码;根据初始模型参数和本地数据集训练局部模型,得到局部模型参数;将局部模型参数加密并发送给聚合服务器,以供聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数;获取全局模型参数,根据全局模型参数和局部模型参数更新局部模型,得到训练好的代码补全模型;获取用户输入的代码,将代码输入至代码补全模型,得到目标代码。
第二方面,本申请实施例提供了一种代码补全装置,包括:获取单元,用于获取本地数据集和聚合服务器发送的初始模型参数,其中,本地数据集包括多个源代码;局部训练单元,用于根据初始模型参数和本地数据集训练局部模型,得到局部模型参数;发送单元,用于将局部模型参数加密并发送给聚合服务器,以供聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数;更新单元,用于获取全局模型参数,根据全局模型参数和局部模型参数更新局部模型得到训练好的代码补全模型;处理单元,用于获取用户输入的代码,将代码输入至代码补全模型,得到目标代码。
第三方面,本申请实施例提供一种代码补全设备,包括:处理器和存储器,处理器执行存储器中的代码执行代码补全方法,该代码补全方法包括:获取本地数据集和聚合服务器发送的初始模型参数,其中,本地数据集包括多个源代码;根据初始模型参数和本地数据集训练局部模型,得到局部模型参数;将局部模型参数加密并发送给聚合服务器,以供聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数;获取全局模型参数,根据全局模型参数和局部模型参数更新局部模型,得到训练好的代码补全模型;获取用户输入的代码,将代码输入至代码补全模型,得到目标代码。
第四方面,本申请实施例提供一种计算机可读存储介质,包括指令,当指令在计算机上运行时,使得计算机执行代码补全方法,该代码补全方法包括:获取本地数据集和聚合服务器发送的初始模型参数,其中,本地数据集包括多个源代码;根据初始模型参数和本 地数据集训练局部模型,得到局部模型参数;将局部模型参数加密并发送给聚合服务器,以供聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数;获取全局模型参数,根据全局模型参数和局部模型参数更新局部模型,得到训练好的代码补全模型;获取用户输入的代码,将代码输入至代码补全模型,得到目标代码。
本申请实施例通过采用联邦学习的架构,可以在保证各个参与方的代码不公开情况下,一起训练一个高效的代码补全模型,模型可以根据每个参与方用户的编码习惯,提供更加个性化的代码补全服务,满足开发编程过程中的各种需求,进一步加快软件开发的过程。
附图说明
为了更清楚地说明本申请实施例或背景技术中的技术方案,下面将对本申请实施例或背景技术中所需要使用的附图进行说明。
图1是本申请实施例提供的一种联邦学习的系统;
图2是本申请实施例提供的一种的代码补全方法流程图;
图3是本申请实施例提供的一种代码补全示意图;
图4是本申请实施例提供的一种局部模型的代码补全方法流程图;
图5是本申请实施例提供的一种局部模型框架示意图;
图6是本申请实施例提供的一种代码补全装置的结构示意图;
图7是本申请实施例提供的一种电子设备结构框图。
具体实施方式
本申请的实施例部分使用的术语仅用于对本申请的具体实施例进行解释,而非旨在限定本申请。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
本申请的技术方案可涉及人工智能技术领域,如可具体涉及机器学习技术,以实现代码补全。可选的,本申请涉及的数据集和/或目标代码等信息可存储于数据库中,或者可以存储于区块链中,比如通过区块链分布式存储,本申请不做限定。
如图1所示,图1是一种联邦学习的系统架构示意图。图1示出的系统包括聚合服务器和多个参与方。其中,每个参与方都拥有自己的本地数据集和局部模型,每个参与方拥有的局部模型相同,每个参与方的本地数据集可以有部分相同或者全部不同。
本申请实施例中,上述每个参与方首先根据本地数据集和聚合服务器发送的参数训练局部模型,得到局部模型参数,然后将局部模型参数发送给聚合服务器。聚合服务器对上述多个参与方的局部模型参数进行聚合得到全局模型参数,并将全局模型参数发送给每个参与方。每个参与方收到全局模型参数,根据全局模型参数和局部模型参数更新局部模型,得到新的局部模型,再将新的局部模型参数发给聚合服务器进行聚合,聚合服务器对多个参与方发送的新的局部模型参数进行聚合,得到新的全局模型参数,并将新的全局模型参 数发送给每个参与方。当聚合服务器与每个参与方交互的次数未达到预设次数时,重复上述聚合服务器与每个参与方交互的步骤,当聚合服务器与每个参与方交互的次数达到预设次数时,则停止训练,得到训练好的代码补全模型。
参见图2,图2是本申请实施例提供的一种代码补全方法的流程图,该方法包括:
S101、获取本地数据集和聚合服务器发送的初始模型参数。
具体地,聚合服务器随机生成初始模型参数W,然后将初始模型参数W发送给n个参与方。其中,每个参与方拥有局部模型M i,n个参与方分别拥有模型M 1,M 2,…,M n,每个模型M i有m个模型参数,第i个模型有参数
Figure PCTCN2021083488-appb-000001
初始模型参数W的个数与每个局部模型中参数的个数一致,即包括m个参数。每个参与方拥有一个本地数据集,n个参与方分别有数据集D 1,D 2,…,D n,不同参与方的数据集可以部分相同或者全部不同,其中,本地数据集包括源代码,例如,多个参与方是一个公司的不同部门,每个部门都有自己部门的业务对应的源代码,那么每个参与方数据集可以有部分的相同或者全部不同。
示例性地,若有4个参与方,4个参与方分别拥有M 1,M 2,M 3,M 4和本地数据集D 1,D 2,D 3,D 4,若每个模型有3个模型参数,那么第1个模型(即第1个参与方)M 1有参数
Figure PCTCN2021083488-appb-000002
和数据集D 1;同样,第2个模型(即第2个参与方)M 2有参数
Figure PCTCN2021083488-appb-000003
和数据集D 2;第3个模型(即第3个参与方)M 3有参数
Figure PCTCN2021083488-appb-000004
和数据集D 3;第4个模型(即第4个参与方)M 4有参数
Figure PCTCN2021083488-appb-000005
和数据集D 4,初始模型参数W包括3个参数。
S102、根据初始模型参数和本地数据集训练局部模型,得到局部模型参数。
具体地,对于第i个参与方,使用本地数据集D i训练自己的局部模型M i,在满足收敛条件时,得到局部模型参数W i。其中,收敛条件为迭代次数等于预设迭代次数或损失函数值小于预设值。
S103、将局部模型参数加密并发送给聚合服务器,以供聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数。
具体地,每个参与方将基于局部模型M i训练收敛后得到的参数W i进行同态加密得到[W i],然后把[W i]发送给聚合服务器。其中,聚合服务器根据每个参与方发送的局部模型参数进行聚合,得到全局模型参数,具体实现过程为:对于每个局部模型的第j个参数
Figure PCTCN2021083488-appb-000006
聚合服务器对其求平均可以得到全局模型参数
Figure PCTCN2021083488-appb-000007
Figure PCTCN2021083488-appb-000008
可以理解的是,对于每个局部模型有m个参数,经过聚合服务器聚合可以得到m个全局模型参数
Figure PCTCN2021083488-appb-000009
然后聚合服务器将全局模型参数
Figure PCTCN2021083488-appb-000010
Figure PCTCN2021083488-appb-000011
发送给每个参与方。
其中,同态加密是基于数学难题的计算复杂性理论的密码学技术。对经过同态加密的数据进行处理得到一个输出,将这一输出进行解密,其结果与用同一方法处理未加密的原始数据得到的输出结果是一样的。
本申请实施例中,通过基于同态加密方式,可以有效地保护每个参与方的参数不公开,保护每个参与方数据的隐私,同时,聚合服务器不用解密,减少计算量。
S104、获取全局模型参数,根据全局模型参数和局部模型参数更新局部模型,得到训练好的代码补全模型。
具体地,每个参与方收到聚合服务器发送的全局模型参数
Figure PCTCN2021083488-appb-000012
后,对全局模型参数
Figure PCTCN2021083488-appb-000013
进行解密得到解密的全局参数
Figure PCTCN2021083488-appb-000014
每个参与方根据各自的局部模型参数与解密后 全局模型参数进行加权平均得到新的局部模型参数,其中,第i个参与方的第j个局部模型参数W i,j更新为:
Figure PCTCN2021083488-appb-000015
其中,β是一个取值范围为0到1的实数。根据各自的局部模型参数与全局模型参数更新局部模型,得到新的局部模型。当β值越大时,表明新的局部模型保留更多本地局部模型的特征,即提供更个性化的代码补全;反之,当β值越小时,表明新的局部模型保留更少本地局部模型的特征。
当聚合服务器与每个参与方交互的次数未达到预设次数时,重复上述S101-S104;当聚合服务器与每个参与方交互的次数达到预设次数时,则停止训练,得到训练好的代码补全模型。本申请实施例可以通过调节β的值,选择保留本地局部模型的特征,根据参与方的实际需求,提供更个性化、更加精准的代码补全。
S105、获取用户输入的代码,将代码输入至代码补全模型,得到目标代码。
具体地,获取用户输入的待预测的代码,代码补全模型会根据用户输入的代码进行自动提示和补全,得到目标代码。
示例性地,在代码补全的系统中,用户输入的代码可以如图3所示代码,当用户输入字符串“co”时,系统会自动提示“config”、“contributes”、“contributors”、“publishConfig”、“categories”等字符串,当检测到用户点击其中一个字符串时,例如系统检测到字符串“config”上的触控操作时,响应该操作,系统会自动补全代码。
示例性地,用户输入的代码可以是如下代码:
Figure PCTCN2021083488-appb-000016
其中()表示缺失的代码,将该段代码输入代码补全模型中,输出目标代码为:
Figure PCTCN2021083488-appb-000017
本申请实施例可以在保证各个参与方的代码不公开情况下,一起训练一个高效的代码补全模型,提供更加精准、更加个性化的代码补全服务,满足开发编程过程中的各种需求,进一步加快软件开发的过程。
如图4所示,上述对于第i个参与方,使用本地数据集D i训练自己的局部模型M i,在满足收敛条件时,得到局部模型参数W i的具体过程为以下步骤:
S201、获取本地数据集中的源代码,将源代码解析成抽象语法树。
具体地,每个参与方获取本地数据集D i中的源代码,并且为每一个源代码建立一颗对应于此源代码的抽象语法树(Abstract Syntax Tree,AST),用AST表示对应的源代码。
其中,抽象语法树是源代码语法结构的一种抽象表示。以树状的形式表现编程语言的语法结构,抽象语法树包括多个节点,树上的每个节点都表示源代码中的一种结构。S202、将抽象语法树作为局部模型的输入,训练局部模型,得到目标节点元素。
具体地,局部模型包括节点值预测模型和节点类型预测模型两个并联模型。其中,节点值预测模型用于对抽象语法树编码,预测目标节点的值;节点类型预测模型用于提取抽象语法树的层次结构,预测目标节点的类型。具体可参见图5,图5示出了本申请实施例的一种局部模型框架示意图。训练局部模型时两个并联的模型是并行训练,训练具体步骤为:
步骤1:对抽象语法树进行深度优先遍历,得到节点序列,同时采用Path2root保存抽象语法树的层次结构,得到Path2root层次化特征。
具体地,对抽象语法树AST进行深度优先遍历,得到节点序列。同时,采用Path2root保存抽象语法树的层次结构,得到Path2root层次化特征。其中,Path2root是一个编码器,输入是AST中当前节点到根节点的路径,然后把路径上的所有节点的类型编码成一个特征向量。
其中,深度优先遍历是是一种用于遍历或搜索树或图的算法。该算法会尽可能深的搜索树的分支。当节点的所在边都己被探寻过,搜索将回溯到发现节点的那条边的起始节点。这一过程一直进行到已发现从源节点可达的所有节点为止。如果还存在未被发现的节点,则选择其中一个作为源节点并重复以上过程,整个进程反复进行直到所有节点都被访问为止。
在本实施例中,由于深度优先遍历,步骤1中的节点序列失去了AST的层次结构,因此采用Path2root来保存AST的层次结构。
步骤2:分别编码AST,预测下一个节点的值和下一个节点的类型。
具体地,采用Transformer XL算法对节点序列进行编码,得到抽象语法树向量,即AST向量。采用循环神经网络(Recurrent Neural Network,RNN)算法对Path2root层次化特征进行编码,得到Path2root向量。
其中,Transformer XL算法是一种语言训练模型,是Transformer算法的改进。
示例性地,假设S τ=[x τ,1,…,x τ,L]和S τ+1=[x τ+1,1,…,x τ+1,L]是两个连续的、长度为L的代码片段。记第τ个片段S τ的第n个隐藏层状态为
Figure PCTCN2021083488-appb-000018
其中d表示隐藏层状态的维数。片段S τ+1的第n个隐藏层状态可以按照下列公式计算:
Figure PCTCN2021083488-appb-000019
Figure PCTCN2021083488-appb-000020
Figure PCTCN2021083488-appb-000021
其中,函数SG(·)表示停止梯度计算;[h uοh v]表示连接两个隐藏层序列;
Figure PCTCN2021083488-appb-000022
表示包含前一个代码片段信息的输入;
Figure PCTCN2021083488-appb-000023
表示第τ+1个代码片段第n层输出,也就是Transformer XL编码后的AST向量;w表示模型参数。
双向RNN算法具体步骤为:假设Path2root上有
Figure PCTCN2021083488-appb-000024
其中
Figure PCTCN2021083488-appb-000025
表示在第t个时间步,路径中第i个节点的类型。双向RNN的隐藏层状态可以按下列公式计算:
Figure PCTCN2021083488-appb-000026
Figure PCTCN2021083488-appb-000027
然后将
Figure PCTCN2021083488-appb-000028
Figure PCTCN2021083488-appb-000029
连接起来得到由双向RNN编码得到的Path2root向量表示P t
本申请实施例通过采用Transformer XL算法解决了代码序列中的长依赖问题以及代码序列长度不一问题;同时,由于深度优先遍历,节点序列失去了AST的层次结构,采用Path2root来保存AST的层次结构,使得模型预测更加准确。其中,长依赖问题是两个关联度高的词之间距离很远。
步骤3:输出目标元素
将AST向量和Path2root向量连接预测目标节点的值,得到目标节点的值;将AST向量和Path2root向量连接预测目标节点的类型,得到目标节点的类型。
具体地,对于每个预测模型,分别将来自另一个预测模型的输出向量与该预测模型的输出向量连接起来,然后计算两个预测模型的输出:
Figure PCTCN2021083488-appb-000030
然后用softmax函数来生成输出的概率分布,以选择最终代码补全的结果:
Figure PCTCN2021083488-appb-000031
其中
Figure PCTCN2021083488-appb-000032
都是可训练的参数。V表示词典大小,H表示AST编码结果的维数,H p表示Path2root编码结果的维数,k取值为1、2,用来表示不同的预测模型。
S203、计算整个局部模型的损失函数值。
具体地,对于节点值预测模型,根据目标节点的值与实际节点的值确定第一损失函数值Loss 1,对于节点类型预测模型,目标节点的类型与实际节点的类型确定第二损失函数值Loss 2。将第一损失函数值Loss 1与第二损失函数值Loss 2进行加权平均,得到整个局部模型的损失函数值Loss:
Figure PCTCN2021083488-appb-000033
α k的初值被设为0.5,随着模型的更新,α k的值会更新。
S204、根据损失函数值更新局部模型。
根据局部模型的损失函数值更新局部模型,采用随机梯度下降的方法对整个局部模型进行迭代,迭代次数等于预设迭代次数或损失函数值小于预设值,则停止训练局部模型M i
本申请实施例通过将局部训练模型分成两个并联的节点值预测模型和节点类型预测模型,可以提取更多层次、更多尺度的特征,获得更准确的代码推荐服务。节点值预测模型对抽象语法树进行优先遍历,得到节点序列,采用Transformer XL算法对节点序列进行编码,得到AST向量,解决了代码序列中的长依赖问题以及代码序列长度不一问题。节点类型预测模型采用Path2root来保存AST的层次结构,得到Path2root层次化特征,采用循环神经网络(Recurrent Neural Network,RNN)算法对Path2root层次化特征进行编码,得到Path2root向量,可以很好的捕捉抽象语法树的结构信息,提供更加精确的代码预测。最后将AST向量与Path2root向量连接起来预测节点值预测模型的输出,将AST向量与Path2root向量连接起来预测节点类型预测模型的输出,可以更加精确的预测目标代码。
本申请实施例还提供了一种代码补全装置,该装置可用于实现本申请上述各代码补全方法实施例。具体地,参见图6,图6是本申请实施例提供的一种代码补全装置结构示意图。本实施例的装置600包括:
获取单元601,用于获取本地数据集和聚合服务器发送的初始模型参数,其中,本地数据集包括多个源代码;
处理单元602,用于根据初始模型参数和本地数据集训练局部模型,得到局部模型参数;
发送单元603,用于将局部模型参数加密并发送给聚合服务器,以供聚合服务器根据 多个参与方发送的局部模型参数进行聚合,得到全局模型参数;
更新单元604,用于获取全局模型参数,根据全局模型参数和局部模型参数更新局部模型得到训练好的代码补全模型;
处理单元602,还用于获取用户输入的代码,将代码输入至代码补全模型,得到目标代码。
在本申请代码补全装置的一个具体实施例中,上述获取单元601获取本地数据集和聚合服务器发送的初始模型参数的具体操作可以参照上述S101中的相关操作,在此不再赘述;上述发送单元603将局部模型参数加密并发送给聚合服务器的具体操作可以参照上述S103中的相关操作,在此不再赘述;上述更新单元604得到训练好的代码补全模型的具体操作可以参照上述S104中的相关操作,在此不再赘述;上述处理单元602得到目标代码的具体操作可以参照上述S105中的相关操作,在此不再赘述。
在一种具体的实现方式中,上述处理单元602用于根据初始模型参数和本地数据集训练局部模型,得到局部模型参数的过程具体包括:
获取本地数据集中的源代码,将源代码解析成抽象语法树,抽象语法树包括多个节点;
将抽象语法树输入局部模型,训练局部模型,得到目标节点元素,目标节点元素包括目标节点的值与目标节点的类型;
根据目标节点元素与实际节点元素确定损失函数值;
根据损失函数值更新局部模型;
在满足收敛条件时,得到更新后的局部模型对应的局部模型参数,收敛条件为迭代次数等于预设迭代次数或损失函数值小于预设值。
在一种具体的实现方式中,上述处理单元602获取本地数据集中的源代码,将源代码解析成抽象语法树的具体操作可以参见上述S201中的相关操作,在此不再赘述;上述处理单元602得到目标节点元素的具体操作可以参见上述S202中的相关操作,在此不再赘述;上述处理单元602确定损失函数值的具体操作可以参见上述S203中的相关操作,在此不再赘述;上述处理单元602更新局部模型、得到更新后的局部模型对应的局部模型参数的具体操作可以参见上述S204中的相关操作,在此不再赘述。
另外,本申请实施例提供了一种电子设备,其可以包括本申请上述任一实施例的代码补全方法。具体地,该电子设备例如可以是终端设备或者服务器等设备。
本申请实施例还提供了另一种电子设备,包括:
处理器和存储器,处理器执行存储器中的代码,从而完成本申请上述任一实施例代码补全方法的操作。
图7是本申请实施例提供的一种电子设备结构框图。该电子设备可以是上述的代码补全设备。该电子设备可包括存储器和处理器。可选的,该电子设备还可包括通信接口。下面参考图7,其示出了适于用来实现本申请实施例的终端设备或服务器的电子设备的结构示意图。如图7所示,该电子设备包括:一个或多个处理器701;通信接口702,存储器703。上述处理器701、通信接口702、和存储器703通过总线704连接。存储器703用于存储指令,处理器701用于执行存储器703存储的指令。其中,处理器701被配置用于调用程序指令执行:
获取本地数据集和聚合服务器发送的初始模型参数,其中,本地数据集包括多个源代码;
根据初始模型参数和本地数据集训练局部模型,得到局部模型参数;
将局部模型参数加密并发送给聚合服务器,以供聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数;
获取全局模型参数,根据全局模型参数和局部模型参数更新局部模型,得到训练好的 代码补全模型;
获取用户输入的代码,将代码输入至代码补全模型,得到目标代码。
应当理解,在本申请实施例中,所称处理器701可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
通信接口702可以为有线接口或无线接口,用于与其他模块或设备进行通信,有线接口可以是以太接口、局域互联网络(local interconnect network,LIN)等,无线接口可以是蜂窝网络接口或使用无线局域网接口等。
存储器703可以是非易失性存储器,例如,只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。存储器1003也可以是易失性存储器,易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。
存储器703也可用于存储指令和数据,以便于处理器701调用存储器703中存储的指令实现上述代码补全装置执行的操作。
总线704可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。总线704可以分为地址总线、数据总线、控制总线等。为便于表示,图7中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
可选地,还可以包括输入/输出接口705,输入/输出接口705连接有输入/输出设备,用于接收输入的信息,输出操作结果。
具体实现中,本申请实施例中所描述的处理器701、通信接口702、可执行本申请实施例提供的一种代码补全方法和装置的各个实施例中所描述的实现方式,在此不再赘述。
在本申请的另一实施例中提供一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,计算机程序包括程序指令,程序指令被处理器执行时实现:获取本地数据集和聚合服务器发送的初始模型参数,其中,本地数据集包括多个源代码;根据初始模型参数和本地数据集训练局部模型,得到局部模型参数;将局部模型参数加密并发送给聚合服务器,以供聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数;获取全局模型参数,根据全局模型参数和局部模型参数更新局部模型,得到训练好的代码补全模型;获取用户输入的代码,将代码输入至代码补全模型,得到目标代码。
可选的,该程序指令被处理器执行时还可实现上述实施例中方法的其他步骤,这里不再赘述。进一步可选的,本申请涉及的存储介质如计算机可读存储介质可以是非易失性的,也可以是易失性的。
计算机可读存储介质可以是前述任一实施例的电子设备的内部存储单元,例如终端的硬盘或内存。计算机可读存储介质也可以是终端的外部存储设备,例如终端上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,计算机可读存储介质还可以既包括电子设备的内部存储单元也包括外部存储设备。计算机可读存储介质用于存储计算机程序以及电子设备所需的其他程序和数据。计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和 软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的服务器、设备和单元的具体工作过程,可以参考前述方法实施例中的对应过程,也可执行发明实施例所描述的电子设备的实现方式,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的服务器、设备和方法,可以通过其它的方式实现。例如,以上所描述的服务器实施例仅仅是示意性的,例如,上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种代码补全方法,其中,应用于第一参与方,所述第一参与方是包括聚合服务器和多个参与方的系统中的任意一个参与方,包括:
    获取本地数据集和聚合服务器发送的初始模型参数,其中,所述本地数据集包括多个源代码;
    根据所述初始模型参数和所述本地数据集训练局部模型,得到局部模型参数;
    将所述局部模型参数加密并发送给所述聚合服务器,以供所述聚合服务器根据所述多个参与方发送的所述局部模型参数进行聚合,得到全局模型参数;
    获取所述全局模型参数,根据所述全局模型参数和所述局部模型参数更新所述局部模型,得到训练好的代码补全模型;
    获取用户输入的代码,将所述代码输入至所述代码补全模型,得到目标代码。
  2. 根据权利要求1所述的方法,其中,所述根据所述初始模型参数和所述本地数据集训练局部模型,得到局部模型参数,包括:
    获取本地数据集中的源代码,将所述源代码解析成抽象语法树,所述抽象语法树包括多个节点;
    将所述抽象语法树输入所述局部模型,训练所述局部模型,得到目标节点元素,所述目标节点元素包括目标节点的值与目标节点的类型;
    根据所述目标节点元素与实际节点元素确定损失函数值;
    根据所述损失函数值更新所述局部模型;
    在满足收敛条件时,得到更新后的局部模型对应的所述局部模型参数,所述收敛条件为迭代次数等于预设迭代次数或所述损失函数值小于预设值。
  3. 根据权利要求2所述的方法,其中,
    所述局部模型包括并联的节点值预测模型和节点类型预测模型;所述节点值预测模型用于对所述抽象语法树编码,预测所述目标节点的值,所述节点类型预测模型用于提取所述抽象语法树的层次结构,预测所述目标节点的类型。
  4. 根据权利要求2所述方法,其中,所述训练所述局部模型,得到目标节点元素,包括:
    对所述抽象语法树进行深度优先遍历,得到节点序列,采用Path2root保存所述抽象语法树的层次结构,得到Path2root层次化特征;
    采用Transformer XL算法对所述节点序列进行编码,得到抽象语法树向量,采用循环神经网络算法对所述Path2root层次化特征进行编码,得到Path2root向量;
    将所述抽象语法树向量和所述Path2root向量连接预测目标节点的值,得到所述目标节点的值;将所述抽象语法树向量和所述Path2root向量连接预测目标节点的类型,得到所述目标节点的类型。
  5. 根据权利要求2所述的方法,其中,所述根据目标节点元素与实际节点元素确定损失函数值,包括:
    根据所述目标节点的值与实际节点的值确定第一损失函数值;
    根据所述目标节点的类型与实际节点的类型确定第二损失函数值;
    将所述第一损失函数值与第二损失函数值进行加权平均,得到所述局部模型的损失函数值。
  6. 根据权利要求1所述的方法,其中,所述将所述局部模型参数加密并发送给所述聚合服务器,包括:
    将所述局部模型参数进行同态加密,得到加密的局部模型参数,将所述加密的局部模型参数发送给所述聚合服务器。
  7. 根据权利要求1所述的方法,其中,所述根据所述全局模型参数和所述局部模型参数更新所述局部模型,包括:
    将所述局部模型参数与所述全局模型参数进行加权平均,得到新的局部模型参数,根据所述新的局部模型参数更新所述局部模型。
  8. 一种代码补全装置,其中,包括:
    获取单元,用于获取本地数据集和聚合服务器发送的初始模型参数,其中,所述本地数据集包括多个源代码;
    处理单元,用于根据所述初始模型参数和所述本地数据集训练局部模型,得到局部模型参数;
    发送单元,用于将所述局部模型参数加密并发送给所述聚合服务器,以供所述聚合服务器根据多个参与方发送的所述局部模型参数进行聚合,得到全局模型参数;
    更新单元,用于获取所述全局模型参数,根据所述全局模型参数和所述局部模型参数更新所述局部模型得到训练好的代码补全模型;
    所述处理单元,还用于获取用户输入的代码,将所述代码输入至所述代码补全模型,得到目标代码。
  9. 一种代码补全设备,其中,包括:处理器和存储器,所述处理器执行所述存储器中的代码执行以下方法:
    获取本地数据集和聚合服务器发送的初始模型参数,其中,所述本地数据集包括多个源代码;
    根据所述初始模型参数和所述本地数据集训练局部模型,得到局部模型参数;
    将所述局部模型参数加密并发送给所述聚合服务器,以供所述聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数;
    获取所述全局模型参数,根据所述全局模型参数和所述局部模型参数更新所述局部模型,得到训练好的代码补全模型;
    获取用户输入的代码,将所述代码输入至所述代码补全模型,得到目标代码。
  10. 根据权利要求9所述的代码补全设备,其中,执行所述根据所述初始模型参数和所述本地数据集训练局部模型,得到局部模型参数,包括:
    获取本地数据集中的源代码,将所述源代码解析成抽象语法树,所述抽象语法树包括多个节点;
    将所述抽象语法树输入所述局部模型,训练所述局部模型,得到目标节点元素,所述目标节点元素包括目标节点的值与目标节点的类型;
    根据所述目标节点元素与实际节点元素确定损失函数值;
    根据所述损失函数值更新所述局部模型;
    在满足收敛条件时,得到更新后的局部模型对应的所述局部模型参数,所述收敛条件为迭代次数等于预设迭代次数或所述损失函数值小于预设值。
  11. 根据权利要求10所述的代码补全设备,其中,
    所述局部模型包括并联的节点值预测模型和节点类型预测模型;所述节点值预测模型用于对所述抽象语法树编码,预测所述目标节点的值,所述节点类型预测模型用于提取所述抽象语法树的层次结构,预测所述目标节点的类型。
  12. 根据权利要求10所述代码补全设备,其中,执行所述训练所述局部模型,得到目标节点元素,包括:
    对所述抽象语法树进行深度优先遍历,得到节点序列,采用Path2root保存所述抽象语法树的层次结构,得到Path2root层次化特征;
    采用Transformer XL算法对所述节点序列进行编码,得到抽象语法树向量,采用循环 神经网络算法对所述Path2root层次化特征进行编码,得到Path2root向量;
    将所述抽象语法树向量和所述Path2root向量连接预测目标节点的值,得到所述目标节点的值;将所述抽象语法树向量和所述Path2root向量连接预测目标节点的类型,得到所述目标节点的类型。
  13. 根据权利要求10所述的代码补全设备,其中,执行所述根据目标节点元素与实际节点元素确定损失函数值,包括:
    根据所述目标节点的值与实际节点的值确定第一损失函数值;
    根据所述目标节点的类型与实际节点的类型确定第二损失函数值;
    将所述第一损失函数值与第二损失函数值进行加权平均,得到所述局部模型的损失函数值。
  14. 根据权利要求9所述的代码补全设备,其中,执行所述将所述局部模型参数加密并发送给所述聚合服务器,包括:
    将所述局部模型参数进行同态加密,得到加密的局部模型参数,将所述加密的局部模型参数发送给所述聚合服务器。
  15. 一种计算机可读存储介质,其中,包括指令,当所述指令在计算机上运行时,使得所述计算机执行以下方法:
    获取本地数据集和聚合服务器发送的初始模型参数,其中,所述本地数据集包括多个源代码;
    根据所述初始模型参数和所述本地数据集训练局部模型,得到局部模型参数;
    将所述局部模型参数加密并发送给所述聚合服务器,以供所述聚合服务器根据多个参与方发送的局部模型参数进行聚合,得到全局模型参数;
    获取所述全局模型参数,根据所述全局模型参数和所述局部模型参数更新所述局部模型,得到训练好的代码补全模型;
    获取用户输入的代码,将所述代码输入至所述代码补全模型,得到目标代码。
  16. 根据权利要求15所述的计算机可读存储介质,其中,执行所述根据所述初始模型参数和所述本地数据集训练局部模型,得到局部模型参数,包括:
    获取本地数据集中的源代码,将所述源代码解析成抽象语法树,所述抽象语法树包括多个节点;
    将所述抽象语法树输入所述局部模型,训练所述局部模型,得到目标节点元素,所述目标节点元素包括目标节点的值与目标节点的类型;
    根据所述目标节点元素与实际节点元素确定损失函数值;
    根据所述损失函数值更新所述局部模型;
    在满足收敛条件时,得到更新后的局部模型对应的所述局部模型参数,所述收敛条件为迭代次数等于预设迭代次数或所述损失函数值小于预设值。
  17. 根据权利要求16所述的计算机可读存储介质,其中,
    所述局部模型包括并联的节点值预测模型和节点类型预测模型;所述节点值预测模型用于对所述抽象语法树编码,预测所述目标节点的值,所述节点类型预测模型用于提取所述抽象语法树的层次结构,预测所述目标节点的类型。
  18. 根据权利要求16所述计算机可读存储介质,其中,执行所述训练所述局部模型,得到目标节点元素,包括:
    对所述抽象语法树进行深度优先遍历,得到节点序列,采用Path2root保存所述抽象语法树的层次结构,得到Path2root层次化特征;
    采用Transformer XL算法对所述节点序列进行编码,得到抽象语法树向量,采用循环神经网络算法对所述Path2root层次化特征进行编码,得到Path2root向量;
    将所述抽象语法树向量和所述Path2root向量连接预测目标节点的值,得到所述目标节点的值;将所述抽象语法树向量和所述Path2root向量连接预测目标节点的类型,得到所述目标节点的类型。
  19. 根据权利要求16所述的计算机可读存储介质,其中,执行所述根据目标节点元素与实际节点元素确定损失函数值,包括:
    根据所述目标节点的值与实际节点的值确定第一损失函数值;
    根据所述目标节点的类型与实际节点的类型确定第二损失函数值;
    将所述第一损失函数值与第二损失函数值进行加权平均,得到所述局部模型的损失函数值。
  20. 根据权利要求19所述的计算机可读存储介质,其中,执行所述将所述局部模型参数加密并发送给所述聚合服务器,包括:
    将所述局部模型参数进行同态加密,得到加密的局部模型参数,将所述加密的局部模型参数发送给所述聚合服务器。
PCT/CN2021/083488 2020-12-18 2021-03-29 一种代码补全方法、装置以及相关设备 WO2022126909A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011507517.1A CN112527273A (zh) 2020-12-18 2020-12-18 一种代码补全方法、装置以及相关设备
CN202011507517.1 2020-12-18

Publications (1)

Publication Number Publication Date
WO2022126909A1 true WO2022126909A1 (zh) 2022-06-23

Family

ID=75001791

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/083488 WO2022126909A1 (zh) 2020-12-18 2021-03-29 一种代码补全方法、装置以及相关设备

Country Status (2)

Country Link
CN (1) CN112527273A (zh)
WO (1) WO2022126909A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115834580A (zh) * 2022-11-17 2023-03-21 清华大学 面向海洋大数据的分布式数据处理方法、装置和设备
CN116151132A (zh) * 2023-04-19 2023-05-23 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) 一种编程学习场景的智能代码补全方法、系统及储存介质
CN117395085A (zh) * 2023-12-12 2024-01-12 天津医康互联科技有限公司 全局协方差矩阵计算方法、装置、电子设备及存储介质
CN117573096A (zh) * 2024-01-17 2024-02-20 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) 一种融合抽象语法树结构信息的智能代码补全方法

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527273A (zh) * 2020-12-18 2021-03-19 平安科技(深圳)有限公司 一种代码补全方法、装置以及相关设备
CN113487041B (zh) * 2021-07-15 2024-05-07 深圳市与飞科技有限公司 横向联邦学习方法、装置及存储介质
CN113805861B (zh) * 2021-09-17 2023-08-11 平安银行股份有限公司 基于机器学习的代码生成方法、代码编辑系统及存储介质
CN115840965B (zh) * 2022-12-27 2023-08-08 光谷技术有限公司 一种信息安全保障模型训练方法和系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108388425A (zh) * 2018-03-20 2018-08-10 北京大学 一种基于lstm自动补全代码的方法
CN109614103A (zh) * 2018-10-19 2019-04-12 北京硅心科技有限公司 一种基于字符的代码补全方法及系统
WO2019219846A1 (en) * 2018-05-17 2019-11-21 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. Concepts for distributed learning of neural networks and/or transmission of parameterization updates therefor
CN110688121A (zh) * 2019-08-22 2020-01-14 深圳壹账通智能科技有限公司 代码补全方法、装置、计算机装置及存储介质
CN112527273A (zh) * 2020-12-18 2021-03-19 平安科技(深圳)有限公司 一种代码补全方法、装置以及相关设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108388425A (zh) * 2018-03-20 2018-08-10 北京大学 一种基于lstm自动补全代码的方法
WO2019219846A1 (en) * 2018-05-17 2019-11-21 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. Concepts for distributed learning of neural networks and/or transmission of parameterization updates therefor
CN109614103A (zh) * 2018-10-19 2019-04-12 北京硅心科技有限公司 一种基于字符的代码补全方法及系统
CN110688121A (zh) * 2019-08-22 2020-01-14 深圳壹账通智能科技有限公司 代码补全方法、装置、计算机装置及存储介质
CN112527273A (zh) * 2020-12-18 2021-03-19 平安科技(深圳)有限公司 一种代码补全方法、装置以及相关设备

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
FANG LIU; GE LI; BOLIN WEI; XIN XIA; MING LI; ZHIYI FU; ZHI JIN: "A Self-Attentional Neural Architecture for Code Completion with Multi-Task Learning", ARXIV.ORG, 16 September 2019 (2019-09-16), pages 1 - 12, XP081477702 *
KONEČNÝ JAKUB, MCMAHAN H. BRENDAN, YU FELIX X, RICHTÁRIK PETER, SURESH ANANDA THEERTHA, BACON DAVE: "Federated Learning: Strategies for Improving Communication Efficiency", ARXIV, 18 October 2016 (2016-10-18), pages 1 - 5, XP055944394 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115834580A (zh) * 2022-11-17 2023-03-21 清华大学 面向海洋大数据的分布式数据处理方法、装置和设备
CN115834580B (zh) * 2022-11-17 2023-05-30 清华大学 面向海洋大数据的分布式数据处理方法、装置和设备
CN116151132A (zh) * 2023-04-19 2023-05-23 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) 一种编程学习场景的智能代码补全方法、系统及储存介质
CN116151132B (zh) * 2023-04-19 2023-07-18 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) 一种编程学习场景的智能代码补全方法、系统及储存介质
CN117395085A (zh) * 2023-12-12 2024-01-12 天津医康互联科技有限公司 全局协方差矩阵计算方法、装置、电子设备及存储介质
CN117395085B (zh) * 2023-12-12 2024-03-22 天津医康互联科技有限公司 全局协方差矩阵计算方法、装置、电子设备及存储介质
CN117573096A (zh) * 2024-01-17 2024-02-20 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) 一种融合抽象语法树结构信息的智能代码补全方法
CN117573096B (zh) * 2024-01-17 2024-04-09 合肥综合性国家科学中心人工智能研究院(安徽省人工智能实验室) 一种融合抽象语法树结构信息的智能代码补全方法

Also Published As

Publication number Publication date
CN112527273A (zh) 2021-03-19

Similar Documents

Publication Publication Date Title
WO2022126909A1 (zh) 一种代码补全方法、装置以及相关设备
CN109165725B (zh) 基于迁移学习的神经网络联邦建模方法、设备及存储介质
WO2021120676A1 (zh) 联邦学习网络下的模型训练方法及其相关设备
CN109284313B (zh) 基于半监督学习的联邦建模方法、设备及可读存储介质
CN112733967B (zh) 联邦学习的模型训练方法、装置、设备及存储介质
Blanton et al. Data-oblivious graph algorithms for secure computation and outsourcing
CN113159327A (zh) 基于联邦学习系统的模型训练方法、装置、电子设备
US9590966B2 (en) Reducing authentication confidence over time based on user history
CN113505882B (zh) 基于联邦神经网络模型的数据处理方法、相关设备及介质
CN111400504B (zh) 企业关键人的识别方法和装置
WO2021174877A1 (zh) 基于智能决策的目标检测模型的处理方法、及其相关设备
JP7388445B2 (ja) ニューラルネットワークの更新方法、端末装置、計算装置及びプログラム
WO2021208701A1 (zh) 代码变更的注释生成方法、装置、电子设备及存储介质
US20230186049A1 (en) Training method and apparatus for a neural network model, device and storage medium
Niu et al. Secure federated submodel learning
CN116032663A (zh) 基于边缘设备的隐私数据处理系统、方法、设备及介质
US20230353347A1 (en) Method, apparatus, and system for training tree model
Wang et al. Heterogeneous defect prediction based on federated transfer learning via knowledge distillation
CN115150063A (zh) 模型加密的方法、装置及电子设备
CN113221153B (zh) 图神经网络训练方法、装置、计算设备及存储介质
Akter et al. Edge intelligence-based privacy protection framework for iot-based smart healthcare systems
Wu et al. Distributed modelling approaches for data privacy preserving
Stay et al. Bicategorical semantics for nondeterministic computation
US20230113896A1 (en) System for Restrictive Discovery of Private Data Feature Intersection
CN115527686A (zh) 多数据源医学数据分析模型训练方法、装置、设备和介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21904849

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21904849

Country of ref document: EP

Kind code of ref document: A1