arXiv is now an independent nonprofit! Learn more
License: arXiv.org perpetual non-exclusive license
arXiv:1707.00802v2 [cs.LG] 09 Jul 2017

PBODL : Parallel Bayesian Online Deep Learning for Click-Through Rate Prediction in Tencent Advertising System

Xun Liu    Wei Xue    Lei Xiao    Bo Zhang
Abstract

We describe a parallel bayesian online deep learning framework (PBODL) for click-through rate (CTR) prediction within today’s Tencent advertising system, which provides quick and accurate learning of user preferences. We first explain the framework with a deep probit regression model, which is trained with probabilistic back-propagation in the mode of assumed Gaussian density filtering. Then we extend the model family to a variety of bayesian online models with increasing feature embedding capabilities, such as Sparse-MLP, FM-MLP and FFM-MLP. Finally, we implement a parallel training system based on a stream computing infrastructure and parameter servers. Experiments with public available datasets and Tencent industrial datasets show that models within our framework perform better than several common online models, such as AdPredictor, FTRL-Proximal and MatchBox. Online A/B test within Tencent advertising system further proves that our framework could achieve CTR and CPM lift by learning more quickly and accurately.

1 Introduction

Online advertising is a multi-billion dollar industry and is growing significantly each year. Just like in other online advertising settings, e.g., sponsored search, predicting ad click-through rates plays a central role in online advertising, since it impacts both user experience and profitability of the whole advertising system.

1.1 Tencent Advertising System

In Tencent advertising platform, we choose ads from millions of candidates and serve them to hundreds of millions of users every day. In contrast to sponsored search, it is difficult for us to find out the instant needs of users, since we don’t have search keywords by the time serving ads to them. As a result, advertising recommendations are usually made based on user’s historical behaviors and context information.

Click-Through rate in advertising settings can be modeled as:

ctr=P(click|user,ad,context)ctr=P(click|user,ad,context)

Features used in the conditional part are usually divided into three categories :

  • user features : age, gender, interest, etc;

  • Ad features : advertiser id, ad plan id, material id, ad industry, etc;

  • Context feature : time, location, connection type, etc.

The click-through rate prediction in tencent advertising platform faces many challenges :

  • New Ads : Ad repository within our advertising system is updated frequently. 10% to 20% of the inventory could be replaced with new ads in each day. At the same time, advertisers are allowed to change their targeting rules during the campaign. Apparently, a daily or hourly updated model is not quick enough to support such kind of constant changes, and usually results in suboptimal revenue and advertisers’ complaints according to our experience.

  • Features Engineering : As in all machine learning scenarios, features used dominate the performance of click-through rate prediction models. Unfortunately, feature engineering is a very time and resource consuming process. It demands more time and resource when you take more features into account, and could become the bottleneck of the whole modeling process.

  • Low latency : The runtime latency spent on CTR prediction could not be large without negative impacts on user experience. In mobile advertising scenario, our latency budget for CTR prediction is about 10 ms. Considering the number of candidate ads, this is a very limited budget.

  • Big Data : Click-through rate prediction is a massive-scale learning problem from all perspectives with no doubt. Billions of training samples are generated each day, leaving out the number of users and ads involved.

In the face of the above challenges, we set the following design goals for our solution:

  • Rapid Model Update : We think rapid model update is one of the most effective ways to deal with constantly changing recommendation scenarios. Considering the scale of the learning problem, online learning (bayesian online learning in particular) paradigm is chosen as a corner stone of our solution.

  • Nonlinear Model : Linear models depends heavily on feature engineering, which is both time and resource consuming. Besides that, the size of a linear model explodes quickly while introducing more higher-order features. Inspired by the end-to-end training idea of deep learning, we choose deep nonlinear models as another corner stone of our solution.

  • Balance of Complexity and Latency : Since the latency budget for CTR predictions per request is limited (10ms), deep models with dozens or hundreds of layers are impractical for real-life deployment. In fact, deep models with 3   5 hidden layers are proposed currently. In addition, each layer/operation involved should be designed and implemented as efficiently as possible (scale up).

  • Scale Out : The solution should be able to scale out so as to support billions or even tens of billions of training samples per day.

1.2 Related work

Logistic regression with cross-features is an early well-known solution to CTR problem(M. Richardson 2007; O. Chapelle & Rosales 2015). But it depends on complex features engineering and suffers curse of dimensionality. OWLQN(G Andrew 2007) proposed by Microsoft can effectively pruning model and has been widely applied in many recommendation scenarios.

In recent years, nonlinear models and online learning have got great attention in the field of CTR prediction. Factorization Machines (FM)(Rendle 2010; Rendle 2012) depends less on features engineering and is widely used in various competitions. A variant of FM called Field-aware Factorization Machines (FFM) has been used to win two click-through rate prediction competitions hosted by Criteo and Avazu(Lin 2016). GBDT is another common solution in click-through rate prediction competitions and also widely used in industry.

Inspired by deep learning(A. Krizhevsky & Hinton 2012; A. Graves & Hinton 2013), deep neural network is getting more popular in both competitions and industrial scenarios. But traditional deep neural networks cannot be directly applied to high-dimensional feature spaces, so many studies have focused on constructing better embedding layers. Sampling-based Neural Network (SNN) uses a regular embedding layer and Factorisation Machine supported Neural Network (FNN) initializes the embedding layer with the result of a pre-trained FM model(W. Zhang & Wang 2013). Unlike FNN, Product-based Neural Network (PNN)(Yanru Qu 2016) can end-to-end learn the local dependencies which is similar to FM. Besides studis in embedding layers, Wide and Deep model(Cheng et al. 2016) proposed by Google combines deep neural networks and linear models and significantly increases app acquisitions compared with wide-only and deep-only models in Google Play store. Convolutional neural networks (CNN) or Recurrent neural networks (RNN) are also tried with applications in CTR systems(Q. Liu & Wang 2015; Yuyu Zhang 2014).

