Deep Interest Network

Also known as: DIN

On this page 7

Deep Interest Network (DIN) is a click-through rate prediction model that represents a user’s interests differently for each candidate item, using an attention-style local activation unit to weight past behaviors by their relevance to the item being scored. Developed by Alibaba for display advertising and published in 2018, it became a reference design for behavior-sequence modeling in recommender systems.

Earlier deep CTR models compressed a user’s entire history into one fixed-length vector, regardless of what was being recommended. DIN rests on the observation that users have diverse, partly unrelated interests, and that only a few past actions matter for any single prediction: a click on running shoes says much about a sports watch ad and little about a cookbook.

How Deep Interest Network builds a user representation

DIN follows the familiar embedding and multilayer perceptron pattern of deep CTR prediction, with one key change in how the behavior sequence is pooled. Sparse categorical features such as user ID, item ID, shop ID and category are mapped to dense item embeddings, and the final representation is fed into a multilayer perceptron that outputs a click probability.

The difference lies in the pooling step. Instead of averaging or summing behavior embeddings, DIN computes an activation weight for each past behavior relative to the candidate ad. The weighted sum of behavior embeddings then forms a candidate-specific interest vector. The table below lists the main components.

ComponentRoleNotes
Embedding layerMaps sparse IDs to dense vectorsGoods, shop and category IDs combined
Behavior sequenceLists items the user interacted withTypically clicks within a time window
Local activation unitScores each behavior against the candidateSmall feedforward network
Weighted sum poolingBuilds the user interest vectorWeights are not softmax-normalized
Multilayer perceptronCombines all features into a predictionUses Dice or PReLU activations
Sigmoid outputProduces click probabilityTrained with log loss
Main components of the DIN architecture

The local activation unit takes the behavior embedding, the candidate embedding and their outer product or element-wise difference as input, and outputs a scalar weight. The authors deliberately skip softmax normalization so that the sum of weights reflects the intensity of a user’s interest, not only its distribution.

Training techniques introduced with DIN

DIN was trained on billions of samples with very large ID spaces, which made overfitting a practical obstacle. The original work therefore proposed two training techniques and an evaluation metric alongside the architecture.

TechniqueProblem addressedIdea
Mini-batch aware regularizationOverfitting on huge sparse embeddingsApply L2 only to parameters active in the mini-batch
Dice activationFixed rectifier point in PReLUAdaptive switch point based on input statistics
GAUC metricGlobal AUC mixes users unfairlyAverage per-user AUC weighted by impressions
Supporting techniques from the original work

Mini-batch aware regularization matters because a full L2 penalty over millions of embedding rows is too expensive to compute at each step. Dice generalizes PReLU by moving the activation threshold according to the mean and variance of its input, which improved convergence in the reported experiments. GAUC reflects the real task better, because ads compete for one user at a time.

Deep Interest Network compared with other CTR models

DIN is best understood as an answer to the fixed user vector limitation of earlier models. The comparison below places it among ranking models that appear in the same field.

ModelBehavior handlingMain idea
Wide & DeepPooled into a fixed vectorMemorization plus generalization
DeepFMPooled into a fixed vectorFactorization machine with deep component
Deep Interest NetworkWeighted by candidate relevanceLocal activation attention
Deep Interest Evolution NetworkModeled as an evolving sequenceGRU with attention update gate
Search-based interest modelRetrieves relevant long-term behaviorsTwo-stage search over thousands of events
SASRec and BERT4RecFull self-attention over the sequenceTransformer sequential recommendation
DIN among deep CTR prediction models

Unlike SASRec, which learns relationships among all past items, DIN applies target attention: only the relation between each behavior and the candidate is modeled. This is cheaper and well suited to the ranking stage, but it ignores the order and evolution of interests, which later models such as DIEN addressed.

Deploying DIN in production ranking

DIN belongs in the ranking stage of a multi-stage ranking pipeline, after candidate generation has narrowed millions of items to a few hundred. Because the interest vector depends on the candidate, it must be recomputed for every user-item pair, which rules out the precomputed user embeddings used by a two-tower model in retrieval.

  • Sequence length: behavior histories are usually truncated to the most recent 50 to a few hundred events to bound latency.
  • Feature choice: item, shop and category embeddings of past behaviors typically carry most of the signal.
  • Serving cost: attention over each candidate multiplies computation, so teams batch candidates and cache behavior embeddings.
  • Freshness: the behavior sequence should update in near real time, or the model scores stale interests.

In the original online A/B test on Alibaba display advertising, DIN reported up to about 10 percent higher click-through rate and a meaningful revenue gain over a pooled baseline. Results of that size depend heavily on data volume and feature quality, and smaller systems should expect more modest improvements.

Limitations and common mistakes

DIN is strong but not universal. Its benefits shrink when user histories are short or sparse, as in cold start scenarios, because there is little behavior to attend over.

  • No sequence order: DIN treats behaviors as a set, so it misses interest drift over time.
  • Short-term focus: truncated histories discard long-term interests, a gap later filled by retrieval-based models.
  • Bias reinforcement: attention on past clicks can deepen popularity bias and filter bubbles unless diversity controls are added.
  • Misapplied softmax: normalizing the weights removes the interest intensity signal the design relies on.

In everyday language

Picture a shop assistant who remembers what you bought before. You look at hiking boots. A good assistant recalls your tent and backpack, not your coffee mug. Deep Interest Network does this for an online store. It looks back at your past clicks. It pays most attention to the ones that match the item on screen.

Older systems mixed all your history into one summary. DIN builds a fresh summary for every item it considers. That makes its guesses about what you might click much sharper.

Seen in the real world

A mid-sized online marketplace with about two million daily active users ranks 300 candidate products for each home page visit. Its existing ranking model averages the embeddings of each user’s last 100 clicks, so a shopper who browsed both baby clothes and power tools receives a blurred profile.

The ranking team replaces average pooling with a DIN-style local activation unit over item and category embeddings. Offline, GAUC rises by roughly one percentage point. In a two-week A/B test, click-through rate on recommended products increases by several percent, with the largest gains for users who have broad, mixed browsing histories.

Latency rises by a few milliseconds per request, which the team offsets by caching behavior embeddings. The outcome is more relevant recommendations for multi-interest shoppers at an acceptable serving cost.