<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[RecSys et al.]]></title><description><![CDATA[RecSys et al.]]></description><link>https://abhayshukla.com</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Nov 2026 13:57:24 GMT</lastBuildDate><atom:link href="https://abhayshukla.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[DIN: Deep Interest Network for Click-Through Rate Prediction]]></title><description><![CDATA[Learning Target Item Aware User Interest Representation for CTR Prediction]]></description><link>https://abhayshukla.com/din-deep-interest-network-for-ctr-prediction</link><guid isPermaLink="true">https://abhayshukla.com/din-deep-interest-network-for-ctr-prediction</guid><category><![CDATA[ctr]]></category><category><![CDATA[recommender-systems]]></category><category><![CDATA[recsys]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Sat, 23 Aug 2025 15:39:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1755962286765/748687e5-31d0-4d4c-a490-e1131ea309fa.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>DIN is published by Alibaba and Taobao in KDD’2018. The paper mentions that DIN was successfully deployed in the online display advertising system in Alibaba, serving the main traffic.</p>
<p>Full Paper: <a target="_blank" href="https://arxiv.org/abs/1706.06978">Deep Interest Network for Click-Through Rate Prediction</a></p>
<h1 id="heading-motivation-behind-din">Motivation Behind DIN</h1>
<p>DNN models with Embedding&amp;MLP paradigm:</p>
<ul>
<li><p>Map sparse inputs to low dimensional embedding vectors</p>
</li>
<li><p>Transform embedding vectors to fixed length vectors for each feature group</p>
</li>
<li><p>Concatenate all the resulting vectors before passing them to MLP layers</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755958895395/bca3fe45-15ed-49d1-982f-7f68de6a495b.png" alt class="image--center mx-auto" /></p>
<p>The bottleneck with this approach is that:</p>
<ul>
<li><p>User feature vector learned from their behavior sequences is the same irrespective of the target item.</p>
</li>
<li><p>However, in context of a target item, only some part of the historical user behavior will be relevant and therefore the entire user history does not contribute equally to capture user interest w.r.t. a target item</p>
</li>
</ul>
<p>The example in the paper explains it as: “a female swimmer will click a recommended goggle mostly due to the purchase of bathing suit rather than the shoes in her last week’s shopping list“.</p>
<p>Lets see what is proposed with DIN.</p>
<h1 id="heading-deep-interest-network-din">Deep Interest Network (DIN)</h1>
<p>Feature sets used in online display advertising system in Alibaba are shown below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755959869082/eb1c899f-c41a-4a73-92ac-5581991cfc9d.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755960762967/82ab8832-ad03-4375-8909-9a25c5af2fbd.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>In Embedding&amp;MLP paradigm</p>
<ul>
<li><p>One-hot features get converted to fixed-length feature vectors directly by the embedding layer</p>
</li>
<li><p>Variable length sequences such as item ids visited by the user are represented as multi-hot features, embedding are looked up for each index and then pooling operation is used to get fixed-length feature vector</p>
</li>
</ul>
</li>
</ul>
<p>In DIN, multi-hot features which contain rich user behaviors, are converted to fixed feature length while capturing relevant information in context of the target item.</p>
<h2 id="heading-din-architecture">DIN Architecture</h2>
<p>Notice the changes in the architecture w.r.t. the Embedding&amp;MLP paradigm.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755961016581/67a59b0a-e0aa-4e6c-8f03-3ebf908ede7f.png" alt class="image--center mx-auto" /></p>
<p>DIN introduces a local activation unit which is applied on the user behavior features, and performs a weighted sum pooling to calculate user representation for a given candidate item A.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755961361480/826d16f6-8051-461b-b807-aef8a5316522.png" alt class="image--center mx-auto" /></p>
<p>\(v_U(A)\) represents the user vector given a target item A</p>
<p>\(e_1, e_2, ..., e_H\) are the embeddings of the H items user has interacted with</p>
<p>\(v_A\) is the embedding of the target item A</p>
<p>\(a(.)\) is a feed-forward network with output as the activation weight</p>
<p>It keeps rest of the architecture same.</p>
<p><strong>IMP</strong>: Compared to traditional attention method where sum of attention weights is constrained to 1 using softmax operation, this normalization is relaxed in DIN. Instead, sum of attention weights is treated as “an approximation of the intensity of activated user interests”.</p>
<p>Two more novel contributions mentioned in the paper are:</p>
<ul>
<li><p>Mini-batch Aware Regularization where L2 regularization updates only the weights which are active in the forward pass and</p>
</li>
<li><p>Dice activation function may be viewed as a generalization of PReLu</p>
</li>
</ul>
<h1 id="heading-experiments">Experiments</h1>
<h2 id="heading-dataset">Dataset</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755962630429/ec91b1cc-1409-4d4c-a5e3-f20e65c2a551.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-metrics">Metrics</h2>
<p>AUC and RelaImpr are used to measure performance.</p>
<h2 id="heading-offline-results-on-alibaba-dataset">Offline Results on Alibaba Dataset</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755962824162/2e8dd419-04bb-4c83-bcbd-a26789354341.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-online-results">Online Results</h2>
<p>Online A/B testing in the display advertising system in Alibaba was conducted from 2017-05 to 2017-06. DIN trained with the proposed regularizer and activation function resulted in up to 10.0% CTR and 3.8% RPM(Revenue Per Mille) improvement compared with the BaseModel.</p>
<h1 id="heading-other-insights">Other Insights</h1>
<ul>
<li><p>Ads are ranked by \(CTR^\alpha * bid\_price\) with \(\alpha &gt; 1\), which controls the balance between CTR and RPM</p>
</li>
<li><p>Inference time is less than 10ms for hundreds of ads per visitor</p>
</li>
<li><p>Request batching is done to take full advantage of GPU</p>
</li>
<li><p>Concurrent kernel computation is done which allows execution of matrix computations to be processed with multiple CUDA kernels concurrently</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[AttriBERT - Session-based Product Attribute Recommendation with BERT]]></title><description><![CDATA[Personalized Refinement or Filter Recommendation]]></description><link>https://abhayshukla.com/attribert-session-based-product-attribute-recommendation-with-bert</link><guid isPermaLink="true">https://abhayshukla.com/attribert-session-based-product-attribute-recommendation-with-bert</guid><category><![CDATA[recsys]]></category><category><![CDATA[Personalization ]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Fri, 27 Dec 2024 19:20:58 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1735327170178/8727f5ec-133c-4486-b7a0-071b7a51343d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Authors in this paper propose approach to <strong>recommend personalized refinements</strong> (or filters) in feeds, such as search results, <strong>based on in-session user interactions</strong>. The model is based on the encoder only architecture of BERT and uses the Masked Language Modelling (MLM) task for refinement prediction.</p>
<p>The full paper can be read here <a target="_blank" href="https://dl.acm.org/doi/10.1145/3539618.3594714">https://dl.acm.org/doi/10.1145/3539618.3594714</a>.</p>
<p>The two proposed ways to model the personalized session-based refinement recommendation are:</p>
<ol>
<li><p><strong>Helping the Journey (HTJ)</strong>: given the partially-complete session, predict the dictionary of attribute-values which the user will explore next</p>
</li>
<li><p><strong>Helping the decision (HTD)</strong>: given the partially-complete session, directly predict the attribute-values of product the user will purchase</p>
</li>
</ol>
<h2 id="heading-refinements-suggest-strong-user-intent">Refinements Suggest Strong User Intent</h2>
<p>Authors note that, “search sessions with refinements applied have higher purchase rate compared to sessions without any refinement. Applying the right refinement earlier in the shopping mission can help customer find product of their choice quickly and in turn reduce session lengths and session abandonment.”</p>
<h3 id="heading-personalized-refinement-recommendations">Personalized Refinement Recommendations</h3>
<p>Session-based recommendation system (SBRS) can provide personalized refinement recommendations based on in-session user behavior. For example, when searching for "shoes" different refinements like <code>Color:Black and Brand:Nike</code> or <code>Color:Blue and Brand:Adidas</code> can be recommended based on the preferences inferred from recent user interactions. A non-personalized system on the contrary would recommend the same refinements to all the users.</p>
<h3 id="heading-product-representation-using-attributes">Product Representation Using Attributes</h3>
<p>Users in shopping journey are more likely to interact with products with similar attributes. Hence, product representation based on product attributes would be more informative for identifying attributes to recommend next.</p>
<h2 id="heading-problem-formulation">Problem Formulation</h2>
<p>User session is represented as \(S = [a_{1}, a_{2}, …, a_{t}, …a_{n}]\) a chronological sequence of products user interacted. Each product is represented as dictionary of attribute-value pairs, \(a_i = \{k^{i}_{1}\\:v^{i}_{1},...,k^{i}_{n}\\:v^{i}_{n}\}\) The problem can then be formulated as,</p>
<h3 id="heading-helping-the-journey-htj">Helping the Journey (HTJ)</h3>
<p>Predict the attribute-values of next product user will interact with given their interaction history till time step t, i.e.</p>
<p>$$P(a_{t+1} = a | a_1, ..., a_t)$$</p><h3 id="heading-helping-the-decision-htd"><strong>Helping the decision (HTD)</strong></h3>
<p>Predict the attribute-values of product user will purchase given their interaction history till time step t, i.e.</p>
<p>$$P(a_p = a | a_1, ..., a_t)$$</p><p>where a is the attribute-value of the product in prediction context.</p>
<h2 id="heading-attribert">AttriBERT</h2>
<p>AttriBert utilizes the BERT architecture for attribute prediction.</p>
<h3 id="heading-product-representation">Product Representation</h3>
<p>Two variants of the model are proposed,</p>
<ol>
<li><p>AttriBERT: product is represented only by attribute-values, and</p>
</li>
<li><p>AttriBERT+: product is represented by attribute and attribute-values both</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735319869086/04824d6b-7483-478e-b3bf-068b2502567a.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-positional-embedding">Positional Embedding</h3>
<p>Each attribute-value is assigned a position index such that attribute-values of the i-th product are assigned position index of i.</p>
<h3 id="heading-training-whole-product-attribute-wpa-mask-modeling">Training: Whole Product Attribute (WPA) Mask Modeling</h3>
<p>For each product, with probability <em>p</em> all its corresponding attributes and attribute-values are masked (i.e., replace with special mask token "[M]"). During training the model has to predict the original attribute-values corresponding to the masked tokens based on its left and right context.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735320710005/34fce0c9-1c48-4219-94ab-0f358014c341.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-output-projection">Output Projection</h3>
<p>Given the output of the final encoder layer, assuming we masked \(v_t\) the masked product is predicted based on \(h_t\). A feedforward network with GELU activation is used to produce an output distribution over target attribute-values:</p>
<p>$$𝑃(v) = softmax(GELU(h^TW + b)E^T + b')$$</p><p>where W is the projection matrix, b and b’ are bias terms, \(E \in R^{|V|\ \times\ d}\) is the embedding matrix for the attribute-value set V and embedding size d.</p>
<h3 id="heading-loss">Loss</h3>
<p>Negative log likelihood of the masked targets is defined as the loss,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735321428827/1bb54c54-583c-4471-a891-617289ff2aae.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-inferenceprediction">Inference/Prediction</h3>
<p>Similar to BERT4Rec, special token "[M]" is appended to the end of sequence, and then the attribute-values are predicted based on the final hidden representation of the "[M]".</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735326148563/02b6a8bc-ce2a-45ab-bc1e-a260e692f03b.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-data">Data</h3>
<p>Only sessions with purchase are used for the model as training on non-purchase sessions could result in refinement recommendations which result in session abandonment (non-conversion).</p>
<h3 id="heading-metrics">Metrics</h3>
<p>Three types of metrics for evaluation.</p>
<ol>
<li><p>Customer behavior metrics: Precision, Recall and Mean Reciprocal Rank (MRR) to quantify how well the model captures the attribute-value preferences of customers.</p>
</li>
<li><p>Diversity metrics: Coverage to quantify the percentage of unique attribute-values appearing in model predictions; and</p>
</li>
<li><p>Popularity Bias (Pop) to quantifies the tendency of model to recommend popular (high frequency) attribute-values.</p>
</li>
</ol>
<h3 id="heading-results">Results</h3>
<p>AttriBERT+ model outperforms other models in most of the metrics.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1735326466978/ee4ab862-83df-46c3-91e0-3fb33c03b833.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Interpretable Attribute-based Action-aware Bandits for Within-Session Personalization in E-commerce]]></title><description><![CDATA[Authors propose Online Personalized Attribute-based Re-ranker (OPAR), a light-weight, within-session personalization approach using multi-arm bandits…]]></description><link>https://abhayshukla.com/interpretable-attribute-based-action-aware-bandits-for-within-session-personalization-in-e-commerce</link><guid isPermaLink="true">https://abhayshukla.com/interpretable-attribute-based-action-aware-bandits-for-within-session-personalization-in-e-commerce</guid><category><![CDATA[recommender-systems]]></category><category><![CDATA[Personalization ]]></category><category><![CDATA[reranker]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Tue, 03 Dec 2024 09:43:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1733229222167/cdf6cb49-fe96-4e1f-9c08-5a1fc40fa728.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Authors propose Online Personalized Attribute-based Re-ranker (OPAR), a light-weight, within-session personalization approach using multi-arm bandits (MAB). Each arm of the MAB represents an attribute.</p>
<p>As users interact with products, the bandit learns attributes which user is interested in, forming an interpretable user preference profile, which can be used to re-rank products in real-time in a personalized manner.</p>
<p>Complete paper is available at <a target="_blank" href="https://www.dsml.etsy.com/publication-summaries/item-interaction-embeddings-www-2020-hy8cd-kt393">Interpretable Attribute-based Action-aware Bandits for Within-Session Personalization in E-commerce</a>.</p>
<h2 id="heading-attribute-preference-learning">Attribute Preference Learning</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733218816652/c8eb2c38-2fec-4945-aeb2-c87358eca759.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Initialize attributes with Beta distribution. Different initializations include uniform, random or estimated based on held-out historical datasets.</li>
</ul>
<p>$$\alpha_{atr} \mathrel{{+}{=}} \delta_{A_t}(1 - e^{-|\mathcal{U_t}|_0})$$</p><ul>
<li>where \(\mathcal{U}_t\) denotes the set of attributes existing in items with positive actions (i.e., click, add-to-cart, purchase).</li>
</ul>
<ul>
<li>At time step t, for each item user has no action on (say only impression happened), update Beta distribution of associated item attributes as,</li>
</ul>
<p>$$\beta_{atr} \mathrel{{+}{=}} \delta_{A_t}(1 - e^{-\gamma|\mathcal{V_t}\backslash\mathcal{U_t}|_0})$$</p><ul>
<li><p>where \(\mathcal{V}_t\) is the union of all attributes existing in items user has impressed upon and \(\gamma\) controls intensity on implicit no-actions.</p>
</li>
<li><p>User interactions \(A_t\) are defined as,</p>
</li>
</ul>
<p>$$A_t(x_i) = \begin{cases} 0, &amp; \text{no action on }x_i\\ 1, &amp; x_i \text{ is purchased}\\ 2, &amp; x_i \text{ is added to cart} \\ 3, &amp; x_i \text{ is clicked} \end{cases}$$</p><ul>
<li>\(\delta_{A}\) represent action-aware increments on attribute parameters</li>
</ul>
<h2 id="heading-re-ranking">Re-Ranking</h2>
<ul>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733218723927/e8475634-8cca-4f3e-90f9-de17664deb93.png" alt class="image--center mx-auto" /></p>
<p>  At time step t, for each item user interacted with (say by clicking on a item which has the attribute), update Beta distribution of associated item attributes as,</p>
</li>
<li><p>Sample user preference from the learned distribution of N attributes encountered in the session so far</p>
</li>
</ul>
<p>$$\Theta = \{\theta_{atr_n}\}_{n=1}^N \sim \{Beta(\alpha_{atr_n}, \beta_{atr_n})\}_{n=1}^N$$</p><ul>
<li><p>Rank the attributes in descending order of preference</p>
</li>
<li><p>For a given item x, sum of reciprocal rank of its attributes represents the item score</p>
</li>
</ul>
<p>$$score(x) = \sum_{atr_h \in x}\frac{1}{rank(\theta_{atr_h})}$$</p><ul>
<li>Re-rank given list based on the derived item scores</li>
</ul>
<h2 id="heading-opar-algorithm">OPAR Algorithm</h2>
<h3 id="heading-session">Session</h3>
<p>$$S = \{[Q_t, I_t, A_t]\}_{t=1}^T$$</p><p>Where at time step t, \(Q_t\) is the user query, \(I_t\) contains the candidate items to be re-ranked and \(A_t\) is the type of user interaction with the items.</p>
<h3 id="heading-attribute">Attribute</h3>
<p>Each item can be represented by set of its attributes.</p>
<p>$$x_i = \{atr_1, atr_2, ..., atr_{H_x}\}$$</p><p>where \(H_{x_i}\) denotes the total number of attributes associated with item \(x_i\).</p>
<p>\(\mathcal{U}_t\) = set of attributes associated from items with positive actions (i.e., click, add-to-cart, purchase), and \(\mathcal{V}_t\) be union of all attributes existing in \(x_i  \in I_y\), i.e.,</p>
<p>$$\begin{align} \mathcal{U}_t &amp;= \cup\{atr_h : \forall atr_h \in x_i\ if\ A_t(x_i) \neq 0,\ \forall x_i \in I_t\} \\ \mathcal{V}_t &amp;= \cup\{atr_h : \forall atr_h \in x_i,\ \forall x_i \in I_t\} \end{align}$$</p><p>Now, the complete OPAR algorithm is</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733172178813/111f17d6-a6fd-4fd2-a658-c346501bc021.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-discussion">Discussion</h2>
<p>Assuming all products have similar number of attributes,</p>
<ul>
<li><p>For the first set of recommendations, if all attributes are randomly initialized, the re-ranking will be random.</p>
</li>
<li><p>If user interacts with a product whose attributes are not shared by any other product in the recommendation, then only \(\alpha\) for corresponding attributes will increase. For all other non-interacted attributes only \(\beta\) will increase.</p>
</li>
<li><p>If interacted product attributes are shared by other products also, then both \(\alpha\) and \(\beta\) will increase for these attributes. For all other non-interacted attributes only \(\beta\) will increase.</p>
</li>
<li><p>If user at time step t engages with a lot more attributes then \(\alpha\) of corresponding attributes will increase a lot faster than their \(\beta\). This intensity of non-action can also be tuned by the hyperparameter \(\gamma\).</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Luong Attention]]></title><description><![CDATA[Luong Attention is proposed in the paper Effective Approaches to Attention-based Neural Machine Translation with two variants Global Attention Local…]]></description><link>https://abhayshukla.com/luong-attention</link><guid isPermaLink="true">https://abhayshukla.com/luong-attention</guid><category><![CDATA[attention-mechanism]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Sun, 01 Dec 2024 19:51:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1733253452843/f78de043-0d3f-4916-ad55-4c080003edc4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Luong Attention is proposed in the paper <a target="_blank" href="https://arxiv.org/abs/1508.04025">Effective Approaches to Attention-based Neural Machine Translation</a> with two variants</p>
<ul>
<li><p>Global Attention</p>
</li>
<li><p>Local Attention</p>
</li>
</ul>
<p>The proposed NMT model architecture consists of LSTM encoder to encode input sequences and LSTM decoder to predict the translation.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732971266932/5ce99c0a-f475-438d-9f28-e4c676ec34dd.png" alt class="image--center mx-auto" /></p>
<p>At each time step t in the decoding phase, given the target hidden state \(h_t\) and the source-side context vector \(c_t\), attentional hidden state is computed as,</p>
<p>$$\mathbf{\tilde{h}}_t = \tanh(\mathbf{W}_c[\mathbf{c}_t;\mathbf{h}_t])$$</p><p>and then tokens are predicted as,</p>
<p>$$p(y_t|y_{<p>The difference in global and local attention mechanisms is in the manner source-side context vector \(\mathbf{c}_t\) is computed.</p>
<h2 id="heading-global-attention">Global Attention</h2>
<p>Global attentional model considers all the hidden states of the encoder when deriving the context vector \(c_t\).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733080464702/505b0475-ed7a-484a-b83d-9d93273eb1a2.png" alt class="image--center mx-auto" /></p>
<ul>
<li>For the current target hidden state \(h_t\) and each source hidden state \(\bar{h}_s\), attention score is computed as,</li>
</ul>
<p>$$\begin{align} a_t(s) &amp;= align(h_t, \bar{h}_s) \\ &amp;= \frac{exp(score(h_t, \bar{h}_s))}{\sum_{s'}exp(score(h_t, \bar{h}_{s'}))} \end{align}$$</p><ul>
<li>Authors propose different methods to compute score,</li>
</ul>
<p>$$\begin{equation} score(h_t, \bar{h}_s) = \begin{cases} h_t^T\bar{h}_s &amp; dot\\ h_{t}^{T}W_a\bar{h}_s &amp; general\\ v_{a}^{T}tanh(W_a[h_t;\bar{h}_s]) &amp; concat \end{cases} \end{equation}$$</p><ul>
<li>Global attention vector is then computed as weighted average over all the source states</li>
</ul>
<p>$$c_t = \sum_s{a_t(s)\bar{h}_s}$$</p><h2 id="heading-local-attention">Local Attention</h2>
<p>Local attentional mechanism chooses to focus only on a small subset of the source positions per target word.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1733082573859/0d01ef72-0226-4cbd-84ad-751a0e16fd58.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>For each decoding step t, an aligned position \(p_t\) in source sequence can estimated by the following methods,</p>
<ul>
<li><p>Monotonic alignment (local-m): simply set \(p_t = t\) assuming that source and target sequences are roughly monotonically aligned</p>
</li>
<li><p>Predictive alignment (local-p): for given input sequence length S, predict an aligned position as,</p>
</li>
</ul>
</li>
</ul>
<p>$$p_t = S \cdot sigmoid(v_p^⊤tanh(W_ph_t))$$</p><ul>
<li><p>Context vector \(c_t\) is then derived as weighted average of encoder hidden states in the window \([p_t-D, p_t+D]\), where D is empirically estimated</p>
</li>
<li><p>Further, to favor alignment points near \(p_t\), a Gaussian distribution is placed centered around \(p_t\). As a result, the alignment weights are defined as,</p>
</li>
</ul>
<p>$$\begin{align} a_t(s) &amp;= align(h_t, \bar{h}_s) exp\left(-\frac{(s-p_t)^2}{2\sigma^2}\right) \\ \sigma &amp;= \frac{D}{2} \end{align}$$</p><p>Where s is an integer within the context window centered at \(p_t\) and \(align(h_t, \bar{h}_s)\) is same as defined for Global Attention.</p>
</p>]]></content:encoded></item><item><title><![CDATA[Hard, Soft and Doubly Stochastic Attention]]></title><description><![CDATA[For the image captioning task, the paper Show, Attend and Tell: Neural Image Caption Generation with Visual Attention proposes three different attention…]]></description><link>https://abhayshukla.com/hard-soft-and-doubly-stochastic-attention</link><guid isPermaLink="true">https://abhayshukla.com/hard-soft-and-doubly-stochastic-attention</guid><category><![CDATA[attention-mechanism]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Sat, 30 Nov 2024 12:33:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1733255282806/dd0ed255-c88d-4c31-8011-3b4e831d4f7c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>For the image captioning task, the paper <a target="_blank" href="https://arxiv.org/abs/1502.03044">Show, Attend and Tell: Neural Image Caption Generation with Visual Attention</a> proposes three different attention mechanisms,</p>
<ul>
<li><p>Stochastic Hard Attention</p>
</li>
<li><p>Deterministic Soft Attention</p>
</li>
<li><p>Doubly Stochastic Attention (variation of Deterministic Soft Attention)</p>
</li>
</ul>
<p>The proposed architecture for image captioning has a CNN encoder to extract feature maps from the image and LSTM decoder to predict the tokens of the caption.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732966151543/8238758f-f698-42e5-a5a5-4e4345740f53.png" alt class="image--center mx-auto" /></p>
<p>The common steps in all three attention mechanisms is as follow,</p>
<ul>
<li>CNN is used to extract L feature vectors, called annotation vectors in the paper, from the image</li>
</ul>
<p>$$a = \{\mathbf{a}_1,..., \mathbf{a}_L\}, \mathbf{a}_i \in \mathbb{R}^D$$</p><ul>
<li>For previous hidden state of the decoder \(h_{t-1}\) and each annotation vector \(a_i\), attention weight/score \(\alpha_{t, i}\) is calculated as,</li>
</ul>
<p>$$\begin{align} e_{t,i} &amp;= MLP(\mathbf{a}_i, \mathbf{h}_{t-1}) \\ \alpha_{t,i} &amp;= \frac{exp(e_{t,i})}{\sum_{k=1}^{L}exp(e_{t,k})} \\ \end{align}$$</p><p>\(\alpha_i\) can be interpreted either as the probability that location i is the right place to focus for producing the next word, or as the relative importance to give to location i in blending the \(a_i\)’s together.</p>
<h2 id="heading-stochastic-hard-attention">Stochastic Hard Attention</h2>
<p>At step t, \(\alpha_{t,i}\)’s are used to define a multinoulli distribution,</p>
<p>$$s_{t,i} = Multinoulli(\{\alpha_{t, i}\})$$</p><p>\(s_{t,i}\), thus, is an indicator one-hot variable which is set to 1 if the i-th location (out of L) is the one used to extract visual features.</p>
<p>The attention vector is then computed as,</p>
<p>$$\hat{\mathbf{z}}_t = \sum_{i=1}^{L} s_{t,i}\mathbf{a}_i$$</p><p>Essentially in this case you sample from the multinoulli distribution and the feature vector corresponding to the selected index (location) becomes the attention vector.</p>
<h2 id="heading-deterministic-soft-attention">Deterministic Soft Attention</h2>
<p>Deterministic Soft Attention mechanism computes expected attention vector using the attention weights as</p>
<p>$$\hat{\mathbf{z}}_t = \sum_{i=1}^{L} \alpha_{t,i}\mathbf{a}_i$$</p><p>The authors also use a gating scalar \(\beta\) (predicted from previous hidden state of decoder) for the attention vector, i.e.</p>
<p>$$\begin{align} \beta_t &amp;= \sigma(MLP(\mathbf{h}_{t-1})) \\ \tilde{\mathbf{z}}_t &amp;= \beta_t\sum_{i=1}^{L} \alpha_{t,i}\mathbf{a}_i \end{align}$$</p><p>Authors observe that the attention weights put more emphasis on the objects in the images by including the scalar \(\beta\).</p>
<h2 id="heading-doubly-stochastic-attention">Doubly Stochastic Attention</h2>
<p>Doubly Stochastic Attention modifies Deterministic Soft Attention by introducing a form of doubly stochastic regularization by encouraging \(\sum_t{\alpha_{t, i}} \approx 1\). This can be interpreted as encouraging the model to pay equal attention to every part of the image over the course of generation.</p>
<p>Doubly stochastic regularization is achieved by adding the regularization term as,</p>
<p>$$L = -\log(P(\mathbf{y}|\mathbf{x})) + \lambda\sum_{i}^{L}(1 - \sum_{t}^{C}\alpha_{t, i})^2$$</p><p>where C is the length of target.</p>
]]></content:encoded></item><item><title><![CDATA[Bahdanau Attention]]></title><description><![CDATA[The paper Neural Machine Translation by Jointly Learning to Align and Translate formally introduced the concept of attention for the first time. One of the…]]></description><link>https://abhayshukla.com/bahdanau-attention</link><guid isPermaLink="true">https://abhayshukla.com/bahdanau-attention</guid><category><![CDATA[attention-mechanism]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Fri, 29 Nov 2024 20:17:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1733304845631/817b3dc4-213e-4219-9d05-d09c707ba83f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The paper <a target="_blank" href="https://arxiv.org/abs/1409.0473">Neural Machine Translation by Jointly Learning to Align and Translate</a> formally introduced the concept of attention for the first time.</p>
<p>One of the illustrations (shown below) presented in the paper <a target="_blank" href="https://arxiv.org/abs/1406.1078">Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translation</a> is quite interesting in this context.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732909135849/90fd9b87-e682-463b-9d75-f37d936da69f.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>What if context vector C is computed by taking all the hidden states of the encoder?</p>
</li>
<li><p>What if context vector C is computed for each decoding step differently?</p>
</li>
</ul>
<h2 id="heading-bahdanau-attention">Bahdanau Attention</h2>
<p>Bahdanau Attention was proposed for Neural Machine Translation task using Bi-directional RNN encoder and RNN decoder.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732909268557/6f29ee56-9fe4-4b30-bd92-ca5188390c53.png" alt class="image--center mx-auto" /></p>
<p>In each decoding step,</p>
<ul>
<li>hidden state of decoder (query) is used to attend to all hidden states of the encoder (keys) to compute attention score for each hidden state</li>
</ul>
<p>$$\begin{align} h_j &amp;= Concat(\overrightarrow{h_j}, \overleftarrow{h_j}) \\ e_{t,j} &amp;= MLP(s_{t-1}, h_j) \\ \alpha_{t,j} &amp;= \frac{exp(e_{t,j})}{\sum_{k=1}^{T}{exp(e_{t,k})}} \\ \end{align}$$</p><ul>
<li>context vector is then computed as weighted sum of hidden states of the encoder (values) with attention scores as the weights</li>
</ul>
<p>$$c_{t} = \sum_{j=1}^{T}\alpha_{t,j}h_j$$</p><p>The attended context vector along with the decoder hidden state is then used to predict the next token.</p>
<blockquote>
<p>Here is an interesting thread by Andrej Karpathy on how Bahdanau ended up building this attention mechanism.</p>
</blockquote>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/karpathy/status/1864023344435380613">https://twitter.com/karpathy/status/1864023344435380613</a></div>
]]></content:encoded></item><item><title><![CDATA[ReLoop: A Self-Correction Continual Learning Loop for Recommender Systems]]></title><description><![CDATA[ReLoop]]></description><link>https://abhayshukla.com/reloop-a-self-correction-continual-learning-loop-for-recommender-systems</link><guid isPermaLink="true">https://abhayshukla.com/reloop-a-self-correction-continual-learning-loop-for-recommender-systems</guid><category><![CDATA[recsys]]></category><category><![CDATA[recommender-systems]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[Recommendation System]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Wed, 12 Jun 2024 18:34:13 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1733730160553/c15de70a-8fd9-4808-b33a-ca1ca5382f60.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">Introduction</h1>
<p>Models deployed to production often undergo re-training to learn from new user behaviors and improve the predictions. This training loop is demonstrated in the figure below,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1718046011824/f68fed32-560e-4c0d-9fec-643cbf4c148a.png" alt class="image--center mx-auto" /></p>
<ol>
<li><p>Training data is collected from user's implicit feedback such as clicked items as positives and viewed but not clicked as negatives</p>
</li>
<li><p>Ranking model is trained on the collected data</p>
</li>
<li><p>Production model is updated with the new model</p>
</li>
<li><p>Updated production model is used for online inference and the newly received user feedback is logged</p>
</li>
</ol>
<p>In a regular (re)training loop, steps 1-4 are repeated, usually at some predetermined condition or frequency.</p>
<p>You can find the complete paper <a target="_blank" href="https://dl.acm.org/doi/abs/10.1145/3477495.3531922">here</a>. It is quite easy to read.</p>
<h1 id="heading-motivation-behind-reloop">Motivation Behind ReLoop</h1>
<p>Humans learn not only from the newly gathered information but also from the mistakes made in the past. Can recommender systems do the same? This is the key question authors ask.</p>
<p>In the retraining process described above, the training loop only focuses on the freshly collected user data and does not consider the errors previous model made to improve its learning. This is what inspired the authors to design a training strategy which reflects and learns from the past errors as well.</p>
<blockquote>
<p>"Our key insight is that a new model should be forced to make smaller prediction errors than the previous model versions on the same data samples, and thus achieves the ability of self correction."</p>
</blockquote>
<p>The proposed approach ReLoop introduces a Self-Correction Module during model re-training to learn from previous mistakes.</p>
<h1 id="heading-reloop-approach">ReLoop Approach</h1>
<p>ReLoop training strategy is presented in the figure below,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1718128955595/6ea9803c-5caa-415e-9ead-b7af7591c2a1.png" alt class="image--center mx-auto" /></p>
<p>Note that</p>
<ul>
<li><p>By introducing Self-Correction Module training loop couples the two successive training periods directly</p>
</li>
<li><p>The illustration and discussion below is presented in context of pCTR model but the technique is model agnostic.</p>
</li>
</ul>
<p>The details of the Self-Correction Module are discussed below.</p>
<h2 id="heading-self-correction-module">Self-Correction Module</h2>
<p>Self-Correction Module compares the prediction of <code>model@(t-1)</code> and that of new <code>model@t</code> with the ground truth and defines a Self-Correction Loss.</p>
<p>Let,</p>
<p>\(\tilde{y}_{last}\): be the prediction of the <code>model@(t-1)</code>, currently in production</p>
<p>\(y\): be the ground truth observed in user logs</p>
<p>\(\hat{y}\): be the prediction of the new <code>model@t</code> which is to be trained</p>
<p>For the case of positive label, i.e. \(y = 1\),</p>
<p>\(y - \hat{y}\): is the Current Error w.r.t. <code>model@t</code></p>
<p>\(y - \tilde{y}_{last}\): is the Last Error w.r.t. <code>model@(t-1)</code></p>
<p>To build a self-correcting system, training process@t should get lower error than the previous one. I.e.</p>
<p>$$y - \hat{y} \leq y - \tilde{y}_{last} \Leftrightarrow \tilde{y}_{last} - \hat{y} \leq 0$$</p><p>Similarly, for the case of positive label, i.e. \(y=0\), we get</p>
<p>$$\hat{y} - \tilde{y}_{last} \leq 0$$</p><p>These two conditions are combined to define the self-correction (SE) loss as,</p>
<p>$$\mathcal{L}_{sc} = y\times max(\tilde{y}_{last} - \hat{y}, 0) + (1-y)\times max(\hat{y} - \tilde{y}_{last}, 0)$$</p><h2 id="heading-training-strategy">Training Strategy</h2>
<p>For CTR prediction task the binary cross-entropy (CE) loss is defined as</p>
<p>$$\mathcal{L}_{ce} = -y\times log\ \hat{y} - (1-y)\times log\ (1-\hat{y})$$</p><p>ReLoop loss is formulated as sum of CE loss and SE loss as,</p>
<p>$$\mathcal{L} = \alpha \mathcal{L}_{sc} + (1-\alpha)\mathcal{L}_{ce}$$</p><p>where \(\alpha \in [0,1]\) is the hyper-parameter to adjust the importance of SC loss and CE loss.</p>
<p>Authors make a comparison of self-correction loss with Knowledge Distillation (KD) based training loss. KD loss is given by,</p>
<p>$$\mathcal{L}_{kd} = -\tilde{y}_{last}\times log\ \hat{y} - (1-\tilde{y}_{last})\times log(1-\hat{y})$$</p><p>A comparison of \(\mathcal{L}_{ce}\), \(\mathcal{L}_{sc}\) and \(\mathcal{L}_{kd}\) is shown in the figure below,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1718216252399/98f32460-dedd-475c-80f4-f70a644cbdd9.png" alt class="image--center mx-auto" /></p>
<p>Note that \(\mathcal{L}_{sc}\) is activated only when current model performs worse off than the last model.</p>
<h1 id="heading-result-discussion">Result Discussion</h1>
<h2 id="heading-data">Data</h2>
<p><strong>Criteo</strong>: is CTR prediction dataset. 45M instances, 13 numerical feature fields and 26 categorical fields.</p>
<p><strong>Avazu</strong>: is a mobile ads dataset. 40M instances, 22 feature fields including advertisement attributes and user features.</p>
<p><strong>MovieLens</strong>: 2M instances.</p>
<p><strong>Frappe</strong> dataset is collected from a context-aware app discovery tool. 288k instances and 10 feature fields.</p>
<p><strong>Production</strong> dataset. 500M instances and over 100 feature fields, sampled from an industrial news feed product.</p>
<h2 id="heading-baselines">Baselines</h2>
<p>ReLoop model is compared with SOTA approaches including FTRL (Follow The Regularized Leader), FM (Factorization Machines), NFM (Neural Factorization Machines), PNN (Product-Based Neural Network), Deep&amp;Cross, Wide&amp;Deep, DeepFM, xDeepFM, FmFM (Field-matrixed Factorization Machines), AFN+ (Adaptive Factorization Network), Distill.</p>
<h2 id="heading-metric">Metric</h2>
<ul>
<li><p>AUC and LogLoss are used as offline metrics.</p>
</li>
<li><p>CTR is used as online metric.</p>
</li>
</ul>
<h2 id="heading-offline-results">Offline Results</h2>
<p>In offline experiments ReLoop strategy beats other baselines on public datasets. ReLoop (RLP) training strategy is model agnostic but for comparison and experiments DCN and DeepFM backbones are used for training.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1718215131685/3313b1c6-3f7c-468b-9424-4c6d12c5936a.png" alt class="image--center mx-auto" /></p>
<p>Knowledge Distillation (KD) strategy is the closest to RLP (ReLoop) in public dataset and these two are further on production data as well. It is found that ReLoop beats KD strategy on production data as well.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1718215141966/6b65dcd5-2fb0-4d6a-8d78-b528ca5aedea.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-online-results">Online Results</h2>
<p>Online results show significant CTR improvement over baseline in A/B test.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1718215463865/4ecb6a3d-99cb-4a6e-b419-0606b15c3dfa.png" alt class="image--center mx-auto" /></p>
<p>Interestingly, authors also conduct A/A test and the online results report improvements on (A/B - A/A).</p>
<p>It is also shown that irrespective of the choice of \(\alpha\), the hyper-parameter to adjust the importance of self-correction loss and cross-entropy loss, ReLoop method performs better than baseline methods.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1718215770309/88eceb40-df57-45bf-a83f-0c9c834f6ae4.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-thoughtsquestions">Thoughts/Questions</h1>
<ol>
<li><p>It will be interesting to extend such a framework to cases where the new model is not a re-trained one but a new model altogether, e.g. a new architecture.</p>
</li>
<li><p>\(\mathcal{L}_{ce}\) and \(\mathcal{L}_{sc}\) losses are of different scales. In such a case, does convex combination makes sense?</p>
</li>
<li><p>How will this training strategy perform w.r.t. noisy labels and outliers? Will it force the re-training to over-fit on noise and outliers?</p>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[AITM: Modeling the Sequential Dependence among Audience Multi-step Conversions with Multi-task Learning in Targeted Display Advertising]]></title><description><![CDATA[ESMM et al. - Part 4]]></description><link>https://abhayshukla.com/aitm-modeling-the-sequential-dependence-among-audience-multi-step-conversions-with-multi-task-learning-in-targeted-display-advertising</link><guid isPermaLink="true">https://abhayshukla.com/aitm-modeling-the-sequential-dependence-among-audience-multi-step-conversions-with-multi-task-learning-in-targeted-display-advertising</guid><category><![CDATA[recsys]]></category><category><![CDATA[recommender-systems]]></category><category><![CDATA[Recommendation System]]></category><category><![CDATA[Machine Learning]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Sun, 02 Jun 2024 19:57:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1717358141651/4ade877d-c4ef-407a-8e7d-2e093a497723.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this post I summarise the ideas in the paper "Modeling the Sequential Dependence among Audience Multi-step Conversions with Multi-task Learning in Targeted Display Advertising". You can find the full paper <a target="_blank" href="https://dl.acm.org/doi/10.1145/3447548.3467071">here</a>.</p>
<h1 id="heading-recap">Recap</h1>
<p>In the <a target="_blank" href="https://silpara.hashnode.dev/esmm-et-al-part-3">previous post</a>, we discussed how post-click behaviors can be used to add more supervision to <a target="_blank" href="https://silpara.hashnode.dev/esmm-et-al-part-2">ESMM</a> modeling technique, further alleviating the data sparsity (DS) issue faced in post-click conversion rate (CVR) prediction. To achieve this,</p>
<ol>
<li><p>user sequential behavior graph is created</p>
</li>
<li><p>actions post-click and pre-purchase are divided into Deterministic Actions (DAction) which are strongly correlated with purchase and Other Actions (OAction) to simplify the graph</p>
</li>
<li><p>finally, ESM2 model is trained for <code>CTR (impression =&gt; click)</code>, <code>CTAVR (impression =&gt; click =&gt; DAction)</code> and <code>CTCVR (impression =&gt; click =&gt; D(O)Action) =&gt; purchase)</code> tasks which are defined over the entire space.</p>
</li>
</ol>
<p>For more detailed summary, you can read <a target="_blank" href="https://silpara.hashnode.dev/esmm-et-al-part-3">ESMM et al. - Part 3</a>.</p>
<hr />
<h1 id="heading-motivation-behind-aitm">Motivation Behind AITM</h1>
<p>Customer acquisition in domains such as financial advertising (e.g. credit card advertising) have long multi-step conversion path (<code>impression =&gt; click =&gt; application =&gt; approval =&gt; activation</code>), as shown in the figure below, compared to e-commerce (<code>impression =&gt; click =&gt; purchase</code>).</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717320369517/67279504-7cc4-4eac-86ca-598994ade488.png" alt class="image--center mx-auto" /></p>
<p>To model long-path sequential dependence is challenging for a number of reasons such as,</p>
<ul>
<li><p>Positive feedback at each subsequent step is sparser leading to increased class imbalance at later stages</p>
</li>
<li><p>Rich transfer of information from the previous step which has more positive labels is critical to alleviate class imbalance of the subsequent steps</p>
</li>
<li><p>For scenarios such as banner ads which take traffic away from other user conversion opportunities, if the sequentially dependent end-to-end conversion relation is not learned well, it could mean loss of business, i.e. we need to ensure</p>
</li>
</ul>
<p>$$𝑦_1 \geq 𝑦_2 \geq \cdots \geq 𝑦_𝑇,\ (𝑦_𝑡 \in \{0, 1\},\ 𝑡 = 1, 2, \ldots ,𝑇)$$</p><h2 id="heading-gap-in-prior-methods">Gap in Prior Methods</h2>
<blockquote>
<p>"In industry and academia, multi-task learning is a typical solution to improve the end-to-end conversion in the audience multi-step conversion task. Recently, considerable efforts have been done to model task relationships in multi-task learning."</p>
</blockquote>
<p>In context of sequential task dependence modeling, I recommend you to read the literature review on multi-task learning (MTL) from the paper as well. Here I summarize it in brief.</p>
<h3 id="heading-expert-bottom-pattern">Expert-Bottom Pattern</h3>
<p>As shown in part (a) of the figure below, <em>"The main idea of the Expert-Bottom pattern is to control how Expert modules are shared across all tasks at the bottom of the multi-task model, and the Tower modules at the top handle each task separately."</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717322534289/c596ca46-91eb-44d9-ab25-1f21f73bb311.png" alt class="image--center mx-auto" /></p>
<p>However, often richer representations are learned at the Tower modules at the top but these representations are not shared between the tasks to improve each other. This is a drawback of the expert-bottom pattern architectures.</p>
<h3 id="heading-probability-transfer-pattern">Probability-Transfer Pattern</h3>
<p>As shown in part (b) of the figure above, the current architectures enable sequential dependence learning via simple scalar probability multiplication. Learned representations which contain richer information are not transferred to the tasks. This limits the amount of information shared between the tasks.</p>
<p>Also, prior methods focus on non-end-to-end post-click conversion (e.g. <code>p(purchase | click)</code>) which do not fully address the challenges with end-to-end long multi-step conversions.</p>
<h1 id="heading-mtl-ranking-system-in-meituan-app">MTL Ranking System in Meituan App</h1>
<blockquote>
<p>"Meituan is a Chinese shopping platform for locally found consumer products and retail services including entertainment, dining, delivery, travel and other services." - Wikipedia</p>
</blockquote>
<p>The MTL ranking system models four tasks click, application, approval and activation. Among them, the approval and activation are the main tasks, and the click and application are the auxiliary tasks.</p>
<h2 id="heading-trade-off-between-businesses">Trade-off Between Businesses</h2>
<p>Since a number of businesses are on-boarded on Meituan, to which business traffic should be diverted to depends on</p>
<ul>
<li><p><code>weight</code>: an aggregate importance derived from the value of the business, value of the audience, value of audience to the business, and</p>
</li>
<li><p><code>y_hat</code>: the predicted conversion probability</p>
</li>
</ul>
<p>as a result the final score is defined as,</p>
<p>$$score = weight * \hat{y}$$</p><p>and them the traffic is diverted to the business with the highest score. In practice this could mean e.g. whether the banner should show ad for a co-branded credit card or an offer for movie tickets.</p>
<h2 id="heading-trade-off-between-objectives">Trade-off Between Objectives</h2>
<p>The other interesting bit in the ranking system is shown in the figure below,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717325663631/0611b674-68b6-4275-8e25-9f6a63f1ed25.png" alt class="image--center mx-auto" /></p>
<p>Notice the component <code>Selector</code><em>.</em> Different businesses/clients have different objectives and selector helps in choosing the right trade-off between the corresponding ranking objectives. E.g. "Start-up banks often want to issue more credit cards to quickly occupy the market, while mature banks want to increase the activation rate to achieve rapid profits", therefore start-ups may want to focus only on approval rate prediction while mature banks may want to focus only on activation rate prediction.</p>
<h1 id="heading-approach">Approach</h1>
<h2 id="heading-problem-formulation">Problem Formulation</h2>
<p>The goal is to predict end-to-end conversion probability at each conversion step <code>t</code> given the input features <code>x</code> , i.e.</p>
<p>$$\hat{y}_t = p(y_1=1, y_2=1, \ldots, y_t=1|x)$$</p><h2 id="heading-adaptive-information-transfer-multi-task-aitm-framework">Adaptive Information Transfer Multi-task (AITM) Framework</h2>
<p>Data flow through the model is as follows,</p>
<p>$$\begin{gather*} \pmb{v} = [v_i;v_2;\ldots;v_{|\pmb{x}|}] \\ \\ \pmb{q_t} = f_t({\pmb{v}}) \\ \\ \pmb{z_1} = \pmb{q_1} \\ \\ \pmb{z}t = AIT(\pmb{p}{t-1}, \pmb{q}t) \\ \\ \pmb{p}{t-1} = g_{t-1}(\pmb{z}_{t-1}) \\ \\ \hat{y}_t = sigmoid(MLP(\pmb{z}_t)) \end{gather*}$$</p><p>where \(v_i\) is embedding of feature \(x_i \in x\).</p>
<p>New lets discuss the individual components.</p>
<h3 id="heading-shared-embedding-module">Shared Embedding Module</h3>
<p>The input <code>x</code> to AITM architecture is encoded to embedding <code>v</code> through a Shared Embedding Module. Here <code>v</code> is the concatenation of embedding of individual features in <code>x</code>.</p>
<p>$$\pmb{v} = [v_i;v_2;\ldots;v_{|\pmb{x}|}]$$</p><p>Shared Embedding Module helps address the data sparsity issue for the tasks with high class imbalance by sharing the embedding parameters with tasks with richer labels.</p>
<h3 id="heading-task-tower-module">Task Tower Module</h3>
<p>Input embedding <code>v</code> is fed to task specific modules. Details of task towers are not discussed in the paper but its hinted that they can be anything from simple MLPs to advanced models like NFM, DeepFM etc.</p>
<p>$$\pmb{q_t} = f_t({\pmb{v}})$$</p><p>where <code>f(.)</code> represents the task tower function.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717349686550/fd8ff561-ac04-4aae-baff-4cb653acb758.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-ait-module">AIT Module</h3>
<p>Output embedding of task tower <code>q</code> and transformed embedding from previous task tower <code>p</code> are given as input to the AIT module. This module then applies self attention over the two input embeddings and the resulting embedding is used to estimate the task probability.</p>
<p>$$\begin{gather*} \pmb{z_1} = \pmb{q_1} \\ \\ \pmb{p}{t-1} = g{t-1}(\pmb{z}_{t-1}) \\ \\ \pmb{z}t = AIT(\pmb{p}{t-1}, \pmb{q}_t) \\ \\ \end{gather*}$$</p><p>Notice that the rich representation learned at the previous task tower (t-1) is passed as information to the subsequent task (t) instead of just a scalar probability value.</p>
<h3 id="heading-task-probability-prediction">Task Probability Prediction</h3>
<p>Finally task probability is estimated as</p>
<p>$$\begin{gather*} \hat{y}_t = sigmoid(MLP(\pmb{z}_t)) \end{gather*}$$</p><h2 id="heading-loss">Loss</h2>
<p>Cross-entropy loss is used for individual conversion step prediction and a behavior loss calibrator is defined to enforce the sequential conversion dependence</p>
<p>$$𝑦_1 \geq 𝑦_2 \geq \cdots \geq 𝑦_𝑇$$</p><p>i.e. each subsequent end-to-end conversion step probability is lower than the last step probability.</p>
<h3 id="heading-task-loss">Task Loss</h3>
<p>$$\mathcal{L}_{ce}(\theta) = -\frac{1}{N} \sum{t=1}^{T}\sum_{(\pmb{x},y_t) \in D}^{N} ((y_tlog(\hat{y}_t) + (1-y_t)log(1-\hat{y}_t))$$</p><h3 id="heading-behavioral-expectation-calibrator">Behavioral Expectation Calibrator</h3>
<p>$$\mathcal{L}_{lc}(\theta) = -\frac{1}{N} \sum{t=2}^{T}\sum_{\pmb{x} \in D}^{N} max(\hat{y}t - \hat{y}{t-1}, 0)$$</p><h3 id="heading-final-loss">Final Loss</h3>
<p>$$\mathcal{L}(\theta)= \mathcal{L}_{ce}(\theta)+ \alpha\mathcal{L}_{lc}(\theta)$$</p><h2 id="heading-evaluation-metric">Evaluation Metric</h2>
<p>AUC is used to measure model performance for offline results and increase in conversion rate is used as a metric for online performance.</p>
<h1 id="heading-result-discussion">Result Discussion</h1>
<h2 id="heading-baselines">Baselines</h2>
<p>LightGBM, MLP, ESMM, OMoE (single gate MoE), MMoE, and PLE (Progressive Layered Extraction) models are used as baselines.</p>
<h2 id="heading-offline-results">Offline Results</h2>
<p>Improvement over LightGBM are reported in gains column in the result below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717356944618/f4861149-9df0-479b-9ee0-f46ccd6cb513.png" alt class="image--center mx-auto" /></p>
<p>Industrial dataset means the Meituan dataset. The public dataset used is the Ali-CCP (Alibaba Click and Conversion Prediction) dataset.</p>
<h2 id="heading-online-results">Online Results</h2>
<p>Gain in activation and conversion rates in the online experiment are shown below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717357115166/2fb0e3f4-b413-40f6-afaf-3b76c8d5490b.png" alt class="image--center mx-auto" /></p>
<p>Notice that in offline, the AUC improvement of AITM over LightGBM was only 1.69% (0.0142 over 0.8392) for approval task and 2.74% (0.0234 over 0.8536) for activation task but the improvement in online experiment are huge!</p>
<h1 id="heading-questionsobservations">Questions/Observations</h1>
<ol>
<li><p>How is the ranking done in online is not clearly stated, whether approval or activation task probability was used or a weighed sum of both?</p>
</li>
<li><p>Activation negatives were down sampled to 1% overall proportion during model training.</p>
</li>
<li><p>The TP999, TP9999 of the real-time prediction is less than 20ms, 30ms, which is impressive!</p>
</li>
</ol>
<p>The paper also have very insightful analysis on how are the embeddings separated at the top of the tower and what kind of information transfer is observed. I recommend you to read it directly from the paper.</p>
]]></content:encoded></item><item><title><![CDATA[ESM2: Entire Space Multi-Task Modeling via Post-Click Behavior Decomposition for Conversion Rate Prediction]]></title><description><![CDATA[ESMM et al. - Part 3]]></description><link>https://abhayshukla.com/esm2-entire-space-multi-task-modeling-via-post-click-behavior-decomposition-for-conversion-rate-prediction</link><guid isPermaLink="true">https://abhayshukla.com/esm2-entire-space-multi-task-modeling-via-post-click-behavior-decomposition-for-conversion-rate-prediction</guid><category><![CDATA[recsys]]></category><category><![CDATA[recommender-systems]]></category><category><![CDATA[Recommendation System]]></category><category><![CDATA[Machine Learning]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Thu, 23 May 2024 19:30:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1716493187565/c0661609-b2eb-46be-8aa0-ba5019885dbc.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this post I summarise the ideas in the paper "Entire Space Multi-Task Modeling via Post-Click Behavior Decomposition for Conversion Rate Prediction". You can find the paper <a target="_blank" href="https://dl.acm.org/doi/abs/10.1145/3397271.3401443">here.</a></p>
<h1 id="heading-recap">Recap</h1>
<p>A quick recap of the previous paper discussed in the <a target="_blank" href="https://silpara.hashnode.dev/esmm-et-al-part-2">previous post</a>: ESMM attempts to address the Sample Selection Bias (SSB) and Data Sparsity (DS) challenges associated with CVR modelling. SSB is solved by training the model in the entire space through <code>CTR (P[click = 1 | impression])</code> and <code>CTCVR (P[order=1 and click = 1 | impression])</code> tasks. Since these two tasks are defined on the entire impression space, the derived <code>pCVR = pCTCVR/pCTR</code> is also valid in the entire space.</p>
<p>DS is solved by sharing the embedding parameters between CTR and CVR tasks, which otherwise will not be properly trained just for CVR task due to lack of enough supervision (conversion events are rare).</p>
<p>With this context, let's look at the model Elaborated Entire Space Supervised Multi-task Model (ESM2) proposed in the current paper.</p>
<h1 id="heading-motivation-behind-esm2">Motivation Behind ESM2</h1>
<p>Authors point out that purchase events are rare (only 1% CVR and 0.1% CTCVR in online real-world logs), as a result existing methods still struggle to address the DS issues in CVR modelling. In the context of the ESMM paper, I think this means that while the CTCVR task helps, it still does not provide enough supervision to address the DS issue.</p>
<h2 id="heading-how-can-we-provide-more-supervision">How can we provide more supervision?</h2>
<p>Users take several actions post-click, such as add-to-cart, wishlist, another item click etc, before they make a purchase. Maybe they add items relevant to them in their wishlist and wait for discounts. Or they add all the relevant items to the wishlist or cart as shortlists but do not want to make a purchase decision immediately. Many of these post-click actions are related to eventual purchase. If these actions are leveraged then they can potentially provide abundant supervision signals to train the CVR model, compared to purchase signals alone.</p>
<p>With these additional supervision signals along with the ideas proposed in ESMM, not only can CVR be modelled in the entire space but data sparsity issues can also be further alleviated. This is the core idea behind ESM2.</p>
<h1 id="heading-approach">Approach</h1>
<h2 id="heading-user-sequential-behaviour-graph-types-of-post-click-actions">User Sequential Behaviour Graph: Types of Post-Click Actions</h2>
<p>To make things simple, different types of post-click actions in the user browsing behaviour graph can be grouped into Deterministic Action (DAction) for purchase and Other Action (OAction). In the figure below, it is shown that 12% of add-to-cart and 31% of wishlist items lead to purchase respectively in the data analysed by the authors. Such high intent post-click actions are grouped into DActions and other low intent post-click actions are grouped into OAction.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716489475766/514999f7-6317-408d-8e51-a1de3dac4664.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-probabilistic-formulation-of-user-sequential-behaviour-graph">Probabilistic Formulation of User Sequential Behaviour Graph</h2>
<p>The terminology for labels and conditioning variables followed in the paper is as follows:</p>
<p>v = view<br />c = click<br />a = action (1 means DAction, 0 means OAction)<br />b = purchase</p>
<p>Based on the graph (c) in the figure above, let's define probability on different segments of the graph</p>
<p><strong>impression =&gt; click</strong></p>
<p>$$y1 = p(c = 1 | v = 1)$$</p><p><strong>click =&gt; DAction</strong></p>
<p>$$y2 = p(a = 1 | c = 1)$$</p><p><strong>click =&gt; OAction</strong></p>
<p>$$1 - y2 = p(a = 0 | c = 1)$$</p><p><strong>DAction =&gt; purchase</strong></p>
<p>$$y3 = p(b = 1 | a = 1)$$</p><p><strong>OAction =&gt; purchase</strong></p>
<p>$$y4 = p(b = 1 | a = 0)$$</p><p>Now we can define different quantities of interest for modelling,</p>
<p><strong>impression =&gt; click</strong></p>
<p>$$pCTR = y1$$</p><p><strong>impression =&gt; click =&gt; DAction</strong></p>
<p>$$pAVR = y1*y2$$</p><p><strong>click =&gt; D(O)Action =&gt; purchase</strong></p>
<p>$$pCVR = y2*y3 + (1 - y2)*y4$$</p><p><strong>impression =&gt; click =&gt; D(O)Action =&gt; purchase</strong></p>
<p>$$pCTCVR = pCTRpCVR = y1(y2*y3 + (1 - y2)*y4)$$</p><p>You can also visualize these probability calculations in the tree below,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716489810296/87270a5b-3585-422f-bd27-0da1842d29fb.png" alt class="image--center mx-auto" /></p>
<p>In ESM2, CVR modelling is done leveraging these relationships in user sequential behaviour graph.</p>
<h1 id="heading-proposed-architecture">Proposed Architecture</h1>
<p>The architecture proposed by the authors follows the ideas in ESMM where supervision is provided for impression space labels and other variables are treated as intermediaries. As a result, <code>CTR (impression =&gt; click)</code>, <code>CTAVR (impression =&gt; click =&gt; DAction)</code> and <code>CTCVR (impression =&gt; click =&gt; D(O)Action) =&gt; purchase)</code> are the three tasks on which ESM2 model is trained. The architecture is shown in the figure below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716489872195/069c28fd-d5a8-4d96-b99a-1d9a6005fa4a.png" alt class="image--center mx-auto" /></p>
<p>There are three modules in the architecture,</p>
<p><strong>SEM</strong>: <strong>S</strong>hared <strong>E</strong>mbedding <strong>M</strong>odule is shared across tasks and addresses the data sparsity.</p>
<p><strong>DPM</strong>: <strong>D</strong>ecomposed <strong>P</strong>rediction <strong>M</strong>odule has MLPs trained separately for specific tasks and intermediary variables.</p>
<p><strong>SCM</strong>: <strong>S</strong>equential <strong>C</strong>omposition <strong>M</strong>odule enforces the sequential relationships defined in the user sequential behaviour graph.</p>
<h2 id="heading-loss"><strong>Loss</strong></h2>
<p>The overall loss for the model is,</p>
<p>$$L(\Theta) = w_{ctr} \times L_{ctr} + w_{ctavr} \times L_{ctavr} + w_{ctcvr} \times L_{ctcvr}$$</p><p>where each individual loss <code>L</code> is the logloss for the respective task and <code>w</code> indicates the weight associated with the corresponding loss.</p>
<h2 id="heading-evaluation-metric"><strong>Evaluation Metric</strong></h2>
<p>AUC, GAUC and F1 score are used for model evaluation.</p>
<h2 id="heading-features"><strong>Features</strong></h2>
<p>The user features include users' ID, ages, genders and purchasing powers, etc.</p>
<p>The item features include items' ID, prices, accumulated CTR and CVR from historical logs, etc.</p>
<p>The user-item features include users’ historical preference scores on items, etc.</p>
<p>Dense numerical features are first discretized based on their boundary values and then represented as one-hot vectors. For numerical features, they alternatively also try tanh transformation and found marginal improvement in AUC.</p>
<p>$$g_{ij} = tanh \Bigg(\cfrac{f_{ij} - \mu_{f_{j}}}{\sigma_{f_{j}}}\Bigg)$$</p><h1 id="heading-result-discussion">Result Discussion</h1>
<h2 id="heading-baselines">Baselines</h2>
<p>GBDT: gradient boosting decision tree model</p>
<p>DNN: similar to a single branch of ESM2</p>
<p>DNN-OS: similar to DNN with label oversampling to address DS</p>
<p>ESMM: which models impression=&gt;click=&gt;purchase with any other post-click action</p>
<h2 id="heading-offline-results">Offline Results</h2>
<p>Offline results show that ESM2 outperforms all other baselines.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716492403200/56898482-0f7d-4ef0-8bf3-478a484df051.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716492414734/35ef1ad9-e338-4427-941b-9a7e0daeb0e0.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-online-results">Online Results</h2>
<p>Online results validates the offline performance and show that ESM2 outperforms other baselines and has significant improvement over ESMM.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1716492426121/9ebdfe49-83d5-4a82-a48b-f4b8111d0487.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-questionsobservations">Questions/Observations</h1>
<ol>
<li><p>What is enforcing the model to train intermediate variables y2, y3 and y4 to train properly?</p>
</li>
<li><p>What might be the intuition <code>tanh</code> worked slightly better for numerical features instead of discretized embedding based approach?</p>
</li>
<li><p>The approach shows significant improvement over ESMM, does it mean the issues with CVR training with ESMM are resolved with this approach?</p>
</li>
<li><p>IDs are used as inputs in the model on which embeddings are learned</p>
</li>
<li><p>The model was deployed online, model latency is 20 ms.</p>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[ESMM: Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate]]></title><description><![CDATA[ESMM et al. - Part 2]]></description><link>https://abhayshukla.com/esmm-entire-space-multi-task-model-an-effective-approach-for-estimating-post-click-conversion-rate</link><guid isPermaLink="true">https://abhayshukla.com/esmm-entire-space-multi-task-model-an-effective-approach-for-estimating-post-click-conversion-rate</guid><category><![CDATA[recsys]]></category><category><![CDATA[recommender-systems]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Wed, 15 May 2024 13:19:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1715779094679/90cd0357-11c1-4b13-9cc5-2361fcdc584b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This post is about the first paper which introduces the ESMM approach. The full paper is available <a target="_blank" href="https://arxiv.org/abs/1804.07931">here</a>, it is fairly easy to read.</p>
<h2 id="heading-which-issues-esmm-addresses">Which Issues ESMM Addresses?</h2>
<p>ESMM proposes an approach to address sample selection bias (<strong>SSB</strong>) and data sparsity (<strong>DS</strong>) associated with CVR models. These problems arise due to difference in training vs inference space (SSB) and difficulty in fitting the CVR model due to sparsity of training data (DS) respectively.</p>
<p>The paper does not focus on the delayed feedback problem of CVR because they mention that it is somewhat acceptable in their case. This means that the time delay between click to conversion is within an acceptable time window and does not lead to data staleness issue in the model training process.</p>
<h2 id="heading-esmm-approach">ESMM Approach</h2>
<h3 id="heading-intuitionexplanation">Intuition/Explanation</h3>
<p>ESMM authors assume that user actions follow the sequential pattern,</p>
<p><code>impression =&gt; click =&gt; conversion</code></p>
<p>This can be expressed in probability as, </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715776164090/927c7291-fbcc-4f3a-9771-3028a788be28.png" alt class="image--center mx-auto" /></p>
<p>where x is the feature vector of observed impression, y is click label and z is conversion label.</p>
<p>A baseline (naive) approach to train CVR model is to take all the clicked samples and further treat converted cases as positives and clicked but not converted cases as negative. Clearly, this dataset is a subset of all impressions on which inference needs to be done (as is evident from the equation above also). Therefore, the naive approach suffers from the SSB issue. However, CTR and CTCVR can be trained directly on the impression data as there is no other conditioning variable. This fact is used to design the ESMM approach.</p>
<p><strong>SSB:</strong> In ESMM, two auxiliary tasks of predicting the post-view CTR and post-view CTCVR are introduced. ESMM treats pCVR as an intermediate variable which multiplied by pCTR equals to pCTCVR. </p>
<p>Both pCTCVR and pCTR are estimated over the entire space with samples of all impressions, thus the derived pCVR should also be applicable over the entire space.</p>
<p><strong>DS:</strong> To address DS of CVR task, embedding table is shared with CTR task. This leads to training of parameters over samples of all impressions, i.e. the entire space.</p>
<h3 id="heading-proposed-architecture">Proposed Architecture</h3>
<p>The architecture below is fairly self-explanatory at a high level.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715776504079/a4d31cbc-f798-425d-a76a-28b1d50f20cb.png" alt class="image--center mx-auto" /></p>
<p>Details of architecture:</p>
<ul>
<li><p>pooling over user and item field embeddings</p>
</li>
<li><p>ReLU activation function</p>
</li>
<li><p>dimension of embedding vector is 18</p>
</li>
<li><p>each layers in MLP network is 360 x 200 x 80 x 2</p>
</li>
<li><p>adam with parameter β1 = 0.9, β2 = 0.999</p>
</li>
<li><p>ϵ = 10−8</p>
</li>
</ul>
<h3 id="heading-loss">Loss</h3>
<p>Notice that</p>
<ul>
<li><p>total loss is a sum of of losses for CTR and CTCVR tasks</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715776667975/0ad912ce-b12c-484a-bd87-42f6de413cbb.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>since the training tasks are defined over the entire space, therefore naturally the corresponding losses are also defined over the impression space.</p>
</li>
</ul>
<h2 id="heading-results-discussion">Results Discussion</h2>
<h3 id="heading-baselines">Baselines</h3>
<p>Baseline approaches used in the paper for comparison are:</p>
<p><strong>Base</strong>: CVR model trained in click space with architecture similar to CVR task in the proposed architecture section above.</p>
<p><strong>AMAN</strong>: All Missing As Negatives, "applies random sampling strategy to select unclicked impressions as negative examples".</p>
<p><strong>OVERSAMPLING</strong>: "copies positive examples to reduce difficulty of training with sparse data".</p>
<p><strong>UNBIAS</strong>: "fit the truly underlying distribution from observations via rejection sampling. pCTR is taken as the rejection probability."</p>
<p><strong>DIVISION</strong>: estimates pCTR and pCTCVR with individually trained CTR and CTCVR networks and calculates pCVR by <code>pCVR = pCTCVR/pCTR</code>.</p>
<p><strong>ESMM-NS</strong>: ESMM with <strong>N</strong>o embedding parameter <strong>S</strong>haring</p>
<h3 id="heading-offline-results">Offline Results</h3>
<p>Results are reported on public dataset which was released as part of this publication and the whole dataset called as product dataset.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715777527669/86147198-c5a6-4c9f-a309-e115d4f23e2d.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715777534674/b6c9851c-f055-4b29-8520-f7162319ed43.png" alt class="image--center mx-auto" /></p>
<p>The results show that ESMM performs better compared to other baselines.</p>
<h1 id="heading-observationsthoughtsquestions">Observations/Thoughts/Questions</h1>
<ol>
<li><p>The odd thing about the approach is that, the main task (CVR) which ESMM is trying to get better at is just an intermediate variable with no direct supervision on it. Therefore, is it possible that the intermediate variable is optimised properly?</p>
</li>
<li><p>Embedding dimension is just 18 (maybe in 2018 it was still hard to train larger models?)</p>
</li>
<li><p>The paper does not mention that this model is deployed in production, all results reported are offline.</p>
</li>
<li><p>They do not describe whether CTCVR task improved the CTR task performance. Should it?</p>
</li>
<li><p>One of the baseline methods is All Missing As Negative (AMAN) which consistently underestimates prediction mentioned in the literature section of the paper, and it also performs worse among ESMM baselines.</p>
</li>
<li><p>Another competitor models in result section is ESMM-NS, i.e. ESMM without embedding parameter sharing and its results are only marginally worse than ESMM with parameter sharing. Does it mean that DS is only partially addressed?</p>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[An Introduction to Entire Space Multi-Task Modeling]]></title><description><![CDATA[ESMM et al. - Part 1]]></description><link>https://abhayshukla.com/an-introduction-to-entire-space-multi-task-modeling</link><guid isPermaLink="true">https://abhayshukla.com/an-introduction-to-entire-space-multi-task-modeling</guid><category><![CDATA[recsys]]></category><category><![CDATA[recommender-systems]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[Recommendation System]]></category><dc:creator><![CDATA[Abhay Shukla]]></dc:creator><pubDate>Mon, 06 May 2024 18:23:37 GMT</pubDate><content:encoded><![CDATA[<p>In this post, I will use ESMM et al. to describe ESMM and subsequent research along this line of work. I will only motivate/introduce the need for ESMM et al. in the post below.</p>
<p>ESMM et al. aims at addressing the issues with modeling conversion (CVR) such as data sparsity, sample selection bias and delayed feedback issue. In general, I think, these ideas are applicable to many other post-conversion events/feedback such as rating and re-order. But for simplicity, you can think of CVR for reference.</p>
<h1 id="heading-what-are-the-issues-with-cvr-modeling-porder-click-x">What are the issues with CVR Modeling (P[Order | Click, X])?</h1>
<h2 id="heading-sample-selection-bias-ssb">Sample Selection Bias (SSB)</h2>
<p>"SSB refers to the systematic difference of data distributions between training space and inference space." The figure below from ESMM [2018] paper captures the essence of SSB.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1715018739935/aaa3daae-4bc8-4cce-bdab-66800725e082.png" alt="Sample Selection Bias(SSB) - Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate" class="image--center mx-auto" /></p>
<p><em>SSB: Entire Space Multi-Task Model: An Effective Approach for Estimating Post-Click Conversion Rate</em></p>
<p>So the issue with CVR is that the model is trained on clicked samples but the inference is done in impression space (this is not completely true though, can you think why?). This bias is quite severe considering that CTR is typically in the range 3-4%, which means a very small subset of items on the platform get clicked and a subset of them are used for CVR training. But during inference this set is extended to the entire impression space.</p>
<p>As you can guess, this hurts the generalization capability of the model.</p>
<p>Let's come to the second issue.</p>
<h2 id="heading-data-sparsity-ds">Data Sparsity (DS)</h2>
<p>DS simply means not having enough supervision data to train a model with a large number of parameters. As pointed out earlier, this will happen because CTR is about 3-4% and even if CVR is 10%, if the model has a lot of parameters the CVR data might not be enough to reasonably train the model, leading to underfitting and generalization issues.</p>
<p>The third issue is,</p>
<h2 id="heading-cascade-delayed-feedback-cdf">Cascade Delayed Feedback (CDF)</h2>
<p>Delayed Feedback (DF) is the issue where the conversion label is not available soon after a click event occurs. E.g. It's quite common in the ads industry to have an attribution window of 30 days or so for conversion post clicking an ad. This means that when you are training a model, your training data will always have a significant staleness w.r.t. to production data distribution.</p>
<p>CDF is the case where the delayed feedback labels have a cascading effect. E.g. returns can only happen after conversion. So the delay in conversion will have a cascading effect on returns feedback. This means when modeling net conversions, the staleness in training data w.r.t. production will be even more.</p>
<p>These are the three major issues ESMM et al. attempts to address.</p>
<p>Now to conclude this introductory post...</p>
<h2 id="heading-whats-in-the-name-esmm">What's in the name ESMM?</h2>
<p>ESMM name is composed of two things:</p>
<ol>
<li><p><strong>ES</strong> i.e. Entire Space: where the idea is to train the CVR model in the entire space in which inference is to be done.</p>
</li>
<li><p><strong>MM</strong> i.e. Multi-task Model: which hints at the architecture that multi-task modeling is to be leveraged for the entire space training to address SSB and also to solve DS issues.</p>
</li>
</ol>
<p>PS: For folks who are aware of ESMM et al., please do add in comments anything I missed to motivate ESMM.</p>
]]></content:encoded></item></channel></rss>