This application is a continuation of International Application No. PCT/CN2022/118950, filed on Sep. 15, 2022, the disclosure of which is hereby incorporated by reference in its entirety.
This application relates to the field of artificial intelligence (AI) technologies, and in particular, to a model training method, an advertisement placement method, an apparatus, and an electronic device.
Currently, advertisement placement is usually performed based on a profile and a behavior of a user. However, as protection of user information is continuously enhanced, it is increasingly difficult to obtain an identity of the user. Consequently, the profile of the user cannot be obtained, resulting in poor advertisement placement effect.
This application provides a model training method, an advertisement placement method, an apparatus, an electronic device, a server, a computer storage medium, and a computer product, to improve advertisement placement effect.
According to a first aspect, this application provides a model training method. The method includes: obtaining a first sample set, where the first sample set includes a first training sample, and the first training sample includes at least one advertisement feature of an advertisement and at least one context feature corresponding to the advertisement; processing the at least one context feature by using a first model, to obtain a first feature vector; and processing the at least one advertisement feature by using a second model, to obtain a second feature vector; processing a processing result of at least one stage in the first model and a processing result of at least one stage in the second model by using a third model, to obtain a first correlation score, where the first correlation score represents a degree of matching between the at least one context feature and the at least one advertisement feature; obtaining, based on the first feature vector, the second feature vector, the first correlation score, and a sample label of the first training sample, a loss corresponding to the first training sample; and training the first model and the second model based on a loss corresponding to at least one training sample in the first sample set.
In this way, the context feature is used to replace a user feature for model training, and therefore dependence on the user feature in a subsequent model use process is reduced. In addition, the third model is added in a process of training the first model and the second model, to implement interaction modeling between the first model and the second model, and therefore implement interaction between the context feature and the advertisement feature, enhance association between the context feature and the advertisement feature, and improve representation effect of the finally obtained first model and second model. For example, the trained first model may be used to perform feature extraction on a context feature related to a page accessed by a user, and the trained second model may be used to perform feature extraction on an advertisement.
In a possible implementation, the processing the at least one context feature by using a first model, to obtain a first feature vector specifically includes: encoding the at least one context feature by using the first model, to obtain N third feature vectors, where N≥1; and when N=1, processing the N third feature vectors by using the first model, to obtain the first feature vector; or when N≥2, concatenating the N third feature vectors by using the first model, to obtain one fourth feature vector; and processing the fourth feature vector by using the first model, to obtain the first feature vector.
In a possible implementation, the processing the at least one advertisement feature by using a second model, to obtain a second feature vector specifically includes: encoding the at least one advertisement feature by using the second model, to obtain M fifth feature vectors, where M≥1; and when M=1, processing the M fifth feature vectors by using the second model, to obtain the second feature vector; or when M≥2, concatenating the M fifth feature vectors by using the second model, to obtain one sixth feature vector; and processing the sixth feature vector by using the second model, to obtain the second feature vector.
In a possible implementation, the obtaining, based on the first feature vector, the second feature vector, the first correlation score, and a sample label of the first training sample, a loss corresponding to the first training sample specifically includes: obtaining a first loss based on the first feature vector, the second feature vector, and the sample label of the first training sample; obtaining a second loss based on the first correlation score and the sample label of the first training sample; and obtaining, based on the first loss and the second loss, the loss corresponding to the first training sample.
In a possible implementation, the obtaining a first loss based on the first feature vector, the second feature vector, and the sample label of the first training sample includes: determining a second correlation score based on the first feature vector and the second feature vector, where the second correlation score represents a degree of matching between the at least one context feature and the at least one advertisement feature; and obtaining the first loss based on the second correlation score and the sample label of the first training sample.
In a possible implementation, the method may further include: training the third model based on the loss corresponding to the at least one training sample in the first sample set.
In a possible implementation, the third model is a neural network model, and is used to assist, in a process of training the first model and the second model, in calculating a loss corresponding to a training sample in the first sample set. For example, a model structure of the third model may be, but is not limited to, a deep neural network (DNN), a multi-layer perception (MLP), a deep factorization machine (DeepFM), an extreme deep factorization machine (xDeepFM), a deep cross network (DCN), or a deep interest network (DIN).
According to a second aspect, this application provides an advertisement placement method, applied to an electronic device having a display. The method may include: obtaining an access operation of a user on a first page; in response to the access operation, obtaining a first context feature related to the first page, where the first context feature is irrelevant to a user profile and/or a user behavior of the user; and displaying f advertisements based on the first context feature, where f≥1.
In this way, during advertisement placement, a context feature is used to replace a user feature, to reduce dependence on the user feature, implement, when the user feature (for example, a user profile or a user behavior) cannot be obtained, precise advertisement placement by using a context feature related to a page accessed by the user, and resolve a problem of trade-off between privacy protection of user information and precise advertisement placement.
In a possible implementation, after the displaying f advertisements, the method may further include: obtaining a second access operation of the user on a second page; in response to the second access operation, obtaining a second context feature related to the second page, where the second context feature is irrelevant to the user profile and/or the user behavior of the user; and displaying g advertisements based on the second context feature, where g≥1, and at least a part of the g advertisements is different from an advertisement in the f advertisements. For example, content on the first page is different from content on the second page. Because the two pages have different content, the two pages also correspond to different context features, and finally display different advertisements.
In a possible implementation, displaying an advertisement based on a context feature specifically includes: processing the context feature by using a first model, to obtain a first feature vector, where the first model is a neural network model, and the context feature is the first context feature or the second context feature; determining values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement; screening out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K; and displaying advertisements respectively corresponding to the Q similarity values, where when the context feature is the first context feature, the advertisements respectively corresponding to the Q similarity values are the f advertisements; or when the context feature is the second context feature, the advertisements respectively corresponding to the Q similarity values are the g advertisements.
In a possible implementation, displaying an advertisement based on a context feature specifically includes: sending a first message to a server, where the first message includes the context feature, and the context feature is the first context feature or the second context feature; receiving a second message sent by the server, where the second message includes Q advertisements or pieces of advertisement indication information; the pieces of advertisement indication information are used to generate the Q advertisements; and when the context feature is the first context feature, the Q advertisements are the f advertisements; or when the context feature is the second context feature, the Q advertisements are the g advertisements; and displaying the Q advertisements.
In a possible implementation, displaying an advertisement based on a context feature specifically includes: processing the context feature by using a first model, to obtain a first feature vector, where the first model is a neural network model, and the context feature is the first context feature or the second context feature; sending a first message to a server, where the first message includes the first feature vector; receiving a second message sent by the server, where the second message includes Q advertisements or pieces of advertisement indication information; the pieces of advertisement indication information are used to generate the Q advertisements; and when the context feature is the first context feature, the Q advertisements are the f advertisements; or when the context feature is the second context feature, the Q advertisements are the g advertisements; and displaying the Q advertisements.
In a possible implementation, displaying an advertisement based on a context feature specifically includes: sending a first message to a server, where the first message includes the context feature, the first message indicates the server to perform feature extraction on the context feature, and the context feature is the first context feature or the second context feature; receiving a second message sent by the server, where the second message includes a first feature vector extracted by the server based on the context feature; determining values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement; screening out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K; and displaying advertisements respectively corresponding to the Q similarity values, where when the context feature is the first context feature, the advertisements respectively corresponding to the Q similarity values are the f advertisements; or when the context feature is the second context feature, the advertisements respectively corresponding to the Q similarity values are the g advertisements.
In a possible implementation, the first context feature includes one or more of the following: an identifier of the first page, a text on the first page, an identifier of a video on the first page, an identifier of a picture on the first page, an identifier of an audio on the first page, IP region information of the user, access time, a device type of the electronic device, an operator that provides a network service for the electronic device, a network type of the electronic device, a system language of the electronic device, a brand of the electronic device, a model of the electronic device, a scenario in which the electronic device needs to display an advertisement, a size of an area that is in a display interface of the electronic device and that is used to display an advertisement, and a country in which the electronic device is located.
In a possible implementation, the second context feature includes one or more of the following: an identifier of the second page, a text on the second page, an identifier of a video on the second page, an identifier of a picture on the second page, an identifier of an audio on the second page, the IP region information of the user, access time, the device type of the electronic device, the operator that provides the network service for the electronic device, the network type of the electronic device, the system language of the electronic device, the brand of the electronic device, the model of the electronic device, the scenario in which the electronic device needs to display the advertisement, the size of the area that is in the display interface of the electronic device and that is used to display the advertisement, and the country in which the electronic device is located.
According to a third aspect, this application provides an advertisement placement method, applied to a server. The method includes: receiving a first message sent by an electronic device, where the first message includes a context feature related to a page accessed by a user on the electronic device, and the context feature is irrelevant to a user profile and/or a user behavior of the user; in response to the first message, obtaining, based on the context feature, R advertisements or pieces of information that indicate R advertisements, where R≥1; and sending a second message to the electronic device, where the second message indicates the electronic device to display the R advertisements.
In a possible implementation, the obtaining, based on the context feature, R advertisements or pieces of information that indicate R advertisements specifically includes: processing the context feature by using a first model, to obtain a first feature vector, where the first model is a neural network model; determining values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement; screening out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K; and using advertisements respectively corresponding to the Q similarity values as the R advertisements, or using pieces of information that indicate advertisements and that respectively correspond to the Q similarity values as the pieces of information that indicate the R advertisements.
In a possible implementation, the context feature includes one or more of the following: an identifier of the page, a text on the page, an identifier of a video on the page, an identifier of a picture on the page, an identifier of an audio on the page, IP region information of the user, access time, a device type of the electronic device, an operator that provides a network service for the electronic device, a network type of the electronic device, a system language of the electronic device, a brand of the electronic device, a model of the electronic device, a scenario in which the electronic device needs to display an advertisement, a size of an area that is in a display interface of the electronic device and that is used to display an advertisement, and a country in which the electronic device is located.
According to a fourth aspect, this application provides a model training apparatus. The apparatus includes an obtaining module and a processing module. The obtaining module is configured to obtain a first sample set, where the first sample set includes a first training sample, and the first training sample includes at least one advertisement feature of an advertisement and at least one context feature corresponding to the advertisement. The processing module is configured to: process the at least one context feature by using a first model, to obtain a first feature vector; and process the at least one advertisement feature by using a second model, to obtain a second feature vector. The processing module is further configured to process a processing result of at least one stage in the first model and a processing result of at least one stage in the second model by using a third model, to obtain a first correlation score, where the first correlation score represents a degree of matching between the at least one context feature and the at least one advertisement feature. The processing module is further configured to obtain, based on the first feature vector, the second feature vector, the first correlation score, and a sample label of the first training sample, a loss corresponding to the first training sample. The processing module is further configured to train the first model and the second model based on a loss corresponding to at least one training sample in the first sample set.
In a possible implementation, when processing the at least one context feature by using the first model, to obtain the first feature vector, the processing module is specifically configured to: encode the at least one context feature by using the first model, to obtain N third feature vectors, where N≥1; and when N=1, process the N third feature vectors by using the first model, to obtain the first feature vector; or when N≥2, concatenate the N third feature vectors by using the first model, to obtain one fourth feature vector; and process the fourth feature vector by using the first model, to obtain the first feature vector.
In a possible implementation, when processing the at least one advertisement feature by using the second model, to obtain the second feature vector, the processing module is specifically configured to: encode the at least one advertisement feature by using the second model, to obtain M fifth feature vectors, where M≥1; and when M=1, process the M fifth feature vectors by using the second model, to obtain the second feature vector; or when M≥2, concatenate the M fifth feature vectors by using the second model, to obtain one sixth feature vector; and process the sixth feature vector by using the second model, to obtain the second feature vector.
In a possible implementation, when obtaining, based on the first feature vector, the second feature vector, the first correlation score, and the sample label of the first training sample, the loss corresponding to the first training sample, the processing module is specifically configured to: obtain a first loss based on the first feature vector, the second feature vector, and the sample label of the first training sample; obtain a second loss based on the first correlation score and the sample label of the first training sample; and obtain, based on the first loss and the second loss, the loss corresponding to the first training sample.
In a possible implementation, when obtaining the first loss based on the first feature vector, the second feature vector, and the sample label of the first training sample, the processing module is specifically configured to: determine a second correlation score based on the first feature vector and the second feature vector, where the second correlation score represents a degree of matching between the at least one context feature and the at least one advertisement feature; and obtain the first loss based on the second correlation score and the sample label of the first training sample.
In a possible implementation, the processing module is further configured to: train the third model based on the loss corresponding to the at least one training sample in the first sample set.
In a possible implementation, the third model is a neural network model, and is used to assist, in a process of training the first model and the second model, in calculating a loss corresponding to a training sample in the first sample set.
In a possible implementation, the trained first model is used to perform feature extraction on a context feature related to a page accessed by a user, and the trained second model is used to perform feature extraction on the advertisement.
According to a fifth aspect, this application provides an advertisement placement apparatus, where the advertisement placement apparatus may be deployed in an electronic device having a display. The apparatus may include an obtaining module and a display module. The obtaining module is configured to: obtain an access operation of a user on a first page; and in response to the access operation, obtain a first context feature related to the first page, where the context feature is irrelevant to a user profile and/or a user behavior of the user. The display module is configured to display f advertisements based on the first context feature, where f≥1.
In a possible implementation, after the display module displays the f advertisements, the obtaining module is further configured to: obtain a second access operation of the user on a second page; and in response to the second access operation, obtain a second context feature related to the second page, where the second context feature is irrelevant to the user profile and/or the user behavior of the user. The display module is further configured to display g advertisements based on the second context feature, where g≥1, and at least a part of the g advertisements is different from an advertisement in the f advertisements.
In a possible implementation, the apparatus further includes: a processing module, configured to process the context feature by using a first model, to obtain a first feature vector, where the first model is a neural network model, and the context feature is the first context feature or the second context feature. The processing module is further configured to determine values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement. The processing module is further configured to screen out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K. The display module is configured to display advertisements respectively corresponding to the Q similarity values, where when the context feature is the first context feature, the advertisements respectively corresponding to the Q similarity values are the f advertisements; or when the context feature is the second context feature, the advertisements respectively corresponding to the Q similarity values are the g advertisements.
In a possible implementation, the apparatus further includes: a communication module, configured to send a first message to a server, where the first message includes the context feature, and the context feature is the first context feature or the second context feature. The communication module is further configured to receive a second message sent by the server, where the second message includes Q advertisements or pieces of advertisement indication information; the pieces of advertisement indication information are used to generate the Q advertisements; and when the context feature is the first context feature, the Q advertisements are the f advertisements; or when the context feature is the second context feature, the Q advertisements are the g advertisements. The display module is configured to display the Q advertisements.
In a possible implementation, the apparatus further includes: a processing module, configured to process the context feature by using a first model, to obtain a first feature vector, where the first model is a neural network model, and the context feature is the first context feature or the second context feature; and a communication module, configured to send a first message to a server, where the first message includes the first feature vector. The communication module is further configured to receive a second message sent by the server, where the second message includes Q advertisements or pieces of advertisement indication information; the pieces of advertisement indication information are used to generate the Q advertisements; and when the context feature is the first context feature, the Q advertisements are the f advertisements; or when the context feature is the second context feature, the Q advertisements are the g advertisements. The display module is configured to display the Q advertisements.
In a possible implementation, the apparatus further includes: a communication module, configured to send a first message to a server, where the first message includes the context feature, the first message indicates the server to perform feature extraction on the context feature, and the context feature is the first context feature or the second context feature, where the communication module is further configured to receive a second message sent by the server, where the second message includes a first feature vector extracted by the server based on the context feature; and a processing module, configured to determine values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement. The processing module is further configured to screen out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K. The display module is configured to display advertisements respectively corresponding to the Q similarity values, where when the context feature is the first context feature, the advertisements respectively corresponding to the Q similarity values are the f advertisements; or when the context feature is the second context feature, the advertisements respectively corresponding to the Q similarity values are the g advertisements.
In a possible implementation, the first context feature includes one or more of the following: an identifier of the first page, a text on the first page, an identifier of a video on the first page, an identifier of a picture on the first page, an identifier of an audio on the first page, IP region information of the user, access time, a device type of the electronic device, an operator that provides a network service for the electronic device, a network type of the electronic device, a system language of the electronic device, a brand of the electronic device, a model of the electronic device, a scenario in which the electronic device needs to display an advertisement, a size of an area that is in a display interface of the electronic device and that is used to display an advertisement, and a country in which the electronic device is located.
In a possible implementation, the second context feature includes one or more of the following: an identifier of the second page, a text on the second page, an identifier of a video on the second page, an identifier of a picture on the second page, an identifier of an audio on the second page, the IP region information of the user, access time, the device type of the electronic device, the operator that provides the network service for the electronic device, the network type of the electronic device, the system language of the electronic device, the brand of the electronic device, the model of the electronic device, the scenario in which the electronic device needs to display the advertisement, the size of the area that is in the display interface of the electronic device and that is used to display the advertisement, and the country in which the electronic device is located.
According to a sixth aspect, this application provides an advertisement placement apparatus, where the apparatus is deployed in a server. The apparatus includes a communication module and a processing module. The communication module may be configured to receive a first message sent by an electronic device, where the first message includes a context feature related to a page accessed by a user on the electronic device, and the context feature is irrelevant to a user profile and/or a user behavior of the user. The processing module may be configured to: in response to the first message, obtain, based on the context feature, R advertisements or pieces of information that indicate R advertisements, where R≥1. The communication module may be further configured to send a second message to the electronic device, where the second message indicates the electronic device to display the R advertisements.
In a possible implementation, when obtaining, based on the context feature, the R advertisements or the pieces of information that indicate the R advertisements, the processing module is specifically configured to: process the context feature by using a first model, to obtain a first feature vector, where the first model is a neural network model; determine values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement; screen out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K; and use advertisements respectively corresponding to the Q similarity values as the R advertisements, or use pieces of information that indicate advertisements and that respectively correspond to the Q similarity values as the pieces of information that indicate the R advertisements.
In a possible implementation, the context feature includes one or more of the following: an identifier of the page, a text on the page, an identifier of a video on the page, an identifier of a picture on the page, an identifier of an audio on the page, IP region information of the user, access time, a device type of the electronic device, an operator that provides a network service for the electronic device, a network type of the electronic device, a system language of the electronic device, a brand of the electronic device, a model of the electronic device, a scenario in which the electronic device needs to display an advertisement, a size of an area that is in a display interface of the electronic device and that is used to display an advertisement, and a country in which the electronic device is located.
According to a seventh aspect, this application provides an electronic device, including: a display; at least one memory, configured to store a program; and at least one processor, configured to execute the program stored in the memory. When the program stored in the memory is executed, the processor is configured to perform the method described in any one of the second aspect or the possible implementations of the second aspect.
According to an eighth aspect, this application provides a server, including: at least one memory, configured to store a program; and at least one processor, configured to execute the program stored in the memory. When the program stored in the memory is executed, the processor is configured to perform the method described in any one of the third aspect or the possible implementations of the third aspect.
According to a ninth aspect, this application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is run on a processor, the processor is enabled to perform the method described in any one of the first aspect or the possible implementations of the first aspect, or perform the method described in any one of the second aspect or the possible implementations of the second aspect, or perform the method described in any one of the third aspect or the possible implementations of the third aspect.
According to a tenth aspect, this application provides a computer program product. When the computer program product runs on a processor, the processor is enabled to perform the method described in any one of the first aspect or the possible implementations of the first aspect, or perform the method described in any one of the second aspect or the possible implementations of the second aspect, or perform the method described in any one of the third aspect or the possible implementations of the third aspect.
It may be understood that, for beneficial effect of the third aspect to the tenth aspect, reference may be made to related descriptions in the first aspect and the second aspect. Details are not described herein again.
The term “and/or” in this specification describes an association relationship between associated objects and represents that three relationships may exist. For example, A and/or B may represent the following three cases: Only A exists, both A and B exist, and only B exists. The symbol “/” in this specification indicates an “or” relationship between associated objects. For example, A/B indicates A or B.
In the specification and claims of this application, the terms “first”, “second”, and the like are intended to distinguish between different objects, but do not indicate a particular order of the objects. For example, a first response message, a second response message, and the like are used to distinguish between different response messages, but do not indicate a particular order of the response messages.
In embodiments of this application, the term “example”, “for example”, or the like is used to represent giving an example, an illustration, or a description. Any embodiment or design scheme described with “example” or “for example” in embodiments of this application should not be explained as being more preferred or having more advantages than another embodiment or design scheme. Exactly, use of the term “example”, “for example”, or the like is intended to present a relative concept in a specific manner.
In descriptions of embodiments of this application, unless otherwise specified, “a plurality of” means two or more. For example, a plurality of processing units are two or more processing units, and a plurality of elements are two or more elements.
For example, to implement user-oriented precise advertisement placement, a representation model related to a user profile may be trained based on feature data of the user profile and a user behavior, and an advertisement most related to a user is recalled by using the model, to implement precise advertisement placement. To complete an advertisement representation recall technology based on a user profile, usually, first, training may be separately performed on feature data on a user side and an advertisement side based on a dual-tower structure (a user tower and an advertisement tower), to obtain a user-side representation model (referred to as a “user representation model” below) and an advertisement-side representation model (referred to as an “advertisement representation model” below). Then, the user representation model and the advertisement representation model are used to implement user-oriented precise advertisement placement.
For example,
After the user-side feature vector is obtained, a similarity between the user-side feature vector and each advertisement-side feature vector may be calculated by using a cosine similarity algorithm or the like, and advertisements corresponding to one or more advertisement-side feature vectors with high similarities are selected for placement, that is, a to-be-placed advertisement is obtained. For example, after similarities are sorted in descending order, advertisements corresponding to the first five similarities may be used as to-be-placed advertisements. In this way, a required advertisement is recalled from a preset advertisement set.
In the advertisement recall solution shown in
For example,
The user tower apparatus 210 includes a feature encoding (embedding) apparatus 211, a feature concatenation (concatenate) apparatus 212, and a primary network apparatus 213. The feature encoding apparatus 211 is configured to perform feature encoding on each user profile feature and each user behavior feature in a user feature data set, to represent a sparse original feature as a dense feature vector. For example, the feature encoding apparatus 211 may use, but not limited to, a word2vec or item2vec algorithm to perform encoding on features in the user feature data set. The feature concatenation apparatus 212 is configured to concatenate, into one feature vector, feature vectors that correspond to different user features and that are obtained through encoding by the feature encoding apparatus 211. A function of the feature concatenation apparatus 212 may also be understood as feature fusion. The primary network apparatus 213 is configured to control the feature vector obtained through concatenation by the feature concatenation apparatus 212 to undergo sufficient feature interaction across different dimensions, so that more valid feature information can be obtained. A feature vector output by the primary network apparatus 213 may represent a specific user. For example, a model structure of the primary network apparatus 213 may be, but is not limited to, a deep neural network (deep neural network, DNN), a multi-layer neural network (multi-layer perception, MLP), a deep factorization machine (deep factorization machine, DeepFM), an extreme deep factorization machine model (extreme deep factorization machine, xDeepFM), a deep cross network (deep cross network, DCN), or a deep interest network (deep interest network, DIN).
The advertisement tower apparatus 220 includes a feature encoding (embedding) apparatus 221, a feature concatenation (concatenate) apparatus 222, and a primary network apparatus 223. The feature encoding apparatus 221 is configured to perform feature encoding on each advertisement feature in an advertisement feature data set, to represent a sparse original feature as a dense feature vector. The feature concatenation apparatus 222 is configured to concatenate, into one feature vector, feature vectors that correspond to different advertisement features and that are obtained through encoding by the feature encoding apparatus 221. The primary network apparatus 223 is configured to control the feature vector obtained through concatenation by the feature concatenation apparatus 222 to undergo sufficient feature interaction across different dimensions, so that more valid feature information can be obtained. A feature vector output by the primary network apparatus 223 may represent a specific advertisement. For example, a model structure of the primary network apparatus 223 may be, but not limited to, the same as that of the primary network apparatus 213.
The dual-tower loss apparatus 230 is a loss function in the dual-tower model training apparatus 200; and mainly evaluates training degrees of the user tower apparatus 210 and the advertisement tower apparatus 220 according to a similarity comparison method, for example, a cosine similarity comparison method, and reversely propagates the training degrees to the user tower apparatus 210 and the advertisement tower apparatus 220.
In a process of training the user tower apparatus 210 and the advertisement tower apparatus 220 by using the dual-tower model training apparatus 200, a model parameter in the user tower apparatus 210 may be continuously adjusted based on a result output by the dual-tower loss apparatus 230, so that representation of a user feature vector output by the user tower apparatus 210 is more accurate. In addition, a model parameter in the advertisement tower apparatus 220 may be continuously adjusted based on the result output by the dual-tower loss apparatus 230, so that representation of an advertisement feature vector output by the advertisement tower apparatus 220 is more accurate. After training is completed, the dual-tower model training apparatus 200 may solidify a parameter with optimal training effect of the user tower apparatus 210 in the training process, to generate and output the user representation model 300. In addition, the dual-tower model training apparatus 200 may solidify a parameter with optimal training effect of the advertisement tower apparatus 220 in the training process, to generate and output the advertisement representation model 400. The user representation model 300 is used to represent an online user feature as a feature vector, and the advertisement representation model 400 is used to represent an offline advertisement feature as a feature vector.
It can be learned from
In view of this, embodiments of this application provide a model training method. In the method, a context feature may be used to replace a user feature, to reduce dependence on the user feature. In addition, in the method, an auxiliary network is added to the dual-tower model training apparatus 200, to implement interaction modeling between the user tower apparatus 210 and the advertisement tower apparatus 220, and therefore implement interaction between the context feature and an advertisement feature, enhance association between the context feature and the advertisement feature, resolve an information exchange problem of features of two towers, and improve representation effect of a finally obtained model. The context feature may include: a content context feature related to an advertisement, and/or an environment context feature related to the advertisement. For example, the content context feature may be a context record of content included in the advertisement when a user accesses the advertisement, for example, a web page text, an identifier of a web page picture, an identifier of a video, or an identifier of an audio; and the environment context feature may be a context record related to an environment when the user accesses the advertisement, for example, internet protocol (internet protocol, IP) region information (that is, a home location of an IP address), access time, a device type of an electronic device, an operator that provides a network service for the electronic device, a network type of the electronic device, a system language of the electronic device, a brand of the electronic device, a model of the electronic device, a scenario in which the electronic device needs to display an advertisement, a size of an area that is in a display interface of the electronic device and that is used to display an advertisement, or a country in which the electronic device is located.
For example,
The auxiliary network model 340 is used to implement interaction modeling between the user tower apparatus 310 and the advertisement tower apparatus 320, and therefore implement interaction between the context feature and an advertisement feature, and enhance association between the context feature and the advertisement feature. Inputs of the auxiliary network model 340 may be an output of the user tower apparatus 210 in at least one stage and an output of the advertisement tower apparatus 220 in at least one stage. For example, the inputs of the auxiliary network model 340 may be outputs of feature encoding apparatuses 311 and 321, or may be outputs of feature concatenation apparatuses 312 and 322, or may be outputs of primary network apparatuses 313 and 323, or may be outputs of specific network layers of the primary network apparatuses 313 and 323, or may be a combination of several of the foregoing manners, for example, may be a combination of the output of the feature encoding apparatus 311 and the output of the primary network apparatus 323. This may be specifically determined based on an actual situation, and is not limited herein. An output of the auxiliary network model 340 may represent correlation between the context feature and the advertisement feature. For example, a model structure of the auxiliary network model 340 may be, but not limited to, the same as that of the primary network apparatus 313 or 323. In some embodiments, the auxiliary network model 340 may be pre-trained, or may be to-be-trained (that is, not trained). This may be specifically determined based on an actual situation, and is not limited herein. For example, when the auxiliary network model 340 is pre-trained, the context feature data set and the advertisement feature data set may be used as training data, to train the auxiliary network model 340.
The auxiliary network loss apparatus 350 is another loss function in the dual-tower model training apparatus 300; and mainly evaluates training degrees of the user tower apparatus 310, the advertisement tower apparatus 320, and the auxiliary network model 340 based on an output result of the auxiliary network model 340 and a sample label of a preset training sample, and reversely propagates the training degrees to the user tower apparatus 310, the advertisement tower apparatus 320, and the auxiliary network model 340.
In a process of training the user tower apparatus 310 and the advertisement tower apparatus 320 by using the dual-tower model training apparatus 300, a model parameter in the user tower apparatus 310 may be continuously adjusted based on a result output by the dual-tower loss apparatus 330 and a result output by the auxiliary network loss apparatus 350, so that representation of a context feature vector output by the user tower apparatus 310 is more accurate. In addition, a model parameter in the advertisement tower apparatus 320 may be continuously adjusted based on the result output by the dual-tower loss apparatus 330 and the result output by the auxiliary network loss apparatus 350, so that representation of an advertisement feature vector output by the advertisement tower apparatus 320 is more accurate. After training is completed, the dual-tower model training apparatus 300 may solidify a parameter with optimal training effect of the user tower apparatus 310 in the training process, to generate and output a context representation model 500. In addition, the dual-tower model training apparatus 300 may solidify a parameter with optimal training effect of the advertisement tower apparatus 320 in the training process, to generate and output an advertisement representation model 600. The context representation model 500 is used to represent an online context feature as a feature vector, and the advertisement representation model 600 is used to represent an offline advertisement feature as a feature vector.
After the context representation model 500 and the advertisement representation model 600 are obtained: For example,
The following describes, based on content in
For example,
S510: Obtain a first sample set, where the first sample set includes a first training sample, and the first training sample includes at least one advertisement feature of an advertisement and at least one context feature corresponding to the advertisement.
In this embodiment, the first sample set may include at least one training sample. The first sample set may be preset by a user. Certainly, the first sample set may alternatively be a set of training samples collected by using an operation log of the user on a terminal device (for example, a mobile phone or a computer). For example, the operation log may be related to an advertisement, or may be irrelevant to the advertisement. Each training sample in the first sample set may include at least one advertisement feature of one advertisement and at least one context feature corresponding to the advertisement. Different training samples may correspond to different advertisements. For example, the first training sample may include an advertisement feature of an advertisement a and a context feature corresponding to the advertisement a, and a second training sample may include an advertisement feature of an advertisement b and a context feature corresponding to the advertisement b. For example, each advertisement feature may be any one of a title, a category, a brand, a tag, text content, picture content, video content, or the like of the advertisement. Each context feature may be a content context feature corresponding to the advertisement, and/or an environment context feature corresponding to the advertisement. The content context feature may include a context record of content included in the advertisement when the user accesses the advertisement, for example, a web page text, an identifier of a web page picture, an identifier of a video, or an identifier of an audio. The environment context feature may include a context record related to an environment when the user accesses the advertisement, for example, IP address information, access time, a device type of an electronic device, an operator that provides a network service for the electronic device, a network type of the electronic device, a system language of the electronic device, a brand of the electronic device, a model of the electronic device, a scenario in which the electronic device needs to display an advertisement, a size of an area that is in a display interface of the electronic device and that is used to display an advertisement, and a country in which the electronic device is located. In some embodiments, the training sample in the first sample set may be a positive sample, or may be a negative sample. This may be specifically determined based on an actual situation.
For example, a set of context features included in the first sample set may be understood as the context feature data set described in
S520: Process, by using a first model, the context feature included in the first training sample, to obtain a first feature vector; and process, by using a second model, the advertisement feature included in the first training sample, to obtain a second feature vector.
In this embodiment, the context feature included in the first training sample may be processed by using the first model, to obtain the first feature vector; and the advertisement feature included in the first training sample may be processed by using the second model, to obtain the second feature vector. For example, the first model may be understood as the user tower apparatus 310 in
In some embodiments, the context feature included in the first training sample may be encoded by using the first model, to obtain N feature vectors. For example, the context feature may be in one-to-one correspondence to the feature vector obtained through encoding, or certainly may not be in one-to-one correspondence to the feature vector obtained through encoding. This may be specifically determined based on an actual situation. When N=1, the obtained feature vector may be processed by using the first model, for example, sufficient feature interaction may be performed across different dimensions, to obtain the first feature vector. When N≥2, the N obtained feature vectors may be first concatenated by using the first model, to obtain one feature vector. Then, the feature vector obtained through concatenation is processed by using the first model, for example, sufficient feature interaction is performed across different dimensions, to obtain the first feature vector.
In some embodiments, the advertisement feature included in the first training sample may be encoded by using the second model, to obtain M feature vectors. For example, the advertisement feature may be in one-to-one correspondence to the feature vector obtained through encoding, or certainly may not be in one-to-one correspondence to the feature vector obtained through encoding. This may be specifically determined based on an actual situation. When M=1, the obtained feature vector may be processed by using the second model, for example, sufficient feature interaction may be performed across different dimensions, to obtain the second feature vector. When M≥2, the M obtained feature vectors may be first concatenated by using the second model, to obtain one feature vector. Then, the feature vector obtained through concatenation is processed by using the second model, for example, sufficient feature interaction is performed across different dimensions, to obtain the second feature vector.
S530: Process a processing result of at least one stage in the first model and a processing result of at least one stage in the second model by using a third model, to obtain a first correlation score, where the first correlation score represents a degree of matching between the context feature included in the first training sample and the advertisement feature included in the first training sample.
In this embodiment, the processing result of the at least one stage in the first model and the processing result of the at least one stage in the second model may be processed by using the third model, to obtain the first correlation score. The first correlation score may represent the degree of matching between the context feature included in the first training sample and the advertisement feature included in the first training sample. For example, the third model may be understood as the auxiliary network model 340 in
In some embodiments, the processing result of the at least one stage in the first model may be a result output by any one or more neural network layers in the first model. When the first model is the user tower apparatus 310 in
In some embodiments, the processing result of the at least one stage in the second model may be a result output by any one or more neural network layers in the second model. When the second model is the advertisement tower apparatus 320 in
S540: Obtain, based on the first feature vector, the second feature vector, the first correlation score, and a sample label of the first training sample, a loss corresponding to the first training sample.
In this embodiment, after the first feature vector, the second feature vector, and the first correlation score are obtained, the loss corresponding to the first training sample may be determined based on the first feature vector, the second feature vector, the first correlation score, and the sample label of the first training sample.
In some embodiments, a first loss may be first obtained based on the first feature vector, the second feature vector, and the sample label of the first training sample. Then, a second loss is obtained based on the first correlation score and the sample label of the first training sample. Finally, the loss corresponding to the first training sample is obtained based on the first loss and the second loss. A sequence of obtaining the first loss and the second loss may be determined based on an actual situation, and is not limited herein.
For the first loss, the first feature vector and the second feature vector may be processed based on, but not limited to, a cosine similarity algorithm, to obtain a correlation score between the first feature vector and the second feature vector. The correlation score may represent the degree of matching between the context feature included in the first training sample and the advertisement feature included in the first training sample. Then, the correlation score and the sample label of the first training sample may be processed by using a preset loss function, to obtain the first loss. For example, the first loss may be obtained through processing by the dual-tower loss apparatus 330 described in
For the second loss, the first correlation score and the sample label of the first training sample may be processed by using a preset loss function, to obtain the second loss. For example, the second loss may be obtained through processing by the auxiliary network loss apparatus 350 described in
The loss corresponding to the first training sample may be obtained by performing addition, weighted averaging, or multiplication on the first loss and the second loss. This may be specifically determined based on an actual situation, and is not limited herein.
The foregoing describes a process of processing one training sample in the first sample set. For other training samples in the first sample set, refer to the process of processing the first training sample, to obtain a loss corresponding to each of the other training samples. Details are not described herein again.
After a loss of each training sample in the first sample set is determined, S550 may be performed. In some embodiments, S550 may alternatively be performed once each time one loss is obtained, or S550 may alternatively be performed once each time a batch of (for example, two or three) losses are obtained. This may be specifically determined based on an actual situation, and is not limited herein. In addition, a loss described in S550 is the loss obtained in this case.
S550: Train the first model and the second model based on a loss corresponding to the at least one training sample in the first sample set.
In this embodiment, after losses corresponding to one or more training samples are obtained, the first model and the second model may be trained to minimize these losses. Certainly, the third model may also be trained. For example, after the losses corresponding to the one or more training samples are obtained, parameters in the first model and the second model may be updated by using, but not limited to, a backpropagation algorithm, to complete training of the first model and the second model.
In some embodiments, the first model may be used to perform feature extraction on a context feature related to a page accessed by the user, and the second model may be used to perform feature extraction on an advertisement.
In this way, the context feature is used to replace a user feature for model training, and therefore dependence on the user feature in a subsequent model use process is reduced. In addition, the third model is added in the process of training the first model and the second model, to implement interaction modeling between the first model and the second model, and therefore implement interaction between the context feature and the advertisement feature, enhance association between the context feature and the advertisement feature, and improve representation effect of the finally obtained first model and second model.
After training of the first model and the second model is completed, the two models may be used for advertisement placement. The trained first model may be understood as the context representation model 500 described in
For example,
S610: Obtain an access operation of a user on a first page.
In this embodiment, when the user browses a specific page on the electronic device or delivers an instruction for accessing a specific page, the electronic device may obtain an access operation of the user on the page.
For example, the electronic device is a mobile phone. In a process of using the mobile phone, when the user uses a browser configured on the mobile phone, after the user enters a specific keyword and taps to search, an interface presented by the browser may be the first page accessed by the user. In this case, the operation of tapping to search by the user may be understood as the access operation. In addition, the user selects content in the interface presented by the browser, and taps to browse the content. Then, an interface presented by the browser may be the first page accessed by the user. In this case, an operation of tapping to browse the related content by the user may be understood as the access operation.
S620: In response to the access operation of the user, obtain a first context feature related to the first page, where the first context feature is irrelevant to a user profile and/or a user behavior of the user.
In this embodiment, with authorization of the user, information about the page accessed by the user may be actively obtained, and the information is analyzed to determine a context feature related to content of the first page, for example, an identifier of the page, or an identifier of a text, a video, a picture, or an audio on the page; and/or with authorization of the user, context information of an environment at the time when the user accesses the first page may also be obtained, to obtain a context feature related to the environment for accessing the first page, for example, one or more of IP region information of the user, access time, a device type of the electronic device, an operator that provides a network service for the electronic device, a network type of the electronic device, a system language of the electronic device, a brand of the electronic device, a model of the electronic device, a scenario in which the electronic device needs to display an advertisement, a size of an area that is in a display interface of the electronic device and that is used to display an advertisement, a country in which the electronic device is located, and the like. For example, different display interfaces on the electronic device may be used to present different content to the user. In this embodiment, the context feature related to the content of the first page and/or the context feature related to the environment for accessing the first page are/is irrelevant to the user profile and/or the user behavior of the user. For example, the first context feature may include the context feature related to the content of the first page, and/or the context feature related to the environment for accessing the first page. The first context feature is irrelevant to the user profile and/or the user behavior of the user.
S630: Display f advertisements based on the first context feature, where f≥1.
In this embodiment, after the first context feature is obtained, the f advertisements may be displayed, where f≥1.
In a possible implementation, the context representation model 500 (referred to as a “first model” below) obtained through training in
S6311: Process the first context feature by using the first model, to obtain a first feature vector.
In this embodiment, after the context feature is obtained, the first context feature may be input into the first model obtained through the foregoing model training, to process the context feature by using the first model, to obtain the first feature vector.
S6312: Determine values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement.
In this embodiment, features of K to-be-placed advertisements may be processed in advance by using a second model obtained through the foregoing model training, to obtain the K second feature vectors. One second feature vector corresponds to one advertisement. Each second feature vector represents a feature of one advertisement. Then, after the first feature vector is obtained, the values of similarity between the first feature vector and the K second feature vectors may be determined by using a cosine similarity algorithm or the like, to obtain the K similarity values.
S6313: Screen out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K.
In this embodiment, after the K similarity values are obtained, the K similarity values may be sorted, for example, in descending order or in ascending order. Then, Q larger similarity values are selected from the K similarity values. Each of the Q similarity values is greater than the similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K. For example, a value of Q may be, but is not limited to, a preset value. For example, if Q is equal to 2, K=4, and the K similarity values are 2, 4, 6, and 7, similarity values obtained through screening are 6 and 7. For example, S6311 to S6313 may be understood as a process of obtaining, based on the context feature, Q advertisements or pieces of information that indicate Q advertisements (that is, Q pieces of advertisement indication information). After the Q similarity values are screened out, advertisements respectively corresponding to the Q similarity values may be used as advertisements that need to be placed, or pieces of information that indicate advertisements and that respectively correspond to the Q similarity values are used as pieces of information that indicate advertisements that need to be placed. A quantity of advertisements that need to be placed is the same as the value of Q, and a quantity of pieces of information about an advertisement that needs to be placed is also the same as the value of Q. For example, the quantity of advertisements that need to be placed or the quantity of pieces of information about an advertisement that needs to be placed may alternatively be represented by another quantity, for example, k, R, or g, but these values are the same as Q in the Q similarity values obtained through screening.
S6314: Display the advertisements respectively corresponding to the Q similarity values, where the advertisements respectively corresponding to the Q similarity values are the f advertisements.
In this embodiment, after the Q similarity values are screened out, the advertisements respectively corresponding to the Q similarity values may be used as advertisements that need to be placed this time, and the advertisements are displayed, so that the user can browse the advertisements. The advertisements respectively corresponding to the Q similarity values are the f advertisements described in S630.
In this way, the f advertisements are displayed based on the first context feature.
In another possible implementation, S6311 to S6313 in
In still another possible implementation, S6312 and S6313 in
In yet another possible implementation, S6311 in
In this way, during advertisement placement, a context feature is used to replace a user feature, to reduce dependence on the user feature, implement, when the user feature (for example, a user profile or a user behavior) cannot be obtained, precise advertisement placement by using a context feature related to a page accessed by the user, and resolve a problem of trade-off between privacy protection of user information and precise advertisement placement.
In some embodiments, after S630, when the user performs page switching on the electronic device, the electronic device may further obtain a second access operation of the user on a second page. Then, in response to the second access operation, the electronic device may obtain a second context feature related to the second page, where the second context feature is irrelevant to the user profile and/or the user behavior of the user. Finally, the electronic device may display g advertisements based on the second context feature, where g≥1, and at least a part of the g advertisements is different from an advertisement in the f advertisements. For example, the second context feature may include one or more of an identifier of the second page, a text on the second page, an identifier of a video on the second page, an identifier of a picture on the second page, an identifier of an audio on the second page, the IP region information of the user, access time, the device type of the electronic device, the operator that provides the network service for the electronic device, the network type of the electronic device, the system language of the electronic device, the brand of the electronic device, the model of the electronic device, the scenario in which the electronic device needs to display the advertisement (for example, a startup scenario or a scenario in which a specific application is used), the size of the area that is in the display interface of the electronic device and that is used to display the advertisement, the country in which the electronic device is located, and the like. In some embodiments, for an execution step after S630, refer to the descriptions of
For ease of understanding, the following uses examples for description.
As shown in
In addition, when the user A and a user B use a same type of mobile phone (for example, mobile phones used by the user A and the user B have a same networking mode, a same operator, a same manufacturer, and the like), and access a same page at same time and at a same place, because in this embodiment, advertisement recommendation is performed based on a context feature of a page accessed by a user, and context features of the page accessed by the user A and the user B are the same, a same advertisement may be recommended to the user A and the user B. For comparison, when advertisement recommendation is performed by using a user feature, although the context features of the page accessed by the user A and the user B are the same, because user features of the user A and the user B are different, advertisements recommended to the user A and the user B are different. In addition, as shown in
In addition, when a user uses a same mobile phone to browse different pages at different time, the different pages include different content. Therefore, when the user switches a page, a placed advertisement may be changed synchronously. For example, as shown in
It may be understood that sequence numbers of the steps in the foregoing embodiments do not mean execution sequences. The execution sequences of the processes should be determined based on functions and internal logic of the processes, and should not be construed as any limitation on implementation processes of embodiments of this application. In addition, in some possible implementations, the steps in the foregoing embodiments may be selectively performed, or may be partially performed, or may be completely performed based on an actual situation. This is not limited herein.
Based on the method in the foregoing embodiments, an embodiment of this application further provides a model training apparatus.
For example,
In some embodiments, when processing the at least one context feature by using the first model, to obtain the first feature vector, the processing module 1120 is specifically configured to: encode the at least one context feature by using the first model, to obtain N third feature vectors, where N≥1; and when N=1, process the N third feature vectors by using the first model, to obtain the first feature vector; or when N≥2, concatenate the N third feature vectors by using the first model, to obtain one fourth feature vector; and process the fourth feature vector by using the first model, to obtain the first feature vector.
In some embodiments, when processing the at least one advertisement feature by using the second model, to obtain the second feature vector, the processing module 1120 is specifically configured to: encode the at least one advertisement feature by using the second model, to obtain M fifth feature vectors, where M≥1; and when M=1, process the M fifth feature vectors by using the second model, to obtain the second feature vector; or when M≥2, concatenate the M fifth feature vectors by using the second model, to obtain one sixth feature vector; and process the sixth feature vector by using the second model, to obtain the second feature vector.
In some embodiments, when obtaining, based on the first feature vector, the second feature vector, the first correlation score, and the sample label of the first training sample, the loss corresponding to the first training sample, the processing module 1120 is specifically configured to: obtain a first loss based on the first feature vector, the second feature vector, and the sample label of the first training sample; obtain a second loss based on the first correlation score and the sample label of the first training sample; and obtain, based on the first loss and the second loss, the loss corresponding to the first training sample.
In some embodiments, when obtaining the first loss based on the first feature vector, the second feature vector, and the sample label of the first training sample, the processing module 1120 is specifically configured to: determine a second correlation score based on the first feature vector and the second feature vector, where the second correlation score represents a degree of matching between the at least one context feature and the at least one advertisement feature; and obtain the first loss based on the second correlation score and the sample label of the first training sample.
In some embodiments, the processing module 1120 is further configured to: train the third model based on the loss corresponding to the at least one training sample in the first sample set.
In some embodiments, the trained first model is used to perform feature extraction on a context feature related to a page accessed by a user, and the trained second model is used to perform feature extraction on the advertisement.
In some embodiments, the third model is a neural network model, and is used to assist, in a process of training the first model and the second model, in calculating a loss corresponding to a training sample in the first sample set.
It should be understood that the foregoing apparatus is configured to perform the model training method described in the foregoing embodiment, and an implementation principle and technical effect of a corresponding program module in the apparatus are similar to the descriptions in the foregoing method. For a working process of the apparatus, refer to a corresponding process in the foregoing method. Details are not described herein again.
Based on the method in the foregoing embodiments, an embodiment of this application further provides an advertisement placement apparatus.
For example,
In some embodiments, after the display module 1220 displays the f advertisements, the obtaining module 1210 is further configured to: obtain a second access operation of the user on a second page; and in response to the second access operation, obtain a second context feature related to the second page, where the second context feature is irrelevant to the user profile and/or the user behavior of the user. The display module 1220 is further configured to display g advertisements based on the second context feature, where g≥1, and at least a part of the g advertisements is different from an advertisement in the f advertisements.
In some embodiments, the apparatus further includes: a processing module (not shown in the figure), configured to process the context feature by using a first model, to obtain a first feature vector, where the first model is a neural network model, and the context feature is the first context feature or the second context feature. The processing module is further configured to determine values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement. The processing module is further configured to screen out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K. The display module 1220 is configured to display advertisements respectively corresponding to the Q similarity values, where when the context feature is the first context feature, the advertisements respectively corresponding to the Q similarity values are the f advertisements; or when the context feature is the second context feature, the advertisements respectively corresponding to the Q similarity values are the g advertisements.
In some embodiments, the apparatus further includes: a communication module (not shown in the figure), configured to send a first message to a server, where the first message includes the context feature, and the context feature is the first context feature or the second context feature. The communication module is further configured to receive a second message sent by the server, where the second message includes Q advertisements or pieces of advertisement indication information; the pieces of advertisement indication information are used to generate the Q advertisements; and when the context feature is the first context feature, the Q advertisements are the f advertisements; or when the context feature is the second context feature, the Q advertisements are the g advertisements. The display module 1220 is configured to display the Q advertisements.
In some embodiments, the apparatus further includes: a processing module (not shown in the figure), configured to process the context feature by using a first model, to obtain a first feature vector, where the first model is a neural network model, and the context feature is the first context feature or the second context feature; and a communication module, configured to send a first message to a server, where the first message includes the first feature vector. The communication module is further configured to receive a second message sent by the server, where the second message includes Q advertisements or pieces of advertisement indication information; the pieces of advertisement indication information are used to generate the Q advertisements; and when the context feature is the first context feature, the Q advertisements are the f advertisements; or when the context feature is the second context feature, the Q advertisements are the g advertisements. The display module 1220 is configured to display the Q advertisements.
In some embodiments, the apparatus further includes: a communication module (not shown in the figure), configured to send a first message to a server, where the first message includes the context feature, the first message indicates the server to perform feature extraction on the context feature, and the context feature is the first context feature or the second context feature, where the communication module is further configured to receive a second message sent by the server, where the second message includes a first feature vector extracted by the server based on the context feature; and a processing module (not shown in the figure), configured to determine values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement. The processing module is further configured to screen out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K. The display module 1220 is configured to display advertisements respectively corresponding to the Q similarity values, where when the context feature is the first context feature, the advertisements respectively corresponding to the Q similarity values are the f advertisements; or when the context feature is the second context feature, the advertisements respectively corresponding to the Q similarity values are the g advertisements.
In some embodiments, the first context feature includes one or more of the following: an identifier of the first page, a text on the first page, an identifier of a video on the first page, an identifier of a picture on the first page, an identifier of an audio on the first page, IP region information of the user, access time, a device type of the electronic device, an operator that provides a network service for the electronic device, a network type of the electronic device, a system language of the electronic device, a brand of the electronic device, a model of the electronic device, a scenario in which the electronic device needs to display an advertisement, a size of an area that is in a display interface of the electronic device and that is used to display an advertisement, and a country in which the electronic device is located.
In some embodiments, the second context feature includes one or more of the following: an identifier of the second page, a text on the second page, an identifier of a video on the second page, an identifier of a picture on the second page, an identifier of an audio on the second page, the IP region information of the user, access time, the device type of the electronic device, the operator that provides the network service for the electronic device, the network type of the electronic device, the system language of the electronic device, the brand of the electronic device, the model of the electronic device, the scenario in which the electronic device needs to display the advertisement, the size of the area that is in the display interface of the electronic device and that is used to display the advertisement, and the country in which the electronic device is located.
It should be understood that the foregoing apparatus is configured to perform the advertisement placement method described in the foregoing embodiment, and an implementation principle and technical effect of a corresponding program module in the apparatus are similar to the descriptions in the foregoing method. For a working process of the apparatus, refer to a corresponding process in the foregoing method. Details are not described herein again.
Based on the method in the foregoing embodiments, an embodiment of this application further provides an advertisement placement apparatus.
For example,
In some embodiments, when obtaining, based on the context feature, the R advertisements or the pieces of information that indicate the R advertisements, the processing module 1320 is specifically configured to: process the context feature by using a first model, to obtain a first feature vector, where the first model is a neural network model; determine values of similarity between the first feature vector and K second feature vectors, to obtain K similarity values, where each second feature vector represents a feature of one advertisement; screen out Q similarity values from the K similarity values, where each of the Q similarity values is greater than a similarity value other than the Q similarity values in the K similarity values, and 1≤Q≤K; and use advertisements respectively corresponding to the Q similarity values as the R advertisements, or use pieces of information that indicate advertisements and that respectively correspond to the Q similarity values as the pieces of information that indicate the R advertisements.
In some embodiments, the context feature includes one or more of the following: an identifier of the page, a text on the page, an identifier of a video on the page, an identifier of a picture on the page, an identifier of an audio on the page, IP region information of the user, access time, and a type, an operator, and a networking mode of the electronic device used by the user.
It should be understood that the foregoing apparatus is configured to perform the advertisement placement method described in the foregoing embodiment, and an implementation principle and technical effect of a corresponding program module in the apparatus are similar to the descriptions in the foregoing method. For a working process of the apparatus, refer to a corresponding process in the foregoing method. Details are not described herein again.
Based on the method in the foregoing embodiments, an embodiment of this application provides an electronic device. The electronic device may include: a display; at least one memory, configured to store a program; and at least one processor, configured to execute the program stored in the memory. When the program stored in the memory is executed, the processor is configured to perform the method described in the foregoing embodiments. For example, the electronic device may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, a server, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook, a cellular phone, a personal digital assistant (personal digital assistant, PDA), an augmented reality (augmented reality, AR) device, a virtual reality (virtual reality, VR) device, an artificial intelligence (artificial intelligence, AI) device, a wearable device, a vehicle-mounted device, a smart household device, and/or a smart city device. A specific type of the electronic device is not specially limited in embodiments of this application.
Based on the method in the foregoing embodiments, an embodiment of this application provides a server. The server may include: at least one memory, configured to store a program; and at least one processor, configured to execute the program stored in the memory. When the program stored in the memory is executed, the processor is configured to perform the method described in the foregoing embodiments. For example, the server may be but is not limited to a cloud server, a virtual machine, a hardware server, or the like. A specific type of the server is not specially limited in embodiments of this application.
Based on the method in the foregoing embodiments, an embodiment of this application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is run on a processor, the processor is enabled to perform the method in the foregoing embodiments.
Based on the method in the foregoing embodiments, an embodiment of this application provides a computer program product. When the computer program product runs on a processor, the processor is enabled to perform the method in the foregoing embodiments.
It may be understood that, the processor in embodiments of this application may be a central processing unit (central processing unit, CPU), or may be another general-purpose processor, a digital signal processor (digital signal processor, DSP), an application-specific integrated circuit (application-specific integrated circuit, ASIC), a field programmable gate array (field programmable gate array, FPGA) or another programmable logic device, a transistor logic device, a hardware component, or any combination thereof. The general-purpose processor may be a microprocessor, or may be any conventional processor.
The method steps in embodiments of this application may be implemented in a hardware manner, or may be implemented in a manner of executing software instructions by the processor. The software instructions may include corresponding software modules. The software modules may be stored in a random access memory (random access memory, RAM), a flash memory, a read-only memory (read-only memory, ROM), a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasable PROM, EPROM), an electrically erasable programmable read-only memory (electrically EPROM, EEPROM), a register, a hard disk, a removable hard disk, a CD-ROM, or any other form of storage medium well-known in the art. For example, the storage medium is coupled to the processor, so that the processor can read information from the storage medium or write information into the storage medium. Certainly, the storage medium may alternatively be a component of the processor. The processor and the storage medium may be located in an ASIC.
All or some of the foregoing embodiments may be implemented by using software, hardware, firmware, or any combination thereof. When software is used to implement the embodiments, all or some of the embodiments may be implemented in a form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedure or functions according to embodiments of this application are completely or partially generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or another programmable apparatus. The computer instructions may be stored in a computer-readable storage medium, or may be transmitted by using the computer-readable storage medium. The computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or a digital subscriber line (DSL)) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium accessible by a computer, or a data storage device, such as a server or a data center, integrating one or more usable media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a DVD), a semiconductor medium (for example, a solid state disk (solid state disk, SSD)), or the like.
It may be understood that various numbers in embodiments of this application are merely used for differentiation for ease of description, and are not used to limit the scope of embodiments of this application.
| Number | Date | Country | |
|---|---|---|---|
| Parent | PCT/CN2022/118950 | Sep 2022 | WO |
| Child | 19078639 | US |