xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems
CTR (click-through rate) prediction is a core task in recommender systems: the goal is to predict whether a user will click an item, given combinations of user, item, and context features. This post explains xDeepFM (eXtreme Deep Factorization Machine), proposed by six Microsoft Research Asia researchers in 2018 (KDD 2018), which combines explicit vector-wise and implicit bit-wise feature interactions in a single "dual-engine" architecture.
Key points
- The core problem: valuable predictive signals live in *combinatorial features* (e.g., age + occupation + time + device + query), but the combinatorial space is astronomically large, making manual feature engineering infeasible.
- Historical evolution:
- Logistic regression: linear weights per feature; cannot capture cross effects.
- Factorization Machines (FM, 2010): embeddings and dot products automatically learn second-order interactions and generalize to unseen pairs, but higher orders are hard.
- Deep neural networks (DeepFM, Wide & Deep, DCN): theoretically can approximate arbitrary functions, but interactions are *implicit* and *bit-wise* (embedded elements mix across fields inside neurons), sacrificing interpretability.
- CIN branch — explicit, vector-wise interactions.
- DNN branch — implicit, bit-wise interactions (the flattened embedding passes through fully connected layers). 3. Output layer: linear combination of the linear unit, optional FM unit, CIN output, and DNN output, followed by a sigmoid:
- Each layer computes outer products between the previous layer's vectors and the raw embeddings X⁰, producing a 3D tensor Z^l ∈ ℝ^(H_{l-1} × n × k).
- CNN-style filters then compress this tensor back to a matrix X^l (similar to 1×1 convolutions), followed by a nonlinear activation.
- The design shares properties with CNNs (local connectivity, parameter sharing, hierarchical abstraction) and RNNs (each layer depends on the previous layer plus the original input).
- Bounded degree: layer *l* captures interactions of order up to *l+1*, which keeps interaction order interpretable and controllable — but is also the reason the implicit DNN branch is needed as a complement.
- Trained with log loss; all branches are jointly optimized end-to-end.
- Data uses the FFM format (
<label> <field_id>:<feature_id>:<feature_value>), which is field-aware, sparse, and widely supported. - Criteo has 39 fields (13 continuous, 26 categorical), ~2.3M features after hashing, and a highly imbalanced label (typical CTR 3–5%), so AUC is the primary metric.
- Example hyperparameters from the reference notebook:
learning_rate=0.002,batch_size=4096,epochs=10,cross_layer_sizes=[20,10](CIN),layer_sizes=[20,20](DNN), and L2 regularization of 0.01 on embeddings, CIN, and DNN respectively. - Training dynamics: AUC rises quickly in the first 3 epochs (0.66 → 0.73) as low-order patterns are learned, then improves more slowly as high-order interactions are mined. On the tiny Criteo sample the model reaches AUC ≈ 0.7356, logloss ≈ 0.5017 (the paper reports ~0.747 on the full dataset).
- Deployment challenges include millisecond-level latency (addressable via model compression/quantization), data distribution drift (incremental training is supported by the modular design), and interpretability requirements (CIN exposes which interactions matter).
- Follow-up research inspired by xDeepFM includes AutoInt (self-attention based interactions), Fi-GNN (graph neural networks over feature fields), and FinalMLP (two-MLP gated fusion).
- Open future directions: dynamic (context-dependent) interactions, multimodal feature interaction, and causal rather than purely correlational modeling.
Architecture: a dual-engine model
xDeepFM stacks three layers:
1. Embedding layer: sparse categorical fields are mapped to dense low-dimensional vectors, forming a matrix X⁰ ∈ ℝ^(n×k). 2. Interaction layer, with parallel branches:
ŷ = σ(y_linear + y_FM + y_CIN + y_DNN)
The model is modular: hyperparameters use_Linear_part, use_FM_part, use_CIN_part, and use_DNN_part enable/disable components, so it can degrade to plain FM or run as a pure explicit-interaction model.
The Compressed Interaction Network (CIN)
CIN generates explicit, vector-level interactions:
Training and evaluation on Criteo
Industrial relevance and follow-ups
References
1. Lian, J., et al. (2018). xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems. *KDD 2018*, 1–10. https://doi.org/10.1145/3219819.3220023 2. Juan, Y., et al. (2016). Field-aware Factorization Machines for CTR Prediction. *RecSys 2016*, 43–50. 3. Guo, H., et al. (2017). DeepFM: A Factorization-Machine based Neural Network for CTR Prediction. *IJCAI 2017*, 1725–1731. 4. Cheng, H. T., et al. (2016). Wide & Deep Learning for Recommender Systems. *DLRS 2016*, 7–10. 5. Wang, R., et al. (2021). DCN V2: Improved Deep & Cross Network. *The Web Conference 2021*, 1785–1797.