Although the models above have achieved state of art performance at their time, their experiments were mainly done on offline datasets with batch training. In real world online advertising scenarios, the system has to balance the accuracy of the model on history (training) data and the latency before pushing the model online. So many companies have tried online learning paradigm. AdPredictor(T. Graepel & Herbrich 2010) proposed by Microsoft and FTRL(H. B. McMahan & Kubica 2013) proposed by Google are two of the most famous models. But these two models are both linear models and suffer features engineering related costs. Facebook introduces a hybrid model which combines decision trees with online linear model and the new model outperforms either of these methods on their own by over 3%(X. He & Candela 2014). MatchBox(David Stern 2009) proposed by Microsoft is an online matrix factorization model but it’s hard to port its learning algorithm to more complex models like DNN.

In this paper, we describe a parallel bayesian online deep learning framework used for click through rate prediction in Tencent advertising system. Section 2 introduces the framework with a bayesian deep probit model trained with probabilistic backpropagation in the mode of assumed Gaussian density filtering(Herna ́ndez Lobato & Adams 2015; Minka 2001), then extends the model famility with some novel online deep models and presents a parallel model updating framework(Broderick & Jordan 2013; Minka 2001). Section 3 compares these models with common models such as AdPredictor, FTRL, FM and MLP in both offline datasets and online experiments. Section 4 gives some notes when we apply this framework. Finally, Section 5 presents conclusions and future work.

The main contributions of the paper are:

  • A general parallel bayesian online deep learning framework sutiable for a variety of bayesian online models.

  • Some novel bayesian online deep model with efficient training and predicting operations.

  • We applied the framework and these bayesian online models in the Tencent Advertising system and get significant improvements over commonly used models.

2 Parallel Bayesian Online Deep Learning Framework

In this section we present a bayesian online learning framework. In this framework, we can implement variety of models whose parameters can be real-time updated. In Section 2.1 we describe the deep probit model for CTR and how to inference on it. In Section 2.2 we describe several novel deep models in this framework. In Section 2.3 we describe how to parallelly update parameters in an easy way.

Refer to caption

Figure 1: Bayesian Deep Probit Model

2.1 Bayesian Deep Probit Model

The deep probit model is a feed-forward neural network with a probit link function like Figure 1.

Given a data point(𝒙,y)(\boldsymbol{x},y), made up of a input feature vector 𝒙\boldsymbol{x} and a label variable yy, we assume that yy is obtained as :

y=sign(f(𝒙,𝝎)+ϵ)\begin{split}y=sign(f(\boldsymbol{x},\boldsymbol{\omega})+\epsilon)\end{split} (1)

where f(𝒙,𝝎)f(\boldsymbol{x},\boldsymbol{\omega}) is the output of the feed-forward neural network with weights given by 𝝎\boldsymbol{\omega} and 𝒙\boldsymbol{x}, and ϵ\epsilon is an additive noise, where ϵN(0,1)\epsilon\sim N(0,1).

Because of sparse input features, the first layer of the model is a embedding layer, where 𝝎e\boldsymbol{\omega}_{e} is its weight and 𝒛e\boldsymbol{z}_{e} is its output. For get better embedding of sparse input features, we add a common embedding op layer which is similar to inner product layer in PNN. In general, this layer is parameterless. Considered the amount of calculation, we introduce three effective embedding op layer. Then the output of embedding op layer is used as the input of a common deep neural model with multiple hidden layers. The number of hidden layers is LL. There are VlV_{l} hidden units in layer l[1,L]l\in{[1,L]} and 𝝎l\boldsymbol{\omega}_{l} is the weight matrices between hidden layer l1{l-1} and hidden layer ll. We denote the output of layer ll by 𝒛l\boldsymbol{z}_{l} and the input of layer ll by 𝒂l=𝝎l𝒛l1/Vl1+1\boldsymbol{a}_{l}=\boldsymbol{\omega}_{l}\boldsymbol{z}_{l-1}/\sqrt{V_{l-1}+1}. Specially, 𝒛0\boldsymbol{z}_{0} is the output of embedding op layer and 𝒛L=f(𝒙,𝝎)\boldsymbol{z}_{L}=f(\boldsymbol{x},\boldsymbol{\omega}). The activation functions for each hidden layer are rectified linear units (ReLUs).

We have described the general structure of our CTR model. Then we need to know how to inference on the model. Given input feature vector 𝒙\boldsymbol{x} and 𝒘\boldsymbol{w}, the CTR can be written as :

p(y|𝒙,𝒘)=Φ(y𝒛L)\begin{split}p(y|\boldsymbol{x},\boldsymbol{w})&=\Phi(y\boldsymbol{z}_{L})\end{split} (2)

To complete our probabilistic model, we specify a Gaussian prior distribution for each of 𝒘\boldsymbol{w}. In particular,

p(𝒘)=p(𝝎e)l=1Lp(𝝎l)=i=0NeN(ωe,i|me,ve)l=1Lj=1NlN(ωl,j|ml,vl)\begin{split}p(\boldsymbol{w})&=p(\boldsymbol{\omega}_{e})\prod_{l=1}^{L}{p(\boldsymbol{\omega}_{l})}\\ &=\prod_{i=0}^{N_{e}}N(\omega_{e,i}|m_{e},v_{e})\prod_{l=1}^{L}\prod_{j=1}^{N_{l}}{N(\omega_{l,j}|m_{l},v_{l})}\end{split} (3)

where me,mlm_{e},m_{l} is prior mean and ve,vlv_{e},v_{l} is prior variance.

Considered the prior distribution, predictive distribution can be derived as

