Very large-scale distributed machine learning device

By adopting the idea of ​​reverse conduction and parallel communication in the machine learning framework, parallel training and online prediction of the ultra-large-scale distributed machine learning framework are realized, which solves the shortcomings of the existing framework in terms of versatility, performance and ease of use, and improves It improves the efficiency of model creation, training and deployment, and supports applications in high-concurrency and high-timeliness scenarios.

CN114510351BActive Publication Date: 2024-10-22BEIJING ZHONGQIAN PROTON NETWORK INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210133980.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-14
Publication Date
2024-10-22
Estimated Expiration
2042-02-14

AI Technical Summary

Technical Problem

Existing machine learning frameworks have deficiencies in versatility, performance, and ease of use, which require a large number of adaptations and custom modifications in specific scenarios. The threshold is high, and the performance is insufficient in high-concurrency and high-timeliness scenarios, making it difficult to implement. Plug and play and flexible and easy to use.

Method used

A very large-scale distributed machine learning framework is designed, which adopts the idea of ​​reverse conduction and realizes parallel training and updating of model parameters through parallel communication and hash slicing processing. It supports multi-model parallel training and provides online prediction and model management functions. The layer operator and Net algorithm network structure are used to integrate model creation, training, and inference, and the C++ third-party library is used to realize the design of the training cluster without synchronization locks.

Benefits of technology

It realizes automatic multi-model parallel training capabilities, solves the timeliness problem of ultra-large-scale model updates, supports a rich model algorithm library in the decision-making vertical AI field, and has good interface design with peripheral systems, improving the efficiency of model creation, training and deployment. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114510351B_ABST
    Figure CN114510351B_ABST
Patent Text Reader

Abstract

The present invention discloses a super-large-scale distributed machine learning framework, method, device and storage medium, and relates to the field of computer technology. The framework comprises: a machine learning training module, which is used to communicate in parallel with a server node of a parameter server module through a subthread, and obtain the feature weights of the current batch of samples in each model from the parameter server node according to the feature ID of the current batch of samples; calculate the feature gradient according to the model configuration obtained from the server node and the feature weights of the current batch of samples in each model; send the feature gradient of the current batch of samples to the parameter server node according to the feature ID of the current batch of samples; the parameter server module comprises a plurality of server nodes, each server node stores part of the model parameters; each server node updates the feature gradient and feature weight corresponding to the feature ID in the stored model parameters according to the received feature gradient corresponding to the feature ID of the current batch of samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a very large-scale distributed machine learning framework, method, device and storage medium. Background Art

[0002] The machine learning framework is the core technology in the field of AI and the infrastructure of machine learning. It provides basic capability support related to model training and inference and prediction, avoiding the trouble of algorithm engineers repeating the underlying work of reinventing the wheel of algorithms and deployment adaptation. Open source general deep learning frameworks have developed a lot in recent years, among which TensorFlow and PyTorch are the two most widely used frameworks with the most users.

[0003] TensorFlow is a deep learning framework that Google opened up in 2015. It is developed and maintained by Google Brain, Google's artificial intelligence team. It allows users to quickly design deep learning networks and abstract underlying details without spending a lot of time writing low-level CUDA or C++ code. TensorFlow has excellent performance in many aspects, such as the simplicity of the code for designing neural network structures, the execution efficiency of distributed deep learning algorithms, and the convenience of deployment. TensorFlow uses data flow graphs for numerical calculations. The nodes in the graph represent mathematical operations, and the edges in the graph represent multidimensional arrays (tensors) passed between these nodes.

[0004] The disadvantages of TensorFlow are: ① For beginners of deep learning, the threshold of TensorFlow is very high, and the learning curve is too steep. You need to practice, explore the community and continue to read articles to master the tricks of TensorFlow; ② The interface design is obscure and difficult to understand, creating many abstract concepts such as graphs, sessions, namespaces, PlaceHolders, etc., which are difficult to get started; ③ In terms of performance, it runs significantly slower than other frameworks. TensorFlow has developed to this day, which is somewhat "starting from grandeur and confined by grandeur", which is also a common problem of all general frameworks that pursue big and comprehensive.

