WO2024067373A1 - 一种数据处理方法及相关装置 - Google Patents

一种数据处理方法及相关装置 Download PDF

Info

Publication number
WO2024067373A1
WO2024067373A1 PCT/CN2023/120541 CN2023120541W WO2024067373A1 WO 2024067373 A1 WO2024067373 A1 WO 2024067373A1 CN 2023120541 W CN2023120541 W CN 2023120541W WO 2024067373 A1 WO2024067373 A1 WO 2024067373A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
mapping relationship
network
units
neural network
Prior art date
Application number
PCT/CN2023/120541
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 WO2024067373A1 publication Critical patent/WO2024067373A1/zh

Links

Classifications

    • 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/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent

Definitions

  • the present application relates to the field of artificial intelligence, and in particular to a data processing method and related devices.
  • Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
  • artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence.
  • Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
  • Another problem with this core issue is how to design and train such a costly model to fully realize its value, and at the beginning of the design, it is necessary to prepare for possible unknown usage scenarios in the future, because such a costly model cannot be retrained over and over again, so there needs to be some form that can save the results of previous training and be able to prepare for possible usage scenarios in the future.
  • a large-scale model can be divided into multiple network units. Corresponding network units are set for different input samples (such as different word vectors). When a certain input sample is used for model training, only the network unit corresponding to the input sample among the multiple network units is updated, and the updated network unit will be stored so that it can be called at the next update.
  • the present application provides a data processing method that can increase the size of a large-scale model itself and increase the scalability and flexibility of the large-scale model.
  • an embodiment of the present application provides a data processing method, the method comprising: determining one or more target network units corresponding to a target word vector token and a storage address of the one or more target network units according to a target mapping relationship, wherein the storage space corresponding to the storage address is located in a storage space outside a computing unit; obtaining the one or more target network units from the storage space corresponding to the storage address; the one or more target network units are used to construct a neural network; and according to the target word vector, executing a training process corresponding to the neural network through the computing unit.
  • the target network unit in the large-scale model is stored in a storage location outside the computing unit, when the current training sample is the corresponding word vector, the corresponding one or more target network units are extracted from the storage location outside the computing unit. Since the storage space of the storage location outside the computing unit can be set larger, the size of the large-scale model itself can be increased through storage and computing separation, and the scalability and flexibility of the large-scale model can be increased.
  • the target network unit is a feed forward network FFN.
  • the computing unit is a graphics processing unit GPU, a tensor processing unit TPU, or a neural network processor NPU.
  • the storage space corresponding to the storage address is located in a memory, a network storage, or a hard disk.
  • the target mapping relationship includes a first target mapping relationship
  • the first target mapping relationship indicates multiple word vectors and one or more network units corresponding to each word vector
  • the first target mapping relationship is specifically a mapping table.
  • mapping relationship between training samples (word vector tokens) and network units is constructed by hashing. Since a training sample in the hash can only correspond to a unique network unit, and since there is a numerical range limit in the hash, as the training sample increases, a large number of different training samples may correspond to the same network unit, which affects the accuracy of the trained model.
  • the mapping relationship between the training sample (word vector token) and the network unit is recorded in a mapping table, so that one training sample can correspond to multiple network units, and since there is no numerical range limit, a large number of different training samples will not correspond to the same network unit, thereby increasing the accuracy of the trained model.
  • the training process corresponding to the target neural network is executed by the computing unit to obtain an updated target neural network, and the updated target neural network includes the updated one or more target network units.
  • the method also includes: updating the data in the storage space corresponding to the storage address according to the updated one or more target network units.
  • the method before determining one or more target network units corresponding to the target word vector and the storage address of the one or more target network units according to the target mapping relationship, the method also includes: receiving modification information from the user regarding a second target mapping relationship, wherein the second target mapping relationship includes multiple word vectors and a network unit corresponding to each word vector; and modifying the second target mapping relationship according to the modification information to obtain the target mapping relationship.
  • the modification information is used to indicate at least one of the following: deletion, replacement or addition of a network unit corresponding to at least one word vector in the second target mapping relationship; deletion, replacement or addition of a mapping relationship included in the second target mapping relationship, wherein the mapping relationship is a word vector and a network unit corresponding to the word vector.
  • the method before determining one or more target network units corresponding to the target word vector and the storage address of the one or more target network units according to the target mapping relationship, the method further includes: in the process of training the neural network through the target word vector, based on the degree of decrease in training loss being lower than a threshold, adding network units corresponding to the target word vector in the second target mapping relationship to obtain the target mapping relationship.
  • the degree of decrease in training loss is low, it can be said that the current performance of the model cannot be further improved.
  • the structure of the neural network can be changed by adding network units so that the training loss can continue to decrease.
  • the target mapping relationship includes a plurality of word units and a network unit corresponding to each word unit, and the method further includes:
  • network units corresponding to some word units are determined from multiple word units included in the target mapping relationship, and the network units corresponding to the some word units in the neural network after convergence are used to construct a target neural network; the target neural network is used to perform model inference.
  • the present application provides a data processing device, the device comprising:
  • a processing module used to determine one or more target network units corresponding to the target word vector token and storage addresses of the one or more target network units according to the target mapping relationship, wherein the storage space corresponding to the storage address is located in the storage space outside the computing unit;
  • the one or more target network units are used to construct a neural network
  • the model training module is used to perform the training process corresponding to the neural network through the computing unit according to the target word vector.
  • the target network unit is a feed forward network FFN.
  • the computing unit is a graphics processing unit GPU, a tensor processing unit TPU, or a neural network processor NPU.
  • the storage space corresponding to the storage address is located in a memory, a network storage, or a hard disk.
  • the target mapping relationship includes a first target mapping relationship
  • the first target mapping relationship indicates multiple word vectors and one or more network units corresponding to each word vector
  • the first target mapping relationship is specifically a mapping table.
  • the training process corresponding to the target neural network is performed by the computing unit to obtain an updated target neural network
  • the updated target neural network includes the updated one or more target network units
  • the processing module is further used to:
  • data in the storage space corresponding to the storage address is updated.
  • the processing module before determining, according to the target mapping relationship, one or more target network units corresponding to the target word vector and the storage addresses of the one or more target network units, the processing module is further used to:
  • the second target mapping relationship includes a plurality of word vectors and a network unit corresponding to each word vector;
  • the second target mapping relationship is modified according to the modification information to obtain the target mapping relationship.
  • the modification information is used to indicate at least one of the following:
  • mapping relationship included in the second target mapping relationship, wherein the mapping relationship is a word vector and a network unit corresponding to the word vector.
  • the processing module before determining, according to the target mapping relationship, one or more target network units corresponding to the target word vector and the storage addresses of the one or more target network units, the processing module is further used to:
  • the network unit corresponding to the target word vector in the second target mapping relationship is increased to obtain the target mapping relationship.
  • the target mapping relationship includes multiple word units and a network unit corresponding to each word unit, and the processing module is further used to:
  • network units corresponding to some word units are determined from multiple word units included in the target mapping relationship, and the network units corresponding to the some word units in the neural network after convergence are used to construct a target neural network; the target neural network is used to perform model inference.
  • an embodiment of the present application provides a data processing device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform any optional method as described in the first aspect above.
  • an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored.
  • the computer-readable storage medium is run on a computer, the computer executes the above-mentioned first aspect and any optional method.
  • an embodiment of the present application provides a computer program product, including code, which, when executed, is used to implement the above-mentioned first aspect and any optional method.
  • the present application provides a chip system, which includes a processor for supporting a data processing device to implement the functions involved in the above aspects, such as sending or processing the data involved in the above methods; or information.
  • the chip system also includes a memory, which is used to store program instructions and data necessary for executing the device or training the device.
  • the chip system can be composed of chips, or it can include chips and other discrete devices.
  • FIG1 is a schematic diagram of a structure of an artificial intelligence main framework
  • FIG2 is a schematic diagram of the application system framework of the present invention.
  • FIG3 is a schematic diagram of the application system framework of the present invention.
  • FIG4A is a schematic diagram of a network structure
  • FIG4B is a schematic diagram of a network structure
  • FIG5 is a flow chart of a data processing method
  • FIG6 is a flowchart of a data processing method
  • FIG7 is a flow chart of a data processing method
  • FIG8 is a flow chart of a data processing method
  • FIG9 is a flow chart of a data processing method
  • FIG10 is a flow chart of a data processing method
  • FIG11 is a flow chart of a data processing method
  • FIG12 is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application.
  • FIG13 is a schematic diagram of an execution device provided in an embodiment of the present application.
  • FIG14 is a schematic diagram of a training device provided in an embodiment of the present application.
  • FIG. 15 is a schematic diagram of a chip provided in an embodiment of the present application.
  • Figure 1 shows a structural diagram of the main framework of artificial intelligence.
  • the following is an explanation of the above artificial intelligence theme framework from the two dimensions of "intelligent information chain” (horizontal axis) and “IT value chain” (vertical axis).
  • the "intelligent information chain” reflects a series of processes from data acquisition to processing. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has undergone a condensation process of "data-information-knowledge-wisdom".
  • the "IT value chain” reflects the value that artificial intelligence brings to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecology process of the system.
  • the infrastructure provides computing power support for the artificial intelligence system, enables communication with the outside world, and is supported by the basic platform. It communicates with the outside world through sensors; computing power is provided by smart chips (CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips); the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.
  • smart chips CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips
  • the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc.
  • sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.
  • the data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence.
  • the data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.
  • Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
  • machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
  • Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.
  • Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.
  • some general capabilities can be further formed based on the results of the data processing, such as an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
  • Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical applications. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
  • the embodiments of the present application can be applied to the field of information recommendation, and the scenarios include but are not limited to scenarios involving e-commerce product recommendations, search engine result recommendations, application market recommendations, music recommendations, video recommendations, etc.
  • the recommended items in various application scenarios can also be referred to as "objects" to facilitate subsequent descriptions, that is, in different recommendation scenarios, the recommended object can be an APP, or a video, or music, or a certain product (such as the presentation interface of an online shopping platform, which will display different products for presentation according to different users, which can actually be presented through the recommendation results of a recommendation model).
  • These recommendation scenarios usually involve user behavior log collection, log data preprocessing (for example, quantization, sampling, etc.), sample set training to obtain a recommendation model, and analysis and processing of the objects involved in the scenario corresponding to the training sample items (such as APP, music, etc.) according to the recommendation model.
  • the samples selected in the recommendation model training link come from the operation behavior of users in the mobile application market for the recommended APP, and the recommendation model trained thereby is applicable to the above-mentioned mobile APP application market, or can be used in the APP application market of other types of terminals to recommend terminal APPs.
  • the recommendation model will eventually calculate the recommendation probability or score of each recommended object.
  • the recommendation system selects the recommendation results according to certain selection rules, such as sorting them by recommendation probability or score, presenting them to users through corresponding applications or terminal devices, and users operating on the objects in the recommendation results to generate user behavior logs.
  • a recommendation request is triggered.
  • the recommendation system inputs the request and its related feature information into the deployed recommendation model, and then predicts the user's click-through rate for all candidate objects. Subsequently, the candidate objects are sorted in descending order according to the predicted click-through rate, and the candidate objects are displayed in order in different positions as the recommendation results for the user.
  • the user browses the displayed items and performs user behaviors, such as browsing, clicking, and downloading. These user behaviors will be stored in the log as training data, and the parameters of the recommendation model will be updated from time to time through the offline training module to improve the recommendation effect of the model.
  • the recommendation module of the app market predicts the possibility of the user downloading each given candidate application based on the user's historical download records, user click records, the application's own characteristics, time, location and other environmental characteristics. Based on the prediction results, the app market displays them in descending order of likelihood to increase the probability of application download. Specifically, applications that are more likely to be downloaded are ranked at the front, and applications that are less likely to be downloaded are ranked at the back.
  • the user's behavior will also be stored in the log and the parameters of the prediction model will be trained and updated through the offline training module.
  • Lifelong companions can record past events of users based on system data and application data, understand the user's current intentions, predict the user's future actions or behaviors, and ultimately realize intelligent services.
  • the user's behavior data including end-side text messages, photos, email events, etc.
  • a user portrait system is built, and on the other hand, a learning and memory module based on user information filtering, association analysis, cross-domain recommendations, causal reasoning, etc. is implemented to build a user's personal knowledge graph.
  • an embodiment of the present invention provides a recommendation system architecture 200 .
  • the data collection device 260 is used to collect samples.
  • a training sample can be composed of multiple feature information (or described as attribute information, such as user attributes and item attributes).
  • feature information can specifically include user feature information, object feature information and label features.
  • User feature information is used to characterize the characteristics of the user, such as gender, age, occupation, hobbies, etc.
  • Object feature information is used to characterize the characteristics of the object pushed to the user.
  • Different recommendation systems correspond to different objects, and the types of features that need to be extracted from different objects are also different.
  • the object features extracted from the training samples of the APP market can be the name (logo), type, size, etc.
  • the object features mentioned in the training samples of the e-commerce APP can be the name of the product, the category it belongs to, the price range, etc.; the label feature is used to indicate whether the sample is a positive example or a negative example.
  • the label feature of the sample can be obtained through the user's operation information on the recommended object.
  • the sample in which the user operates the recommended object is a positive example, and the sample in which the user does not operate the recommended object or only browses the recommended object is a negative example.
  • the label feature is 1, indicating that the sample is a positive example, and if the user does not perform any operation on the recommended object, the label feature is 1, indicating that the sample is a positive example. operation, the label feature is 0, indicating that the sample is a negative example.
  • the sample can be stored in the database 230.
  • Some or all of the feature information in the sample in the database 230 can also be directly obtained from the client device 240, such as user feature information, user operation information on the object (used to determine the type identification), object feature information (such as object identification), etc.
  • the training device 220 obtains a model parameter matrix based on sample training in the database 230 for generating the recommendation model 201.
  • the recommendation model 201 can be used to evaluate a large number of objects to obtain the scores of each object to be recommended. Further, a specified or preset number of objects can be recommended from the evaluation results of a large number of objects.
  • the calculation module 211 obtains the recommendation result based on the evaluation result of the recommendation model 201 and recommends it to the client device through the I/O interface 212.
  • the training device 220 can select positive and negative samples from the sample set in the database 230 and add them to the training set, and then use the recommendation model to train the samples in the training set to obtain a trained recommendation model; the implementation details of the calculation module 211 can refer to the detailed description of the method embodiment shown in Figure 5.
  • the recommendation model 201 is sent to the execution device 210, or the model parameter matrix is directly sent to the execution device 210, and the recommendation model is constructed in the execution device 210 for making recommendations for the corresponding system.
  • the recommendation model obtained based on video-related sample training can be used to recommend videos to users on video websites or APPs
  • the recommendation model obtained based on APP-related sample training can be used to recommend APPs to users in the application market.
  • the execution device 210 is configured with an I/O interface 212 for data exchange with external devices.
  • the execution device 210 can obtain user feature information, such as user identification, user identity, gender, occupation, hobbies, etc., from the client device 240 through the I/O interface 212. This part of information can also be obtained from the system database.
  • the recommendation model 201 recommends target recommendation objects to the user based on the user feature information and the feature information of the recommended object.
  • the execution device 210 can be set in a cloud server or in a user client.
  • the execution device 210 can call data, codes, etc. in the data storage system 250, and can also store output data in the data storage system 250.
  • the data storage system 250 can be set in the execution device 210, or can be set independently, or can be set in other network entities, and the number can be one or more.
  • the calculation module 211 uses the recommendation model 201 to process the user characteristic information and the characteristic information of the object to be recommended. For example, the calculation module 211 uses the recommendation model 201 to analyze and process the user characteristic information and the characteristic information of the object to be recommended, so as to obtain the score of the object to be recommended, and sort the objects to be recommended according to the scores, wherein the objects with higher rankings will be recommended to the client device 240.
  • the I/O interface 212 returns the recommendation result to the client device 240 for presentation to the user.
  • the training device 220 can generate corresponding recommendation models 201 based on different sample feature information for different goals to provide users with better results.
  • FIG2 is only a schematic diagram of a system architecture provided by an embodiment of the present invention.
  • the positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation.
  • the data storage system 250 is an external memory relative to the execution device 210. In other cases, the data storage system 250 can also be placed in the execution device 210.
  • the training device 220, the execution device 210, and the client device 240 may be three different physical devices respectively. It is also possible that the training device 220 and the execution device 210 are on the same physical device or a cluster. It is also possible that the execution device 210 and the client device 240 are on the same physical device or a cluster.
  • the execution device 210 is implemented by one or more servers, and optionally cooperates with other computing devices, such as data storage, routers, load balancers and other devices; the execution device 210 can be arranged at one physical site, or distributed at multiple physical sites.
  • the execution device 210 can use the data in the data storage system 250, or call the program code in the data storage system 250 to implement the object recommendation function.
  • the information of the object to be recommended is input into the recommendation model, and the recommendation model generates an estimated score for each object to be recommended, and then sorts them in order from high to low according to the estimated scores, and recommends the object to be recommended to the user according to the sorting results. For example, the first 10 objects in the sorting results are recommended to the user.
  • the data storage system 250 is used to receive and store the parameters of the recommendation model sent by the training device, as well as the data for storing the recommendation results obtained by the recommendation model. Of course, it may also include the program code (or instructions) required for the normal operation of the storage system 250.
  • the data storage system 250 can be a distributed storage cluster composed of one or more devices deployed outside the execution device 210. At this time, when the execution device 210 needs to use the data on the storage system 250, the storage system 250 can send the data required by the execution device to the execution device 210, and accordingly, the execution device 210 receives and stores (or caches) the data.
  • the data storage system 250 can also Deployed in the execution device 210, when deployed in the execution device 210, the distributed storage system may include one or more memories. Optionally, when there are multiple memories, different memories are used to store different types of data. For example, the model parameters of the recommendation model generated by the training device and the data of the recommendation results obtained by the recommendation model can be stored in two different memories respectively.
  • Each local device can represent any computing device, such as a personal computer, a computer workstation, a smart phone, a tablet computer, a smart camera, a smart car or other type of cellular phone, a media consumption device, a wearable device, a set-top box, a game console, etc.
  • the local device of each user can interact with the execution device 210 through a communication network of any communication mechanism/communication standard.
  • the communication network can be a wide area network, a local area network, a point-to-point connection, etc., or any combination thereof.
  • the execution device 210 may be implemented by a local device.
  • the local device 301 may implement the recommendation function of the execution device 210 based on the recommendation model to obtain user feature information and feedback the recommendation result to the user, or provide services to the user of the local device 302.
  • CTR Click-throughrate
  • Click probability also known as click-through rate
  • Click-through rate refers to the ratio of the number of clicks and exposures of recommended information (for example, recommended items) on a website or application. Click-through rate is usually an important indicator in the recommendation system.
  • a personalized recommendation system refers to a system that uses a machine learning algorithm to analyze the user's historical data (such as the operation information in the embodiment of the present application), and uses this to predict new requests and provide personalized recommendation results.
  • Offline training refers to a module in a personalized recommendation system that iteratively updates the recommendation model parameters according to the machine learning algorithm based on the user's historical data (such as the operation information in the embodiment of the present application) until the set requirements are met.
  • Online prediction refers to predicting the user's preference for the recommended item in the current context based on the offline trained model according to the characteristics of the user, item and context, and predicting the probability of the user selecting the recommended item.
  • FIG4A is a schematic diagram of a recommendation system provided in an embodiment of the present application.
  • the recommendation system will input the request and related information (such as the operation information in the embodiment of the present application) into the recommendation model, and then predict the user's selection rate for items in the system. Further, the items are sorted in descending order according to the predicted selection rate or a function based on the selection rate, that is, the recommendation system can display the items in different positions in sequence as recommendation results for the user.
  • the user browses items in different positions and performs user behaviors, such as browsing, selecting, and downloading. At the same time, the user's actual behavior will be stored in the log as training data, and the parameters of the recommendation model will be continuously updated through the offline training module to improve the prediction effect of the model.
  • a user can trigger the recommendation system in the application market by opening the application market in a smart terminal (e.g., a mobile phone).
  • the recommendation system in the application market will predict the probability of the user downloading each recommended candidate APP based on the user's historical behavior log, such as the user's historical download records, user selection records, and the application market's own characteristics, such as time, location and other environmental feature information.
  • the recommendation system in the application market can display the candidate APPs in descending order according to the predicted probability values, thereby increasing the download probability of the candidate APPs.
  • an APP with a higher predicted user selection rate may be displayed in a front recommended position, and an APP with a lower predicted user selection rate may be displayed in a back recommended position.
  • the above-mentioned recommendation model may be a neural network model.
  • the following introduces the relevant terms and concepts of the neural network that may be involved in the embodiments of the present application.
  • a neural network may be composed of neural units, and a neural unit may refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input, and the output of the operation unit may be:
  • n is a natural number greater than 1
  • Ws is the weight of xs
  • b is the bias of the neural unit.
  • f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal.
  • the output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function.
  • a neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit.
  • the input of each neural unit can be connected to the local receptive field of the previous layer to extract the characteristics of the local receptive field.
  • the local receptive field can be an area composed of several neural units.
  • Deep Neural Network also known as multi-layer neural network
  • DNN Deep Neural Network
  • the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer.
  • the first layer is the input layer
  • the last layer is the output layer
  • the layers in between are all hidden layers.
  • the layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer.
  • the coefficients from the kth neuron in the L-1th layer to the jth neuron in the Lth layer are defined as It should be noted that the input layer does not have a W parameter.
  • W the weight parameter
  • more hidden layers allow the network to better describe complex situations in the real world. Theoretically, the more parameters a model has, the higher its complexity and the greater its "capacity", which means it can complete more complex learning tasks.
  • Training a deep neural network is the process of learning the weight matrix, and its ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (a weight matrix formed by many layers of vectors W).
  • the error back propagation (BP) algorithm can be used to correct the size of the parameters in the initial model during the training process, so that the error loss of the model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the parameters in the initial model are updated by back propagating the error loss information, so that the error loss converges.
  • the back propagation algorithm is a back propagation movement dominated by error loss, aiming to obtain the optimal model parameters, such as the weight matrix.
  • the parameters of the machine learning model are trained through optimization methods such as gradient descent, and finally the trained model is used to complete the prediction of unknown data.
  • a system that uses machine learning algorithms to analyze and build models based on historical user data, and uses this to predict new user requests and provide personalized recommendation results.
  • Hybrid experts In a neural network, each linear layer is regarded as an expert. Multiple linear layers are parallelized, and one or more of them is The outputs of several experts are weighted averaged and the results are output to the next layer.
  • Computational graph A computational graph structure constructed by the operations described by the user through the deep neural network framework. It usually describes the entire deep neural network calculation process, including forward propagation, back propagation, and parameter update.
  • Memory network Convert the input into a vector internal to the network and store the vector in the memory matrix.
  • Routing A function that controls the mapping relationship between input data and a certain network module.
  • Continuous learning also known as lifelong learning, is a research direction for solving such problems. Its goal is to expand the adaptability of the model so that the model can learn knowledge of different tasks at different times without forgetting the characteristics of previous tasks.
  • Page table A data structure that can be used to record the mapping relationship between two types of data. It is usually used to convert virtual addresses into physical addresses.
  • a hierarchical page table is also a type of page table.
  • the page table is stored in a storage medium.
  • the base address of the page table also referred to as the page table base address, refers to the starting address of the physical address storing the page table.
  • the size of the page table determines the value range of the virtual address corresponding to the page table.
  • the virtual address in the page table is the virtual address of the instance or device using the page table, which is used to indicate the offset of the physical address of a certain position (or a certain table entry) in the page table relative to the page table base address.
  • the data stored at a certain position in the page table is the physical address in the physical address space of the instance or device using the page table.
  • a page table includes multiple table entries, each of which can indicate the mapping relationship between a virtual address and a physical address. It should be understood that the table entry mentioned here is a functional description, and the specific implementation method of the table entry is not limited in this application. For example, the mapping relationship between a virtual address and a physical address may be cross-level, and the mapping relationship between a virtual address and a physical address may also be indirect.
  • the page table in this application can specifically be a multi-level page table.
  • FIG. 4B is a schematic diagram of the architecture of a transformer layer.
  • the neural network includes an embedding layer and at least one transformer layer, and the at least one transformer layer can be N transformer layers (N is an integer greater than 0), wherein each transformer layer includes an attention layer, an add&norm layer, a feed forward layer, and an add&norm layer that are adjacent in sequence.
  • the current input is embedded to obtain multiple feature vectors;
  • P input vectors are obtained from the previous layer of the transformer layer, and the first input vector among the P input vectors is taken as the center, and the intermediate vector corresponding to the first input vector is obtained based on the correlation between each input vector within the preset attention window range and the first input vector, so as to determine the P intermediate vectors corresponding to the P input vectors;
  • the P intermediate vectors are merged into Q output vectors, wherein the multiple output vectors obtained by the last transformer layer in at least one transformer layer are used as the feature representation of the current input.
  • the current input is embedded to obtain multiple feature vectors.
  • the embedding layer may be referred to as an input embedding layer.
  • the current input may be a text input, such as a paragraph of text or a sentence.
  • the text may be a Chinese text, an English text, or a text in another language.
  • the embedding layer may embed each word in the current input, and obtain a feature vector of each word.
  • the embedding layer includes an input embedding layer and a positional encoding layer.
  • each word in the current input may be subjected to word embedding processing, thereby obtaining a word embedding vector of each word.
  • the position of each word in the current input may be obtained, and then a position vector may be generated for the position of each word.
  • the position of each word may be the absolute position of each word in the current input. Taking the current input as “How many numbers should I return Huabei” as an example, the position of “how many” may be represented as the first position, the position of “number” may be represented as the second position, and so on. In some examples, the position of each word may be the relative position between each word. Still taking the current input of "repayment due on which date” as an example, the position of "how many” can be expressed as before “number”, the position of "number” can be expressed as after "how many” and before “should”, etc.
  • the position vector of each word and the corresponding word embedding vector can be combined to obtain the feature vector of each word, that is, to obtain multiple feature vectors corresponding to the current input.
  • Multiple feature vectors can be represented as an embedding matrix with a preset dimension. The number of feature vectors in the multiple feature vectors can be set to M, and the preset dimension can be H, then the multiple feature vectors can be represented as an M ⁇ H embedding matrix.
  • P input vectors are obtained from the previous layer of the first transformer layer. Taking any first input vector among the P input vectors as the center, based on the correlation between each input vector within the preset attention window range and the first input vector, the intermediate vector corresponding to the first input vector is obtained, and thus the P intermediate vectors corresponding to the P input vectors are determined.
  • the attention layer can also be called a multi-head attention layer. In one example, the attention layer can be a fixed window multi-head attention layer. multi-head attention) layer.
  • the first transformer layer may be the next layer of the above-mentioned embedding layer, and the P input vectors are the multiple feature vectors obtained from the embedding layer.
  • at least one transformer layer in the neural network provided in the embodiments of this specification also includes a second transformer layer.
  • the second transformer layer is the previous layer of the first self-attention, and the P input vectors are the P output vectors output by the second transformer layer.
  • the multiple output vectors obtained through the above steps can be used as a feature representation of the current input.
  • the feature representation is a feature representation of the current input suitable for computer processing.
  • the attention mechanism imitates the internal process of biological observation behavior, that is, a mechanism that aligns internal experience and external sensations to increase the observation precision of some areas, and can use limited attention resources to quickly filter out high-value information from a large amount of information.
  • the attention mechanism can quickly extract important features of sparse data, and is therefore widely used in natural language processing tasks, especially machine translation.
  • the self-attention mechanism is an improvement on the attention mechanism, which reduces dependence on external information and is better at capturing the internal correlation of data or features.
  • the essential idea of the attention mechanism can be rewritten as the following formula:
  • Lx
  • represents the length of Source.
  • the formula means that the elements in Source are imagined to be composed of a series of data pairs. At this time, given a certain element Query in the target Target, by calculating the similarity or correlation between Query and each Key, the weight coefficient of the Value corresponding to each Key is obtained, and then the Value is weighted and summed to obtain the final Attention value. Therefore, the Attention mechanism is essentially a weighted sum of the Value values of the elements in Source, and Query and Key are used to calculate the weight coefficient of the corresponding Value.
  • Attention can be understood as selectively filtering out a small amount of important information from a large amount of information and focusing on these important information, ignoring most of the unimportant information.
  • the focusing process is reflected in the calculation of the weight coefficient.
  • the self-attention mechanism can be understood as internal Attention (intra attention).
  • the Attention mechanism occurs between the Query element of the Target and all the elements in the Source.
  • the specific calculation process is the same, but the calculation object has changed.
  • Another problem with this core issue is how to design and train such a costly model to fully realize its value, and at the beginning of the design, it is necessary to prepare for possible unknown usage scenarios in the future, because such a costly model cannot be retrained over and over again, so there needs to be some form that can save the results of previous training and be able to prepare for possible usage scenarios in the future.
  • a large-scale model can be divided into multiple network units. Corresponding network units are set for different input samples (such as different word vectors). When a certain input sample is used for model training, only the network unit corresponding to the input sample among the multiple network units is updated, and the updated network unit will be stored so that it can be called at the next update.
  • the present application provides a data processing method.
  • FIG. 5 is a schematic diagram of an embodiment of a data processing method provided in an embodiment of the present application.
  • a data processing method provided in an embodiment of the present application includes:
  • the target mapping relationship determine one or more target network units corresponding to the target word vector token and the storage address of the one or more target network units, and the storage space corresponding to the storage address is located in the storage space outside the computing unit.
  • the execution subject of step 501 may be a terminal device, and the terminal device may be a portable mobile device, such as but not limited to a mobile or portable computing device (such as a smart phone), a personal computer, a server computer, a handheld device (such as a tablet) or a laptop device, a multi-processor system, a game console or controller, a microprocessor-based system, a set-top box, a programmable consumer electronic product, a mobile phone, a mobile computing and/or communication device with a wearable or accessory form factor (such as a watch, glasses, a headset or an earplug), or a wearable or accessory form factor (such as a watch, glasses, a headset or an earplug).
  • devices network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like.
  • the execution entity of step 501 may be a server on the cloud side.
  • the target network unit is a feed forward network FFN, and the target network unit may also be referred to as an expert network in the embodiment of the present application.
  • a mapping relationship between different training samples (word vector tokens) and target network units can be pre-constructed.
  • word vector tokens word vector tokens
  • target network units or it can be called a multi-value mapping table or a multi-level mapping table
  • the network structure at the location of the target network unit in the large-scale network can be set to the network unit or a combination of network units indicated in the mapping relationship.
  • the target mapping relationship may include a first target mapping relationship and a second target mapping relationship
  • the first target mapping relationship may indicate a mapping relationship between a word vector and a network unit, specifically a mapping relationship between a word vector and an identification ID corresponding to the network unit.
  • Identification used to distinguish one or a thing from other similar or different things. For example, a node identifier, a network identifier, a network card identifier.
  • the identifier can be a name, a number, or a distinguishing feature, such as a type identifier.
  • the present application does not limit the implementation of various identifiers, as long as a distinction can be made.
  • mapping relationship between training samples (word vector tokens) and network units is constructed by hashing. Since one training sample in the hash can only correspond to one unique network unit, and since there is a numerical range limit in the hash, as the number of training samples increases, a large number of different training samples may correspond to the same network unit, which affects the accuracy of the trained model.
  • the mapping relationship between training samples (word vector tokens) and network units is recorded in a mapping table, so that one training sample can correspond to multiple network units, and since there is no numerical range limit, a large number of different training samples will not correspond to the same network unit, thereby increasing the accuracy of the trained model.
  • a large-scale network (such as Pangu alpha or FFN in Transformer) can be replaced with the storage unit in Figure 6, that is, several experts arranged in parallel.
  • the grouping of these experts is determined by a multi-value mapping table.
  • Each multi-value mapping table is composed of many key-value pairs.
  • the words (tokens) in the vocabulary constitute the key of the multi-value mapping table, and the value is the ID number of the expert, such as E1 to E11 in the figure.
  • the control module can dynamically extract the computing units that need to be calculated from the storage unit according to the data of the data unit for efficient calculation.
  • the grouping is determined by the user when constructing the multi-value mapping table.
  • a multi-injection mapping table as shown in Figure 7 can be constructed.
  • the user first determines the number of groups G that need to be modeled, as well as the number of experts K_g initialized for each group.
  • For the tokens in the vocabulary, which group or groups they belong to is determined by the user.
  • the user can group the tokens according to the language to which they belong, with Chinese as one expert group and English as another expert group. Some tokens belong to two expert groups, such as some Arabic numerals.
  • the number of experts in each group is also fixed.
  • the tokens belonging to this expert group can be assigned to the experts through a certain function, such as randomly or sequentially.
  • the computing unit is a graphics processing unit GPU, a tensor processing unit TPU or a neural network processor NPU.
  • the target mapping relationship includes a first target mapping relationship
  • the first target mapping relationship indicates multiple word vectors and one or more network units corresponding to each word vector
  • the first target mapping relationship is specifically a mapping table.
  • the target mapping relationship may further include a third target mapping relationship, and the third target mapping relationship indicates the storage location of each network element.
  • the storage location may be represented by a physical address or a virtual address corresponding to the storage space, and the corresponding physical address may be uniquely determined based on the virtual address, for example, the address may include a starting address and an offset.
  • the target network unit in the large-scale model is stored in a storage location outside the computing unit, when the current training sample is the corresponding word vector, the corresponding one or more target network units are extracted from the storage location outside the computing unit. Since the storage space of the storage location outside the computing unit can be set larger, the size of the large-scale model itself can be increased through storage and computing separation, and the scalability and flexibility of the large-scale model can be increased.
  • the above target mapping relationship can be modified by a user.
  • modification information from the user regarding a second target mapping relationship may also be received, wherein the second target mapping relationship includes multiple word vectors and a network unit corresponding to each word vector; the second target mapping relationship is modified according to the modification information to obtain the target mapping relationship.
  • the modification information can be used to modify the network unit corresponding to a word vector in the second target mapping relationship, or to modify the correspondence between the word vector and the network unit.
  • the modification information is used to indicate at least one of the following: deletion, replacement or addition of a network unit corresponding to at least one word vector in the second target mapping relationship; deletion, replacement or addition of a mapping relationship included in the second target mapping relationship, wherein the mapping relationship is a word vector and a network unit corresponding to the word vector.
  • system can also modify the mapping relationship based on the model training situation.
  • the structure of the neural network can be changed by adding network units so that the training loss can continue to decrease), the network units corresponding to the target word vector in the second target mapping relationship can be added to obtain the target mapping relationship.
  • the capacity expansion and deletion of the memory network can be supported in this embodiment, and the effect of continuous learning can be achieved at the same time.
  • Continuous learning refers to the technology that the model can continue to learn new data after learning data for a period of time, which can avoid the knowledge learned previously from being forgotten, and can learn new knowledge at the same time.
  • Step 1 Training reads whether the mapping table is modified from the configuration file. If there is a modification, the multi-value mapping table and the corresponding storage unit are modified according to the configuration.
  • This configuration is very flexible. It can be an expansion of the same expert group, such as the expansion of expert group E4 in the figure, or it can be an expansion of a new expert group, such as the expansion of expert group 3 in the figure. Then continue training.
  • Step 2 Read the amplification threshold K in the configuration file, and for each expert group's loss, always record the minimum loss value. If the minimum value has not been updated for K consecutive steps, it is considered that the model loss has no longer decreased, and go to step 3. Otherwise, continue training.
  • Step 3 After the conditions of step 2 are met, modify the multi-value mapping table for the expert group corresponding to the loss that does not decrease. Assuming that the original expert group is M experts, add a new mapping expert to the experts mapped to 1/M tokens in the multi-value mapping table according to a certain rule, as shown in E4 in the figure. This rule can be the most frequent 1/M tokens, or randomly select 1/M tokens.
  • Step 4 The framework adjusts the computational graph in real time, allocates new storage space to the newly added expert E4, and continues training.
  • the memory module of the model can be scaled to expand and tailor the model capacity for different scenarios.
  • the one or more target network units from the storage space corresponding to the storage address; the one or more target network units are used to construct a neural network.
  • the one or more target network units can be obtained from the storage space corresponding to the storage address, and the one or more target network units can be used to construct a neural network. Specifically, one or more target network units can be used to construct a network structure corresponding to the position of the target network unit.
  • FIG. 8 A schematic diagram of the specific process can be shown in Figure 8 below, which mainly consists of the following steps:
  • Step 1 When an iteration of training begins, the control module reads the data of this iteration.
  • Step 2 Based on the data read in the previous step, use the data as the key in the multi-value mapping table to find the corresponding expert number.
  • Step 3 There are two steps. First, find the memory address of the corresponding expert according to the expert number found in the previous step. Then, in 3.2, extract the experts to be used or freeze the unused experts according to the found memory address. This extraction can be to build a calculation subgraph in a new memory space and copy the corresponding experts in the storage unit to the new calculation space, or to use a virtual memory mapping in the storage unit to manage the corresponding experts in the storage unit as calculation units. This freezing will propagate the freezing operation from the calculation graph to the corresponding reverse calculation nodes and optimizer update nodes, ensuring that the experts who do not need to be calculated in this round do not need to participate in the calculation of the forward, reverse and optimizer updates.
  • the computing unit executes a training process corresponding to the neural network.
  • the training process corresponding to the target neural network is executed by the computing unit to obtain an updated target neural network, and the updated target neural network includes the updated one or more target network units. According to the updated one or more target network units, the data in the storage space corresponding to the storage address is updated for the next call.
  • an optional implementation step of the embodiment of the present application may include:
  • Step 4 Use the computing unit constructed in the previous step to perform actual calculations on the data read in step 1 and the corresponding experts, forward-propagate the loss, perform reverse calculations, and update the expert parameters with the optimizer.
  • Step 5 Synchronize the updated expert parameters in the computing unit with the corresponding expert parameters in the storage unit.
  • the idea behind the above steps is to find out the sparse expert memory units, that is, the experts in the storage units, through memory management, and ensure that only these activated experts are calculated.
  • the rest that do not need to be calculated do not participate in any forward, backward, or optimizer update calculations, ensuring that the sparse memory network has no redundancy in calculations, thereby improving training efficiency.
  • the target mapping relationship includes multiple word units and a network unit corresponding to each word unit.
  • the network units corresponding to some word units can also be determined from the multiple word units included in the target mapping relationship based on the neural network after convergence.
  • the network units corresponding to some word units in the neural network after convergence are used to construct a target neural network; the target neural network is used to perform model inference.
  • the above process can be called sub-model extraction, and an exemplary process can be shown in FIG. 10 .
  • the embodiment of the present application proposes a new type of scalable memory network design and its efficient training algorithm. It ensures that while a large model composed of such network modules can be efficiently trained, the model can obtain continuous learning capabilities through the expansion and contraction of the memory module, ensuring that the model is always in the latest knowledge state.
  • the system architecture is shown in Figure 11 below:
  • the first is the multi-value mapping table.
  • This module is the feasible data structure basis of this patent. Unlike the hash mentioned in the above related work, mapping is a directly stored key-value pair relationship. It does not need to be mapped to a fixed index range through a hash function, so there is no collision problem. This determines that the relationship constructed with the mapping data structure will not lose key information.
  • the multi-value mapping used here is to build a mapping pair of a key value and a set. The set can contain any number of elements, which ensures that our mapping relationship is not just a single one.
  • the multi-value mapping table in this patent supports multiple operations, such as search, insertion, deletion and other modifications. These operations cooperate with the control module to be described below to realize the training algorithm and lifelong learning algorithm described in our patent.
  • the second is the control module.
  • the control module is shown as the dotted control module in the figure below.
  • the control module is the core of this system and has two main functions:
  • One is a function designed to complete lifelong learning capabilities. After the control module obtains information from the loss or a certain metric function, if it determines that the number of memory networks needs to be increased, the algorithm enters the "yes" branch, and the storage control unit first modifies the multi-value mapping table, adds or deletes the key-value pairs in the mapping, and then the storage control unit opens up or releases the corresponding memory space in the storage subgraph part.
  • the algorithm will go to the "no" branch.
  • the routing of the control module can read the data of the current data unit, query the mapping relationship in the multi-value mapping table, and know the number of the memory network that needs to be calculated this time.
  • the calculation control module will extract the subgraph that needs to be calculated in some way, which can be pulling, building a new subgraph, or freezing the uncalculated part in the local storage subgraph to ensure that only the part that needs to be calculated is calculated. And this operation will be propagated to all relevant calculation parts of the calculation graph. In large-scale distributed scenarios, the corresponding gradient transmission will not be performed, thereby greatly reducing the calculation and communication volume of the entire model.
  • the third is the memory network module. It is the storage unit and computing unit in the figure.
  • the memory module is composed of linear networks, usually more than one linear network.
  • Each linear network has a number, such as A, B, C, D in the figure, which is used to distinguish different linear networks. This number is also the value element in the key-value pair in the multi-value mapping table.
  • the control device can find the address of the corresponding memory network through this value, and extract, copy, delete, add and other operations on the corresponding network.
  • Each network memorizes the current layer features corresponding to the current state training entity.
  • the fourth is the data unit, which can be training data or some encoded intermediate results.
  • a data processing device 1200 provided by an embodiment of the present application includes:
  • the processing module 1201 is used to determine one or more target network units corresponding to the target word vector token and the storage addresses of the one or more target network units according to the target mapping relationship, and the storage space corresponding to the storage address is located in the storage space outside the computing unit;
  • the one or more target network units are used to construct a neural network
  • processing module 1201 For the specific description of the processing module 1201 , reference may be made to the introduction of step 501 and step 502 in the above embodiment, which will not be repeated here.
  • the model training module 1202 is used to execute the training process corresponding to the neural network through the computing unit according to the target word vector.
  • model training module 1202 for the specific description of the model training module 1202, please refer to the introduction of step 503 in the above embodiment, which will not be repeated here.
  • the computing unit is a graphics processing unit GPU, a tensor processing unit TPU, or a neural network processor NPU.
  • the storage space corresponding to the storage address is located in a memory, a network storage, or a hard disk.
  • the target mapping relationship includes a first target mapping relationship
  • the first target mapping relationship indicates multiple word vectors and one or more network units corresponding to each word vector
  • the first target mapping relationship is specifically a mapping table.
  • the training process corresponding to the target neural network is performed by the computing unit to obtain an updated target neural network
  • the updated target neural network includes the updated one or more target network units
  • the processing module is further used to:
  • data in the storage space corresponding to the storage address is updated.
  • the processing module before determining, according to the target mapping relationship, one or more target network units corresponding to the target word vector and the storage addresses of the one or more target network units, the processing module is further used to:
  • the second target mapping relationship includes a plurality of word vectors and a network unit corresponding to each word vector;
  • the second target mapping relationship is modified according to the modification information to obtain the target mapping relationship.
  • the modification information is used to indicate at least one of the following:
  • mapping relationship included in the second target mapping relationship, wherein the mapping relationship is a word vector and a network unit corresponding to the word vector.
  • the processing module before determining, according to the target mapping relationship, one or more target network units corresponding to the target word vector and the storage addresses of the one or more target network units, the processing module is further used to:
  • the network unit corresponding to the target word vector in the second target mapping relationship is increased to obtain the target mapping relationship.
  • the target mapping relationship includes multiple word units and a network unit corresponding to each word unit, and the processing module is further used to:
  • network units corresponding to some word units are determined from multiple word units included in the target mapping relationship, and the network units corresponding to the some word units in the neural network after convergence are used to construct a target neural network; the target neural network is used to perform model inference.
  • FIG. 13 is a schematic diagram of a structure of an execution device provided in an embodiment of the present application.
  • the execution device 1300 can be specifically manifested as a mobile phone, a tablet, a laptop computer, a smart wearable device, a server, etc., which is not limited here. Among them, the execution device 1300 implements the function of the image processing method in the embodiment corresponding to FIG. 10.
  • the execution device 1300 includes: a receiver 1301, a transmitter 1302, a processor 1303 and a memory 1304 (wherein the processor in the execution device 1300 is The number of processors 1303 may be one or more), wherein the processor 1303 may include an application processor 13031 and a communication processor 13032.
  • the receiver 1301, the transmitter 1302, the processor 1303 and the memory 1304 may be connected via a bus or other means.
  • the memory 1304 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1303. A portion of the memory 1304 may also include a non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 1304 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
  • the processor 1303 controls the operation of the execution device.
  • the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc.
  • the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc.
  • various buses are referred to as bus systems in the figure.
  • the method disclosed in the above embodiment of the present application can be applied to the processor 1303, or implemented by the processor 1303.
  • the processor 1303 can be an integrated circuit chip with signal processing capabilities.
  • each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 1303.
  • the above processor 1303 can be a general-purpose processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and a vision processor (vision processing unit, VPU), a tensor processor (tensor processing unit, TPU) and other processors suitable for AI computing, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • the processor 1303 can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.
  • the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
  • the steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc.
  • the storage medium is located in the memory 1304, and the processor 1303 reads the information in the memory 1304, and completes the steps 501 to 503 in the above embodiment in combination with its hardware.
  • the receiver 1301 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device.
  • the transmitter 1302 can be used to output digital or character information through the first interface; the transmitter 1302 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1302 can also include a display device such as a display screen.
  • the present application also provides a training device, please refer to FIG. 14, which is a structural diagram of the training device provided by the present application.
  • the training device 1400 can be the data processing device introduced in the above embodiment.
  • the training device 1400 is implemented by one or more servers.
  • the training device 1400 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1414 (for example, one or more processors) and memory 1432, one or more storage media 1430 (for example, one or more mass storage devices) storing application programs 1442 or data 1444.
  • the memory 1432 and the storage medium 1430 can be short-term storage or permanent storage.
  • the program stored in the storage medium 1430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processor 1414 can be configured to communicate with the storage medium 1430 to execute a series of instruction operations in the storage medium 1430 on the training device 1400.
  • the training device 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input and output interfaces 1458; or, one or more operating systems 1441, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
  • the embodiment of the present application also provides a computer program product including computer-readable instructions, which, when executed on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
  • a computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing.
  • the computer-readable storage medium When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
  • the execution device, training device or terminal device provided in the embodiment of the present application may be a chip, and the chip includes: a processing unit and a communication Unit, the processing unit may be, for example, a processor, and the communication unit may be, for example, an input/output interface, a pin or a circuit, etc.
  • the processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the model training method described in the above embodiment, or so that the chip in the training device executes the steps related to model training in the above embodiment.
  • the storage unit is a storage unit in the chip, such as a register, a cache, etc.
  • the storage unit may also be a storage unit located outside the chip in the wireless access device end, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
  • ROM read-only memory
  • RAM random access memory
  • FIG. 15 is a schematic diagram of a structure of a chip provided in an embodiment of the present application.
  • the chip can be expressed as a neural network processor NPU 1500.
  • NPU 1500 is mounted on the host CPU (Host CPU) as a coprocessor, and tasks are assigned by the Host CPU.
  • the core part of the NPU is the operation circuit 1503, which is controlled by the controller 1504 to extract matrix data from the memory and perform multiplication operations.
  • the operation circuit 1503 includes multiple processing units (Process Engine, PE) inside.
  • the operation circuit 1503 is a two-dimensional systolic array.
  • the operation circuit 1503 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition.
  • the operation circuit 1503 is a general-purpose matrix processor.
  • the operation circuit takes the corresponding data of matrix B from the weight memory 1502 and caches it on each PE in the operation circuit.
  • the operation circuit takes the matrix A data from the input memory 1501 and performs matrix operation with matrix B, and the partial result or final result of the matrix is stored in the accumulator 1508.
  • Unified memory 1506 is used to store input data and output data. Weight data is directly transferred to weight memory 1502 through Direct Memory Access Controller (DMAC) 1505. Input data is also transferred to unified memory 1506 through DMAC.
  • DMAC Direct Memory Access Controller
  • BIU stands for Bus Interface Unit, that is, the bus interface unit 1510, which is used for the interaction between AXI bus and DMAC and instruction fetch buffer (IFB) 1509.
  • IOB instruction fetch buffer
  • the bus interface unit 1510 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 1509 to obtain instructions from the external memory, and is also used for the storage unit access controller 1505 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • BIU Bus Interface Unit
  • DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 1506 or to transfer weight data to the weight memory 1502 or to transfer input data to the input memory 1501.
  • the vector calculation unit 1507 includes multiple operation processing units, which further process the output of the operation circuit when necessary, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as Batch Normalization, pixel-level summation, upsampling of feature planes, etc.
  • the vector calculation unit 1507 can store the processed output vector to the unified memory 1506.
  • the vector calculation unit 1507 can apply a linear function; or a nonlinear function to the output of the operation circuit 1503, such as linear interpolation of the feature plane extracted by the convolution layer, and then, for example, a vector of accumulated values to generate an activation value.
  • the vector calculation unit 1507 generates a normalized value, a pixel-level summed value, or both.
  • the processed output vector can be used as an activation input to the operation circuit 1503, for example, for use in a subsequent layer in a neural network.
  • An instruction fetch buffer 1509 connected to the controller 1504 is used to store instructions used by the controller 1504;
  • Unified memory 1506, input memory 1501, weight memory 1502 and instruction fetch memory 1509 are all on-chip memories. External memories are private to the NPU hardware architecture.
  • the processor mentioned in any of the above places may be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
  • the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
  • the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
  • the technical solution of the present application can essentially or in other words, the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, U disk, mobile hard disk, ROM, RAM, disk or CD, etc., including a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
  • a readable storage medium such as a computer floppy disk, U disk, mobile hard disk, ROM, RAM, disk or CD, etc.
  • all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof.
  • all or part of the embodiments may be implemented in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center.
  • the computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations.
  • the available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
  • a magnetic medium e.g., a floppy disk, a hard disk, a tape
  • an optical medium e.g., a DVD
  • a semiconductor medium e.g., a solid-state drive (SSD)

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Molecular Biology (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Image Analysis (AREA)

Abstract

一种数据处理方法,应用于人工智能领域,方法包括:根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及存储地址,存储地址对应的存储空间位于计算单元之外的存储空间;从存储空间中获取一个或多个目标网络单元;根据目标词向量,通过计算单元执行根据一个或多个目标网络单元构建的神经网络对应的训练过程。本申请中由于大规模模型中的目标网络单元存储在计算单元之外的存储位置,在当前的训练样本为对应的词向量时,从计算单元之外的存储位置中提取对应的一个或多个目标网络单元,由于计算单元之外的存储位置的存储空间可以设置的较大,通过存算分离,可以提高训练时大规模模型自身的大小,并增加大规模模型的可扩展性和灵活度。

Description

一种数据处理方法及相关装置
本申请要求于2022年09月30日提交中国国家知识产权局、申请号为202211214438.0、申请名称为“一种数据处理方法及相关装置”的中国专利申请的优先权。
技术领域
本申请涉及人工智能领域,尤其涉及一种数据处理方法及相关装置。
背景技术
人工智能(artificial intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。
近年来,随着计算芯片技术和大规模计算集群的快速发展,越来越多的大模型开始出现,千亿甚至万亿级别的大模型成为最近甚至未来一段时间的主流技术趋势。但是,大模型最核心的问题在于,训练和使用成本极其高昂,通常需要数百块,甚至几千块GPU、TPU或者NPU芯片等计算单元组成的超大规模集群,计算数周甚至数个月时间,成本以百万至千万美元计。这个核心问题的另一个问题是,成本如此高昂的模型,如何设计和训练,以充分发挥其价值,并在设计之初,就要为未来可能的未知的使用场景做出准备,因为成本如此高昂的模型,是不可能被一遍一遍的重新训练的,因此需要有某种形式能够保存以前训练的成果,并能够为未来的可能使用场景做准备。
在一种实现方案中,可以将大规模模型划分为多个网络单元,针对于不同的输入样本(例如不同的词向量),设置有对应的网络单元,在使用某一输入样本进行模型训练时,多个网络单元中仅该输入样本对应的网络单元被更新,且更新后的网络单元会被存储起来,以便下一次更新时被调用。
在现有技术中,通常使用计算单元中的内存来存储大模型,计算单元中的内存较小,限制了大规模模型自身的大小。
发明内容
本申请提供了一种数据处理方法,可以提高大规模模型自身的大小,并增加大规模模型的可扩展性和灵活度。
第一方面,本申请实施例提供了一种数据处理方法,所述方法包括:根据目标映射关系,确定目标词向量token对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址,所述存储地址对应的存储空间位于计算单元之外的存储空间;从所述存储地址对应的存储空间中获取所述一个或多个目标网络单元;所述一个或多个目标网络单元用于构建神经网络;根据所述目标词向量,通过所述计算单元执行所述神经网络对应的训练过程。
由于大规模模型中的目标网络单元存储在计算单元之外的存储位置,在当前的训练样本为对应的词向量时,从计算单元之外的存储位置中提取对应的一个或多个目标网络单元,由于计算单元之外的存储位置的存储空间可以设置的较大,通过存算分离,可以提高大规模模型自身的大小,并增加大规模模型的可扩展性和灵活度。
在一种可能的实现中,所述目标网络单元为前向传播网络FFN。
在一种可能的实现中,所述计算单元为图形处理器GPU、张量处理器TPU或者神经网络处理器NPU。
在一种可能的实现中,所述存储地址对应的存储空间位于内存、网络存储器或者硬盘。
在一种可能的实现中,所述目标映射关系包括第一目标映射关系,所述第一目标映射关系指示多个词向量以及每个词向量对应的一个或多个网络单元,所述第一目标映射关系具体为映射表。
在现有技术中,通过散列hash的方式来构建训练样本(词向量token)和网络单元之间的映射关系, 由于散列hash中一个训练样本仅能对应唯一一个网络单元,且由于散列hash中存在数值范围限制,随着训练样本的增大,可能会出现大量不同的训练样本对应于同一个网络单元的情况,使得训练后的模型的精度受到影响。本申请中,通过映射表的方式来记载训练样本(词向量token)和网络单元之间的映射关系,可以实现一个训练样本对应多个网络单元,且由于没有数值范围限制,不会出现大量不同的训练样本对应于同一个网络单元的情况,进而可以增大训练后的模型的精度。
在一种可能的实现中,所述通过所述计算单元执行所述目标神经网络对应的训练过程用于得到更新后的目标神经网络,所述更新后的目标神经网络包括更新后的所述一个或多个目标网络单元,所述方法还包括:根据所述更新后的所述一个或多个目标网络单元,更新所述存储地址对应的存储空间中的数据。
在一种可能的实现中,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述方法还包括:接收到用户针对于第二目标映射关系的修改信息,其中,所述第二目标映射关系包括多个词向量以及每个词向量对应的网络单元;根据所述修改信息,修改第二目标映射关系,以得到所述目标映射关系。
在一种可能的实现中,所述修改信息用于指示如下的至少一种:对所述第二目标映射关系中至少一个词向量对应的网络单元的删除、替换或者增加;对所述第二目标映射关系中包括的映射关系的删除、替换或者增加,所述映射关系为词向量以及词向量对应的网络单元。
在一种可能的实现中,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述方法还包括:在通过所述目标词向量对所述神经网络执行训练过程中,基于训练损失的下降程度低于阈值,对第二目标映射关系中所述目标词向量对应的网络单元进行增加,以得到所述目标映射关系。在训练损失的下降程度较低时,可以表示模型当前的性能无法再继续提高了,这时候可以通过增加网络单元来改变神经网络的结构,使得训练的损失可以继续下降。
在一种可能的实现中,所述所述目标映射关系包括多个词单元以及每个词单元对应的网络单元,所述方法还包括:
根据收敛后所述神经网络,从所述目标映射关系中包括的多个词单元中确定部分词单元对应的网络单元,所述收敛后所述神经网络中所述部分词单元对应的网络单元用于构建目标神经网络;所述目标神经网络用于进行模型推理。
第二方面,本申请提供了一种数据处理装置,所述装置包括:
处理模块,用于根据目标映射关系,确定目标词向量token对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址,所述存储地址对应的存储空间位于计算单元之外的存储空间;
从所述存储地址对应的存储空间中获取所述一个或多个目标网络单元;所述一个或多个目标网络单元用于构建神经网络;
模型训练模块,用于根据所述目标词向量,通过所述计算单元执行所述神经网络对应的训练过程。
在一种可能的实现中,所述目标网络单元为前向传播网络FFN。
在一种可能的实现中,所述计算单元为图形处理器GPU、张量处理器TPU或者神经网络处理器NPU。
在一种可能的实现中,所述存储地址对应的存储空间位于内存、网络存储器或者硬盘。
在一种可能的实现中,所述目标映射关系包括第一目标映射关系,所述第一目标映射关系指示多个词向量以及每个词向量对应的一个或多个网络单元,所述第一目标映射关系具体为映射表。
在一种可能的实现中,所述通过所述计算单元执行所述目标神经网络对应的训练过程用于得到更新后的目标神经网络,所述更新后的目标神经网络包括更新后的所述一个或多个目标网络单元,所述处理模块,还用于:
根据所述更新后的所述一个或多个目标网络单元,更新所述存储地址对应的存储空间中的数据。
在一种可能的实现中,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述处理模块,还用于:
接收到用户针对于第二目标映射关系的修改信息,其中,所述第二目标映射关系包括多个词向量以及每个词向量对应的网络单元;
根据所述修改信息,修改第二目标映射关系,以得到所述目标映射关系。
在一种可能的实现中,所述修改信息用于指示如下的至少一种:
对所述第二目标映射关系中至少一个词向量对应的网络单元的删除、替换或者增加;
对所述第二目标映射关系中包括的映射关系的删除、替换或者增加,所述映射关系为词向量以及词向量对应的网络单元。
在一种可能的实现中,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述处理模块,还用于:
在通过所述目标词向量对所述神经网络执行训练过程中,基于训练损失的下降程度低于阈值,对第二目标映射关系中所述目标词向量对应的网络单元进行增加,以得到所述目标映射关系。
在一种可能的实现中,所述所述目标映射关系包括多个词单元以及每个词单元对应的网络单元,所述处理模块,还用于:
根据收敛后所述神经网络,从所述目标映射关系中包括的多个词单元中确定部分词单元对应的网络单元,所述收敛后所述神经网络中所述部分词单元对应的网络单元用于构建目标神经网络;所述目标神经网络用于进行模型推理。
第三方面,本申请实施例提供了一种数据处理装置,可以包括存储器、处理器以及总线系统,其中,存储器用于存储程序,处理器用于执行存储器中的程序,以执行如上述第一方面任一可选的方法。
第四方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面及任一可选的方法。
第五方面,本申请实施例提供了一种计算机程序产品,包括代码,当代码被执行时,用于实现上述第一方面及任一可选的方法。
第六方面,本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持数据处理装置实现上述方面中所涉及的功能,例如,发送或处理上述方法中所涉及的数据;或,信息。在一种可能的设计中,芯片系统还包括存储器,所述存储器,用于保存执行设备或训练设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包括芯片和其他分立器件。
附图说明
图1为人工智能主体框架的一种结构示意图;
图2为本发明的应用系统框架示意;
图3为本发明的应用系统框架示意;
图4A为一种网络的结构示意图;
图4B为一种网络的结构示意图;
图5为一种数据处理方法的流程示意;
图6为一种数据处理方法的流程示意;
图7为一种数据处理方法的流程示意;
图8为一种数据处理方法的流程示意;
图9为一种数据处理方法的流程示意;
图10为一种数据处理方法的流程示意;
图11为一种数据处理方法的流程示意;
图12为本申请实施例提供的一种数据处理装置的结构示意图;
图13为本申请实施例提供的一种执行设备的示意图;
图14为本申请实施例提供的一种训练设备的示意图;
图15为本申请实施例提供的一种芯片的示意图。
具体实施方式
下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。
下面结合附图,对本申请的实施例进行描述。本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。
首先对人工智能系统总体工作流程进行描述,请参见图1,图1示出的为人工智能主体框架的一种结构示意图,下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。其中,“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。
(1)基础设施
基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。
(2)数据
基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位移、液位、温度、湿度等感知数据。
(3)数据处理
数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。
其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。
推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。
决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。
(4)通用能力
对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别等等。
(5)智能产品及行业应用
智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能终端、智能交通、智能医疗、自动驾驶、智慧城市等。
本申请实施例可以应用于信息推荐领域,该场景包括但不限于涉及电商产品推荐、搜索引擎结果推荐、应用市场推荐、音乐推荐、视频推荐等场景,各种不同应用场景中被推荐的物品也可以称为“对象”以方便后续描述,即在不同的推荐场景中,推荐对象可以是APP,或者视频,或者音乐,或者某款商品(如线上购物平台的呈现界面,会根据用户的不同而显示不同的商品进行呈现,这实质也可以是通过推荐模型的推荐结果来进行呈现)。这些推荐场景通常涉及用户行为日志采集、日志数据预处理(例如,量化、采样等)、样本集训练以获得推荐模型、根据推荐模型对训练样本项对应的场景中所涉及的对象(如APP、音乐等)进行分析处理、例如,推荐模型训练环节中所选择的样本来自于手机应用市场用户对于所推荐APP的操作行为,则由此所训练出来的推荐模型则适用于上述手机APP应用市场,或者可以用于其它的类型的终端的APP应用市场进行终端APP的推荐。推荐模型将最终计算出各个待推荐对象的推荐概率或者分值,推荐系统根据一定的选择规则选定的推荐结果,例如按照推荐概率或者分值进行排序,通过相应的应用或者终端设备呈现给用户、用户对推荐结果中的对象进行操作以生成用户行为日志等环节。
参照图4A,在推荐过程中,当一个用户与推荐系统进行交互会触发一个推荐请求,推荐系统会将该请求及其相关的特征信息输入到部署的推荐模型中,然后预测用户对所有候选对象的点击率。随后,根据预测的点击率对候选对象进行降序排列,按顺序将候选对象展示在不同的位置作为对用户的推荐结果。用户对展示的项目进行浏览并发生用户行为,如浏览、点击和下载等。这些用户行为会被存入日志中作为训练数据,通过离线训练模块不定期地更新推荐模型的参数,提高模型的推荐效果。
比如,用户打开手机应用市场即可触发应用市场的推荐模块,应用市场的推荐模块会根据用户的历史下载记录、用户点击记录,应用的自身特征,时间、地点等环境特征信息,预测用户对给定的各个候选应用的下载可能性。根据预测的结果,应用市场按照可能性降序展示,达到提高应用下载概率的效果。具体来说,将更有可能下载的应用排在靠前的位置,将不太可能下载的应用排列在靠后的位置。而用户的行为也会存入日志并通过离线训练模块对预测模型的参数进行训练和更新。
又比如,在终身伴侣相关的应用中,可以基于用户在视频、音乐、新闻等域的历史数据,通过各种模型和算法,仿照人脑机制,构建认知大脑,搭建用户终身学习系统框架。终身伴侣可以根据系统数据和应用数据等来记录用户过去发生的事件,理解用户的当前意图,预测用户未来的动作或行为,最终实现智能服务。在当前第一阶段,根据音乐APP、视频APP和浏览器APP等获取用户的行为数据(包含端侧短信、照片、邮件事件等信息),一方面构建用户画像系统,另一方面实现基于用户信息过滤、关联分析、跨域推荐、因果推理等的学习与记忆模块,构建用户个人知识图谱。
接下来介绍本申请实施例的应用架构。
参见附图2,本发明实施例提供了一种推荐系统架构200。数据采集设备260用于采集样本,一个训练样本可以由多个特征信息(或者描述为属性信息,例如用户属性以及物品属性)组成,特征信息可以有多种,具体可以包括用户特征信息和对象特征信息以及标签特征,用户特征信息用于表征用户的特征,例如性别,年龄,职业,爱好等,对象特征信息用于表征向用户所推送的对象的特征,不同的推荐系统对应不同的对象,不同的对象所需要提取的特征类型也不想同,例如APP市场的训练样本中所提取的对象特征可以为,APP的名称(标识),类型,大小等;而电商类APP的训练样本中所提起的对象特征可以为,商品的名称,所属的类别,价格区间等;标签特征,则是用于表示这个样本是正例还是负例,通常样本的标签特征可以通过用户对所推荐对象的操作信息所获的,用户对所推荐对象有进行操作的样本为正例,用户对所推荐对象没有进行操作,或者仅浏览的样本为负例,例如当用户点击或者下载或者购买了所推荐的对象,则所述标签特征为1,表示该样本是正例,而如果用户没有对所推荐的对象进行任何 操作,则所述标签特征为0,表示该样本是负例。样本在采集后可以保存在数据库230中,数据库230中的样本中的部分或全部特征信息也可以直接从客户设备240中获取,如用户特征信息,用户对对象的操作信息(用于确定类型标识),对象特征信息(如对象标识)等。训练设备220基于数据库230中样本训练获取模型参数矩阵用于生成推荐模型201。下面将更详细地描述训练设备220如何训练得到用于生成推荐模型201的模型参数矩阵,推荐模型201能够用于对大量对象进行评估从而得出各个待推荐对象的分值,进一步的还可以从大量对象的评估结果中推荐指定或者预设数目个对象,计算模块211基于推荐模型201的评估结果获取推荐结果,通过I/O接口212推荐给客户设备。
在本申请实施例中,该训练设备220可以从数据库230中样本集内选取正、负样本添加到所述训练集中,之后采用推荐模型对训练集中的样本进行训练从而得到训练后的推荐模型;计算模块211的实现细节可以参照图5所示的方法实施例的详细描述。
训练设备220基于样本训练获得模型参数矩阵后用于构建推荐模型201后,将推荐模型201发送给执行设备210,或者直接将模型参数矩阵发送给执行设备210,在执行设备210中构建推荐模型,用于进行相应系统的推荐,例如基于视频相关的样本训练获得的推荐模型可以用于视频网站或APP中对用户进行视频的推荐,基于APP相关的样本训练获得的推荐模型可以用于应用市场中对用户进行APP的推荐。
执行设备210配置有I/O接口212,与外部设备进行数据交互,执行设备210可以通过I/O接口212从客户设备240获取用户特征信息,例如用户标识、用户身份、性别、职业、爱好等,此部分信息也可以从系统数据库中获取。推荐模型201基于用户特征信息和待推荐对象特征信息向用户推荐目标推荐对象。执行设备210可以设置在云端服务器中,也可以设置于用户客户端中。
执行设备210可以调用数据存储系统250中的数据、代码等,同时也可以将输出的数据存入数据存储系统250中。数据存储系统250可以设置于执行设备210中,也可以独立设置,或者设置于其他网络实体中,数量可以是一个也可以是多个。
计算模块211使用推荐模型201对用户特征信息,待推荐对象特征信息进行处理,例如,该计算模块211使用推荐模型201对用户特征信息,以及待推荐对象的特征信息进行分析处理,从而得出该待推荐对象的分值,对待推荐对象按照分值进行排序,其中,排序靠前的对象将作为推荐给客户设备240的对象。
最后,I/O接口212将推荐结果返回给客户设备240,呈现给用户。
更深层地,训练设备220可以针对不同的目标,基于不同的样本特征信息生成相应的推荐模型201,以给用户提供更佳的结果。
值得注意的,附图2仅是本发明实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在附图2中,数据存储系统250相对执行设备210是外部存储器,在其它情况下,也可将数据存储系统250置于执行设备210中。
在本申请实施例中,该训练设备220、执行设备210、客户设备240可以分别为三个不同的物理设备,也可能该训练设备220和执行设备210在同一个物理设备或者一个集群上,也可能该执行设备210与该客户设备240在同一个物理设备或者一个集群上。
参见附图3,是本发明实施例提的一种系统架构300。在此架构中执行设备210由一个或多个服务器实现,可选的,与其它计算设备配合,例如:数据存储、路由器、负载均衡器等设备;执行设备210可以布置在一个物理站点上,或者分布在多个物理站点上。执行设备210可以使用数据存储系统250中的数据,或者调用数据存储系统250中的程序代码实现对象推荐的功能,具体地,将待推荐的对象的信息输入到推荐模型中,推荐模型为每个待推荐对象生成预估分数,然后按照预估分数从高到低的顺序进行排序,按照排序结果向用户推荐该待推荐对象。例如,将排序结果中的前10个对象推荐给用户。
其中,数据存储系统250用于接收和存储训练设备发送的推荐模型的参数,以及用于存储通过推荐模型得到的推荐结果的数据,当然还可能包括该存储系统250正常运行所需的程序代码(或指令)。数据存储系统250可以为部署在执行设备210以外的一个设备或者多个设备构成的分布式存储集群,此时,当执行设备210需要使用存储系统250上的数据时,可以由存储系统250向执行设备210发送该执行设备所需的数据,相应地,该执行设备210接收并存储(或者缓存)该数据。当然数据存储系统250也可以 部署在执行设备210内,当部署在执行设备210内时,该分布式存储系统可以包括一个或者多个存储器,可选的,存在多个存储器时,不同的存储器用于存储不同类型的数据,如通过训练设备生成的推荐模型的模型参数和通过推荐模型得到的推荐结果的数据可以分别存储在两个不同的存储器上。
用户可以操作各自的用户设备(例如本地设备301和本地设备302)与执行设备210进行交互。每个本地设备可以表示任何计算设备,例如个人计算机、计算机工作站、智能手机、平板电脑、智能摄像头、智能汽车或其他类型蜂窝电话、媒体消费设备、可穿戴设备、机顶盒、游戏机等。
每个用户的本地设备可以通过任何通信机制/通信标准的通信网络与执行设备210进行交互,通信网络可以是广域网、局域网、点对点连接等方式,或它们的任意组合。
在另一种实现中,执行设备210可以由本地设备实现,例如,本地设备301可以基于推荐模型实现执行设备210的的推荐功能获取用户特征信息并向用户反馈推荐结果,或者为本地设备302的用户提供服务。
由于本申请实施例涉及大量神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。
1、点击概率(click-throughrate,CTR)
点击概率又可以称为点击率,是指网站或者应用程序上推荐信息(例如,推荐物品)被点击次数和曝光次数之比,点击率通常是推荐系统中衡量推荐系统的重要指标。
2、个性化推荐系统
个性化推荐系统是指根据用户的历史数据(例如本申请实施例中的操作信息),利用机器学习算法进行分析,并以此对新请求进行预测,给出个性化的推荐结果的系统。
3、离线训练(offlinetraining)
离线训练是指在个性化推荐系统中,根据用户的历史数据(例如本申请实施例中的操作信息),对推荐模型参数按照器学习的算法进行迭代更新直至达到设定要求的模块。
4、在线预测(onlineinference)
在线预测是指基于离线训练好的模型,根据用户、物品和上下文的特征预测该用户在当前上下文环境下对推荐物品的喜好程度,预测用户选择推荐物品的概率。
例如,图4A是本申请实施例提供的推荐系统的示意图。如图4A所示,当一个用户进入统,会触发一个推荐的请求,推荐系统会将该请求及其相关信息(例如本申请实施例中的操作信息)输入到推荐模型,然后预测用户对系统内的物品的选择率。进一步,根据预测的选择率或基于该选择率的某个函数将物品降序排列,即推荐系统可以按顺序将物品展示在不同的位置作为对用户的推荐结果。用户浏览不同的处于位置的物品并发生用户行为,如浏览、选择以及下载等。同时,用户的实际行为会存入日志中作为训练数据,通过离线训练模块不断更新推荐模型的参数,提高模型的预测效果。
例如,用户打开智能终端(例如,手机)中的应用市场即可触发应用市场中的推荐系统。应用市场的推荐系统会根据用户的历史行为日志,例如,用户的历史下载记录、用户选择记录,应用市场的自身特征,比如时间、地点等环境特征信息,预测用户下载推荐的各个候选APP的概率。根据计算的结果,应用市场的推荐系统可以按照预测的概率值大小降序展示候选APP,从而提高候选APP的下载概率。
示例性地,可以将预测的用户选择率较高的APP展示在靠前的推荐位置,将预测的用户选择率较低的APP展示在靠后的推荐位置。
上述推荐模型可以是神经网络模型,下面对本申请实施例可能涉及的神经网络的相关术语和概念进行介绍。
(1)神经网络
神经网络可以是由神经单元组成的,神经单元可以是指以xs(即输入数据)和截距1为输入的运算单元,该运算单元的输出可以为:
其中,s=1、2、……n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输入,激活函数可以是sigmoid函数。神经网络是将多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。
(2)深度神经网络
深度神经网络(Deep Neural Network,DNN),也称多层神经网络,可以理解为具有很多层隐含层的神经网络,这里的“很多”并没有特别的度量标准。从DNN按不同层的位置划分,DNN内部的神经网络可以分为三类:输入层,隐含层,输出层。一般来说第一层是输入层,最后一层是输出层,中间的层数都是隐含层。层与层之间是全连接的,也就是说,第i层的任意一个神经元一定与第i+1层的任意一个神经元相连。虽然DNN看起来很复杂,但是就每一层的工作来说,其实并不复杂,简单来说就是如下线性关系表达式:其中,是输入向量,是输出向量,是偏移向量,W是权重矩阵(也称系数),α()是激活函数。每一层仅仅是对输入向量经过如此简单的操作得到输出向量由于DNN层数多,则系数W和偏移向量的数量也就很多了。这些参数在DNN中的定义如下所述:以系数W为例:假设在一个三层的DNN中,第二层的第4个神经元到第三层的第2个神经元的线性系数定义为上标3代表系数W所在的层数,而下标对应的是输出的第三层索引2和输入的第二层索引4。总结就是:第L-1层的第k个神经元到第L层的第j个神经元的系数定义为需要注意的是,输入层是没有W参数的。在深度神经网络中,更多的隐含层让网络更能够刻画现实世界中的复杂情形。理论上而言,参数越多的模型复杂度越高,“容量”也就越大,也就意味着它能完成更复杂的学习任务。训练深度神经网络的也就是学习权重矩阵的过程,其最终目的是得到训练好的深度神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。
(3)损失函数
在训练深度神经网络的过程中,因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到深度神经网络能够预测出真正想要的目标值或与真正想要的目标值非常接近的值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。
(4)反向传播算法
可以采用误差反向传播(back propagation,BP)算法在训练过程中修正初始模型中参数的大小,使得模型的误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始模型中的参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的模型参数,例如权重矩阵。
(5)机器学习系统
基于输入数据和标签,通过梯度下降等优化方法训练机器学习模型的参数,最终利用训练得到的模型来完成未知数据的预测。
(6)个性化推荐系统
根据用户的历史数据,利用机器学习算法进行分析和建模,并以此对新的用户请求进行预测,给出个性化的推荐结果的系统。
(7)混合专家:在神经网络中,将每个线性层看做一个专家,多个线性层并行,将其中一个或者 若干个专家的输出进行加权平均,并将结果输出到下一层。
(8)计算图:将用户通过深度神经网络框架描述的运算构建成的一个计算的图结构,通常描述整个深度神经网络计算的流程,包括前向、反向传播以及参数更新。
(9)记忆网络:将输入转化为网络里面内在的向量,并将向量保存在记忆矩阵里面。
(10)路由:控制输入数据和某个网络模块映射关系的函数。
(11)持续学习:也称终身学习(Life-long learning)是解决此类问题的研究方向,它的目标是扩展模型适应能力,令模型能够在不同时刻学习不同任务的知识,同时不会遗忘先前任务的特征。
(12)页表:一种数据结构,可以用于记载两种数据之间的映射关系。通常用于将虚拟地址转换为物理地址。分级页表也是页表的一种。页表被存储在存储介质中,页表的基址,也简称页表基址,是指存储该页表的物理地址的起始地址。页表的大小决定这个页表对应的虚拟地址的取值范围。页表中的虚拟地址是使用该页表的实例或者设备的虚拟地址,用于指示该页表中某个位置(或者说某个表项)的物理地址相对于页表基址的偏移量。而页表中某个位置存储的数据,就是使用这个页表的实例或者设备的物理地址空间中的物理地址。一个页表中包括多个表项,每个表项都可以指示一个虚拟地址与一个物理地址的映射关系,应理解的是,这里所说的表项是个功能性的描述,表项的具体实现方式本申请不做限定,例如一个虚拟地址与一个物理地址的映射关系可能是跨级的,一个虚拟地址与一个物理地址的映射关系也可能是间接的。本申请中的页表具体可以为多级页表。
(13)transformer层
参照图4B,图4B为一种transformer层的架构示意,如图4B所示,神经网络包括嵌入层和至少一个transformer层,至少一个transformer层可以为N个transformer层(N大于0的整数),其中,每个transformer层包括依次相邻的注意力层、加和与归一化(add&norm)层、前馈(feed forward)层和加和与归一化层。在嵌入层,对当前输入进行嵌入处理,得到多个特征向量;在所述注意力层,从所述transformer层的上一层获取P个输入向量,以P个输入向量中的任意的第一输入向量为中心,基于预设的注意力窗口范围内的各个输入向量与该第一输入向量之间的关联度,得到该第一输入向量对应的中间向量,如此确定出P个输入向量对应的P个中间向量;在所述池化层,将所述P个中间向量合并为Q个输出向量,其中至少一个transformer层中最后一个transformer层得到的多个输出向量用作所述当前输入的特征表示。
接下来,结合具体例子对上述各步骤进行具体介绍。
首先,在所述嵌入层,对当前输入进行嵌入处理,得到多个特征向量。
嵌入层可以称为输入嵌入(input embedding)层。当前输入可以为文本输入,例如可以为一段文本,也可以为一个句子。文本可以为中文文本,也可以为英文文本,还可以为其他语言文本。嵌入层在获取当前输入后,可以对该当前输入中各个词进行嵌入处理,可得到各个词的特征向量。在一些实施例中,如图4B所示,所述嵌入层包括输入嵌入层和位置编码(positional encoding)层。在输入嵌入层,可以对当前输入中的各个词进行词嵌入处理,从而得到各个词的词嵌入向量。在位置编码层,可以获取各个词在该当前输入中的位置,进而对各个词的位置生成位置向量。在一些示例中,各个词的位置可以为各个词在该当前输入中的绝对位置。以当前输入为“几号应还花呗”为例,其中的“几”的位置可以表示为第一位,“号”的位置可以表示为第二位,……。在一些示例中,各个词的位置可以为各个词之间的相对位置。仍以当前输入为“几号应还款”为例,其中的“几”的位置可以表示为“号”之前,“号”的位置可以表示为“几”之后、“应”之前,……。当得到当前输入中各个词的词嵌入向量和位置向量时,可以将各个词的位置向量和对应的词嵌入向量进行组合,得到各个词特征向量,即得到该当前输入对应的多个特征向量。多个特征向量可以表示为具有预设维度的嵌入矩阵。可以设定该多个特征向量中的特征向量个数为M,预设维度为H维,则该多个特征向量可以表示为M×H的嵌入矩阵。
其次,从所述第一transformer层的上一层获取P个输入向量,以P个输入向量中的任意的第一输入向量为中心,基于预设的注意力窗口范围内的各个输入向量与该第一输入向量之间的关联度,得到该第一输入向量对应的中间向量,如此确定出P个输入向量对应的P个中间向量。注意力层也可以称为多头注意力(multi-head attention)层。在一个例子中,注意力层可以为固定窗口多头注意力(fixed window  multi-head attention)层。
在一些实施例中,第一transformer层可以为上述嵌入层的下一层,P个输入向量为从嵌入层得到的所述多个特征向量。在一些实施例中,本说明书实施例提供的神经网络中的至少一个transformer层还包括第二transformer层。该第二transformer层为第一自注意力的上一层,则P个输入向量为第二transformer层输出的P个输出向量。在该神经网络中的最后一个transformer层,通过上述步骤的多个输出向量可用作当前输入的特征表示。该特征表示为为当前输入的一种适合计算机处理的特征表示。
(14)注意力机制(attention mechanism)
注意力机制模仿了生物观察行为的内部过程,即一种将内部经验和外部感觉对齐从而增加部分区域的观察精细度的机制,能够利用有限的注意力资源从大量信息中快速筛选出高价值信息。注意力机制可以快速提取稀疏数据的重要特征,因而被广泛用于自然语言处理任务,特别是机器翻译。而自注意力机制(self-attention mechanism)是注意力机制的改进,其减少了对外部信息的依赖,更擅长捕捉数据或特征的内部相关性。注意力机制的本质思想可以改写为如下公式:
其中,Lx=||Source||代表Source的长度,公式含义即将Source中的构成元素想象成是由一系列的数据对构成,此时给定目标Target中的某个元素Query,通过计算Query和各个Key的相似性或者相关性,得到每个Key对应Value的权重系数,然后对Value进行加权求和,即得到了最终的Attention数值。所以本质上Attention机制是对Source中元素的Value值进行加权求和,而Query和Key用来计算对应Value的权重系数。从概念上理解,把Attention可以理解为从大量信息中有选择地筛选出少量重要信息并聚焦到这些重要信息上,忽略大多不重要的信息。聚焦的过程体现在权重系数的计算上,权重越大越聚焦于其对应的Value值上,即权重代表了信息的重要性,而Value是其对应的信息。自注意力机制可以理解为内部Attention(intra attention),Attention机制发生在Target的元素Query和Source中的所有元素之间,自注意力机制指的是在Source内部元素之间或者Target内部元素之间发生的Attention机制,也可以理解为Target=Source这种特殊情况下的注意力计算机制,其具体计算过程是一样的,只是计算对象发生了变化而已。
近年来,随着计算芯片技术和大规模计算集群的快速发展,越来越多的大模型开始出现,千亿甚至万亿级别的大模型成为最近甚至未来一段时间的主流技术趋势。但是,大模型最核心的问题在于,训练和使用成本极其高昂,通常需要数百块,甚至几千块GPU、TPU或者NPU芯片等计算单元组成的超大规模集群,计算数周甚至数个月时间,成本以百万至千万美元计。这个核心问题的另一个问题是,成本如此高昂的模型,如何设计和训练,以充分发挥其价值,并在设计之初,就要为未来可能的未知的使用场景做出准备,因为成本如此高昂的模型,是不可能被一遍一遍的重新训练的,因此需要有某种形式能够保存以前训练的成果,并能够为未来的可能使用场景做准备。
在一种实现方案中,可以将大规模模型划分为多个网络单元,针对于不同的输入样本(例如不同的词向量),设置有对应的网络单元,在使用某一输入样本进行模型训练时,多个网络单元中仅该输入样本对应的网络单元被更新,且更新后的网络单元会被存储起来,以便下一次更新时被调用。
在现有技术中,通常使用计算单元中的内存来存储大模型,计算单元中的内存较小,限制了大规模模型自身的大小。
为了解决上述问题,本申请提供了一种数据处理方法。
参照图5,图5为本申请实施例提供的一种数据处理方法的实施例示意,如图5示出的那样,本申请实施例提供的一种数据处理方法,包括:
501、根据目标映射关系,确定目标词向量token对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址,所述存储地址对应的存储空间位于计算单元之外的存储空间。
本申请实施例中,步骤501的执行主体可以为终端设备,终端设备可以为便携式移动设备,例如但不限于移动或便携式计算设备(如智能手机)、个人计算机、服务器计算机、手持式设备(例如平板)或膝上型设备、多处理器系统、游戏控制台或控制器、基于微处理器的系统、机顶盒、可编程消费电子产品、移动电话、具有可穿戴或配件形状因子(例如,手表、眼镜、头戴式耳机或耳塞)的移动计算和/或通信设 备、网络PC、小型计算机、大型计算机、包括上面的系统或设备中的任何一种的分布式计算环境等等。
本申请实施例中,步骤501的执行主体可以为云侧的服务器。
为了方便描述,以下不对执行主体的形态进行区分,都描述为训练设备。
在一种可能的实现中,所述目标网络单元为前向传播网络FFN,目标网络单元在本申请实施例中也可以称之为专家网络。
在一种可能的实现中,可以预先构建不同训练样本(词向量token)和目标网络单元之间的映射关系(或者可以称之为多值映射表或者多级映射表),大规模网络在针对不同训练样本(词向量token)进行模型训练时,可以将大规模网络中目标网络单元所在位置的网络结构设置成映射关系中所指示的网络单元或者网络单元的组合。
其中,目标映射关系可以包括第一目标映射关系和第二目标映射关系,第一目标映射关系可以指示词向量和网络单元之间的映射关系,具体可以是词向量和网络单元对应的标识ID之间的映射关系。标识:用于将一种或者一个事物与其他同类或不同类的事物做区分。比如,节点的标识,网络的标识,网卡的标识。标识可以是名称,编号,也可以是以某个有区分性的特征作为标识,例如用种类标识。本申请对各种标识的实现不做限制,只要可以做出区分即可。
在现有技术中,通过散列hash的方式来构建训练样本(词向量token)和网络单元之间的映射关系,由于散列hash中一个训练样本仅能对应唯一一个网络单元,且由于散列hash中存在数值范围限制,随着训练样本的增大,可能会出现大量不同的训练样本对应于同一个网络单元的情况,使得训练后的模型的精度受到影响。本申请中,通过映射表的方式来记载训练样本(词向量token)和网络单元之间的映射关系,可以实现一个训练样本对应多个网络单元,且由于没有数值范围限制,不会出现大量不同的训练样本对应于同一个网络单元的情况,进而可以增大训练后的模型的精度。
在一种可能的实现中,可以将大规模网络(例如盘古alpha或者Transformer中的FFN)替换为图6中的存储单元,即若干个并行排列的expert。这些专家的分组是由多值映射表决定的,每个多值映射表许多由键值对(key-value)构成,可选的,词表中的词(token)构成多值映射表的键(key),值(value)就是专家的ID号,比如图中的E1到E11。构建好这个多值映射表后,在训练过程中,控制模块就可以根据数据单元的数据动态从存储单元中提取需要计算的计算单元高效计算。可选的,也可以根据loss值决定是否动态扩展存储单元的专家模块。
关于上述多值映射表的构建:
分组是在构建多值映射表的时候由用户决定的,例如,可以构建如下图7的多射映射表。用户先确定需要建模的分组数量G,以及每个分组初始化的专家个数K_g,对词表的Token来说,属于哪个或哪些分组,是由用户自己的决定的,例如,用户可以根据token所属的语言分组,中文为一个专家组,英文为另一个专家组,有些token属于两个专家组,比如一些阿拉伯数字。分好分组以后,每个分组的专家数也是固定的,那么属于这个专家组的token就可以通过某个函数进行分配映射的专家,比如可以随机,也可以顺序取余。在训练开始之前,需要构建好一个初始版本的多值映射表,然后启动训练。
在一种可能的实现中,在一种可能的实现中,所述计算单元为图形处理器GPU、张量处理器TPU或者神经网络处理器NPU。
在一种可能的实现中,所述存储地址对应的存储空间位于内存、网络存储器或者硬盘。
在一种可能的实现中,所述目标映射关系包括第一目标映射关系,所述第一目标映射关系指示多个词向量以及每个词向量对应的一个或多个网络单元,所述第一目标映射关系具体为映射表。
在一种可能的实现中,所述目标映射关系还可以包括第三目标映射关系,所述第三目标映射关系指示每个网络单元的存储位置。该存储位置可以通过存储空间对应的物理地址或者虚拟地址来表示,基于该虚拟地址可以唯一确定对应的物理地址,例如,地址可以包括起始地址以及偏置。
由于大规模模型中的目标网络单元存储在计算单元之外的存储位置,在当前的训练样本为对应的词向量时,从计算单元之外的存储位置中提取对应的一个或多个目标网络单元,由于计算单元之外的存储位置的存储空间可以设置的较大,通过存算分离,可以提高大规模模型自身的大小,并增加大规模模型的可扩展性和灵活度。
在一种可能的实现中,上述目标映射关系可以被用户修改。
具体的,在一种可能的实现中,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,还可以接收到用户针对于第二目标映射关系的修改信息,其中,所述第二目标映射关系包括多个词向量以及每个词向量对应的网络单元;根据所述修改信息,修改第二目标映射关系,以得到所述目标映射关系。
修改信息可以用于修改第二目标映射关系中某个词向量所对应的网络单元进行修改,或者是对词向量与网络单元的对应关系进行修改。
在一种可能的实现中,所述修改信息用于指示如下的至少一种:对所述第二目标映射关系中至少一个词向量对应的网络单元的删除、替换或者增加;对所述第二目标映射关系中包括的映射关系的删除、替换或者增加,所述映射关系为词向量以及词向量对应的网络单元。
此外,系统还可以基于模型训练的情况自行进行映射关系的修改。
在一种可能的实现中,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,可以在通过所述目标词向量对所述神经网络执行训练过程中,基于训练损失的下降程度低于阈值(在训练损失的下降程度较低时,可以表示模型当前的性能无法再继续提高了,这时候可以通过增加网络单元来改变神经网络的结构,使得训练的损失可以继续下降),对第二目标映射关系中所述目标词向量对应的网络单元进行增加,以得到所述目标映射关系。
在一种可能的实现中,可以通过确定应映射关系和大容量的映射关系数据结构,可以支撑本实施例进行记忆网络的容量扩增和删减,并在同时取得持续学习的效果。持续学习指的是模型能够在学习了一段时间的数据后,继续学习新的数据,能够避免之前学到的知识被遗忘,同时能够学习到新的知识的技术。本实施例的一个可选的流程如下:
如图9所示,步骤如下:
步骤1、训练从配置文件中读取是否修改映射表,如果有修改,则按照配置修改多值映射表和相应的存储单元。这种配置是非常灵活的,可以是同一个专家组的扩充,如图扩充专家组的E4,也可以是扩充新的专家组,如图中扩充专家组3。然后继续训练。
步骤2、读取配置文件中的扩增阈值K,针对每个专家组的loss,并时刻记录loss的最小值,如果最小值已经连续K步没有更新,则认为模型的loss已经不再降了,进入步骤3。否则就继续训练。
步骤3、满足步骤2条件后,针对不降的loss对应的专家组,修改多值映射表,假设原始专家组为M个专家,则按照某种规则将多值映射表中1/M个token映射的专家,添加一个新的映射专家,如图中的E4。其中这个规则可以是最高频的1/M个token,或者是随机选取1/M个token。
步骤4、框架实时调整计算图,并分配新的存储空间给新增添的专家E4,并继续训练。
通过上述方式,可以允许模型的记忆模块进行伸缩,以针对不同场景,扩展和裁剪模型容量。
502、从所述存储地址对应的存储空间中获取所述一个或多个目标网络单元;所述一个或多个目标网络单元用于构建神经网络。
在一种可能的实现中,在获取到存储地址后,可以从存储地址对应的存储空间中获取所述一个或多个目标网络单元,并利用该一个或多个目标网络单元进行神经网络的构建,具体的,一个或多个目标网络单元可以用于进行目标网络单元对应位置的网络结构的构建。
具体流程的一个示意可以如下图8所示,主要由以下步骤组成:
步骤1:当一个迭代的训练开始的时候,控制模块读取本次迭代的数据。
步骤2:根据上一步读取的数据,在多值映射表中,以数据为key,查找对应的专家的编号。
步骤3:分两步,先根据上一步查找到的专家的编号,找到对应专家的内存地址。然后3.2,根据找到的内存地址,将需要使用的专家提取出来,或者将不使用的专家冻结。这种提取可以是在新的内存空间,构建计算子图,将存储单元中对应的专家拷贝到新的计算空间,也可以是在存储单元中,用虚拟的内存映射管理存储单元中对应的专家做为计算单元。而这种冻结,会将冻结操从计算图上传播给对应的反向计算节点和优化器更新节点,确保在本轮中不需要计算的专家,正向反向和优化器更新都不需要参与计算。
503、根据所述目标词向量,通过所述计算单元执行所述神经网络对应的训练过程。
在一种可能的实现中,所述通过所述计算单元执行所述目标神经网络对应的训练过程用于得到更新后的目标神经网络,所述更新后的目标神经网络包括更新后的所述一个或多个目标网络单元,根据所述更新后的所述一个或多个目标网络单元,更新所述存储地址对应的存储空间中的数据,以便下一次调用。
参照图8,本申请实施例的一个可选实现步骤可以包括:
步骤4:利用上一步构建的计算单元,将步骤1读入的数据和对应的专家做实际的计算,前向转播算出loss,并做反向计算,以及优化器更新专家参数。
步骤5:将计算单元中更新的专家参数,和存储单元中对应的专家参数同步。
上述步骤的思想在于,通过内存管理,将稀疏化的专家记忆单元,也就是存储单元中的专家找出来,并确保只计算这一部分激活的专家,其余不需要计算的不参与任何前向,反向,优化器更新的计算,保证稀疏化的记忆网络在计算中没有冗余,从而提到训练效率。
在一种可能的实现中,所述所述目标映射关系包括多个词单元以及每个词单元对应的网络单元,还可以根据收敛后所述神经网络,从所述目标映射关系中包括的多个词单元中确定部分词单元对应的网络单元,所述收敛后所述神经网络中所述部分词单元对应的网络单元用于构建目标神经网络;所述目标神经网络用于进行模型推理。
上述过程可以称之为子模型的抽取,示例性的流程可以参照图10所示。
本申请实施例提出了一种新型的可伸缩的记忆网络设计,同其高效训练算法。保证能够在高效训练由这样的网络模块构成的大模型的同时,使得模型通过记忆模块的伸缩,获得持续学习能力,保证模型一直处于最新的知识状态。系统架构如下图11所示:
一是多值映射表(multi-value mapping)。该模块是本专利可行的数据结构基础。和上面相关工作中提到的散列不同,映射是一种直接存储的键值对关系,不需要通过散列函数去映射到一个固定的索引范围,因此没有碰撞问题。这就决定了用映射数据结构构建的关系,不会丢失关键信息。而这里采用多值映射,就是构建一个键值和集合的映射对,集合中可以是任意多的元素,这样就保证了我们的映射关系不仅仅是单一的。本专利中的多值映射表,支持多种操作,如查找,插入和删除等修改。这些操作和下面将要描述的控制模块配合,实现了我们专利描述的训练算法和终身学习算法。
二是控制模块。控制模块如下图虚线控制模块所示,控制模块是本系统的核心,具体有两个主要功能:
一是为完成终身学习能力设计的功能,控制模块从损失或者某个度量函数获得信息后,如果判断需要增加记忆网络的数量,算法走入“是”分支,存储控制单元首先会修改多值映射表,增添或者删除映射内的键值对,然后存储控制单元会在存储子图部分开辟或者释放对应的内存空间。
二是为了实现高性能训练设计的功能,如果判断为否,也就是说不需要进行记忆网络的增添和删除,算法将会走到“否”分支。在这个分支,控制模块的路由能够通过读取当前数据单元的数据,查询多值映射表中的映射关系,得知本次需要计算的记忆网络的编号,并根据这个查询结果,计算控制模块将需要计算的子图通过某种方式提取出来,可以是拉取,也可以是构建一个新的子图,也可以是在存储子图的本地,对不计算的部分进行冻结,确保只计算需要计算的部分。并且这个操作将会传播给计算图的所有相关计算部分,在大规模分布式场景中,将不进行对应的梯度传输,从而大大减少整个模型的计算量和通信量。
三是记忆网络模块。就是图中的存储单元和计算单元,记忆模块由线性网络构成,一般有一个以上的线性网络构成,每个线性网络有一个编号,比如图中的A,B,C,D,用于区分不同的线性网络,这个编号也是多值映射表中的键值对中的值的元素,控制装置可以通过这个值找到对应的记忆网络的地址,并对对应的网络进行提取,拷贝,删除,新增等操作。每个网络记忆了当前状态训练实体对应的本层特征。
四是数据单元。可以是训练数据,也可以是某种经过编码的中间结果。
接下来从装置的角度介绍本申请实施例提供的一种数据处理装置,参照图12,图12为本申请实施例提供的一种数据处理装置的结构示意,如图12所示,本申请实施例提供的一种数据处理装置1200包括:
处理模块1201,用于根据目标映射关系,确定目标词向量token对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址,所述存储地址对应的存储空间位于计算单元之外的存储空间;
从所述存储地址对应的存储空间中获取所述一个或多个目标网络单元;所述一个或多个目标网络单元用于构建神经网络;
其中,关于处理模块1201的具体描述,可以参照上述实施例中步骤501和步骤502的介绍,这里不再赘述。
模型训练模块1202,用于根据所述目标词向量,通过所述计算单元执行所述神经网络对应的训练过程。
其中,关于模型训练模块1202的具体描述,可以参照上述实施例中步骤503的介绍,这里不再赘述。
在一种可能的实现中,所述目标网络单元为前向传播网络FFN。
在一种可能的实现中,所述计算单元为图形处理器GPU、张量处理器TPU或者神经网络处理器NPU。
在一种可能的实现中,所述存储地址对应的存储空间位于内存、网络存储器或者硬盘。
在一种可能的实现中,所述目标映射关系包括第一目标映射关系,所述第一目标映射关系指示多个词向量以及每个词向量对应的一个或多个网络单元,所述第一目标映射关系具体为映射表。
在一种可能的实现中,所述通过所述计算单元执行所述目标神经网络对应的训练过程用于得到更新后的目标神经网络,所述更新后的目标神经网络包括更新后的所述一个或多个目标网络单元,所述处理模块,还用于:
根据所述更新后的所述一个或多个目标网络单元,更新所述存储地址对应的存储空间中的数据。
在一种可能的实现中,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述处理模块,还用于:
接收到用户针对于第二目标映射关系的修改信息,其中,所述第二目标映射关系包括多个词向量以及每个词向量对应的网络单元;
根据所述修改信息,修改第二目标映射关系,以得到所述目标映射关系。
在一种可能的实现中,所述修改信息用于指示如下的至少一种:
对所述第二目标映射关系中至少一个词向量对应的网络单元的删除、替换或者增加;
对所述第二目标映射关系中包括的映射关系的删除、替换或者增加,所述映射关系为词向量以及词向量对应的网络单元。
在一种可能的实现中,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述处理模块,还用于:
在通过所述目标词向量对所述神经网络执行训练过程中,基于训练损失的下降程度低于阈值,对第二目标映射关系中所述目标词向量对应的网络单元进行增加,以得到所述目标映射关系。
在一种可能的实现中,所述所述目标映射关系包括多个词单元以及每个词单元对应的网络单元,所述处理模块,还用于:
根据收敛后所述神经网络,从所述目标映射关系中包括的多个词单元中确定部分词单元对应的网络单元,所述收敛后所述神经网络中所述部分词单元对应的网络单元用于构建目标神经网络;所述目标神经网络用于进行模型推理。
接下来介绍本申请实施例提供的一种执行设备,请参阅图13,图13为本申请实施例提供的执行设备的一种结构示意图,执行设备1300具体可以表现为手机、平板、笔记本电脑、智能穿戴设备、服务器等,此处不做限定。其中,执行设备1300实现图10对应实施例中图像处理方法的功能。具体的,执行设备1300包括:接收器1301、发射器1302、处理器1303和存储器1304(其中执行设备1300中的处 理器1303的数量可以一个或多个),其中,处理器1303可以包括应用处理器13031和通信处理器13032。在本申请的一些实施例中,接收器1301、发射器1302、处理器1303和存储器1304可通过总线或其它方式连接。
存储器1304可以包括只读存储器和随机存取存储器,并向处理器1303提供指令和数据。存储器1304的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器1304存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。
处理器1303控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。
上述本申请实施例揭示的方法可以应用于处理器1303中,或者由处理器1303实现。处理器1303可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器1303中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器1303可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器、以及视觉处理器(vision processing unit,VPU)、张量处理器(tensor processing unit,TPU)等适用于AI运算的处理器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器1303可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1304,处理器1303读取存储器1304中的信息,结合其硬件完成上述实施例中步骤501至步骤503的步骤。
接收器1301可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器1302可用于通过第一接口输出数字或字符信息;发射器1302还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器1302还可以包括显示屏等显示设备。
本申请实施例还提供了一种训练设备,请参阅图14,图14是本申请实施例提供的训练设备一种结构示意图,具体的,训练设备1400可以为上述实施例介绍的数据处理装置,训练设备1400由一个或多个服务器实现,训练设备1400可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1414(例如,一个或一个以上处理器)和存储器1432,一个或一个以上存储应用程序1442或数据1444的存储介质1430(例如一个或一个以上海量存储设备)。其中,存储器1432和存储介质1430可以是短暂存储或持久存储。存储在存储介质1430的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器1414可以设置为与存储介质1430通信,在训练设备1400上执行存储介质1430中的一系列指令操作。
训练设备1400还可以包括一个或一个以上电源1426,一个或一个以上有线或无线网络接口1450,一个或一个以上输入输出接口1458;或,一个或一个以上操作系统1441,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。
本申请实施例中还提供一种包括计算机可读指令的计算机程序产品,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信 单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的模型训练方法,或者,以使训练设备内的芯片执行上述实施例中与模型训练相关的步骤。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。
具体的,请参阅图15,图15为本申请实施例提供的芯片的一种结构示意图,所述芯片可以表现为神经网络处理器NPU 1500,NPU 1500作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1503,通过控制器1504控制运算电路1503提取存储器中的矩阵数据并进行乘法运算。
在一些实现中,运算电路1503内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路1503是二维脉动阵列。运算电路1503还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1503是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1502中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1501中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1508中。
统一存储器1506用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)1505,DMAC被搬运到权重存储器1502中。输入数据也通过DMAC被搬运到统一存储器1506中。
BIU为Bus Interface Unit即,总线接口单元1510,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)1509的交互。
总线接口单元1510(Bus Interface Unit,简称BIU),用于取指存储器1509从外部存储器获取指令,还用于存储单元访问控制器1505从外部存储器获取输入矩阵A或者权重矩阵B的原数据。
DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1506或将权重数据搬运到权重存储器1502中或将输入数据数据搬运到输入存储器1501中。
向量计算单元1507包括多个运算处理单元,在需要的情况下,对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对特征平面进行上采样等。
在一些实现中,向量计算单元1507能将经处理的输出的向量存储到统一存储器1506。例如,向量计算单元1507可以将线性函数;或,非线性函数应用到运算电路1503的输出,例如对卷积层提取的特征平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1507生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1503的激活输入,例如用于在神经网络中的后续层中的使用。
控制器1504连接的取指存储器(instruction fetch buffer)1509,用于存储控制器1504使用的指令;
统一存储器1506,输入存储器1501,权重存储器1502以及取指存储器1509均为On-Chip存储器。外部存储器私有于该NPU硬件架构。
其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器 件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。

