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

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

Info

Publication number
WO2024067779A1
WO2024067779A1 PCT/CN2023/122458 CN2023122458W WO2024067779A1 WO 2024067779 A1 WO2024067779 A1 WO 2024067779A1 CN 2023122458 W CN2023122458 W CN 2023122458W WO 2024067779 A1 WO2024067779 A1 WO 2024067779A1
Authority
WO
WIPO (PCT)
Prior art keywords
encoder
attribute information
information
embedding
attention
Prior art date
Application number
PCT/CN2023/122458
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 WO2024067779A1 publication Critical patent/WO2024067779A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

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.
  • Personalized recommendation systems play an important role in many online service platforms, from online advertising and online retail to music and video recommendations. In order to provide users with precise and customized services, these systems try to recommend products that users may be interested in based on their historical interaction data.
  • the usual practice is to construct the interaction between users and products into a dynamic sequence, and then capture the user's diverse and dynamic interest patterns through a sequence model.
  • the above idea can be naturally described as a Next-Item Prediction task (i.e., predicting the next item that the user may interact with), which is modeled in the form of an autoregressive model.
  • BERT4Rec based on the autoencoder sequence recommendation algorithm, which uses the MLM training method to predict masked item interactions based on the user's past and future interaction behavior records.
  • BERT4Rec attempts to break the limitation of behavioral orderliness and introduce future information into the user behavior modeling process, and has achieved remarkable results.
  • BERT4Rec introduces both past and future information into the training process through the MLM task, it is accompanied by a serious training-inference gap. That is, during training, past and future interaction records are used as context to predict masked items, while during inference, only past interaction records can be used to predict the next item that the user may interact with. This contextual difference between training and inference may cause model bias during inference and lead to potential performance degradation.
  • the present application provides a data processing method that can improve the prediction accuracy of the model.
  • the present application provides a data processing method, the method comprising: obtaining first log data and second log data of a user; the first log data includes first attribute information of a first item, and the second log data includes second attribute information of a second item; the occurrence time of the first log data is earlier than that of the second log data; processing a first embedding corresponding to the first attribute information through a first encoder to obtain a first feature representation; processing a second embedding corresponding to the second attribute information through a second encoder to obtain a second feature representation; the difference between the first feature representation and the second embedding, and the difference between the second feature representation and the first embedding are used to construct a loss; and the first encoder and the second encoder are updated according to the loss.
  • the first encoder and the second encoder are updated, so that the first encoder can have the ability to predict future information based on historical information, and the second encoder can have the ability to predict historical information based on future information.
  • the first encoder and the second encoder are imposed with target constraints, and the target constraints are used to constrain the difference between the intermediate outputs of the first encoder and the second encoder to be minimized. That is, the ability of the second encoder can be distilled to the first encoder, so that the first encoder can also have the ability to predict historical information based on future information.
  • the updated first encoder can be used Perform inference on the model.
  • the embodiment of the present application uses two independent encoders to model the interaction information of the past and the future respectively, and at the same time promotes mutual learning between the two by constraining the multi-scale interest representation captured by the two encoders. Therefore, the limitation of insufficient modeling in the prior art is solved and the prediction accuracy of the model is improved.
  • target constraints are imposed on the first encoder and the second encoder, and the target constraints are used to constrain the difference between the intermediate outputs of the first encoder and the second encoder to be minimized.
  • processing the first attribute information through a first encoder includes: processing the first attribute information and the second attribute information through a first encoder according to first self-attention information; the first self-attention information indicates that the second attribute information is masked and the first attribute information is not masked; processing the second attribute information through a second encoder includes: processing the first attribute information and the second attribute information through a second encoder according to second self-attention information; the second self-attention information indicates that the first attribute information is masked and the second attribute information is not masked.
  • the updated first encoder is used to perform model inference.
  • the target constraint is specifically KL divergence.
  • the present application uses KL divergence to constrain the multi-scale user interest representations captured by the past and future encoders, thereby achieving mutual learning of knowledge in past and future behaviors.
  • the first embedding and the second embedding are obtained by respectively processing the first attribute information and the second attribute information through the same embedding layer.
  • the first encoder and the second encoder include multiple attention heads, and the receptive fields corresponding to the attention information in different attention heads are different.
  • the present application uses a self-attention mask to set receptive fields of different lengths for different self-attention heads to capture user interest representations of different scales.
  • the first attribute information and the second attribute information include at least one of the following: item name, developer, installation package size, category, and praise rating.
  • the present application provides a data processing device, the device comprising:
  • a processing module configured to obtain first log data and second log data of a user; the first log data includes first attribute information of a first item, and the second log data includes second attribute information of a second item; and the occurrence time of the first log data is earlier than that of the second log data;
  • An updating module is used to update the first encoder and the second encoder according to the loss; and when updating the first encoder and the second encoder, the first encoder and the second encoder are imposed with a target constraint, and the target constraint is used to constrain the difference between the intermediate outputs of the first encoder and the second encoder to be minimized.
  • the target constraint is a portion of the loss.
  • the processing module is specifically configured to process the first attribute information and the second attribute information through a first encoder according to first self-attention information; the first self-attention information indicates that the second attribute information is masked and the first attribute information is not masked;
  • the processing module is specifically used to process the first attribute information and the second attribute information through a second encoder according to second self-attention information; the second self-attention information indicates that the first attribute information is masked and the second attribute information is not masked.
  • the updated first encoder is used to perform model inference.
  • the target constraint is specifically KL divergence.
  • the first embedding and the second embedding are obtained by respectively processing the first attribute information and the second attribute information through the same embedding layer.
  • the first encoder and the second encoder include multiple attention heads, and the receptive fields corresponding to the attention information in different attention heads are different.
  • the first attribute information and the second attribute information include at least one of the following: item name, developer, installation package size, category, and praise rating.
  • 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 a system architecture provided in an embodiment of the present application.
  • FIG3 is a schematic diagram of a system architecture provided in an embodiment of the present application.
  • FIG4A is a schematic diagram of a recommendation scenario provided in an embodiment of the present application.
  • FIG4B is a schematic diagram of a network provided in an embodiment of the present application.
  • FIG5 is a flow chart of a data processing method provided in an embodiment of the present application.
  • FIG6A is a schematic diagram of a model
  • FIG6B is a schematic diagram of a model
  • FIG6C is a schematic diagram of a model
  • FIG7 is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application.
  • FIG8 is a schematic diagram of an execution device provided in an embodiment of the present application.
  • FIG9 is a schematic diagram of a training device provided in an embodiment of the present application.
  • FIG. 10 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 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 at different positions as the recommendation results for users. Users browse the displayed items and perform 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 user features, such as gender, age, occupation, hobbies, etc.
  • Object feature information is used to characterize the features 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 (identification), type, size, etc. of the APP.
  • the object features mentioned in the training samples of e-commerce APPs 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 is a negative example. For example, when the user clicks, downloads, or purchases the recommended object, 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 0, indicating that the sample is a negative example.
  • the training device 220 obtains the model parameter matrix based on the sample training in the database 230 for generating the recommendation model 201 (such as the feature extraction network and neural network in the embodiment of the present application). The following will describe in more detail how the training device 220 trains to obtain the model parameter matrix for generating the recommendation model 201.
  • the recommendation model 201 can be used to evaluate a large number of objects to obtain the score of each object to be recommended.
  • the calculation module 211 obtains the recommendation results based on the evaluation results of the recommendation model 201 and recommends them 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 the data, code, etc. in the data storage system 250, and can also store the output data in the data storage system 250.
  • the data storage system 250 may be disposed in the execution device 210, or may be disposed independently, or may be disposed in other network entities, and the number may 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, and to store the data of 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. Of course, the data storage system 250 can also be deployed in the execution device 210.
  • the distributed storage system can include one or more memories.
  • different memories are used to store different types of data, such as 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.
  • FIG3 is a schematic diagram of a recommendation system provided in an embodiment of the present application.
  • the recommendation system inputs the request and related information (such as operation information in the embodiment of the present application) into the recommendation model, and then predicts 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. Users browse items in different positions and perform 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 characterize complex situations in the real world. Theory Generally speaking, 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 (the 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.
  • 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, for example, 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 to obtain 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 should I return Huabei" as an example, the position of "how many” may be represented as the first position, and the position of "number” may be represented as the second position, ... ... In some examples, the position of each word may be the relative position between each word.
  • the position of "on which date” can be represented as before “on which date”, and the position of "on which date” can be represented as after “on which date” and before “on which date”, etc.
  • the word embedding vector and position vector of each word in the current input are obtained, 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 feature vectors in the multiple feature vectors can be set.
  • the number of eigenvectors is M
  • the preset dimension is H
  • the multiple eigenvectors can be represented as an M ⁇ H embedding matrix.
  • P input vectors are obtained from the previous layer of the first transformer layer, 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 attention layer can also be called a multi-head attention layer.
  • the attention layer can be a fixed window 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.
  • Personalized recommendation systems play an important role in many online service platforms, from online advertising and online retail to music and video recommendations.
  • these systems attempt to recommend products that users may be interested in based on their historical interaction data.
  • the usual practice is to construct the interaction between users and products into a dynamic sequence, and then capture the user's diverse and dynamic interest patterns through a sequence model.
  • the above idea can be naturally described as a Next-Item Prediction task (i.e., predicting the next item that the user may interact with), which is modeled in the form of an autoregressive model.
  • BERT4Rec based on the autoencoder sequence recommendation algorithm, which uses the MLM training method to predict masked item interactions based on the user's past and future interaction behavior records.
  • BERT4Rec attempts to break the limitation of behavioral orderliness and introduce future information into the user behavior modeling process, and has achieved remarkable results.
  • BERT4Rec introduces both past and future information into the training process through the MLM task, it is accompanied by a serious training-inference gap. That is, during training, past and future interaction records are used as context to predict masked items, while during inference, only past interaction records can be used to predict the next item that the user may interact with. This contextual difference between training and inference may cause model bias during inference and lead to potential performance degradation.
  • 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:
  • first log data and second log data of a user the first log data includes first attribute information of a first item, and the second log data includes second attribute information of a second item; the occurrence time of the first log data is earlier than that of the second log data.
  • 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 earplugs), a network PC, a minicomputer, a mainframe computer, a distributed computing environment including any of the above systems or devices, and the like.
  • a mobile or portable computing device such as a smart phone
  • a personal computer such as a server computer
  • a handheld device such as a tablet
  • a laptop device such as a laptop device
  • a multi-processor system such as a game
  • the execution entity of step 501 may be a server on the cloud side, and the server may receive the user's operation data sent from the terminal device, and then the server may obtain the user's operation data.
  • the training samples may include attribute information of users and items, and the attribute information may be user operation data.
  • the user's operation data can be obtained based on the interaction record between the user and the item (such as the user's behavior log), and the operation data may include the user's actual operation record on each item.
  • the operation data may include the user's attribute information, the attribute information of each item, and the operation type (such as click, download, etc.) of the user's operation on the multiple items.
  • the user's attribute information can be an attribute related to the user's preference characteristics, at least one of gender, age, occupation, income, hobbies and education level, among which gender can be male or female, age can be a number between 0-100, occupation can be teacher, programmer, chef, etc., hobbies can be basketball, tennis, running, etc., and education level can be elementary school, junior high school, high school, university, etc.; this application does not limit the specific type of user's attribute information.
  • the items can be physical items or virtual items, such as applications (APP), audio and video, web pages, and news information.
  • the attribute information of the items can be at least one of the item name, developer, installation package size, category, and popularity.
  • the category of the item can be chatting, parkour games, office, etc.
  • the popularity can be a score, comment, etc. for the item; the present application does not limit the specific type of the attribute information of the item.
  • the user's first log data and second log data may be obtained; the first log data includes first attribute information of a first item, and the second log data includes second attribute information of a second item; the occurrence time of the first log data is earlier than that of the second log data.
  • the first item may include one or more items, and the second item may include one or more items.
  • the attribute information of the items in the sequence can be first mapped into a low-dimensional continuous representation vector through an embedding layer, that is, the first attribute information of the first item is mapped into a first embedding, and the second attribute information of the second item is mapped into a second embedding. Then, the low-dimensional representation sequence x of the items is used as the input of the model.
  • the model may include a first encoder and a second encoder.
  • a second embedding corresponding to the second attribute information through a second encoder to obtain a second feature representation; a difference between the first feature representation and the second embedding, and a difference between the second feature representation and the first embedding are used to construct a loss.
  • the first encoder and the second encoder may include a plurality of transformer layers connected in series.
  • the transformer layer-based encoder may include an embedding layer and multiple transformer layers connected in sequence. The number of transformer layers may be set as needed. The encoder determines a feature vector corresponding to the current node based on the N output vectors obtained from each transformer layer.
  • FIG6B is a schematic diagram of the structure of a transformer layer.
  • the transformer layer of each neural network in the embodiment of the present application can refer to the structure shown in FIG6B .
  • the transformer layer includes a multi-head attention layer, an add&norm layer, a feed forward layer, and an add&norm layer that are adjacent to each other in sequence.
  • the multi-head attention layer obtains N input vectors X l from the previous layer, which can also be expressed as a matrix X.
  • the self-attention mechanism is used to transform each vector based on the correlation between the vectors (or it can be called interaction), and N output vectors are obtained, which can also be expressed as a matrix Y.
  • the input vector obtained is the embedding vector output by the embedding layer;
  • the multi-head attention layer is a multi-head attention layer included in the subsequent transformer layer, such as the multi-head attention layer included in the transformer layer directly connected to the previous transformer layer in Figure 6B, the input vector obtained is the output vector of the previous transformer layer.
  • the MHA layer based on multi-head attention includes multiple attention heads (such as Head 1, Head 2, ..., Head N shown in Figure 6C).
  • FIG6C is a schematic diagram of the operation of an attention head head, which shows how the attention head head transforms the input matrix X into the output matrix Y.
  • the first transformation matrix Q, the second transformation matrix K and the third transformation matrix V are respectively used to transform each input vector Xi in the N input vectors ⁇ X1, X2, ..., XN> to obtain the first intermediate vector (q vector), the second intermediate vector (k vector) and the third intermediate vector (v vector) corresponding to each input vector.
  • the first transformation matrix Q, the second transformation matrix K and the third transformation matrix V can be used to linearly transform the input matrix X composed of the N input vectors to obtain the Q matrix, the K matrix and the V matrix of the input matrix respectively, and then the matrix is split respectively to obtain the q vector, the k vector and the v vector corresponding to each input vector.
  • the respective correlation degrees of the i-th input vector Xi and each input vector Xj are determined.
  • the dot product of qi and kj can also be directly used as the correlation, it is more classical to first divide the dot product by a constant, then perform a softmax operation, and use the result as the correlation between the input vectors Xi and Xj (that is, the correlation between the Q vector and the K vector), that is:
  • the correlation degrees ⁇ i,j between the i-th input vector Xi and each input vector Xj can be used as weight factors to perform weighted combination on the third intermediate vectors (v vectors, vj) corresponding to each input vector Xj to obtain the i-th combination vector Ci corresponding to the i-th input vector Xi:
  • a vector sequence ⁇ C1, C2, ..., CN> of N combination vectors corresponding to N input vectors, or a matrix C can be obtained.
  • N output vectors can be obtained.
  • the output matrix Y is the combination vector matrix C, which can also be written as:
  • the MHA layer maintains m sets of transformation matrices, each set of transformation matrices includes the aforementioned first transformation matrix Q, second transformation matrix K and third transformation matrix V, so that the above operations can be performed in parallel to obtain m combination vector sequences (i.e., m matrices C), each vector sequence includes N combination vectors obtained based on a set of transformation matrices.
  • the MHA layer splices the obtained m combination vector sequences to obtain a spliced matrix; then transforms the spliced matrix through the fourth transformation matrix W to obtain the final output matrix Y.
  • Splitting the output matrix Y corresponds to N output vectors ⁇ Y1, Y2,..., YN>.
  • the MHA layer performs transformation operations based on the correlation between the N input vectors to obtain N output vectors.
  • processing the first attribute information through a first encoder includes: processing the first attribute information and the second attribute information through a first encoder according to first self-attention information; the first self-attention information indicates that the second attribute information is masked and the first attribute information is not masked; processing the second attribute information through a second encoder includes: processing the first attribute information and the second attribute information through a second encoder according to second self-attention information; the second self-attention information indicates that the first attribute information is masked and the second attribute information is not masked.
  • a first embedding corresponding to the first attribute information can be processed by a first encoder to obtain a first feature representation;
  • a second embedding corresponding to the second attribute information can be processed by a second encoder to obtain a second feature representation; the difference between the first feature representation and the second embedding, and the difference between the second feature representation and the first embedding are used to construct the loss.
  • the first encoder and the second encoder are updated, so that the first encoder has the ability to predict future information based on historical information, and the second encoder has the ability to predict historical information based on future information, and when updating the first encoder
  • the first encoder and the second encoder are subject to a target constraint, and the target constraint is used to constrain the difference between the intermediate outputs of the first encoder and the second encoder to be minimized, that is, the ability of the second encoder can be distilled to the first encoder, so that the first encoder can also have the ability to predict historical information based on future information.
  • the updated first encoder can be used for model reasoning.
  • the embodiment of the present application proposes a dual network model (including a first encoder and a second encoder), as shown in Figure 6A.
  • Two independent encoders are used in the dual network to model past and future user behaviors respectively, and the two encoders share the same Embedding layer.
  • the encoder adopts a Transformer structure, which uses a self-attention mask to ensure that the behavior information is processed from left to right or from right to left.
  • the self-attention masks of the two encoders are also dual to each other.
  • the target tasks of the two encoders are also dual to each other, that is, the encoder that processes past interaction information predicts the next possible interactive item (original task), while the encoder responsible for future interaction information predicts the previous item that may interact before the behavior sequence occurs (dual task).
  • original task the encoder that processes past interaction information predicts the next possible interactive item
  • future task the encoder responsible for future interaction information predicts the previous item that may interact before the behavior sequence occurs
  • future information is modeled in a separate way, and is explicitly decoupled from the modeling of past information.
  • the first encoder and the second encoder include multiple attention heads, and the receptive fields corresponding to the attention information in different attention heads are different.
  • the present application uses a self-attention mask to set receptive fields of different lengths for different self-attention heads to capture user interest representations of different scales.
  • target constraints are imposed on the first encoder and the second encoder, and the target constraints are used to constrain the difference between the intermediate outputs of the first encoder and the second encoder to be minimized.
  • the target constraint is specifically KL divergence.
  • the present application uses KL divergence to constrain the multi-scale user interest representations captured by the past and future encoders, thereby achieving mutual learning of knowledge in past and future behaviors.
  • the target constraint may also be a part of the loss.
  • the core device of the embodiment of the present application can be shown in Figure 6A, which consists of a dual network and a bidirectional information transfer.
  • the two encoders in the dual network are responsible for modeling past and future behavior information respectively, and they share the same set of Embedding layer parameters.
  • Bidirectional information transfer uses KL divergence to achieve multi-scale representation distillation between past and future information, thereby enhancing the utilization of future contextual information.
  • the dual network explicitly decouples the processing of past and future information in a direct way, but this also affects the mutual learning between the two encoders to a certain extent.
  • the user preferences captured by the two encoders corresponding to the past and the future are often related or even complementary, so the mutual learning between the two encoders can further improve the model performance.
  • user interests are often dynamic and multi-scale, because there are often both stable long-term interests and dynamic short-term interests. Therefore, the present invention adopts a multi-scale multi-head self-attention mechanism to capture the multi-scale interests of users, and uses KL divergence to constrain the multi-scale user interest representations captured in the past and future encoders to promote mutual learning between the two.
  • the capture of multi-scale interests by the multi-scale multi-head self-attention mechanism is achieved through the different receptive field lengths in the self-attention mask, as shown in (c) and (d) in Figure 6A.
  • This technical solution can predict the commodity that the user is most likely to interact with in the n+1th time under a given interaction type based on the user's interaction history data.
  • the user-item sequence is first mapped into a low-dimensional continuous representation vector through the Embedding layer. Then, the low-dimensional representation sequence x of the item is used as the input of the model, and the overall dual network is processed to obtain the potential interactive items of the user under a certain target behavior in the next time.
  • the above dual network decouples the past and future behavior processing, but it also hinders the mutual learning between the two.
  • the mutual transfer of knowledge between the two encoders can be promoted during the training process.
  • the specific process can be divided into the following steps:
  • a self-attention mask is used to set receptive fields of different lengths for different self-attention heads to capture user interest representations of different scales.
  • KL divergence is used to constrain the multi-scale user interest representations captured by the past and future encoders, thereby achieving mutual learning of knowledge in past and future behaviors.
  • the present application embodiment has conducted sufficient experiments on multiple user behavior sequence recommendation public data sets, and the experimental settings are as follows:
  • the performance is evaluated using Amazon Beauty, Sports, Toys, and Yelp datasets.
  • Table 1 shows a comparison of the recommended performance. Bold indicates the best result, and underline indicates the second best result (i.e., the best baseline). “*” indicates a statistically significant improvement compared to the best baseline (i.e., p value ⁇ 0.05).
  • the present invention has achieved the best experimental results in the three indicators of Hit Rate, NDCG and MRR, which proves the significant effectiveness of the sequential recommendation system proposed in the present invention.
  • Migrating the solution in the present invention to existing work can significantly improve the results of the existing work, which further proves the effectiveness and universality of the present invention.
  • the embodiment of the present application uses two independent encoders to model the interaction information of the past and the future respectively, and at the same time promotes mutual learning between the two by constraining the multi-scale interest representation captured by the two encoders. Therefore, the limitation of insufficient modeling in the prior art is solved and the prediction accuracy of the model is improved.
  • a data processing device 700 provided by an embodiment of the present application includes:
  • Processing module 701 used to obtain first log data and second log data of a user; the first log data includes first attribute information of a first item, and the second log data includes second attribute information of a second item; the occurrence time of the first log data is earlier than that of the second log data;
  • processing module 701 For a detailed introduction to the processing module 701 , reference may be made to the description of steps 501 to 503 in the above embodiment, which will not be repeated here.
  • An updating module 702 is used to update the first encoder and the second encoder according to the loss; and when updating the first encoder and the second encoder, the first encoder and the second encoder are imposed with a target constraint, and the target constraint is used to constrain the difference between the intermediate outputs of the first encoder and the second encoder to be minimized.
  • step 504 For a detailed introduction to the update module 702, reference may be made to the description of step 504 in the above embodiment, which will not be repeated here.
  • the target constraint is a portion of the loss.
  • the processing module is specifically configured to process the first attribute information and the second attribute information through a first encoder according to first self-attention information; the first self-attention information indicates that the second attribute information is masked and the first attribute information is not masked;
  • the processing module is specifically used to process the first attribute information and the second attribute information through a second encoder according to second self-attention information; the second self-attention information indicates that the first attribute information is masked and the second attribute information is not masked.
  • the updated first encoder is used to perform model inference.
  • the target constraint is specifically KL divergence.
  • the first embedding and the second embedding are obtained by respectively processing the first attribute information and the second attribute information through the same embedding layer.
  • the first encoder and the second encoder include multiple attention heads, and the receptive fields corresponding to the attention information in different attention heads are different.
  • the first attribute information and the second attribute information include at least one of the following: item name, developer, installation package size, category, and praise rating.
  • FIG. 8 is an execution device provided in an embodiment of the present application.
  • the execution device 800 can be specifically manifested as a mobile phone, a tablet, a laptop computer, an intelligent wearable device, a server, etc., which is not limited here.
  • the execution device 800 implements the function of the data processing method in the embodiment corresponding to Figure 5.
  • the execution device 800 includes: a receiver 801, a transmitter 802, a processor 803 and a memory 804 (wherein the number of processors 803 in the execution device 800 can be one or more), wherein the processor 803 may include an application processor 8031 and a communication processor 8032.
  • the receiver 801, the transmitter 802, the processor 803 and the memory 804 may be connected via a bus or other means.
  • the memory 804 may include a read-only memory and a random access memory, and provides instructions and data to the processor 803. A portion of the memory 804 may also include a non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 804 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 803 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 803, or implemented by the processor 803.
  • the processor 803 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 in the processor 803 or the instruction in the form of software.
  • the above processor 803 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 803 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 804, and the processor 803 reads the information in the memory 804, and completes the steps 501 to 503 in the above embodiment in combination with its hardware.
  • the receiver 801 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 802 can be used to output digital or character information through the first interface; the transmitter 802 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 802 can also include a display device such as a display screen.
  • the embodiment of the present application also provides a training device, please refer to Figure 9, which is a structural diagram of the training device provided by the embodiment of the present application.
  • the training device 900 is implemented by one or more servers.
  • the training device 900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 99 (for example, one or more processors) and a memory 932, and one or more storage media 930 (for example, one or more mass storage devices) storing application programs 942 or data 944.
  • the memory 932 and the storage medium 930 can be short-term storage or permanent storage.
  • the program stored in the storage medium 930 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 99 can be configured to communicate with the storage medium 930 to execute a series of instruction operations in the storage medium 930 on the training device 900.
  • the training device 900 may also include one or more power supplies 926, one or more wired or wireless network interfaces 950, one or more input and output interfaces 958; or, one or more operating systems 941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
  • the training device may perform steps 501 to 503 in the above embodiment.
  • Also provided in an embodiment of the present application is a computer program product 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 data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described 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, 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. 10 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 1000.
  • NPU 1000 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 1003, which is controlled by the controller 1004 to extract matrix data from the memory and perform multiplication operations.
  • NPU 1000 can implement the data processing method provided in the embodiment described in Figure 5 through the mutual cooperation between various internal devices.
  • the operation circuit 1003 in the NPU 1000 includes a plurality of processing units (Process Engine, PE) therein.
  • the operation circuit 1003 is a two-dimensional systolic array.
  • the operation circuit 1003 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 1003 is a general-purpose matrix processor.
  • the operation circuit takes the corresponding data of matrix B from the weight memory 1002 and caches it on each PE in the operation circuit.
  • the operation circuit takes the matrix A data from the input memory 1001 and performs matrix operation with matrix B.
  • the partial result or final result of the matrix is stored in the accumulator 1008.
  • the unified memory 1006 is used to store input data and output data.
  • the weight data is directly transferred to the weight memory 1002 through the direct memory access controller (DMAC) 1005.
  • the input data is also transferred to the unified memory 1006 through the DMAC.
  • DMAC direct memory access controller
  • BIU stands for Bus Interface Unit, that is, the bus interface unit 1010, which is used for the interaction between AXI bus and DMAC and instruction fetch buffer (IFB) 1009.
  • IOB instruction fetch buffer
  • the bus interface unit 1010 (Bus Interface Unit, BIU for short) is used for the instruction fetch memory 1009 to obtain instructions from the external memory, and is also used for the storage unit access controller 1005 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 1006 or to transfer weight data to the weight memory 1002 or to transfer input data to the input memory 1001.
  • the vector calculation unit 1007 includes multiple operation processing units, and further processes the output of the operation circuit 1003 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 1007 can store the processed output vector to the unified memory 1006.
  • the vector calculation unit 1007 can apply a linear function; or a nonlinear function to the output of the operation circuit 1003, 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 1007 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 1003, for example, for use in a subsequent layer in a neural network.
  • An instruction fetch buffer 1009 connected to the controller 1004 is used to store instructions used by the controller 1004;
  • Unified memory 1006, input memory 1001, weight memory 1002 and instruction fetch memory 1009 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 technicians in the relevant field can clearly understand that the present application can be implemented by software with the necessary communication It can be implemented by hardware, and of course it can also be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. In general, all functions performed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits or dedicated circuits. However, for this application, software program implementation is a better implementation method in most cases.
  • the technical solution of the present application can be 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's floppy disk, U disk, mobile hard disk, ROM, RAM, disk or optical disk, 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's floppy disk, U disk, mobile hard disk, ROM, RAM, disk or optical disk, 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)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Biomedical Technology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biophysics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Medical Informatics (AREA)
  • Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种数据处理方法,可以应用于人工智能领域,方法包括:获取用户的第一日志数据以及第二日志数据;所述第一日志数据包括第一物品的第一属性信息,所述第二日志数据包括第二物品的第二属性信息;所述第一日志数据的发生时间早于所述第二日志数据;通过第一编码器处理所述第一属性信息对应的第一嵌入,得到第一特征表示;通过第二编码器处理所述第二属性信息对应的第二嵌入,得到第二特征表示;所述第一特征表示和所述第二嵌入之间的差异、以及所述第二特征表示和所述第一嵌入之间的差异用于构建损失;根据所述损失更新所述第一编码器以及所述第二编码器。本申请可以提高模型的预测精度。

