No history yet

Deep Neural Recommenders

Beyond Linear Factors

In the last section, we saw how techniques like SVD++ and ALS uncover hidden patterns by decomposing user-item interaction matrices into latent factors. These models are powerful, but they share a fundamental limitation: they primarily capture linear relationships. The dot product at the heart of matrix factorization is a linear operation, which means it can struggle to model the complex, non-linear ways people actually discover things.

For example, a user's preference for a movie might depend on a tricky combination of genre, director, and the lead actor's recent filmography. Simple matrix factorization might miss these higher-order interactions. This is where deep neural networks come in. They allow us to move beyond the dot product and learn far more intricate patterns from the data.

Memorization vs. Generalization

A great recommender needs to do two things well. First, it must memorize what works. It should learn simple, direct rules from the data, like recommending The Empire Strikes Back to someone who just watched A New Hope. This is called memorization.

Second, it must discover new, non-obvious connections. It should be able to generalize from a user's behavior to recommend surprising but relevant items. For example, it might notice that a user who enjoys historical documentaries and sci-fi films might also like a new series about alternate history. This is generalization.

The Wide & Deep learning framework, pioneered by Google, combines both strengths into a single model.

The Wide Part is a simple generalized linear model. It's trained on raw input features and, crucially, —manual combinations of features that capture specific, common co-occurrences. For example, crossing user_country='USA' and item_category='NFL' creates a new feature that strongly predicts interest in American football merchandise. This part is excellent for memorization.

The Deep Part is a feed-forward neural network. It takes raw features and creates dense, low-dimensional embeddings for them, similar to the latent factors we've already seen. By stacking multiple hidden layers, this network can learn complex, high-order feature interactions automatically, enabling it to generalize to unseen feature combinations.

Two Towers for Efficiency

Models like Wide & Deep are great for ranking a small set of candidates, but what if you have a catalog of millions of items, like YouTube or Spotify? Evaluating every single item for a user would be computationally impossible.

This is where the Two-Tower architecture comes in. It's designed for the first stage of a recommendation pipeline: retrieval. The goal is to quickly and efficiently select a few hundred relevant candidates from the entire inventory.

The model consists of two separate deep neural networks:

  1. A User Tower: This network takes user features (ID, watch history, demographics) and computes a user embedding vector.
  2. An Item Tower: This network takes item features (ID, category, text description) and computes an item embedding vector.

During training, the model learns to map positive user-item pairs (e.g., a user watched a video) to embedding vectors that are close together in the shared embedding space. This closeness is measured by the dot product.

The real magic happens at serving time. Because the item tower doesn't depend on user features, you can run it offline and pre-compute the embedding for every single item in your catalog. When a user visits, you only need to run the lightweight user tower to get their embedding. Then, you can use an efficient approximate nearest neighbor search to find the item embeddings that are closest to the user's embedding. This process is incredibly fast and scalable.

Improving the Interaction

Standard matrix factorization, and even the Two-Tower model, ultimately rely on a simple dot product to model the interaction between the user and item embeddings. But what if that interaction is more complex than a simple linear multiplication?

Neural Collaborative Filtering (NCF) replaces the dot product with a full multi-layer perceptron (MLP). Instead of just calculating uTvu^T v, the user and item embedding vectors are concatenated and fed through several neural network layers. This allows the model to learn an arbitrary, complex function for the interaction, capturing non-linear relationships that the dot product would miss.

Another powerful architecture is DeepFM, which stands for Deep Factorization Machine. It builds on the ideas of Wide & Deep but makes a crucial improvement. Instead of a generic linear model for the "wide" part, it uses a Factorization Machine (FM). An FM is effective at modeling second-order feature interactions. DeepFM then shares the same feature embeddings between the FM component and the deep component.

This shared-embedding approach makes the model more efficient and allows it to learn more expressive low-order and high-order feature interactions from the raw features.

Quiz Questions 1/5

What is a primary limitation of traditional matrix factorization models that deep learning-based recommender systems aim to address?

Quiz Questions 2/5

In the context of the Wide & Deep learning framework, what is the main purpose of the "Wide" component?

These deep learning approaches provide a flexible and powerful toolkit for building modern recommenders. By combining specialized components for memorization, generalization, retrieval, and interaction modeling, we can create systems that are both highly accurate and scalable to massive datasets.