p(y|𝒙)=Ep(𝝎)[Φ(y𝒛L)]\begin{split}p(y|\boldsymbol{x})&=E_{p(\boldsymbol{\omega})}[\Phi(y\boldsymbol{z}_{L})]\end{split} (4)

Given p(y|𝒙,𝒘)p(y|\boldsymbol{x},\boldsymbol{w}) and the prior p(𝒘)p(\boldsymbol{w}), the posterior distribution for the parameters ω\omega can then be obtained by applying Bayes’ rule:

p(𝝎|𝒙,y)p(y|𝒙,𝒘)p(𝒘)\begin{split}p(\boldsymbol{\omega}|\boldsymbol{x},y)\propto p(y|\boldsymbol{x},\boldsymbol{w})\cdot p(\boldsymbol{w})\end{split} (5)

Both the exact predictive distribution and exact posterior over weights can’t be calculated in simple closed form. So we use probabilistic backpropagation(PBP)(Herna ́ndez Lobato & Adams 2015) in the mode of assumed Gaussian density filtering to approximate them. PBP is a scalable method for learning Bayesian neural networks. Similar to classical backpropagation, PBP works by computing a forward propagation of probabilities through the network and then doing a backward computation of gradients. First, PBP propagates distributions forward through the network and approximates each new distribution with a Gaussian when necessary. Then PBP computes the gradients of weights and update each of 𝝎\boldsymbol{\omega} with following rules(Minka 2001; Herna ́ndez Lobato & Adams 2015):

mnew\displaystyle m^{new} =m+vlogZm\displaystyle=m+v\frac{\partial{logZ}}{\partial{m}} (6)
vnew\displaystyle v^{new} =vv2[(logZm)22logZv]\displaystyle=v-v^{2}[(\frac{\partial{logZ}}{\partial{m}})^{2}-2\frac{\partial{logZ}}{\partial{v}}] (7)

where ZZ is the the normalization constant :

Z=𝒘p(y|𝒙,𝒘)p(𝒘)=p(y|𝒙)\displaystyle Z=\int_{\boldsymbol{w}}{p(y|\boldsymbol{x},\boldsymbol{w})\cdot p(\boldsymbol{w})}=p(y|\boldsymbol{x}) (8)

When predicting with model, we only need to do a forward computation. Because PBP will approximates each new distribution with a Gaussian when necessary. So 𝒛L\boldsymbol{z}_{L}, the output of last hidden layer will be be approximated as a Gaussian variable with mean m𝒛Lm^{\boldsymbol{z}_{L}} and variance v𝒛Lv^{\boldsymbol{z}_{L}}. So the predictive distribution can be approximated as:

p(y|𝒙)Φ(ym𝒛Lv𝒛L+1)b\begin{split}p(y|\boldsymbol{x})&\approx\Phi(y\frac{m^{\boldsymbol{z}_{L}}}{\sqrt{v^{\boldsymbol{z}_{L}}+1}})b\end{split} (9)

To update the weights of model, we need to compute the normalization constant ZZ. With equations (8) and (9), we can approximate ZZ as :

Z=p(y|𝒙)Φ(ym𝒛Lv𝒛L+1)\begin{split}Z=p(y|\boldsymbol{x})&\approx\Phi(y\frac{m^{\boldsymbol{z}_{L}}}{\sqrt{v^{\boldsymbol{z}_{L}}+1}})\end{split} (10)

However, it remains to compute the mean and variance parameters m𝒛Lm^{\boldsymbol{z}_{L}} and v𝒛Lv^{\boldsymbol{z}_{L}} through the network. In embedding layer, 𝒙i\boldsymbol{x}_{i}, the ii-th element of 𝒙\boldsymbol{x} is transformed to a dense value vector 𝝎e,𝒙i\boldsymbol{\omega}_{e,\boldsymbol{x}_{i}}. Then all dense value vectors are concated as 𝒛e\boldsymbol{z}_{e}.

𝒛e=(𝝎e,𝒙0,𝝎e,𝒙1,,𝝎e,𝒙M)𝒎𝒛e=(𝒎𝝎e,𝒙0,𝒎𝝎e,𝒙1,,𝒎𝝎e,𝒙M)𝒗𝒛e=(𝒗𝝎e,𝒙0,𝒗𝝎e,𝒙1,,𝒗𝝎e,𝒙M)\begin{split}\boldsymbol{z}_{e}&=(\boldsymbol{\omega}_{e,\boldsymbol{x}_{0}},\boldsymbol{\omega}_{e,\boldsymbol{x}_{1}},...,\boldsymbol{\omega}_{e,\boldsymbol{x}_{M}})\\ \boldsymbol{m}^{\boldsymbol{z}_{e}}&=(\boldsymbol{m}^{\boldsymbol{\omega}_{e,\boldsymbol{x}_{0}}},\boldsymbol{m}^{\boldsymbol{\omega}_{e,\boldsymbol{x}_{1}}},...,\boldsymbol{m}^{\boldsymbol{\omega}_{e,\boldsymbol{x}_{M}}})\\ \boldsymbol{v}^{\boldsymbol{z}_{e}}&=(\boldsymbol{v}^{\boldsymbol{\omega}_{e,\boldsymbol{x}_{0}}},\boldsymbol{v}^{\boldsymbol{\omega}_{e,\boldsymbol{x}_{1}}},...,\boldsymbol{v}^{\boldsymbol{\omega}_{e,\boldsymbol{x}_{M}}})\end{split} (11)

In embedding op layer, we can design a variety of operations to get better embedding. The simplest operation is copying input to output :

