Feature Interactions & Engineering

By Ludovico Bessi, Senior ML Engineer at Google · Updated

Feature interactions are combinations of features (user × item, item × time) that carry most of the predictive signal in recommendations. Rankers capture them with hand-crafted crosses, factorization machines, cross networks (DCN-V2) and attention layers (AutoInt), on top of carefully engineered counters, embeddings and freshness features.

Why Interactions Matter

Most predictive signal in recommendations lives in combinations: a user who likes jazz and it is Sunday evening; a cooking video and a user who recently searched for recipes. A model that only adds up individual feature effects misses these. Feature interaction modeling is about capturing such combinations efficiently, without enumerating them by hand.

Hand-Crafted Crosses

The classical approach: define cross features explicitly, such as user_country × item_language or user_age_bucket × item_category, hash them into a large sparse space, and learn a weight per cross. Effective and interpretable, but:

  • The number of possible crosses explodes.
  • Rare combinations get too little data to learn.
  • Every cross needs an engineer's insight.

Factorization Machines

Factorization machines (Rendle, 2010) model every pairwise interaction as the dot product of two learned latent vectors:

ŷ = w₀ + Σ_i w_i x_i + Σ_{i<j} ⟨v_i, v_j⟩ x_i x_j

Because interactions share latent vectors, the model can estimate interactions between features that rarely or never co-occurred in training. The pairwise term can be computed in linear time. Field-aware FMs (FFM) learn separate latent vectors per field pair and were strong in CTR competitions.

Deep Interaction Architectures

DeepFM

Combines an FM component (explicit pairwise interactions) with a deep MLP (implicit higher-order interactions), sharing the same embeddings.

Deep & Cross Network (DCN, DCN-V2)

Cross layers explicitly build higher-order crosses. Each layer computes:

x_{l+1} = x₀ ⊙ (W_l x_l + b_l) + x_l

Stacking L cross layers yields polynomial interactions up to degree L + 1. DCN-V2 (Google, 2020) uses full weight matrices for expressiveness and a low-rank mixture-of-experts version for efficiency, and has been widely deployed. Cross layers can be placed in parallel with or stacked before an MLP.

Attention-based interactions

AutoInt applies multi-head self-attention over feature embeddings so the model learns which features to combine. Transformer-style interaction layers over feature tokens are increasingly common, especially on GPUs.

DLRM's dot-product interactions

Meta's DLRM computes dot products between all pairs of embedding vectors (and the processed dense features) and feeds them to an MLP — essentially FM-style pairwise interactions inside a deep model, chosen for efficiency at scale.

Scaling interaction layers

Recent work focuses on interaction modules that keep improving as they get bigger. Meta's Wukong (2024) stacks factorization-machine-style blocks and reported scaling-law behavior for recommendation quality across a wide range of model sizes. This matters because classic MLP-heavy rankers tended to plateau when simply made larger.

Feature Engineering Still Matters

Learned interactions reduce the need for hand-crafted crosses, but feature design remains one of the highest-leverage activities.

Counting features

Engagement statistics over time windows: item CTR in the last hour/day/week, user CTR on this category, creator follow rate. These carry strong signal and adapt quickly. Handle:

  • Smoothing for low counts (add a prior so a 1/1 click rate does not look like 100%).
  • Multiple windows to capture both trends and stable rates.
  • Point-in-time correctness: training examples must use counts as they were at impression time, not later.

Embedding features

Pretrained content embeddings (text, image, video) give meaning to new items. Similarity features — cosine between the candidate's embedding and the user's recent-history embedding — are cheap and powerful.

ID features and hashing

High-cardinality IDs (users, items, creators) get embedding tables. Hashing bounds memory but causes collisions; collisionless tables with frequency filtering and eviction (as in ByteDance's Monolith) avoid that at the cost of infrastructure complexity.

Feature selection

More features are not free: each costs storage, serving latency and maintenance, and adds skew risk. Measure each feature group's contribution with ablations, and remove features that do not pay for themselves.

Practical Guidance

  1. Start with embeddings for key IDs, counting features with smoothing, and content embeddings.
  2. Use a proven interaction layer (DCN-V2 or DLRM-style dot products) before inventing your own.
  3. Add user–item similarity and history features; these often beat architectural changes.
  4. Keep features point-in-time correct and identical between training and serving.
  5. Prune features regularly; complexity is a cost.

Key Takeaways

  1. Most signal lives in feature combinations; the question is how to learn them efficiently.
  2. Factorization machines share latent vectors to estimate unseen pairwise interactions.
  3. DeepFM, DCN-V2, AutoInt and DLRM learn explicit and implicit interactions; Wukong targets interaction layers that scale.
  4. Counting features, content embeddings and similarity features remain among the highest-value inputs.
  5. Every feature has serving cost and skew risk; ablate and prune.