[0005] PyTorch is an open source deep learning library for Python based on Torch and strongly supported by Facebook. PyTorch supports dynamic computational graphs, providing lower-level methods and more flexibility for users with a more mathematical bent, and its development momentum is unstoppable. It is widely favored by researchers because of its easy-to-use and powerful functions, and can quickly verify research ideas. Currently, many newly published papers use PyTorch as a tool for paper implementation, making it the preferred deep framework solution in the scientific research and academic community.

[0006] The disadvantages of PyTorch are: ① There are big problems with production environment deployment. PyTorch can stand out in the academic world mainly because "research" focuses more on rapid implementation and verification of one's own ideas, and not much on deployment issues. Generally, "the faster the better", but in the industry, fast and stable deployment is necessary. Otherwise, the time saved in doing experiments must be doubled when going online in production. ② Poor performance, especially in some high-concurrency, high-real-time, and large-scale model parameter situations, it is completely unusable.

[0007] In summary, the existing frameworks have the following technical problems:

[0008] A. Generality Issues

[0009] The current mainstream frameworks are all pursuing the goal of a general-purpose machine learning platform, such as taking into account image recognition, speech recognition, natural language processing, robotics, recommendation & advertising algorithms, and other application scenarios. The general-purpose model has multiple layers of abstraction in design, and it sacrifices performance and ease of use. This leads to more adaptation when solving specific scenario problems, and even requires customization of the underlying layer, so the threshold is extremely high.

[0010] B. Industrial-grade scenario performance and training efficiency issues

[0011] Although TensorFlow supports industrial applications better than PyTorch, open source frameworks in actual production deployment environments require deep customization and development. Existing open source framework designs have native structural problems, which are particularly prominent in supporting some high-concurrency and high-timeliness scenarios. General frameworks need to do a lot of adaptation work in the production deployment stage and cannot be plug-and-play. In addition, daily machine learning model tuning and training are not flexible and easy to use.

[0012] C Model Serving Time Issue

[0013] TensorFlow provides an online Serving module for the model, which can solve the problem of small models + low-frequency updates, but is almost powerless for large-scale parameter models + real-time updates. Summary of the invention

[0014] The ultra-large-scale distributed machine learning framework, method, device and storage medium provided by the present invention solve the above-mentioned problems.

[0015] The present invention provides a large-scale distributed machine learning framework, including: a machine learning training module, which is used to create multiple sub-threads according to multiple models; and communicate in parallel with each server node of a parameter server module through each sub-thread, and obtain the feature weights of the current batch samples in each model from the model parameters stored in the server node according to the feature ID of the current batch samples; forward calculate the current batch samples according to the model configuration obtained from the server node and the feature weights of the current batch samples in each model to obtain the model estimation value of each sample; perform backward calculation according to the model estimation value of each sample, the current batch sample label and the model configuration to obtain the feature gradient of the current batch samples; send the feature gradient of the current batch samples to the server node according to the feature ID of the current batch samples;

[0016] The parameter server module includes multiple server nodes, each of which stores part of the model parameters. Each server node is also used to update the feature gradients and feature weights corresponding to the feature ID in the stored model parameters according to the received feature gradients corresponding to the feature ID of the current batch of samples.

[0017] Optionally, it also includes: an online prediction and inference module, which is used to read prediction samples according to the incoming candidate set, extract features from the prediction samples, obtain the feature weights of the specified model from the parameter server module according to the extracted feature ID and the specified model name, and make predictions based on the feature weights of the specified model to obtain the prediction value of the specified model.

[0018] Optionally, it also includes: a client module, used to manage the model configuration and model parameters of each model in the parameter server module.

[0019] Optionally, forward calculation is performed on the current batch of samples according to the model configuration obtained from the server node and the feature weights of the current batch of samples in each model to obtain the model estimate of each sample; backward calculation is performed according to the model estimate of each sample, the current batch of sample labels and the model configuration to obtain the feature gradient of the current batch of samples; specifically:

[0020] The reverse conduction idea is adopted to split the model algorithm into multiple layers of operators according to the model configuration. Each operator in each layer performs two operations:

[0021] Forward calculation: According to the feature weights of the current batch of samples in each model, the current batch of samples is calculated according to the algorithm specified by the operator to output the model estimate of each sample;