𝒛0=𝒛e,𝒎𝒛0=𝒎𝒛e,𝒗𝒛0=𝒗𝒛e\displaystyle\boldsymbol{z}_{0}=\boldsymbol{z}_{e},\qquad\boldsymbol{m}^{\boldsymbol{z}_{0}}=\boldsymbol{m}^{\boldsymbol{z}_{e}},\qquad\boldsymbol{v}^{\boldsymbol{z}_{0}}=\boldsymbol{v}^{\boldsymbol{z}_{e}} (12)

More operations will be introduced in Section 2.2.

In ll-th hidden layer, using moment match, the mean and variance of 𝒂l\boldsymbol{a}_{l} can be approximated as :

𝒎𝒂l=𝒎𝝎l𝒎𝒛l1/Vl+1𝒗𝒂l=[𝒗𝝎l𝒗𝒛l1+(𝒎𝝎l𝒎𝝎l)𝒗𝒛l1+𝒗𝝎l(𝒎𝒛l1𝒎𝒛l1)]/(Vl+1)\begin{split}\boldsymbol{m}^{\boldsymbol{a}_{l}}&=\boldsymbol{m}^{\boldsymbol{\omega}_{l}}\boldsymbol{m}^{\boldsymbol{z}_{l-1}}/\sqrt{V_{l}+1}\\ \boldsymbol{v}^{\boldsymbol{a}_{l}}&=[\boldsymbol{v}^{\boldsymbol{\omega}_{l}}\boldsymbol{v}^{\boldsymbol{z}_{l-1}}+(\boldsymbol{m}^{\boldsymbol{\omega}_{l}}\circ\boldsymbol{m}^{\boldsymbol{\omega}_{l}})\boldsymbol{v}^{\boldsymbol{z}_{l-1}}\\ &+\boldsymbol{v}^{\boldsymbol{\omega}_{l}}(\boldsymbol{m}^{\boldsymbol{z}_{l-1}}\circ\boldsymbol{m}^{\boldsymbol{z}_{l-1}})]/(V_{l}+1)\end{split} (13)

Let 𝒛l=max(0,𝒂l)\boldsymbol{z}_{l}=max(0,\boldsymbol{a}_{l}), the mean and variance of the ii-th element of 𝒛l\boldsymbol{z}_{l} can be approximated as :

𝒎i𝒛l=Φ(αi)vi𝒗i𝒛l=Φ(αi)𝒗i𝒛l(1γi(γi+αi))+𝒎i𝒛lΦ(αi)vi\begin{split}\boldsymbol{m}_{i}^{\boldsymbol{z}_{l}}&=\Phi(\alpha_{i})v^{\prime}_{i}\\ \boldsymbol{v}_{i}^{\boldsymbol{z}_{l}}&=\Phi(\alpha_{i})\boldsymbol{v}_{i}^{\boldsymbol{z}_{l}}(1-\gamma_{i}(\gamma_{i}+\alpha_{i}))\\ &+\boldsymbol{m}_{i}^{\boldsymbol{z}_{l}}\Phi(-\alpha_{i})v^{\prime}_{i}\end{split} (14)

where

vi=𝒎i𝒂l+𝒗i𝒂lγi,αi=𝒎i𝒂l𝒗i𝒂l,γi=ϕ(αi)Φ(αi)\displaystyle v^{\prime}_{i}=\boldsymbol{m}_{i}^{\boldsymbol{a}_{l}}+\sqrt{\boldsymbol{v}_{i}^{\boldsymbol{a}_{l}}}\gamma_{i},\hskip 9.24994pt\alpha_{i}=\frac{\boldsymbol{m}_{i}^{\boldsymbol{a}_{l}}}{\sqrt{\boldsymbol{v}_{i}^{\boldsymbol{a}_{l}}}},\hskip 9.24994pt\gamma_{i}=\frac{\phi(-\alpha_{i})}{\Phi(\alpha_{i})} (15)

Finally, we can get the mean and variance of 𝒛L\boldsymbol{z}_{L}.

2.2 Embedding Operation Layer

In 2.1, we have described a deep probit model with a simplest embedding op layer and how to online learn it and predict with it. In our practice, we find that we can get better performance in online experiment by using better embedding operation layer such as FM and FFM. Here we introduce three novel embedding operations : DimensionAwareSum, FM and FFM. Corresponding to the three operations, we propose three novel models called Sparse-MLP, FM-MLP and FFM-MLP.

2.2.1 DimensionAwareSum Layer

The DimensionAwareSum layer is used in Sparse-MLP as Embedding Operation Layer. When using DimensionAwareSumLayer, we should encode every sparse input feature into dense value vector with fixed length KK. So if the nonzero of input 𝒙\boldsymbol{x} is MM, 𝒛e\boldsymbol{z}_{e} is a M×KM\times{K} matrices. In general,

𝒛e,i,j=𝝎e,𝒙i,ji=1M,j=1K\begin{split}\boldsymbol{z}_{e,i,j}=\boldsymbol{\omega}_{e,\boldsymbol{x}_{i},j}\quad i=1...M,j=1...K\end{split} (16)

where 𝝎e,𝒙i,j\boldsymbol{\omega}_{e,\boldsymbol{x}_{i},j} is the j-th element of dense embedding vector of 𝒙i\boldsymbol{x}_{i}.

The output 𝒛0\boldsymbol{z}_{0} is a K×1K\times{1} matrices and satisfy :

𝒛0,j=i=1M𝒛e,i,ji=1M,j=1K\begin{split}\boldsymbol{z}_{0,j}=\sum_{i=1}^{M}{\boldsymbol{z}_{e,i,j}}\quad i=1...M,j=1...K\end{split} (17)

The mean and variance of 𝒛0,j\boldsymbol{z}_{0,j} can be computed as :