Description

一种数据处理方法及相关装置
本申请要求于2022年09月30日提交国家知识产权局、申请号为202211214436.1、发明名称为“一种数据处理方法及相关装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能领域,尤其涉及一种数据处理方法及相关装置。
背景技术
人工智能(artificial intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。
个性化推荐系统在许多在线服务平台中发挥着重要作用,从在线广告、在线零售到音乐和视频的推荐。为了为用户提供精确和定制的服务,这些系统试图根据用户的历史交互数据推荐用户可能感兴趣的产品。通常的做法是将用户与商品的交互构成一个动态的序列,然后通过序列模型捕获用户多样化动态化的兴趣模式。上述思路可以很自然地被描述为Next-Item Prediction任务(即预测用户可能会交互下一个项目),通过自回归模型的形式来建模。
然而在实际场景中,用户行为并不是严格有序的。例如在购买iPad后,用户可能会点击铅笔、iPad外壳和耳机,但用户很可能是随机点击这三个产品的而并不存在严格的点击顺序。因此目前主流的序列推荐系统的行为有序性假设会造成用户行为建模中的上下文信息损失,因为未来信息(发生在用户与目标项目交互之后的交互)也会提供丰富的背景信息来帮助模型训练。
最近,研究人员已经证明,与自回归模型相比,在训练过程中利用过去和未来的语境信息将显著提升推荐性能。受自然语言处理领域进展的启发,他们提出了基于自编码序列推荐算法的BERT4Rec模型,采用MLM的训练方式,根据用户过去和未来的交互行为记录预测被掩码(Masked)的项目交互。与单向自回归模型(如SASRec)相比,BERT4Rec尝试打破行为有序性的限制,将未来信息引入到用户行为建模过程中,并取得了显著的成效。
尽管BERT4Rec通过MLM任务将过去与未来信息同时引入到训练过程之中,但是其伴随着严重的训练-推理差异(training-inference gap)。即在训练时采用过去与未来的交互记录作为上下文来预测被掩蔽的项目,而在推理时则只能利用过去交互记录预测用户可能交互的下一个项目。这一训练和推理之间的上下文差异可能会在推理过程中造成模型偏差,并导致潜在的性能下降。
发明内容
本申请提供了一种数据处理方法,可以提高模型的预测精度。
第一方面,本申请提供了一种数据处理方法,所述方法包括:获取用户的第一日志数据以及第二日志数据;所述第一日志数据包括第一物品的第一属性信息,所述第二日志数据包括第二物品的第二属性信息;所述第一日志数据的发生时间早于所述第二日志数据;通过第一编码器处理所述第一属性信息对应的第一嵌入,得到第一特征表示;通过第二编码器处理所述第二属性信息对应的第二嵌入,得到第二特征表示;所述第一特征表示和所述第二嵌入之间的差异、以及所述第二特征表示和所述第一嵌入之间的差异用于构建损失;根据所述损失更新所述第一编码器以及所述第二编码器。
基于上述构建的损失来更新第一编码器和第二编码器,可以使得第一编码器具备基于历史信息预测未来信息的能力,第二编码器则可以具备基于未来信息预测历史信息的能力,且在更新所述第一编码器和所述第二编码器时,所述第一编码器和所述第二编码器施加有目标约束,所述目标约束用于约束所述第一编码器和所述第二编码器之间中间输出的差异最小化,也就是可以将第二编码器的能力蒸馏至第一编码器,使得第一编码器也可以具备基于未来信息预测历史信息的能力,更新后的第一编码器可以用于 进行模型的推理。
现有技术虽然通过MLM任务引入了未来行为信息,但是同时也带了严重的训练-推理差异。与现有的推荐模型不同,本申请实施例采用两个独立的编码器分别建模过去和未来的交互信息,同时又通过对两编码器捕获的多尺度兴趣表征进行约束来促进两者的互相学习。因此解决了现有技术中建模不充分的限制,提高了模型的预测精度。
在一种可能的实现中,在更新所述第一编码器和所述第二编码器时,所述第一编码器和所述第二编码器施加有目标约束,所述目标约束用于约束所述第一编码器和所述第二编码器之间中间输出的差异最小化。
在一种可能的实现中,所述通过第一编码器处理所述第一属性信息,包括:根据第一自注意力信息,通过第一编码器处理所述第一属性信息和所述第二属性信息;所述第一自注意力信息指示所述第二属性信息被掩码、且所述第一属性信息未被掩码;所述通过第二编码器处理所述第二属性信息,包括:根据第二自注意力信息,通过第二编码器处理所述第一属性信息和所述第二属性信息;所述第二自注意力信息指示所述第一属性信息被掩码、且所述第二属性信息未被掩码。
在一种可能的实现中,更新后的所述第一编码器用于进行模型推理。
在一种可能的实现中,所述目标约束具体为KL散度。本申请采用KL散度对过去与未来两个编码器捕获得到的多尺度用户兴趣表征进行约束,从而实现过去与未来行为中知识的相互学习。
在一种可能的实现中,所述第一嵌入和所述第二嵌入为通过同一个嵌入层分别对所述第一属性信息和所述第二属性信息进行处理得到的。
在一种可能的实现中,所述第一编码器和所述第二编码器包括多个注意力头,且不同所述注意力头中注意力信息对应的感受野不同。本申请在自注意力机制计算过程中,采用自注意掩码来对不同自注意力头设置不同长度的感受野从而捕获不同尺度的用户兴趣表征。
在一种可能的实现中,所述第一属性信息和所述第二属性信息包括如下的至少一种:物品名称,开发者,安装包大小,品类,好评度。
第二方面,本申请提供了一种数据处理装置,所述装置包括:
处理模块,用于获取用户的第一日志数据以及第二日志数据;所述第一日志数据包括第一物品的第一属性信息,所述第二日志数据包括第二物品的第二属性信息;所述第一日志数据的发生时间早于所述第二日志数据;
通过第一编码器处理所述第一属性信息对应的第一嵌入,得到第一特征表示;
通过第二编码器处理所述第二属性信息对应的第二嵌入,得到第二特征表示;所述第一特征表示和所述第二嵌入之间的差异、以及所述第二特征表示和所述第一嵌入之间的差异用于构建损失;
更新模块,用于根据所述损失更新所述第一编码器以及所述第二编码器;且在更新所述第一编码器和所述第二编码器时,所述第一编码器和所述第二编码器施加有目标约束,所述目标约束用于约束所述第一编码器和所述第二编码器之间中间输出的差异最小化。
在一种可能的实现中,所述目标约束为所述损失的一部分。
在一种可能的实现中,所述处理模块,具体用于根据第一自注意力信息,通过第一编码器处理所述第一属性信息和所述第二属性信息;所述第一自注意力信息指示所述第二属性信息被掩码、且所述第一属性信息未被掩码;
所述处理模块,具体用于根据第二自注意力信息,通过第二编码器处理所述第一属性信息和所述第二属性信息;所述第二自注意力信息指示所述第一属性信息被掩码、且所述第二属性信息未被掩码。
在一种可能的实现中,更新后的所述第一编码器用于进行模型推理。
在一种可能的实现中,所述目标约束具体为KL散度。
在一种可能的实现中,所述第一嵌入和所述第二嵌入为通过同一个嵌入层分别对所述第一属性信息和所述第二属性信息进行处理得到的。
在一种可能的实现中,所述第一编码器和所述第二编码器包括多个注意力头,且不同所述注意力头中注意力信息对应的感受野不同。
在一种可能的实现中,所述第一属性信息和所述第二属性信息包括如下的至少一种:物品名称,开发者,安装包大小,品类,好评度。
第三方面,本申请实施例提供了一种数据处理装置,可以包括存储器、处理器以及总线系统,其中,存储器用于存储程序,处理器用于执行存储器中的程序,以执行如上述第一方面任一可选的方法。
第四方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面及任一可选的方法。
第五方面,本申请实施例提供了一种计算机程序产品,包括代码,当代码被执行时,用于实现上述第一方面及任一可选的方法。
第六方面,本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持数据处理装置实现上述方面中所涉及的功能,例如,发送或处理上述方法中所涉及的数据;或,信息。在一种可能的设计中,芯片系统还包括存储器,所述存储器,用于保存执行设备或训练设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包括芯片和其他分立器件。
附图说明
图1为人工智能主体框架的一种结构示意图;
图2为本申请实施例提供的一种系统架构的示意图;
图3为本申请实施例提供的一种系统架构的示意图;
图4A为本申请实施例提供的一种推荐场景的示意图;
图4B为本申请实施例提供的一种网络的示意图;
图5为本申请实施例提供的一种数据处理方法的流程示意图;
图6A为一种模型示意;
图6B为一种模型示意;
图6C为一种模型示意;
图7为本申请实施例提供的一种数据处理装置的结构示意图;
图8为本申请实施例提供的一种执行设备的示意图;
图9为本申请实施例提供的一种训练设备的示意图;
图10为本申请实施例提供的一种芯片的示意图。
具体实施方式
下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。
下面结合附图,对本申请的实施例进行描述。本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必 限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。
首先对人工智能系统总体工作流程进行描述,请参见图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)
在线预测是指基于离线训练好的模型,根据用户、物品和上下文的特征预测该用户在当前上下文环境下对推荐物品的喜好程度,预测用户选择推荐物品的概率。
例如,图3是本申请实施例提供的推荐系统的示意图。如图3所示,当一个用户进入统,会触发一个推荐的请求,推荐系统会将该请求及其相关信息(例如本申请实施例中的操作信息)输入到推荐模型,然后预测用户对系统内的物品的选择率。进一步,根据预测的选择率或基于该选择率的某个函数将物品降序排列,即推荐系统可以按顺序将物品展示在不同的位置作为对用户的推荐结果。用户浏览不同的处于位置的物品并发生用户行为,如浏览、选择以及下载等。同时,用户的实际行为会存入日志中作为训练数据,通过离线训练模块不断更新推荐模型的参数,提高模型的预测效果。
例如,用户打开智能终端(例如,手机)中的应用市场即可触发应用市场中的推荐系统。应用市场的推荐系统会根据用户的历史行为日志,例如,用户的历史下载记录、用户选择记录,应用市场的自身特征,比如时间、地点等环境特征信息,预测用户下载推荐的各个候选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)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层,通过上述步骤的多个输出向量可用作当前输入的特征表示。该特征表示为为当前输入的一种适合计算机处理的特征表示。
(8)注意力机制(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这种特殊情况下的注意力计算机制,其具体计算过程是一样的,只是计算对象发生了变化而已。
个性化推荐系统在许多在线服务平台中发挥着重要作用,从在线广告、在线零售到音乐和视频的推荐。为了为用户提供精确和定制的服务,这些系统试图根据用户的历史交互数据推荐用户可能感兴趣的产品。通常的做法是将用户与商品的交互构成一个动态的序列,然后通过序列模型捕获用户多样化动态化的兴趣模式。上述思路可以很自然地被描述为Next-Item Prediction任务(即预测用户可能会交互下一个项目),通过自回归模型的形式来建模。
然而在实际场景中,用户行为并不是严格有序的。例如在购买iPad后,用户可能会点击铅笔、iPad外壳和耳机,但用户很可能是随机点击这三个产品的而并不存在严格的点击顺序。因此目前主流的序列推荐系统的行为有序性假设会造成用户行为建模中的上下文信息损失,因为未来信息(发生在用户与目标项目交互之后的交互)也会提供丰富的背景信息来帮助模型训练。
最近,研究人员已经证明,与自回归模型相比,在训练过程中利用过去和未来的语境信息将显著提升推荐性能。受自然语言处理领域进展的启发,他们提出了基于自编码序列推荐算法的BERT4Rec模型,采用MLM的训练方式,根据用户过去和未来的交互行为记录预测被掩码(Masked)的项目交互。与单向自回归模型(如SASRec)相比,BERT4Rec尝试打破行为有序性的限制,将未来信息引入到用户行为建模过程中,并取得了显著的成效。
尽管BERT4Rec通过MLM任务将过去与未来信息同时引入到训练过程之中,但是其伴随着严重的训练-推理差异(training-inference gap)。即在训练时采用过去与未来的交互记录作为上下文来预测被掩蔽的项目,而在推理时则只能利用过去交互记录预测用户可能交互的下一个项目。这一训练和推理之间的上下文差异可能会在推理过程中造成模型偏差,并导致潜在的性能下降。
为了解决上述问题,本申请提供了一种数据处理方法。
参照图5,图5为本申请实施例提供的一种数据处理方法的实施例示意,如图5示出的那样,本申请实施例提供的一种数据处理方法,包括:
501、获取用户的第一日志数据以及第二日志数据;所述第一日志数据包括第一物品的第一属性信息,所述第二日志数据包括第二物品的第二属性信息;所述第一日志数据的发生时间早于所述第二日志数据。
本申请实施例中,步骤501的执行主体可以为终端设备,终端设备可以为便携式移动设备,例如但不限于移动或便携式计算设备(如智能手机)、个人计算机、服务器计算机、手持式设备(例如平板)或膝上型设备、多处理器系统、游戏控制台或控制器、基于微处理器的系统、机顶盒、可编程消费电子产品、移动电话、具有可穿戴或配件形状因子(例如,手表、眼镜、头戴式耳机或耳塞)的移动计算和/或通信设备、网络PC、小型计算机、大型计算机、包括上面的系统或设备中的任何一种的分布式计算环境等等。
本申请实施例中,步骤501的执行主体可以为云侧的服务器,服务器可以接收来自终端设备发送的用户的操作数据,进而服务器可以获取到用户的操作数据。
为了方便描述,以下不对执行主体的形态进行区分,都描述为训练设备。
在一种可能的实现中,在对目标神经网络进行训练时,需要获取到训练样本,以推荐模型为例,所述训练样本可以包括用户和物品的属性信息,属性信息可以为用户的操作数据。
其中,用户的操作数据可以基于用户与物品之间的交互记录(例如用户的行为日志)得到,该操作数据可以包括用户对各个物品的真实操作记录,操作数据可以包括用户的属性信息、各个物品的属性信息信息以及所述用户对所述多个物品进行的操作的操作类型(例如点击、下载等等)。
其中,用户的属性信息可以为与用户喜好特征相关的属性,性别、年龄、职业、收入、爱好以及受教育程度中的至少一种,其中,性别可以为男或者女,年龄可以为0-100之间的数字,职业可以为教师、程序员、厨师等等,爱好可以为篮球、网球、跑步等等,受教育程度可以为小学、初中、高中、大学等等;本申请并不限定用户的属性信息的具体类型。
其中,物品可以为实体物品,或者是虚拟物品,例如可以为应用程序(application,APP)、音视频、网页以及新闻资讯等物品,物品的属性信息可以为物品名称、开发者、安装包大小、品类以及好评度中的至少一种,其中,以物品为应用程序为例,物品的品类可以为聊天类、跑酷类游戏、办公类等等,好评度可以为针对于物品的打分、评论等;本申请并不限定物品的属性信息的具体类型。
在一种可能的实现中,可以获取用户的第一日志数据以及第二日志数据;所述第一日志数据包括第一物品的第一属性信息,所述第二日志数据包括第二物品的第二属性信息;所述第一日志数据的发生时间早于所述第二日志数据。其中,第一物品可以包括一个或多个物品,第二物品可以包括一个或多个物品。
在具体场景中,某个用户所交互过的物品可以组成一个物品序列x=[x1,x2,x3,…,xn]。其中,在序列中,第一物品为第二物品之前的物品。
在一种可能的实现中,可以首先通过嵌入嵌入层Embedding层将序列中的物品的属性信息映射成低维连续表征向量,也就是将第一物品的第一属性信息映射为第一嵌入,将第二物品的第二属性信息映射为第二嵌入。之后,将物品的低维表征序列x作为模型的输入。模型可以包括第一编码器和第二编码器。
502、通过第一编码器处理所述第一属性信息对应的第一嵌入,得到第一特征表示。
503、通过第二编码器处理所述第二属性信息对应的第二嵌入,得到第二特征表示;所述第一特征表示和所述第二嵌入之间的差异、以及所述第二特征表示和所述第一嵌入之间的差异用于构建损失。
在一种可能的实现中,第一编码器和第二编码器可以包括多个串联连接的transformer层。
接下来介绍一个注意力网络的示例:
在一种可能的实现中,基于transformer层的编码器可以包括依次连接的嵌入层以及多个transformer层。transformer层的数目可以根据需要而设置。编码器基于各transformer层得到的N个输出向量,确定当前节点对应的特征向量。
在嵌入层,对当前输入进行嵌入处理,得到多个特征向量。transformer模型的核心特点在于其采用 的独特的注意力机制。参照图6B,图6B为一种transformer层的结构示意,本申请实施例中的各个神经网络的transformer层都可以参照图6B中示出的结构,如图6B中示出的那样,transformer层包括依次相邻的多头注意力层、加和与归一化(add&norm)层、前馈(feed forward)层、加和与归一化层。
其中,多头注意力层从其上一层获取N个输入向量Xl,又可以表示为矩阵X,采用自注意力机制,基于向量间的关联度对各个向量进行变换(或者可以称之为交互),得到N个输出向量,又可以表示为矩阵Y。可以理解,当该多头注意力层是与嵌入层直接相连的层,例如图6B中与嵌入层直连的transformer层,其获取的输入向量即为嵌入层输出的嵌入向量;当该多头注意力层是后续的transformer层包括的多头注意力层,例如图6B中与上一级transformer层直连的transformer层包括的多头注意力层,其获取的输入向量即为前一级transformer层的输出向量。在多头注意力层,基于多头注意力(multi-head attention,MHA)的MHA层包括多个注意力头head(如图6C中示出的Head 1、Head 2、…、Head N)。
图6C为一个注意力头head的操作示意图,该示意图示出注意力头head如何将输入矩阵X变换为输出矩阵Y。如图6C所示,分别采用第一变换矩阵Q,第二变换矩阵K和第三变换矩阵V对N个输入向量<X1,X2,…,XN>中各个输入向量Xi进行变换,得到各个输入向量对应的第一中间向量(q向量),第二中间向量(k向量)和第三中间向量(v向量)。操作上,可以分别用第一变换矩阵Q,第二变换矩阵K和第三变换矩阵V,对N个输入向量构成的输入矩阵X进行线性变换,分别得到输入矩阵的Q矩阵,K矩阵和V矩阵,再分别对矩阵进行拆分,即可得到各个输入向量对应的q向量,k向量和v向量。对于N个输入向量中任意的第i输入向量Xi,基于该第i输入向量对应的第一中间向量(q向量,qi)与各个输入向量Xj对应的各个第二中间向量(k向量,kj)的点乘操作,确定该第i输入向量Xi与各个输入向量Xj的各个关联度。尽管也可以直接将qi与kj的点乘结果确定为关联度,但是更经典地,先将点乘结果除以一常数,然后进行softmax运算,将运算结果作为输入向量Xi与Xj的关联度(也就是Q向量和K向量之间的关联度),即:
于是,可以以该第i输入向量Xi与各个输入向量Xj的各个关联度αi,j作为权重因子,对各个输入向量Xj对应的第三中间向量(v向量,vj)进行加权组合,得到该第i输入向量Xi对应的第i组合向量Ci:
于是,可以得到N个输入向量对应的N个组合向量的向量序列<C1,C2,…,CN>,或矩阵C。基于该组合向量序列,可以得到N个输出向量。具体地,在一个实施例中,可以直接将N个组合向量的向量序列作为N个输出向量,即Yi=Ci。此时,输出矩阵Y即为组合向量矩阵C,又可以写成:
以上为一个注意力头head的处理过程描述,在MHA架构中,MHA层维护m套变换矩阵,每套变换矩阵包括前述第一变换矩阵Q、第二变换矩阵K和第三变换矩阵V,从而可以并行地进行上述操作,得到m个组合向量序列(即m个矩阵C),每个向量序列包括基于一套变换矩阵得到的N个组合向量。在这样的情况下,MHA层将得到的m个组合向量序列进行拼接,得到拼接矩阵;再通过第四变换矩阵W对该拼接矩阵进行变换,得到最终的输出矩阵Y。将该输出矩阵Y拆分即对应于N个输出向量<Y1,Y2,…,YN>。通过以上的操作过程,MHA层基于N个输入向量之间的关联度进行变换操作,得到N个输出向量。
在一种可能的实现中,所述通过第一编码器处理所述第一属性信息,包括:根据第一自注意力信息,通过第一编码器处理所述第一属性信息和所述第二属性信息;所述第一自注意力信息指示所述第二属性信息被掩码、且所述第一属性信息未被掩码;所述通过第二编码器处理所述第二属性信息,包括:根据第二自注意力信息,通过第二编码器处理所述第一属性信息和所述第二属性信息;所述第二自注意力信息指示所述第一属性信息被掩码、且所述第二属性信息未被掩码。
在一种可能的实现中,可以通过第一编码器处理所述第一属性信息对应的第一嵌入,得到第一特征表示;通过第二编码器处理所述第二属性信息对应的第二嵌入,得到第二特征表示;所述第一特征表示和所述第二嵌入之间的差异、以及所述第二特征表示和所述第一嵌入之间的差异用于构建损失。
基于上述构建的损失来更新第一编码器和第二编码器,可以使得第一编码器具备基于历史信息预测未来信息的能力,第二编码器则可以具备基于未来信息预测历史信息的能力,且在更新所述第一编码器 和所述第二编码器时,所述第一编码器和所述第二编码器施加有目标约束,所述目标约束用于约束所述第一编码器和所述第二编码器之间中间输出的差异最小化,也就是可以将第二编码器的能力蒸馏至第一编码器,使得第一编码器也可以具备基于未来信息预测历史信息的能力。更新后的第一编码器可以用于进行模型的推理。
其中,为了充分利用未来信息,同时缓解潜在的训练-推理差异,本申请实施例提出了对偶网络模型(包括第一编码器以及第二编码器),如图6A所示。对偶网络中采用两个彼此独立的编码器分别对过去和未来的用户行为进行建模,并且两个编码器共享同一个Embedding层。编码器采用Transformer结构,其利用自注意力掩码来保证行为信息的从左至右或从右至左处理,换而言之,两个编码器的自注意力掩码也是相互对偶的。就训练任务而言,两编码器的目标任务也是相互对偶的,即处理过去交互信息的编码器预测下一个可能交互的项目(原始任务),而负责未来交互信息的编码器则预测行为序列发生前可能交互的前一个项目(对偶任务)。通过这种方式,未来信息以单独的方式建模,而与过去信息建模显式地解耦开来。
在一种可能的实现中,所述第一编码器和所述第二编码器包括多个注意力头,且不同所述注意力头中注意力信息对应的感受野不同。本申请在自注意力机制计算过程中,采用自注意掩码来对不同自注意力头设置不同长度的感受野从而捕获不同尺度的用户兴趣表征。
504、根据所述损失更新所述第一编码器以及所述第二编码器;且在更新所述第一编码器和所述第二编码器时,所述第一编码器和所述第二编码器施加有目标约束,所述目标约束用于约束所述第一编码器和所述第二编码器之间中间输出的差异最小化。
在一种可能的实现中,在更新所述第一编码器和所述第二编码器时,所述第一编码器和所述第二编码器施加有目标约束,所述目标约束用于约束所述第一编码器和所述第二编码器之间中间输出的差异最小化。
在一种可能的实现中,所述目标约束具体为KL散度。本申请采用KL散度对过去与未来两个编码器捕获得到的多尺度用户兴趣表征进行约束,从而实现过去与未来行为中知识的相互学习。
在一种可能的实现中,所述目标约束还可以为所述损失的一部分。
本申请实施例的核心装置可以如图6A所示,由对偶网络(Dual Networks)和双向信息迁移(Bi-directional Information Transferring)组成。对偶网络中的两个编码器分别负责过去与未来行为信息的建模,它们共享同一套Embedding层参数。双向信息迁移则通过KL散度来实现过去与未来信息之间的多尺度表征蒸馏,从而加强对未来上下文信息的利用。
对偶网络采用直接的方式显式地解耦开了过去与未来信息的处理,但这也在一定程度上影响了两个编码器之间的互相学习。事实上,过去与未来对应的两个编码器所捕获到的用户偏好往往是相关甚至互补的,所以两个编码器之间的互相学习可以进一步提升模型性能。此外在实际场景中,用户利益往往是动态性而多尺度的,因为往往既有稳定的长期利益,也有动态的短期利益。因此,本发明采用多尺度多头自注意力机制来捕获出用户的多尺度兴趣,并采用KL散度给过去与未来编码器中捕获到的多尺度用户兴趣表征进行约束从而促进两者相互学习。多尺度多头自注意力机制对于多尺度兴趣的捕获是通过自注意力掩码中感受野长度的不同实现的,如图6A中的(c)(d)所示。
接下来给出一个本申请实施例中的数据处理方法的具体示例。在具体场景中,某个用户所交互过的商品组成一个商品序列x=[x1,x2,x3,…,xn]。本技术方案可以根据用户的交互历史数据,预测其在n+1次在给定的某种交互类型下,最有可能交互的商品。
具体来说,首先通过Embedding层将用户商品序列映射成低维连续表征向量。之后,将商品低维表征序列x作为模型的输入,整体对偶网络的处理得到用户在下一次某目标行为下的潜在交互商品。
对偶网络的具体流程可以分为以下步骤:
(1)将商品序列x输入到共享的Embedding层得到商品低维表征序列e。再通过过去与未来两个编码器分别对商品低维表征序列e中两两位置之间从左至右(处理过去信息)或从右至左(处理未来信息)地执行自注意力运算,从而更新商品表征。
(2)对更新后的商品表征序列使用层归一化与残差连接,保证梯度的稳定。
(3)商品低维表征通过行为特异性的前馈神经网络,学习行为特异性语义信息。
(4)最终通过对偶网络输出得到的商品低维表征分别进行两个编码器的对偶训练任务。
上述对偶网络将过去与未来行为处理相互解耦,但同时也阻碍了两者之间的相互学习。通过引入约束的方式可以在训练过程中促进两个编码器知识的互相迁移,其具体流程可以分为以下步骤:
(1)在自注意力机制计算过程中,采用自注意掩码来对不同自注意力头设置不同长度的感受野从而捕获不同尺度的用户兴趣表征。
(2)采用KL散度对过去与未来两个编码器捕获得到的多尺度用户兴趣表征进行约束,从而实现过去与未来行为中知识的相互学习。
本申请实施例在多个用户行为序列推荐公开数据集上进行了充分的实验,实验设置如下:
使用Amazon Beauty、Sports、Toys和Yelp数据集进行性能的评价。
使用业界公认的测试指标(HR,越高越好)、(NDCG,越高越好)以及(MRR,越高越好)。
对比了现有的几种技术:
(1)序列推荐模型:Caser、GRU4CTR、HGN、RepeatNet、SASRec、BERT4Rec以及FMLP-Rec
(2)图模型:SRGNN和GCSAN
(3)对比学习模型:S3-Rec和CLEA
表1为推荐性能的比较。加粗表示最佳结果,下划线表示次佳结果(即最佳基线)。“*”表示与最佳基线相比在统计学上显着改善(即p值<0.05)。
表1
经过实验,可以得到以下结论:
在推荐精度上,本发明在Hit Rate、NDCG和MRR三个指标上都取得了最好的实验效果,证明了本发明提出的序列推荐系统的显著有效性。
此外,将本发明中的模块作为插件迁移到现有工作之中,进行了方法的兼容性分析实验,结果如下表2所示。
表2
将本发明中方案迁移到现有工作可以对现有工作效果产生显著改善,这进一步证明了本发明的有效性和普适性。
现有技术虽然通过MLM任务引入了未来行为信息,但是同时也带了严重的训练-推理差异。与现有的推荐模型不同,本申请实施例采用两个独立的编码器分别建模过去和未来的交互信息,同时又通过对两编码器捕获的多尺度兴趣表征进行约束来促进两者的互相学习。因此解决了现有技术建模不充分的限制,提高了模型的预测精度。
接下来从装置的角度介绍本申请实施例提供的一种数据处理装置,参照图7,图7为本申请实施例提供的一种数据处理装置的结构示意,如图7所示,本申请实施例提供的一种数据处理装置700包括:
处理模块701,用于获取用户的第一日志数据以及第二日志数据;所述第一日志数据包括第一物品的第一属性信息,所述第二日志数据包括第二物品的第二属性信息;所述第一日志数据的发生时间早于所述第二日志数据;
通过第一编码器处理所述第一属性信息对应的第一嵌入,得到第一特征表示;
通过第二编码器处理所述第二属性信息对应的第二嵌入,得到第二特征表示;所述第一特征表示和所述第二嵌入之间的差异、以及所述第二特征表示和所述第一嵌入之间的差异用于构建损失;
其中,关于处理模块701的具体介绍可以参照上述实施例中步骤501至步骤503的描述,这里不再赘述。
更新模块702,用于根据所述损失更新所述第一编码器以及所述第二编码器;且在更新所述第一编码器和所述第二编码器时,所述第一编码器和所述第二编码器施加有目标约束,所述目标约束用于约束所述第一编码器和所述第二编码器之间中间输出的差异最小化。
其中,关于更新模块702的具体介绍可以参照上述实施例中步骤504的描述,这里不再赘述。
在一种可能的实现中,所述目标约束为所述损失的一部分。
在一种可能的实现中,所述处理模块,具体用于根据第一自注意力信息,通过第一编码器处理所述第一属性信息和所述第二属性信息;所述第一自注意力信息指示所述第二属性信息被掩码、且所述第一属性信息未被掩码;
所述处理模块,具体用于根据第二自注意力信息,通过第二编码器处理所述第一属性信息和所述第二属性信息;所述第二自注意力信息指示所述第一属性信息被掩码、且所述第二属性信息未被掩码。
在一种可能的实现中,更新后的所述第一编码器用于进行模型推理。
在一种可能的实现中,所述目标约束具体为KL散度。
在一种可能的实现中,所述第一嵌入和所述第二嵌入为通过同一个嵌入层分别对所述第一属性信息和所述第二属性信息进行处理得到的。
在一种可能的实现中,所述第一编码器和所述第二编码器包括多个注意力头,且不同所述注意力头中注意力信息对应的感受野不同。
在一种可能的实现中,所述第一属性信息和所述第二属性信息包括如下的至少一种:物品名称,开发者,安装包大小,品类,好评度。
接下来介绍本申请实施例提供的一种执行设备,请参阅图8,图8为本申请实施例提供的执行设备 的一种结构示意图,执行设备800具体可以表现为手机、平板、笔记本电脑、智能穿戴设备、服务器等,此处不做限定。其中,执行设备800实现图5对应实施例中数据处理方法的功能。具体的,执行设备800包括:接收器801、发射器802、处理器803和存储器804(其中执行设备800中的处理器803的数量可以一个或多个),其中,处理器803可以包括应用处理器8031和通信处理器8032。在本申请的一些实施例中,接收器801、发射器802、处理器803和存储器804可通过总线或其它方式连接。
存储器804可以包括只读存储器和随机存取存储器,并向处理器803提供指令和数据。存储器804的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器804存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。
处理器803控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。
上述本申请实施例揭示的方法可以应用于处理器803中,或者由处理器803实现。处理器803可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器803中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器803可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器、以及视觉处理器(vision processing unit,VPU)、张量处理器(tensor processing unit,TPU)等适用于AI运算的处理器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器803可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器804,处理器803读取存储器804中的信息,结合其硬件完成上述实施例中步骤501至步骤503的步骤。
接收器801可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器802可用于通过第一接口输出数字或字符信息;发射器802还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器802还可以包括显示屏等显示设备。
本申请实施例还提供了一种训练设备,请参阅图9,图9是本申请实施例提供的训练设备一种结构示意图,具体的,训练设备900由一个或多个服务器实现,训练设备900可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)99(例如,一个或一个以上处理器)和存储器932,一个或一个以上存储应用程序942或数据944的存储介质930(例如一个或一个以上海量存储设备)。其中,存储器932和存储介质930可以是短暂存储或持久存储。存储在存储介质930的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器99可以设置为与存储介质930通信,在训练设备900上执行存储介质930中的一系列指令操作。
训练设备900还可以包括一个或一个以上电源926,一个或一个以上有线或无线网络接口950,一个或一个以上输入输出接口958;或,一个或一个以上操作系统941,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。
具体的,训练设备可以进行上述实施例中步骤501至步骤503的步骤。
本申请实施例中还提供一种包括计算机程序产品,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信 单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的数据处理方法,或者,以使训练设备内的芯片执行上述实施例描述的数据处理方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。
具体的,请参阅图10,图10为本申请实施例提供的芯片的一种结构示意图,所述芯片可以表现为神经网络处理器NPU1000,NPU 1000作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1003,通过控制器1004控制运算电路1003提取存储器中的矩阵数据并进行乘法运算。
NPU 1000可以通过内部的各个器件之间的相互配合,来实现图5所描述的实施例中提供的数据处理方法。
更具体的,在一些实现中,NPU 1000中的运算电路1003内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路1003是二维脉动阵列。运算电路1003还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1003是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1002中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1001中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1008中。
统一存储器1006用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)1005,DMAC被搬运到权重存储器1002中。输入数据也通过DMAC被搬运到统一存储器1006中。
BIU为Bus Interface Unit即,总线接口单元1010,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)1009的交互。
总线接口单元1010(Bus Interface Unit,简称BIU),用于取指存储器1009从外部存储器获取指令,还用于存储单元访问控制器1005从外部存储器获取输入矩阵A或者权重矩阵B的原数据。
DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1006或将权重数据搬运到权重存储器1002中或将输入数据数据搬运到输入存储器1001中。
向量计算单元1007包括多个运算处理单元,在需要的情况下,对运算电路1003的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对特征平面进行上采样等。
在一些实现中,向量计算单元1007能将经处理的输出的向量存储到统一存储器1006。例如,向量计算单元1007可以将线性函数;或,非线性函数应用到运算电路1003的输出,例如对卷积层提取的特征平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1007生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1003的激活输入,例如用于在神经网络中的后续层中的使用。
控制器1004连接的取指存储器(instruction fetch buffer)1009,用于存储控制器1004使用的指令;
统一存储器1006,输入存储器1001,权重存储器1002以及取指存储器1009均为On-Chip存储器。外部存储器私有于该NPU硬件架构。
其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通 用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。