Claims (23)

  1. 一种数据处理方法,其特征在于,所述方法包括:
    根据目标映射关系,确定目标词向量token对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址,所述存储地址对应的存储空间位于计算单元之外的存储空间;
    从所述存储地址对应的存储空间中获取所述一个或多个目标网络单元;所述一个或多个目标网络单元用于构建神经网络;
    根据所述目标词向量,通过所述计算单元执行所述神经网络对应的训练过程。
  2. 根据权利要求1所述的方法,其特征在于,不同的所述目标网络单元为不同的前向传播网络FFN。
  3. 根据权利要求1或2所述的方法,其特征在于,所述计算单元为图形处理器GPU、张量处理器TPU或者神经网络处理器NPU。
  4. 根据权利要求1至3任一所述的方法,其特征在于,所述存储地址对应的存储空间位于内存、网络存储器或者硬盘。
  5. 根据权利要求1至4任一所述的方法,其特征在于,所述目标映射关系包括第一目标映射关系,所述第一目标映射关系指示多个词向量以及每个词向量对应的一个或多个网络单元,所述第一目标映射关系具体为多级映射表。
  6. 根据权利要求1至5任一所述的方法,其特征在于,所述通过所述计算单元执行所述目标神经网络对应的训练过程用于得到更新后的目标神经网络,所述更新后的目标神经网络包括更新后的所述一个或多个目标网络单元,所述方法还包括:
    根据所述更新后的所述一个或多个目标网络单元,更新所述存储地址对应的存储空间中的数据。
  7. 根据权利要求1至6任一所述的方法,其特征在于,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述方法还包括:
    接收到用户针对于第二目标映射关系的修改信息,其中,所述第二目标映射关系包括多个词向量以及每个词向量对应的网络单元;
    根据所述修改信息,修改第二目标映射关系,以得到所述目标映射关系。
  8. 根据权利要求5至7任一所述的方法,其特征在于,所述修改信息用于指示如下的至少一种:
    对所述第二目标映射关系中至少一个词向量对应的网络单元的删除、替换或者增加;
    对所述第二目标映射关系中包括的映射关系的删除、替换或者增加,所述映射关系为词向量以及词向量对应的网络单元。
  9. 根据权利要求1至6任一所述的方法,其特征在于,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述方法还包括:
    在通过所述目标词向量对所述神经网络执行训练过程中,基于训练损失的下降程度低于阈值,对第二目标映射关系中所述目标词向量对应的网络单元进行增加,以得到所述目标映射关系。
  10. 根据权利要求1至9任一所述的方法,其特征在于,所述所述目标映射关系包括多个词单元以及每个词单元对应的网络单元,所述方法还包括:
    根据收敛后所述神经网络,从所述目标映射关系中包括的多个词单元中确定部分词单元对应的网络单元,所述收敛后所述神经网络中所述部分词单元对应的网络单元用于构建目标神经网络;所述目标神经网络用于进行模型推理。
  11. 一种数据处理装置,其特征在于,所述装置包括:
    处理模块,用于根据目标映射关系,确定目标词向量token对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址,所述存储地址对应的存储空间位于计算单元之外的存储空间;
    从所述存储地址对应的存储空间中获取所述一个或多个目标网络单元;所述一个或多个目标网络单元用于构建神经网络;
    模型训练模块,用于根据所述目标词向量,通过所述计算单元执行所述神经网络对应的训练过程。
  12. 根据权利要求11所述的装置,其特征在于,所述目标网络单元为前向传播网络FFN。
  13. 根据权利要求11或12所述的装置,其特征在于,所述计算单元为图形处理器GPU、张量处理器 TPU或者神经网络处理器NPU。
  14. 根据权利要求11至13任一所述的装置,其特征在于,所述存储地址对应的存储空间位于内存、网络存储器或者硬盘。
  15. 根据权利要求11至14任一所述的装置,其特征在于,所述目标映射关系包括第一目标映射关系,所述第一目标映射关系指示多个词向量以及每个词向量对应的一个或多个网络单元,所述第一目标映射关系具体为映射表。
  16. 根据权利要求11至15任一所述的装置,其特征在于,所述通过所述计算单元执行所述目标神经网络对应的训练过程用于得到更新后的目标神经网络,所述更新后的目标神经网络包括更新后的所述一个或多个目标网络单元,所述处理模块,还用于:
    根据所述更新后的所述一个或多个目标网络单元,更新所述存储地址对应的存储空间中的数据。
  17. 根据权利要求11至16任一所述的装置,其特征在于,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述处理模块,还用于:
    接收到用户针对于第二目标映射关系的修改信息,其中,所述第二目标映射关系包括多个词向量以及每个词向量对应的网络单元;
    根据所述修改信息,修改第二目标映射关系,以得到所述目标映射关系。
  18. 根据权利要求15至17任一所述的装置,其特征在于,所述修改信息用于指示如下的至少一种:
    对所述第二目标映射关系中至少一个词向量对应的网络单元的删除、替换或者增加;
    对所述第二目标映射关系中包括的映射关系的删除、替换或者增加,所述映射关系为词向量以及词向量对应的网络单元。
  19. 根据权利要求11至16任一所述的装置,其特征在于,在所述根据目标映射关系,确定目标词向量对应的一个或多个目标网络单元以及所述一个或多个目标网络单元的存储地址之前,所述处理模块,还用于:
    在通过所述目标词向量对所述神经网络执行训练过程中,基于训练损失的下降程度低于阈值,对第二目标映射关系中所述目标词向量对应的网络单元进行增加,以得到所述目标映射关系。
  20. 根据权利要求11至19任一所述的装置,其特征在于,所述所述目标映射关系包括多个词单元以及每个词单元对应的网络单元,所述处理模块,还用于:
    根据收敛后所述神经网络,从所述目标映射关系中包括的多个词单元中确定部分词单元对应的网络单元,所述收敛后所述神经网络中所述部分词单元对应的网络单元用于构建目标神经网络;所述目标神经网络用于进行模型推理。
  21. 一种计算设备,其特征在于,所述计算设备包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为获取所述代码,并执行如权利要求1至10任一所述的方法。
  22. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有一个或多个指令,所述指令在由一个或多个计算机执行时使得所述一个或多个计算机实施权利要求1至10任一所述的方法。
  23. 一种计算机程序产品,包括代码,其特征在于,在所述代码被执行时用于实现如权利要求1至10任一所述的方法。