[0022] Backward calculation: Calculate the residual based on the model estimate of each sample and the label value of the current batch of samples, and calculate the residual of each layer of operators in reverse conduction to calculate the feature gradient.

[0023] The present invention also provides a super-large-scale distributed machine learning framework method, including: a machine learning training module, creating multiple sub-threads according to multiple models; and communicating in parallel with each server node of the parameter server module through each sub-thread, obtaining the feature weights of the current batch samples in each model from the model parameters stored in the server node according to the feature ID of the current batch samples; forward calculating the current batch samples according to the model configuration obtained from the server node and the feature weights of the current batch samples in each model to obtain the model estimation value of each sample; backward calculating according to the model estimation value of each sample, the current batch sample label and the model configuration to obtain the feature gradient of the current batch samples; sending the feature gradient of the current batch samples to the server node according to the feature ID of the current batch samples;

[0024] The parameter server module includes multiple server nodes, each of which stores part of the model parameters; each server node updates the feature gradients and feature weights corresponding to the feature ID in the stored model parameters according to the received feature gradients corresponding to the feature ID of the current batch of samples.

[0025] Optionally, it also includes: an online prediction and inference module, which reads prediction samples according to the incoming candidate set, extracts features of the prediction samples, obtains the feature weights of the specified model from the parameter server module according to the extracted feature ID and the specified model name, and predicts according to the feature weights of the specified model to obtain the prediction value of the specified model.

[0026] Optionally, it also includes: a client module, which communicates with the parameter server module and manages the model configuration and model parameters of each model in the parameter server module.

[0027] Optionally, forward calculation is performed on the current batch of samples according to the model configuration and the feature weights of the current batch of samples in each model to obtain the model estimate of each sample; backward calculation is performed according to the model estimate of each sample, the current batch of sample labels and the model configuration to obtain the feature gradient of the current batch of samples; specifically:

[0028] The reverse conduction idea is adopted to split the model algorithm into multiple layers of operators according to the model configuration. Each operator in each layer performs two operations:

[0029] Forward calculation: According to the feature weights of the current batch of samples in each model, the current batch of samples is calculated according to the algorithm specified by the operator to output the model estimate of each sample;

[0030] Backward calculation: Calculate the residual based on the model estimate of each sample and the label value of the current batch of samples, and calculate the residual of each layer of operators in reverse conduction to calculate the feature gradient.

[0031] The present invention provides a device, comprising: a processor;

[0032] A memory for storing executable instructions;

[0033] The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the above-mentioned ultra-large-scale distributed machine learning framework method.

[0034] The present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the above-mentioned ultra-large-scale distributed machine learning framework method.

[0035] Beneficial effects of the present invention: The ultra-large-scale distributed machine learning framework, method, device and storage medium provided by the present invention have the ability of automatic multi-model parallel training, can solve the timeliness problem of ultra-large-scale (trillion features) model updates, and can also achieve good design through interfaces with peripheral systems (such as AB system, portrait system, feature engineering system). Based on the layer operator + Net algorithm network structure design concept, the present invention can realize the integration of model creation, training, and reasoning, realize the training of PS, and the online cluster separation design, and can realize the training cluster without synchronization lock + online cluster synchronization lock difference design through the c++ third-party library omp and mutex, which can support a rich model algorithm library in the decision-making vertical AI field. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A module diagram of a super-large-scale distributed machine learning framework provided in Example 1 of the present invention;

[0037] Figure 2 An operation flow chart of a machine learning training module in a super-large-scale distributed machine learning framework method provided in Example 2 of the present invention;

[0038] Figure 3 An operational flow chart of a parameter server module receiving a request from a machine learning training module in an ultra-large-scale distributed machine learning framework method provided in Example 2 of the present invention;

[0039] Figure 4 An operation flow chart of a parameter server module receiving a request from an online prediction and inference module in a super-large-scale distributed machine learning framework method provided in Embodiment 2 of the present invention;

[0040] Figure 5 This is an operational flow chart of an online prediction and inference module in an ultra-large-scale distributed machine learning framework method provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0041] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0042] Example 1

[0043] This embodiment provides a large-scale distributed machine learning framework. Figure 1 As shown, including:

[0044] It includes: a machine learning training module, which is used to create multiple sub-threads according to multiple models; and communicate in parallel with each server node of the parameter server module through each sub-thread, and obtain the feature weights of the current batch samples in each model from the model parameters stored in the server node according to the feature ID of the current batch samples; forward calculate the current batch samples according to the model configuration obtained from the server node and the feature weights of the current batch samples in each model to obtain the model estimate of each sample; backward calculate according to the model estimate of each sample, the current batch sample label and the model configuration to obtain the feature gradient of the current batch samples; send the feature gradient of the current batch samples to the server node according to the feature ID of the current batch samples;

[0045] The parameter server module includes multiple server nodes, each of which stores part of the model parameters. Each server node is also used to update the feature gradients and feature weights corresponding to the feature ID in the stored model parameters according to the received feature gradients corresponding to the feature ID of the current batch of samples.

[0046] Preferably, the parameter server module performs hash slicing processing on the model parameters, and each server node stores a portion of the model parameters.

[0047] For example, the parameter server module uses the feature ID to take the modulus of the number of server node slices, and stores the model parameter slices in the server node slice number corresponding to the modulus according to the feature ID.

[0048] Preferably, it also includes: an online prediction and inference module, which is used to read prediction samples according to the incoming candidate set, extract features from the prediction samples, obtain the feature weights of the specified model from the parameter server module according to the extracted feature ID and the specified model name, and make predictions based on the feature weights of the specified model to obtain the prediction value of the specified model.

[0049] Preferably, it also includes: a client module, used to manage the model configuration and model parameters of each model in the parameter server module.

[0050] When the server module receives the client's request, it performs management operations such as creation, training, online, offline, deletion, saving breakpoints, and viewing status on each model according to the request type.

[0051] Preferably, the current batch of samples is forward calculated according to the model configuration obtained from the server node and the feature weights of the current batch of samples in each model to obtain the model estimate of each sample; the feature gradient of the current batch of samples is obtained by backward calculation according to the model estimate of each sample, the current batch of sample labels and the model configuration; specifically:

[0052] The reverse conduction idea is adopted to split the model algorithm into multiple layers of operators according to the model configuration. Each operator in each layer performs two operations:

[0053] Forward calculation: According to the feature weights of the current batch of samples in each model, the current batch of samples is calculated according to the algorithm specified by the operator to output the model estimate of each sample;

[0054] Backward calculation: Calculate the residual based on the model estimate of each sample and the label value of the current batch of samples, and calculate the residual of each layer of operators in reverse conduction to calculate the feature gradient.

[0055] The present embodiment also provides a super-large-scale distributed machine learning framework method, including: a machine learning training module, creating multiple sub-threads according to multiple models; and communicating in parallel with each server node of the parameter server module through each sub-thread, obtaining the feature weights of the current batch samples in each model from the model parameters stored in the server node according to the feature ID of the current batch samples; forward calculating the current batch samples according to the model configuration obtained from the server node and the feature weights of the current batch samples in each model to obtain the model estimation value of each sample; backward calculating according to the model estimation value of each sample, the current batch sample label and the model configuration to obtain the feature gradient of the current batch samples; sending the feature gradient of the current batch samples to the server node according to the feature ID of the current batch samples;

[0056] The parameter server module includes multiple server nodes, each of which stores part of the model parameters; each server node updates the feature gradients and feature weights corresponding to the feature ID in the stored model parameters according to the received feature gradients corresponding to the feature ID of the current batch of samples.

[0057] Preferably, it also includes: an online prediction and inference module, which reads prediction samples according to the incoming candidate set, extracts features from the prediction samples, obtains the feature weights of the specified model from the parameter server module according to the extracted feature ID and the specified model name, and predicts according to the feature weights of the specified model to obtain the prediction value of the specified model.

[0058] Preferably, it also includes: a client module, which communicates with the parameter server module and manages the model configuration and model parameters of each model in the parameter server module.

[0059] Preferably, the current batch of samples is forward calculated according to the model configuration and the feature weights of the current batch of samples in each model to obtain the model estimate of each sample; the feature gradient of the current batch of samples is obtained by backward calculation according to the model estimate of each sample, the current batch of sample labels and the model configuration; specifically:

[0060] The reverse conduction idea is adopted to split the model algorithm into multiple layers of operators according to the model configuration. Each operator in each layer performs two operations:

[0061] Forward calculation: According to the feature weights of the current batch of samples in each model, the current batch of samples is calculated according to the algorithm specified by the operator to output the model estimate of each sample;

[0062] Backward calculation: Calculate the residual based on the model estimate of each sample and the label value of the current batch of samples, and calculate the residual of each layer of operators in reverse conduction to calculate the feature gradient.

[0063] This embodiment also provides a device, characterized by comprising: a processor;

[0064] A memory for storing executable instructions;

[0065] The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the above-mentioned ultra-large-scale distributed machine learning framework method.

[0066] This embodiment also provides a computer-readable storage medium, characterized in that the storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the above-mentioned ultra-large-scale distributed machine learning framework method.

[0067] The ultra-large-scale distributed machine learning framework, method, device and storage medium provided by the present invention have automatic multi-model parallel training capabilities, can solve the timeliness problem of ultra-large-scale (trillion features) model updates, and can also achieve good design through interfaces with peripheral systems (such as AB systems, portrait systems, and feature engineering systems). Based on the layer operator + Net algorithm network structure design concept, the present invention can realize the integration of model creation, training, and reasoning, realize the training of PS, and the online cluster separation design, and can realize the training cluster without synchronization lock + online cluster synchronization lock difference design through the c++ third-party library omp and mutex, which can support a rich model algorithm library in the decision-making vertical AI field.

[0068] Example 2

[0069] This embodiment provides a large-scale distributed machine learning framework, which includes four modules:

[0070] ps worker: machine learning training module, used to calculate feature gradients and update them to the PS (parameter server) parameter server module.

[0071] PS (parameter server), parameter server module, is used for model storage, reading, writing and updating data. The parameter server module will hash the model parameters, and each server node (server node) only stores part of the model parameters. It includes training ps module, online prediction ps module and gradient update module ps updater.

[0072] ps client: client module, used to interact with PS and manage models.

[0073] pred: online prediction inference module, accesses PS's online prediction ps module to calculate model scores, and supports real-time online prediction of 9 model targets at 100ms level.

[0074] Details of the technical framework of the four modules

[0075] (a)PS worker

[0076] The worker node is the core working node component of the ps worker module in the ultra-large-scale distributed machine learning framework. The worker node interacts with the server node once each time a batch of samples is read. The worker node calculates the feature gradient and synchronizes the feature gradient to the server node. The model configuration and related model parameter values ​​are stored in the server node. The server node updates the model parameters for the next worker node to calculate the gradient. Model parameters include feature IDs, feature weights corresponding to feature IDs, and feature gradients.

[0077] Each batch of samples is organized for training in mini-batch format, with each batch ranging from hundreds to thousands of samples. There are three advantages to organizing samples in mini-batch format: ① Compared with training samples one by one, small batches will calculate gradient values ​​more balanced and stable, avoiding sharp gradient fluctuations caused by noise; ② Small batches reduce the number of communications with server nodes. In high-concurrency scenarios, the most time-consuming part is the frequent communication between worker nodes and server nodes; ③ When calculating gradients, small batches of samples can make full use of the matrix calculation open source library to optimize the time and space efficiency of gradient calculation.

[0078] Workflow: When working, the worker node reads samples from the standard input. The samples include a sequence of label values ​​and sample feature ID values ​​(i.e., one-hot features), which are organized into a small batch sample set. For the current batch sample feature ID set, the parameter values ​​of the model are pulled from the server node to the local. The model structure configuration needs to be obtained first, and then a forward calculation is performed to obtain the "prediction value" of the current sample state. After that, a backward calculation is performed to obtain the gradient. The feature gradient is calculated and pushed to the server node slice. The server node completes the parameter gradient aggregation and parameter update of the current slice.

[0079] The specific process is as follows Figure 2 As shown, including:

[0080] Step A1: Initialize the worker node and check the validity of multiple models. If the test is qualified, execute step A2. If the test is unqualified, throw an exception.

[0081] Specifically, the worker node is initialized, and the validity of multiple models is checked by accessing the server node through the model name of each model, checking the parameter quantity, existence, creation time, modification time, etc. If the test is qualified, step A2 is executed. If the test fails, an exception is thrown.

[0082] Step A2: Read the sample and determine whether the sample format is correct. If so, execute step A3; otherwise, discard the sample or throw an exception.