Claims (19)

  1. 一种数据处理方法,其特征在于,所述方法包括:
    获取用户的第一日志数据以及第二日志数据;所述第一日志数据包括第一物品的第一属性信息,所述第二日志数据包括第二物品的第二属性信息;所述第一日志数据的发生时间早于所述第二日志数据;
    通过第一编码器处理所述第一属性信息对应的第一嵌入,得到第一特征表示;
    通过第二编码器处理所述第二属性信息对应的第二嵌入,得到第二特征表示;所述第一特征表示和所述第二嵌入之间的差异、以及所述第二特征表示和所述第一嵌入之间的差异用于构建损失;
    根据所述损失更新所述第一编码器以及所述第二编码器;且在更新所述第一编码器和所述第二编码器时,所述第一编码器和所述第二编码器施加有目标约束,所述目标约束用于约束所述第一编码器和所述第二编码器之间中间输出的差异最小化。
  2. 根据权利要求1所述的方法,其特征在于,所述目标约束为所述损失的一部分。
  3. 根据权利要求1或2所述的方法,其特征在于,所述通过第一编码器处理所述第一属性信息,包括:根据第一自注意力信息,通过第一编码器处理所述第一属性信息和所述第二属性信息;所述第一自注意力信息指示所述第二属性信息被掩码、且所述第一属性信息未被掩码;
    所述通过第二编码器处理所述第二属性信息,包括:根据第二自注意力信息,通过第二编码器处理所述第一属性信息和所述第二属性信息;所述第二自注意力信息指示所述第一属性信息被掩码、且所述第二属性信息未被掩码。
  4. 根据权利要求1至3任一所述的方法,其特征在于,更新后的所述第一编码器用于进行模型推理。
  5. 根据权利要求1至4任一所述的方法,其特征在于,所述目标约束具体为KL散度。
  6. 根据权利要求1至5任一所述的方法,其特征在于,所述第一嵌入和所述第二嵌入为通过同一个嵌入层分别对所述第一属性信息和所述第二属性信息进行处理得到的。
  7. 根据权利要求1至6任一所述的方法,其特征在于,所述第一编码器和所述第二编码器包括多个注意力头,且不同所述注意力头中注意力信息对应的感受野不同。
  8. 根据权利要求1至7任一所述的方法,其特征在于,所述第一属性信息和所述第二属性信息包括如下的至少一种:物品名称,开发者,安装包大小,品类,好评度。
  9. 一种数据处理装置,其特征在于,所述装置包括:
    处理模块,用于获取用户的第一日志数据以及第二日志数据;所述第一日志数据包括第一物品的第一属性信息,所述第二日志数据包括第二物品的第二属性信息;所述第一日志数据的发生时间早于所述第二日志数据;
    通过第一编码器处理所述第一属性信息对应的第一嵌入,得到第一特征表示;
    通过第二编码器处理所述第二属性信息对应的第二嵌入,得到第二特征表示;所述第一特征表示和所述第二嵌入之间的差异、以及所述第二特征表示和所述第一嵌入之间的差异用于构建损失;
    更新模块,用于根据所述损失更新所述第一编码器以及所述第二编码器;且在更新所述第一编码器和所述第二编码器时,所述第一编码器和所述第二编码器施加有目标约束,所述目标约束用于约束所述第一编码器和所述第二编码器之间中间输出的差异最小化。
  10. 根据权利要求9所述的装置,其特征在于,所述目标约束为所述损失的一部分。
  11. 根据权利要求9或10所述的装置,其特征在于,所述处理模块,具体用于根据第一自注意力信息,通过第一编码器处理所述第一属性信息和所述第二属性信息;所述第一自注意力信息指示所述第二属性信息被掩码、且所述第一属性信息未被掩码;
    所述处理模块,具体用于根据第二自注意力信息,通过第二编码器处理所述第一属性信息和所述第二属性信息;所述第二自注意力信息指示所述第一属性信息被掩码、且所述第二属性信息未被掩码。
  12. 根据权利要求9至11任一所述的装置,其特征在于,更新后的所述第一编码器用于进行模型推理。
  13. 根据权利要求9至12任一所述的装置,其特征在于,所述目标约束具体为KL散度。
  14. 根据权利要求9至13任一所述的装置,其特征在于,所述第一嵌入和所述第二嵌入为通过同一个嵌入层分别对所述第一属性信息和所述第二属性信息进行处理得到的。
  15. 根据权利要求9至14任一所述的装置,其特征在于,所述第一编码器和所述第二编码器包括多个注意力头,且不同所述注意力头中注意力信息对应的感受野不同。
  16. 根据权利要求9至15任一所述的装置,其特征在于,所述第一属性信息和所述第二属性信息包括如下的至少一种:物品名称,开发者,安装包大小,品类,好评度。
  17. 一种计算设备,其特征在于,所述计算设备包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为获取所述代码,并执行如权利要求1至8任一所述的方法。
  18. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有一个或多个指令,所述指令在由一个或多个计算机执行时使得所述一个或多个计算机实施权利要求1至8任一所述的方法。
  19. 一种计算机程序产品,包括代码,其特征在于,在所述代码被执行时用于实现如权利要求1至8任一所述的方法。