mj𝒛0=i=1Mmi,j𝒛ei=1M,j=1Kvj𝒛0=i=1Mvi,j𝒛ei=1M,j=1K\begin{split}m^{\boldsymbol{z}_{0}}_{j}&=\sum_{i=1}^{M}{m^{\boldsymbol{z}_{e}}_{i,j}}\quad i=1...M,j=1...K\\ v^{\boldsymbol{z}_{0}}_{j}&=\sum_{i=1}^{M}{v^{\boldsymbol{z}_{e}}_{i,j}}\quad i=1...M,j=1...K\end{split} (18)

2.2.2 FM Layer

The FM layer is used in FM-MLP as Embedding Operation Layer. Similar to PNN, we consider product relationship with input. But unlike IPNN, the dimension of 𝒛0\boldsymbol{z}_{0} in FM Layer is KK where the result of inner product layer is a M×MM\times{M} matrices. In general, M×MKM\times{M}\gg K. In addition, 𝒛0\boldsymbol{z}_{0} isn’t non-negative as IPNN and OPNN. The kk-th element of 𝒛0\boldsymbol{z}_{0} satisfy :

𝒛0,k=i=1Mj=i+1M𝒛e,i,k𝒛e,j,ki,j=1M,k=1K\begin{split}\boldsymbol{z}_{0,k}=\sum_{i=1}^{M}\sum_{j=i+1}^{M}{\boldsymbol{z}_{e,i,k}\boldsymbol{z}_{e,j,k}}\quad i,j=1...M,k=1...K\end{split} (19)

Use Moment Match for 𝒛e,i,k𝒛e,j,k\boldsymbol{z}_{e,i,k}\boldsymbol{z}_{e,j,k} and similar trick in FM, the mean and variance of 𝒛0,k\boldsymbol{z}_{0,k} can be computed in O(M)O(M) times.

mk𝒛0=12[(i=1Mmi,k𝒛e)2i=1M(mi,k𝒛e)2]vk𝒛0=12[(i=1Msmi,k𝒛e)2i=1M(smi,k𝒛e)2]12[(i=1M(mi,k𝒛e)2)2i=1M(mi,k𝒛e)4]\begin{split}m^{\boldsymbol{z}_{0}}_{k}&=\frac{1}{2}[(\sum_{i=1}^{M}{m^{\boldsymbol{z}_{e}}_{i,k}})^{2}-\sum_{i=1}^{M}{(m^{\boldsymbol{z}_{e}}_{i,k})^{2}}]\\ v^{\boldsymbol{z}_{0}}_{k}&=\frac{1}{2}[(\sum_{i=1}^{M}{sm^{\boldsymbol{z}_{e}}_{i,k}})^{2}-\sum_{i=1}^{M}{(sm^{\boldsymbol{z}_{e}}_{i,k})^{2}}]\\ &-\frac{1}{2}[(\sum_{i=1}^{M}{(m^{\boldsymbol{z}_{e}}_{i,k})^{2}})^{2}-\sum_{i=1}^{M}{(m^{\boldsymbol{z}_{e}}_{i,k})^{4}}]\end{split} (20)

where smi,k𝒛esm^{\boldsymbol{z}_{e}}_{i,k} is the second moment of 𝒛e,i,k\boldsymbol{z}_{e,i,k} :

smi,k𝒛e=(mi,k𝒛e)2+vi,k𝒛e\begin{split}sm^{\boldsymbol{z}_{e}}_{i,k}=(m^{\boldsymbol{z}_{e}}_{i,k})^{2}+v^{\boldsymbol{z}_{e}}_{i,k}\end{split} (21)

2.2.3 FFM Layer

The FFM layer is used in FFM-MLP as Embedding Operation Layer. FFM is a famous extension of FM and performance better than FM. In FFM layer, The kk-th element of 𝒛0\boldsymbol{z}_{0} satisfy :

𝒛0,k=i=1Mj=i+1M𝒛e,i,fj,k𝒛e,fi,j,ki,j=1M,k=1K,1fi,fjF\begin{split}\boldsymbol{z}_{0,k}=\sum_{i=1}^{M}\sum_{j=i+1}^{M}{\boldsymbol{z}_{e,i,f_{j},k}\boldsymbol{z}_{e,f_{i},j,k}}\\ i,j=1...M,\quad k=1...K,\quad 1\leq f_{i},f_{j}\leq F\end{split} (22)

where FF is the filed num and 𝒛e\boldsymbol{z}_{e} is a F×K×MF\times{K}\times{M} matrices. Unlike DimensionAwareSum and FM Layer, the length of embedding vector of 𝒙i\boldsymbol{x}_{i} is F×KF\times{K} and fif_{i} is the field that 𝒙i\boldsymbol{x}_{i} belongs to.

Unfortunately, FFM can’t reduce the amount of calculation as same as FM. The complexity of FFM is O(KM2)O(KM^{2}) while that of FM is O(KM)O(KM). But when FMF\ll M, we can compute FFM in time O(FKM+KF2)O(FKM+KF^{2}). In actual system such as tencent advertising, FF is usually small e.g 2 or 3 for reducing computation, saving memory and avoiding overfitting.

mk𝒛0=f=1FmAf+fi=1Ffj=fi+1FmBfi,fjvk𝒛0=f=1FvAf+fi=1Ffj=fi+1FvBfi,fj\begin{split}m^{\boldsymbol{z}_{0}}_{k}&=\sum_{f=1}^{F}{m^{A_{f}}}+\sum_{f_{i}=1}^{F}\sum_{f_{j}=f_{i}+1}^{F}{m^{B_{f_{i},f_{j}}}}\\ v^{\boldsymbol{z}_{0}}_{k}&=\sum_{f=1}^{F}{v^{A_{f}}}+\sum_{f_{i}=1}^{F}\sum_{f_{j}=f_{i}+1}^{F}{v^{B_{f_{i},f_{j}}}}\\ \end{split} (23)

where