[0083] Step A3: accumulate the current batch samples of a mini-batch;

[0084] Step A4: communicate with multiple server nodes of the parameter server module in parallel through multiple sub-threads, and pull the feature weights of the current batch of samples in each model from the server nodes;

[0085] Before step A4, the worker node also pulls the model configuration of each model from the server node;

[0086] Step A5: forward calculation is performed on the current batch of samples according to the model configuration obtained from the server node and the feature weights of the current batch of samples in each model to obtain the model estimation value of each sample;

[0087] Step A6: Perform backward calculation based on the model estimate of each sample, the current batch sample label and the model configuration to obtain the feature gradient of the current batch sample; send the feature gradient of the current batch sample to the parameter server node;

[0088] Step A7: Determine whether to read the sample, if yes, return to step A3; otherwise, end.

[0089] In the present invention, the core components of the worker node have two major parts, one is the communication and data transmission module with the server node, and the other is the algorithm operator module, which communicates with the server node interface in thrift mode, and the data block is serialized in protobuf format.

[0090] ps worker supports multi-model parallel training. According to the model names of the passed-in multi-models, multiple sub-threads are created in the initialization phase to communicate with the server node in parallel. One connection between the worker node and the server node of each model is handled by one sub-thread. The algorithm module adopts the reverse conduction idea to decompose the model algorithm into the most basic operator unit Layer. Each layer performs two operations: (1) forward calculation, which calculates the output from the input according to the algorithm specified by the layer; (2) backward calculation, which calculates the residual based on the estimated value and the real sample label value, and reversely calculates the residual of each layer, and then calculates the feature parameter gradient. The output of each layer is the input of the operator of the lower layer, and the residual input of this layer is the residual output of the upper layer.

[0091] In this embodiment, layer is the basic unit of the model algorithm and the smallest algorithm structure unit for adjusting the model. Each layer completes a specific type of calculation. The ultra-large-scale distributed machine learning framework has developed three categories (Data Layer, Common Layer, Loss Layer) with a collection of 30+ different types of layers, such as Embedding, Pooling (Avg / Max / Sum / Mult), Dropout, Sigmoid / Square / Softmax, FM / FFM / WideProd / Dot, Relu / Tanh, as well as data weighting, normalization and loss calculation layers, and each layer has a corresponding gradient update operator (SGD / Adagrad / FTRL, etc.), which can flexibly support the configuration of various model algorithms and support classification / regression modeling for various scenarios.

[0092] In this embodiment, a complete model includes an input layer, an intermediate layer, and an output layer. The present invention can define different types of Layer operators and connect different Layer operators to generate a new model.

[0093] The forward and backward calculations at the model level are ultimately completed by the forward and backward calculations of the single-layer operator layer. The code logic is:

[0094] void Model::forward()

[0095] {

[0096] for(size_.ti=0;i!=layers_.size();++i)

[0097] {

[0098] layers_[i]->forward();

[0099] }

[0100] }

[0101] void Model::backward()

[0102] {

[0103] for(int32_.ti=layers_.size()-1;i>=0;--i)

[0104] {

[0105] layers_[i]->backward();

[0106] }

[0107] }

[0108] The forward and backward calculation logic of a single-layer operator layer is that each operator layer needs to implement a subclass based on the Layer parent class and implement two virtual functions: forward and backwrad. This framework implements more than 30 basic operator layers and provides open interfaces for implementing operator layers of various specified algorithms. New operators only need to implement a subclass based on Layer and implement two forward() and backward() functions.

[0109] (b) PS parameter server module

[0110] The parameter server module is the actual storage, reading, writing and updating module of the model. The parameter server module performs hash slicing on the model parameters. Each server node stores only a part of the model parameters. The simplest hash slicing method is to take the modulus of the server slice number with the feature ID, and the feature is stored in the server slice number corresponding to the modulus. The server consists of three parts in actual deployment: the training ps module, the online prediction ps module and the gradient update module updater.

[0111] In this embodiment, the server node communicates with the worker node, the client node, and the pred node. In addition, it communicates with the gradient update module ps updater to transfer parameters between the training and online server clusters. Different modules communicate through thrift interfaces. The main thrift interfaces are:

[0112] service ParameterServer