PCT/CN2023/122458 2022-09-30 2023-09-28 一种数据处理方法及相关装置 WO2024067779A1 (zh)

Applications Claiming Priority (2)

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

Publications (1)

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

Family

ID=84861154

Family Applications (1)

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

Country Status (2)

Country Link
CN (1) CN115618950A (zh)
WO (1) WO2024067779A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115618950A (zh) * 2022-09-30 2023-01-17 华为技术有限公司 一种数据处理方法及相关装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109635204A (zh) * 2018-12-21 2019-04-16 上海交通大学 基于协同过滤和长短记忆网络的在线推荐系统
CN111046907A (zh) * 2019-11-02 2020-04-21 国网天津市电力公司 一种基于多头注意力机制的半监督卷积网络嵌入方法
US20200364619A1 (en) * 2019-05-16 2020-11-19 Royal Bank Of Canada System and method for diachronic machine learning architecture
CN114490950A (zh) * 2022-04-07 2022-05-13 联通(广东)产业互联网有限公司 编码器模型的训练方法及存储介质、相似度预测方法及系统
CN114707633A (zh) * 2022-03-07 2022-07-05 腾讯科技(深圳)有限公司 特征提取方法、装置、电子设备和存储介质
CN115618950A (zh) * 2022-09-30 2023-01-17 华为技术有限公司 一种数据处理方法及相关装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109635204A (zh) * 2018-12-21 2019-04-16 上海交通大学 基于协同过滤和长短记忆网络的在线推荐系统
US20200364619A1 (en) * 2019-05-16 2020-11-19 Royal Bank Of Canada System and method for diachronic machine learning architecture
CN111046907A (zh) * 2019-11-02 2020-04-21 国网天津市电力公司 一种基于多头注意力机制的半监督卷积网络嵌入方法
CN114707633A (zh) * 2022-03-07 2022-07-05 腾讯科技(深圳)有限公司 特征提取方法、装置、电子设备和存储介质
CN114490950A (zh) * 2022-04-07 2022-05-13 联通(广东)产业互联网有限公司 编码器模型的训练方法及存储介质、相似度预测方法及系统
CN115618950A (zh) * 2022-09-30 2023-01-17 华为技术有限公司 一种数据处理方法及相关装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZHANG, HENGYU ET AL.: "Disentangling Past-Future Modeling in Sequential Recommendation via Dual Networks", IN PROCEEDINGS OF THE 31ST ACM INT'L CONFERENCE ON INFORMATION AND KNOWLEDGE MANAGEMENT, 21 October 2022 (2022-10-21), pages 2549 - 2558, XP059091479, ISSN: 4503-9236, DOI: 10.1145/3511808.3557289 *