mAf=12[(i=1Mmi,f,k𝒛e)2i=1M(mi,f,k𝒛e)2]vAf=12[(i=1Msmi,f,k𝒛e)2i=1M(smi,f,k𝒛e)2]12[(i=1M(mi,f,k𝒛e)2)2i=1M(mi,f,k𝒛e)4]mBfi,fj=(i=1Mmi,fi,k𝒛e)(i=1Mmi,fj,k𝒛e)vBfi,fj=(i=1Mmi,fi,k𝒛e)2(i=1Mvi,fj,k𝒛e)+(i=1Mmi,fj,k𝒛e)2(i=1Mvi,fi,k𝒛e)+(i=1Mvi,fi,k𝒛e)(i=1Mvi,fj,k𝒛e)\begin{split}m^{A_{f}}&=\frac{1}{2}[(\sum_{i=1}^{M}{m^{\boldsymbol{z}_{e}}_{i,f,k}})^{2}-\sum_{i=1}^{M}{(m^{\boldsymbol{z}_{e}}_{i,f,k})^{2}}]\\ v^{A_{f}}&=\frac{1}{2}[(\sum_{i=1}^{M}{sm^{\boldsymbol{z}_{e}}_{i,f,k}})^{2}-\sum_{i=1}^{M}{(sm^{\boldsymbol{z}_{e}}_{i,f,k})^{2}}]\\ &-\frac{1}{2}[(\sum_{i=1}^{M}{(m^{\boldsymbol{z}_{e}}_{i,f,k})^{2}})^{2}-\sum_{i=1}^{M}{(m^{\boldsymbol{z}_{e}}_{i,f,k})^{4}}]\\ m^{B_{f_{i},f_{j}}}&=(\sum_{i=1}^{M}{m^{\boldsymbol{z}_{e}}_{i,f_{i},k}})(\sum_{i=1}^{M}{m^{\boldsymbol{z}_{e}}_{i,f_{j},k}})\\ v^{B_{f_{i},f_{j}}}&=(\sum_{i=1}^{M}{m^{\boldsymbol{z}_{e}}_{i,f_{i},k}})^{2}(\sum_{i=1}^{M}{v^{\boldsymbol{z}_{e}}_{i,f_{j},k}})\\ &+(\sum_{i=1}^{M}{m^{\boldsymbol{z}_{e}}_{i,f_{j},k}})^{2}(\sum_{i=1}^{M}{v^{\boldsymbol{z}_{e}}_{i,f_{i},k}})\\ &+(\sum_{i=1}^{M}{v^{\boldsymbol{z}_{e}}_{i,f_{i},k}})(\sum_{i=1}^{M}{v^{\boldsymbol{z}_{e}}_{i,f_{j},k}})\end{split} (24)

and smi,f,k𝒛esm^{\boldsymbol{z}_{e}}_{i,f,k} is the second moment of 𝒛e,i,f,k\boldsymbol{z}_{e,i,f,k} :

smi,f,k𝒛e=(mi,f,k𝒛e)2+vi,f,k𝒛e\begin{split}sm^{\boldsymbol{z}_{e}}_{i,f,k}=(m^{\boldsymbol{z}_{e}}_{i,f,k})^{2}+v^{\boldsymbol{z}_{e}}_{i,f,k}\end{split} (25)

2.3 Parallel Training

Every day there are ten of billions of samples in tencent advertising system. The CTR model must be trained in parallel mode. Here we introduce a simple and effective parallel update framework for our Bayesian online models.

Refer to caption

Figure 2: Parallel Training Framework

We store global parameters in parameter server and use multiple workers in storm for training data. In time TT, assumed the parameters in parameter server as prior P(θ)P(\theta) and minibatch data in ii-th worker as DiD_{i}, then the posterior can be obtained by applying Bayes’ rule:

p(θ|D1,D2,,DM)p(θ)i=1Mp(Di|θ)\begin{split}p(\theta|D_{1},D_{2},...,D_{M})\propto p(\theta)\prod_{i=1}^{M}p(D_{i}|\theta)\end{split} (26)

Because p(θ|D1,D2,,DM)p(\theta|D_{1},D_{2},...,D_{M}) and p(θ)p(\theta) are Gaussian, the likelihood p(Di|θ)p(D_{i}|\theta) can be approximated as Gaussian. In ii-th worker, we can first compute the p(θ|Di)p(\theta|D_{i}) using PBP. The p(Di|θ)p(D_{i}|\theta) can be obtained by equation 27 and then is updated to parameter server.

p(Di|θ)p(θ|Di)/p(θ)\begin{split}p(D_{i}|\theta)\propto p(\theta|D_{i})/p(\theta)\end{split} (27)

In the case of Gaussian, the flow of training worker and parameter server is as algorithm 1 and algorithm 2.

Algorithm 1 Flow of Train Worker
repeat
  Input: minibatch data DtD_{t} and minibatch size NN
  Initialize p(𝝎)p(\boldsymbol{\omega}) from parameter server.
  for i=1i=1 to NN do
   Compute every mωknewm^{new}_{\omega_{k}} and vωknewv^{new}_{\omega_{k}} in 𝝎\boldsymbol{\omega} using equation 7
   Add the likelihood of Dt,iD_{t,i} using follow equation:  mωklooklikevωklooklike+=mωknewvωknewmωkvωk\frac{m^{looklike}_{\omega_{k}}}{v^{looklike}_{\omega_{k}}}+=\frac{m^{new}_{\omega_{k}}}{v^{new}_{\omega_{k}}}-\frac{m_{\omega_{k}}}{v_{\omega_{k}}}   1vωklooklike+=1vωknew1vωk\frac{1}{v^{looklike}_{\omega_{k}}}+=\frac{1}{v^{new}_{\omega_{k}}}-\frac{1}{v_{\omega_{k}}}
   Update local parameter : mωk=mωknew,vωk=vωknewm_{\omega_{k}}=m^{new}_{\omega_{k}},v_{\omega_{k}}=v^{new}_{\omega_{k}}
  end for
  Update {mωklooklike,vωklooklike}\{m^{looklike}_{\omega_{k}},v^{looklike}_{\omega_{k}}\} as the likelihood of DtD_{t} to parameter server