[0113] {

[0114] / / Interaction interface with client, basic management operation interface of various models

[0115] void create_model(1:CreateModelRequest req)

[0116] void drop.model(1:string req)

[0117] bool set_model(1:SetRequest req)

[0118] string get.stat(1:string model.name)

[0119] void dump(1:string model.name,2:string path)

[0120] void load(1:string model_name,2:string path,3:CreateModelRequest req)

[0121] string list_models()

[0122] / / Worker node interaction interface, used to obtain parameters and update gradients

[0123] FetchResponse fetch(1:FetchRequest req)

[0124] oneway void push(1:PushRequest req)

[0125] / / updater node interface to implement real-time update of model parameters

[0126] void update_realtime_config(1:string model_name)

[0127] list <pushrequest>get.updated_par ameter(1:list <string>model_names)

[0128] }

[0129] In this implementation, the Ps server is essentially a kv cache memory-level distributed database. The ultra-large-scale distributed machine learning framework implements an efficient kv mechanism, designs a double hash mechanism, uses bloomfilter to achieve fast key-value addressing, improves memory usage efficiency, and solves efficient thread locks in multi-threaded and high-concurrency scenarios to ensure model data consistency and maximize read-write concurrency. Each model consists of two parts: data and model configuration items. The model configuration items specify which layer operators the model structure consists of. The data part is the actual parameter weights of the model and the current accumulated gradient. The model parameters include ordinary parameters and vectorized parameters.

[0130] Start the ps parameter server service, you can specify whether the current node is a training server or a server for providing online services

[0131] ps_server-parameter_type=ONLINE / TRAIN-port=PORT

[0132] After starting the ps parameter server service, the specific workflow includes:

[0133] When a worker node request is received, the following is executed: Figure 3 The operation flow shown in the figure, when receiving the pred node request, execute the following Figure 4 The operation flow shown.

[0134] Step B1: When receiving a worker node request, determine the request type. If the request type is a request to obtain model configuration, execute step B2; if the request type is to push the parameter gradient value of the specified feature set, execute step B3; if the request type is to pull the model parameters of the specified feature set, execute step B4;

[0135] Step B2: Get the model configuration, return the model configuration to the worker node, and execute step B5;

[0136] Step B3: Update the feature weight of the specified feature set according to the feature gradient of the specified feature set, and execute step B5;

[0137] Specifically, the feature gradient and feature weight corresponding to the feature ID in the stored model parameters are updated according to the feature gradient corresponding to the feature ID of the specified feature set, and step B5 is executed;

[0138] Step B4: Obtain model parameters based on the specified feature set, return them to the worker node, and execute step B5;

[0139] Specifically, the stored model parameters are obtained according to the feature ID of the specified feature set, and returned to the worker node to execute step B5;

[0140] Step B5: Determine whether to terminate, if yes, end; otherwise, return to step B1.

[0141] Step C1: When receiving a pred node request, determine the request type. If the request type is to obtain the specified model and feature set parameter weights, execute step C2;

[0142] Step C2: Determine whether the specified model exists. If yes, execute step C3; otherwise, throw an exception.

[0143] Step C3: Return the specified model and feature set weights;

[0144] Step C4: Determine whether to terminate, if yes, end; otherwise, return to step C1.

[0145] When receiving a client node request, determine the request type. If the request type is any model management operation among creation, training, online, offline, deletion, saving breakpoints, and viewing status, perform the management operations among creation, training, online, offline, deletion, saving breakpoints, and viewing status according to the request type.

[0146] (c)PS client

[0147] The client node is the model management client, responsible for daily model management operations, and is used to manage the model configuration and model parameters of each model in the parameter server module. The client node and the server node interact through the thrift communication protocol. For the workflow, see the workflow of interaction between server and client nodes.

[0148] -ps_client is a client related to model management, providing model management operations such as model creation, training, online, offline, deletion, saving breakpoints, and viewing status

[0149] pc_client-cmd=CREATE / DROP / STAT / LIST / DUMP-config=model.conf-name=MODEL_NAME-local_model_path=PATH-ps_host=PS_URI

[0150] (d)pred