Also Published As

Publication number Publication date
CN115618950A (zh) 2023-01-17

Similar Documents

Publication Publication Date Title
Zhang et al. Dive into deep learning
WO2021233199A1 (zh) 搜索推荐模型的训练方法、搜索结果排序的方法及装置
WO2023221928A1 (zh) 一种推荐方法、训练方法以及装置
WO2022016556A1 (zh) 一种神经网络蒸馏方法以及装置
WO2024002167A1 (zh) 一种操作预测方法及相关装置
WO2024041483A1 (zh) 一种推荐方法及相关装置
WO2024067779A1 (zh) 一种数据处理方法及相关装置
WO2023185925A1 (zh) 一种数据处理方法及相关装置
CN117009650A (zh) 一种推荐方法以及装置
CN115238909A (zh) 一种基于联邦学习的数据价值评估方法及其相关设备
WO2024067373A1 (zh) 一种数据处理方法及相关装置
WO2024078411A1 (zh) 一种数据处理方法及其装置
WO2024012360A1 (zh) 一种数据处理方法及相关装置
WO2021136058A1 (zh) 一种处理视频的方法及装置
CN116910357A (zh) 一种数据处理方法及相关装置
CN117057855A (zh) 一种数据处理方法及相关装置
CN116910201A (zh) 一种对话数据生成方法及其相关设备
WO2023050143A1 (zh) 一种推荐模型训练方法及装置
CN116843022A (zh) 一种数据处理方法及相关装置
CN117251619A (zh) 一种数据处理方法及相关装置
CN116308640A (zh) 一种推荐方法及相关装置
CN116204709A (zh) 一种数据处理方法及相关装置
CN116205700A (zh) 目标产品的推荐方法、装置、计算机设备和存储介质
Pias et al. Perfect storm: DSAs embrace deep learning for GPU-based computer vision
WO2023051678A1 (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: 23871004

Country of ref document: EP

Kind code of ref document: A1