until
Algorithm 2 Update Flow of Parameter Server
repeat
  Input: {ωk,mklooklike,vklooklike}\{\omega_{k},m^{looklike}_{k},v^{looklike}_{k}\}, size of msg K
  for k=1k=1 to KK do
   Get old value of ωk\omega_{k} : mkold,vkoldm^{old}_{k},v^{old}_{k}
   Compute new value of ωk\omega_{k} using follow equation:
    mknewvknew=mkoldvkold+mklooklikevklooklike\frac{m^{new}_{k}}{v^{new}_{k}}=\frac{m^{old}_{k}}{v^{old}_{k}}+\frac{m^{looklike}_{k}}{v^{looklike}_{k}}
    1vknew=1vkold+1vklooklike\frac{1}{v^{new}_{k}}=\frac{1}{v^{old}_{k}}+\frac{1}{v^{looklike}_{k}}
   Update value of ωk\omega_{k} with mknew,vknewm^{new}_{k},v^{new}_{k}
  end for
until

Above framework can deal with big data in the real world. We have applied it into Tencent advertising system and got a steady performance.

3 Experiment Result

In this section, we present our experiments in detail, including offline experiments and online experiments. In offline experiments, we compare our several online models with previous online models such as AdPredictor, FTRL and MatchBox. We compare them in a Avazu dataset and our internal dataset. In online experiments, we compare our online models with DNN with batch training.

3.1 Offline

3.1.1 Avazu Dataset

Avazu Dataset11 1 https://www.kaggle.com/c/avazu-ctr-prediction is from a competition of kaggle in 2014. For this competition, Avazu has provided a dataset with label of 10 days. We use the previous 9 days of data for training and the last 1 days of data for test. Unlike competition, we take more attention to the model rather than features. So we simply use the original 22 features besides id and device ip. We compare our several models with AdPredictor and FTRL without feature engineering and MatchBox. All models only train data once in chronological order. The result is shown in Table 1. From the result, we can find that our models are significantly better than AdPredictor and FTRL without feature engineering. Compared with MatchBox, our models also perform better on both AUC and Loss.

Table 1: AUC & Loss in Avazu dataset.
Model AUC LOSS
AdPredictor 0.7375 0.4019
FTRL 0.7357 0.4030
MatchBox 0.7426 0.4001
Sprase-MLP(Online) 0.7489 0.3987
FM-MLP(Online) 0.7489 0.3972
FFM-MLP(Online) 0.7498 0.3981

3.1.2 Internal DataSet

In this section, we use our internal dataset of tecent advertising. We use ten days of data to train and one day of data to test. The training dataset comprises 800M instances with 40 categorys of features. The result is shown in Table 2. We can find that our models perform better than other online models without feature engineering.

Table 2: AUC & Loss in tencent internal dataset of advertising.
Model AUC LOSS
AdPredictor 0.7359 0.1210
FTRL 0.7365 0.1212
MatchBox 0.7476 0.1198
Sparse-MLP(Online) 0.7510 0.1192
FM-MLP(Online) 0.7519 0.1191
FFM-MLP(Online) 0.7529 0.1190

3.2 Online

However, offline evaluation can only be used as reference and it isn’t easy to compare online models with batch models in offline datasets. Online environment is more complex, so we generally using A/B test to evaluate the real effect of the models. We have applid our framework and serveral models into tencent advertising system and got a good online effect. Because of the difficulty of feature engineering, we only compare our models with FM and DNN using batch training which has achieved the best effect. The online effect is shown in Table 3. Our online models are better than DNN. An important reason is that our online models can update every 15 minutes while DNN can only update every several hours. So the online models can perform much better in new ads, just as Tabel 4. Meanwhile, the percentage of new Ads using online models is higher than that using batch models, so it can get long term profit to use our bayesian online models. In addition, our online models also achieve cpm lift comparable with ctr lift.

Table 3: CTR Lift in online experiment
Model Lift
FM(Batch) BaseLine
DNN(Batch) +2.2%
FM-MLP(Online) +4.1%
FFM-MLP(Online) +5.6%
Table 4: CTR Lift of new Ads in online experiment
Model Lift Percentage
DNN(Batch) BaseLine 11.86%
FM-MLP(Online) +22.7% 16.72%
FFM-MLP(Online) +25.6% 17.02%

4 Notes

CTR is a systematic project. In this section, we introduce some details in practical application.

4.1 Negative Sampling

Typical CTRs are much lower than 50%, which means that positive examples (clicks) are relatively rare. Thus, simple statistical calculations indicate that clicks are relatively more valuable in learning CTR estimates. We can take advantage of this to significantly reduce the training data size with minimal impact on accuracy. We remain all positive examples and subsampling negative examples with a sample rate ww. Then the predicted CTR as p, the recalibrated CTR qq should be q=p/(p+(1p)/w)q=p/(p+(1-p)/w). In general, we will select a suitable ww to make the ratio of positive and negative samples being about 0.1.

4.2 Burning

Online models need long day’s data to get stable effect. In practice, we want to know the real effect of experiment such as a new model and a new feature as soon as possible. For this purpose, we need to burn a new model with last serveral day’s data. In general, we use 15-30 day’s data to burn a new model.Because the complexity of deep model, we propose training the first several day’s data with a single thread in burning and then with muti multiple threads. Otherwise the effect of new model is often unstable.

4.3 Prior