PCT/CN2023/120541 2022-09-30 2023-09-22 一种数据处理方法及相关装置 WO2024067373A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211214438.0A CN115879508A (zh) 2022-09-30 2022-09-30 一种数据处理方法及相关装置
CN202211214438.0 2022-09-30

Publications (1)

Publication Number Publication Date
WO2024067373A1 true WO2024067373A1 (zh) 2024-04-04

Family

ID=85770203

Family Applications (2)

Application Number Title Priority Date Filing Date
PCT/CN2023/120541 WO2024067373A1 (zh) 2022-09-30 2023-09-22 一种数据处理方法及相关装置
PCT/CN2023/123636 WO2024067884A1 (zh) 2022-09-30 2023-10-09 一种数据处理方法及相关装置

Family Applications After (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/123636 WO2024067884A1 (zh) 2022-09-30 2023-10-09 一种数据处理方法及相关装置

Country Status (2)

Country Link
CN (1) CN115879508A (zh)
WO (2) WO2024067373A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115879508A (zh) * 2022-09-30 2023-03-31 华为技术有限公司 一种数据处理方法及相关装置
CN117809629B (zh) * 2024-02-29 2024-05-24 青岛海尔科技有限公司 基于大模型的交互系统更新方法、装置及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108062505A (zh) * 2016-11-09 2018-05-22 微软技术许可有限责任公司 基于神经网络的动作检测
CN109242092A (zh) * 2018-09-29 2019-01-18 深圳市商汤科技有限公司 网络获取及图像处理方法和装置、电子设备、存储介质
CN111047563A (zh) * 2019-11-26 2020-04-21 深圳度影医疗科技有限公司 一种应用于医学超声图像的神经网络构建方法
CN113902111A (zh) * 2021-12-09 2022-01-07 绍兴埃瓦科技有限公司 多芯片互连系统及神经网络加速处理方法
CN115879508A (zh) * 2022-09-30 2023-03-31 华为技术有限公司 一种数据处理方法及相关装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10366327B2 (en) * 2014-01-31 2019-07-30 Google Llc Generating vector representations of documents
CN107451075B (zh) * 2017-09-22 2023-06-20 北京算能科技有限公司 数据处理芯片和系统、数据存储转发和读取处理方法
CN108776832B (zh) * 2018-06-05 2021-08-24 腾讯科技(深圳)有限公司 信息处理方法、装置、计算机设备和存储介质
CN112686317A (zh) * 2020-12-30 2021-04-20 北京迈格威科技有限公司 神经网络训练方法、装置、电子设备及存储介质
CN114492754A (zh) * 2022-01-27 2022-05-13 上海商汤临港智能科技有限公司 神经网络生成、数据处理方法、装置、电子设备及介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108062505A (zh) * 2016-11-09 2018-05-22 微软技术许可有限责任公司 基于神经网络的动作检测
CN109242092A (zh) * 2018-09-29 2019-01-18 深圳市商汤科技有限公司 网络获取及图像处理方法和装置、电子设备、存储介质
CN111047563A (zh) * 2019-11-26 2020-04-21 深圳度影医疗科技有限公司 一种应用于医学超声图像的神经网络构建方法
CN113902111A (zh) * 2021-12-09 2022-01-07 绍兴埃瓦科技有限公司 多芯片互连系统及神经网络加速处理方法
CN115879508A (zh) * 2022-09-30 2023-03-31 华为技术有限公司 一种数据处理方法及相关装置

Also Published As

Publication number Publication date
WO2024067884A1 (zh) 2024-04-04
CN115879508A (zh) 2023-03-31

Similar Documents

Publication Publication Date Title
US20210256403A1 (en) Recommendation method and apparatus
WO2021233199A1 (zh) 搜索推荐模型的训练方法、搜索结果排序的方法及装置
WO2022022274A1 (zh) 一种模型训练方法及装置
WO2024067373A1 (zh) 一种数据处理方法及相关装置
WO2023221928A1 (zh) 一种推荐方法、训练方法以及装置
WO2022170569A1 (zh) 数据处理方法和装置
CN114519145A (zh) 一种基于图神经网络挖掘用户长短期兴趣的序列推荐方法
WO2023185925A1 (zh) 一种数据处理方法及相关装置
WO2024002167A1 (zh) 一种操作预测方法及相关装置
WO2024041483A1 (zh) 一种推荐方法及相关装置
CN112529149A (zh) 一种数据处理方法及相关装置
WO2024067779A1 (zh) 一种数据处理方法及相关装置
CN115238909A (zh) 一种基于联邦学习的数据价值评估方法及其相关设备
WO2024012360A1 (zh) 一种数据处理方法及相关装置
WO2021136058A1 (zh) 一种处理视频的方法及装置
WO2023246735A1 (zh) 一种项目推荐方法及其相关设备
CN117217284A (zh) 一种数据处理方法及其装置
CN116910357A (zh) 一种数据处理方法及相关装置
CN117057855A (zh) 一种数据处理方法及相关装置
CN116843022A (zh) 一种数据处理方法及相关装置
WO2023273934A1 (zh) 一种模型超参数的选择方法及相关装置
WO2023050143A1 (zh) 一种推荐模型训练方法及装置
CN116308640A (zh) 一种推荐方法及相关装置
CN116204709A (zh) 一种数据处理方法及相关装置
WO2024114659A1 (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: 23870605

Country of ref document: EP

Kind code of ref document: A1