[0151] Pred is an online prediction and inference module. For example, the pred node reads the portrait based on the incoming candidate set, extracts features, and pulls parameters from the server based on the feature ID and the specified model name, and then completes the prediction in pred. Each model corresponds to a prediction value. The multi-target prediction values ​​are remixed into the final estimated score through the following two optional methods, namely, multiplication and addition. In actual application scenarios, method one is better and more commonly used.

[0152] Method 1: pred-score = model_pred1^alpha1*model_pred2^alpha2*...

[0153] model_predN^alphaN

[0154] Method 2: pred-score = model_pred1^alpha1+model_pred2^alpha2+...

[0155] model_predN^alphaN

[0156] The Pred node and the server node interact through the thrift communication protocol. The core workflow of the Pred node is shown in Figure 5, including:

[0157] Step D1: initialization;

[0158] Step D2: Get the incoming candidate set and read the prediction sample;

[0159] Step D3: extracting features from the predicted samples;

[0160] Step D4: Obtain the feature weights of each model from the parameter server node according to the feature ID;

[0161] Step D5: Determine whether the model exists. If so, execute step D6; otherwise, throw an exception.

[0162] Step D6: Obtain the predicted value of each model according to the feature weight of each model, calculate the estimated score according to the predicted value, and return the estimated score;

[0163] Step D7: Determine whether to terminate, if so, end; otherwise, return to step D2.

[0164] The ultra-large-scale distributed machine learning framework provided in this embodiment is based on the layer operator + Net algorithm network structure design concept, integrates model creation, training, and reasoning, realizes the PS training and online cluster separation design, and can realize the training cluster no synchronization lock + online cluster synchronization lock difference design through the C++ third-party library omp and mutex. It can support a rich model algorithm library in the decision-making vertical AI field, and can also solve the timeliness problem of ultra-large-scale (trillion features) model updates; it also has automatic multi-model parallel training capabilities and can achieve good design with peripheral systems (such as AB system, portrait system, feature engineering system) through interfaces.

[0165] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.< / string> < / pushrequest>

Claims

1. A very large-scale distributed machine learning device, It is characterized in that include: A machine learning training module that creates multiple child threads based on multiple models; And communicate in parallel with each server node of the parameter server module through each sub-thread, and obtain the feature weights of the current batch of samples in each model from the model parameters stored in the server node according to the feature ID of the current batch of samples; According to the model configuration obtained from the server node and the feature weights of the current batch of samples in each model, the current batch of samples is forward calculated to obtain the model estimate of each sample; according to the model estimate of each sample, the current batch of sample labels and the model configuration, the feature gradient of the current batch of samples is obtained by backward calculation; Send the feature gradients of the current batch of samples to the server node according to the feature ID of the current batch of samples; The parameter server module includes multiple server nodes, each of which stores part of the model parameters. Each server node is also used to update the feature gradients and feature weights corresponding to the feature ID in the stored model parameters according to the received feature gradients corresponding to the feature ID of the current batch of samples.

2. The ultra-large-scale distributed machine learning device according to claim 1, It is characterized in that Also includes: The online prediction inference module is used to read the prediction samples according to the incoming candidate set, extract features from the prediction samples, obtain the feature weights of the specified model from the parameter server module according to the extracted feature ID and the specified model name, and make predictions based on the feature weights of the specified model to obtain the prediction value of the specified model.

3. The ultra-large-scale distributed machine learning device according to claim 1 or 2, It is characterized in that Also includes: The client module is used to manage the model configuration and model parameters of each model in the parameter server module.

4. The ultra-large-scale distributed machine learning device according to claim 1, It is characterized in that According to the model configuration obtained from the server node and the feature weights of the current batch of samples in each model, the current batch of samples is forward calculated to obtain the model estimate of each sample; according to the model estimate of each sample, the current batch of sample labels and the model configuration, the feature gradient of the current batch of samples is obtained by backward calculation; specifically: The reverse conduction idea is adopted to split the model algorithm into multiple layers of operators according to the model configuration. Each operator in each layer performs two operations: Forward calculation: According to the feature weights of the current batch of samples in each model, the current batch of samples is calculated according to the algorithm specified by the operator to output the model estimate of each sample; Backward calculation: Calculate the residual based on the model estimate of each sample and the label value of the current batch of samples, and calculate the residual of each layer of operators in reverse conduction to calculate the feature gradient.