Because our model can be online learning, so the prior is not very important. The prior mean can be set to zero and prior variance can be set to 0.01 because more accurate and stable effect can be got by using smaller prior variance.

4.4 Weight Decay

If the model has run a long time, some variances of weights would converge towards zero and learning would come to a halt. Like AdPredictor and MatchBox, we make these variances converging back to the prior variance.

v=vvprior(1ε)vprior+εv\begin{split}v^{\prime}=\frac{vv_{prior}}{(1-\varepsilon)v_{prior}+\varepsilon v}\end{split} (28)

where vv is the current variance and vpriorv_{prior} is the prior variance.

4.5 Reinforcement

Though our models only need to one pass of data, we can use more data or learn same data with multiple times for better performance. In fact, we test two methods to improvement effect but keep realtime update.

  • Multiple Data : We can use two or more sets of training workers with same config. These sets training the data with same positive examples and different negative examples because of negative sampling. The then get and update parameters with a same parameter server.

  • Batch Training : We only use one set of training workers. But in every minibatch data, we run multiple ADF or EP on the data.

In our online experiments, both above methods can lead to better performance. However, the two methods is less safe when encountering abnormal data. So it is greater challenges to daily operations.

5 CONCLUSION

We describe a parallel bayesian online deep learning framework used for click through rate prediction in tencent advertising system. And in the framework, we introduce several novel online deep probit regression model and get better performance than other known models in online experiments. Next we should explore more valuable online models in this framework. On the other hand, we would try more bayesian optimization methods to get better performance and more stable effect.

References

  • A. Graves & Hinton (2013) A. Graves, A.-r. Mohamed and Hinton, G. Speech recognition with deep recurrent neural networks. In ICASSP, 2013.
  • A. Krizhevsky & Hinton (2012) A. Krizhevsky, I. Sutskever and Hinton, G. E. Imagenet classification with deep convolutional neural networks. In NIPS, 2012.
  • Broderick & Jordan (2013) Broderick, Tamara, Boyd Nicholas Wibisono Andre Wilson Ashia C and Jordan, Michael. Streaming variational bayes. In NIPS, 2013.
  • Cheng et al. (2016) Cheng, Heng-Tze, Koc, Levent, Harmsen, Jeremiah, Shaked, Tal, Chandra, Tushar, Aradhye, Hrishi, Anderson, Glen, Corrado, Greg, Chai, Wei, Ispir, Mustafa, Anil, Rohan, Haque, Zakaria, Hong, Lichan, Jain, Vihan, Liu, Xiaobing, and Shah, Hemal. Wide & deep learning for recommender systems. 2016. URL http://arxiv.org/abs/1606.07792.
  • David Stern (2009) David Stern, Ralf Herbrich, Thore Graepel. Matchbox: Large scale online bayesian recommendations. In WWW, 2009.
  • G Andrew (2007) G Andrew, J Gao. Scalable training of l1-regularized log-linear models. In ICML, 2007.
  • H. B. McMahan & Kubica (2013) H. B. McMahan, G. Holt, D. Sculley M. Young D. Ebner J. Grady L. Nie T. Phillips E. Davydov D. Golovin S. Chikkerur D. Liu M. Wattenberg A. M. Hrafnkelsson T. Boulos and Kubica, J. Ad click prediction: a view from the trenches. In KDD, 2013.
  • Herna ́ndez Lobato & Adams (2015) Herna ́ndez Lobato, J M and Adams, R P. Probabilistic backpropagation for scalable learning of bayesian neural networks. In ICML, 2015.
  • Lin (2016) Lin, Y Juan,Y Zhuang,WS Chin,CJ. Field-aware factorization machines for ctr prediction. In RecSys, 2016.
  • M. Richardson (2007) M. Richardson, E. Dominowska. Predicting clicks: estimating the click-through rate for new ads. In WWW, pp. 521–530, 2007.
  • Minka (2001) Minka, Thomas. A family of algorithms for approximate Bayesian inference. PhD thesis, MIT, 2001.
  • O. Chapelle & Rosales (2015) O. Chapelle, E. Manavoglu and Rosales, R. Simple and scalable response prediction for display advertising. ACM Transactions on Intelligent Systems and Technology (TIST), 5(4):61, 2015.
  • Q. Liu & Wang (2015) Q. Liu, F. Yu, S. Wu and Wang, L. A convolutional click prediction model. In CIKM, 2015.
  • Rendle (2010) Rendle, S. Factorization machines. In ICDM, 2010.
  • Rendle (2012) Rendle, S. Factorization machines with libfm. ACM Transactions on Intelligent Systems and Technology (TIST), 3(3):57, 2012.
  • T. Graepel & Herbrich (2010) T. Graepel, J. Q. Candela, T. Borchert and Herbrich, R. Web-scale bayesian click-through rate prediction for sponsored search advertising in microsoft’s bing search engine. In ICML, 2010.
  • W. Zhang & Wang (2013) W. Zhang, T. Du and Wang, J. Deep learning over multi-field categorical data: A case study on user response prediction. In ECIR, 2013.
  • X. He & Candela (2014) X. He, J. Pan, O. Jin T. Xu B. Liu T. Xu Y. Shi A. Atallah R. Herbrich S. Bowers and Candela, J. Quiñonero. Practical lessons from predicting clicks on ads at facebook. In ADKDD, 2014.
  • Yanru Qu (2016) Yanru Qu, Han Cai, Kan Ren Weinan Zhang Yong Yu Ying Wen Jun Wang. Product-based neural networks for user response prediction. In ICDM, 2016.
  • Yuyu Zhang (2014) Yuyu Zhang, Hanjun Dai, Chang Xu Jun Feng Taifeng Wang Jiang Bian Bin Wang Tie-Yan Liu. Sequential click prediction for sponsored search with recurrent neural networks. In AAAI, 2014.