GraphFM: Graph Factorization Machines for Feature Interaction Modeling

Shu Wu, Zekun Li, Yunyue Su, Zeyu Cui, Xiaoyu Zhang, Liang Wang

TL;DR

GraphFM bridges the gap between Factorization Machines (FM) and Graph Neural Networks (GNN) to model complex feature interactions in sparse data. By treating features as nodes and selectively learning "beneficial" interactions as edges, it captures high-order relationships efficiently without the noise or computational explosion typical of traditional methods.

What Problem Does This Paper Address?

In fields like online advertising and recommender systems, predicting a user's behavior (like Click-Through Rate or CTR) depends on understanding how different features interact. For example, a user’s Age, the Movie Genre, and the Director might collectively signal a high preference, even if none of those features do so individually.

Traditionally, Factorization Machines (FM) have been the go-to for this, but they have two major flaws:

  1. The Order Limit: Standard FMs usually only look at pairwise (2nd-order) interactions. Moving to higher orders (3rd, 4th, etc.) leads to a "combinatorial explosion" where the number of possible combinations becomes computationally impossible to manage.
  2. The Noise Problem: Most models assume every pair of features should interact. In reality, many interactions (like "Release Date" + "User Language") are irrelevant and just introduce noise, which can actually hurt prediction accuracy.

While Deep Neural Networks (DNNs) can model high-order interactions, they often do so in an "implicit" or "bitwise" way—essentially a black box that offers no explanation for why a prediction was made.

Methods

The authors introduce GraphFM, which reimagines feature interaction as a graph problem.

1. Features as Nodes, Interactions as Edges

Every feature field (e.g., Gender, Occupation, Zipcode) is treated as a node in a graph. An interaction between two features is represented as an edge.

2. Interaction Selection (The "Smart" Part)

Instead of a fully connected graph where everything interacts with everything, GraphFM uses an Interaction Selection mechanism. It employs a small Multi-Layer Perceptron (MLP) to estimate the "benefit" of an interaction between two feature embeddings. It then samples only the top $m_k$ most beneficial neighbors for each node. This makes the graph sparse, reduces noise, and keeps the computation efficient.

3. Interaction Aggregation

To update a feature's representation, GraphFM uses a GNN-style aggregation. However, instead of just averaging neighbor features, it integrates the FM interaction function (element-wise products) and multi-head attention. This allows the model to learn the "polysemy" of interactions—how a feature might mean different things in different semantic contexts.

4. Stacking for High-Order

By stacking $K$ layers, the model naturally captures $K$-order interactions. Layer 1 handles pairwise interactions; Layer 2 uses those results to build 3rd-order interactions, and so on.

Datasets

The model was evaluated on three widely used real-world datasets:

  • Criteo: A massive industry benchmark for CTR prediction containing over 45 million instances.
  • Avazu: Another large-scale CTR dataset with 40 million instances.
  • MovieLens-1M: A classic recommender system dataset containing 1 million movie ratings.

Key Insights and Ideas

  • Sparsity is a Strength: By explicitly selecting "beneficial" interactions, GraphFM proves that "less is more." Removing irrelevant edges prevents the model from overfitting to noise.
  • GNNs as Explicit Feature Explorers: Unlike DNNs that mix features in hidden layers, GraphFM’s graph structure keeps the interactions "explicit." We can actually look at the learned graph to see which features the model thinks are important.
  • Adaptive Structure: The graph isn't fixed. The model learns a different graph structure at each layer, allowing it to be flexible in how it builds high-order combinations.

Key Results

GraphFM consistently outperformed a wide array of baselines, including traditional FMs (AFM, FM), DNN-based models (DeepCrossing, xDeepFM), and other state-of-the-art aggregation models (AutoInt, Fi-GNN).

  • Accuracy Gains: On the MovieLens-1M dataset, GraphFM achieved an AUC of 0.8902, significantly higher than standard FM (0.8252) and even beating strong competitors like AutoInt (0.8823).
  • Interpretability: The authors provided heatmaps of the learned interaction weights. For a correct prediction, the model successfully identified relevant clusters (like linking Genre with ReleaseTime and WatchTime), providing a "rationale" for its output that bitwise DNNs cannot offer.

Limitations and Future Work

The authors noted that while GraphFM is highly effective, its performance margin on the massive Criteo and Avazu datasets was smaller than on MovieLens. They suggest this might be because the fixed feature embedding size (set to 16 for fair comparison) might be a bottleneck for such high-dimensional data.

Future Directions: * Investigating if GraphFM can be applied to broader graph representation learning and node classification tasks. * Exploring more complex sampling strategies beyond "top-k" to further refine the interaction selection.

For those interested in the implementation, the authors have made their code and data available on GitHub.

Summary updated

Abstract

Factorization machine (FM) is a prevalent approach to modeling pairwise (second-order) feature interactions when dealing with high-dimensional sparse data. However, on the one hand, FM fails to capture higher-order feature interactions suffering from combinatorial expansion. On the other hand, taking into account interactions between every pair of features may introduce noise and degrade prediction accuracy. To solve the problems, we propose a novel approach, Graph Factorization Machine (GraphFM), by naturally representing features in the graph structure. In particular, we design a mechanism to select the beneficial feature interactions and formulate them as edges between features. Then the proposed model, which integrates the interaction function of FM into the feature aggregation strategy of Graph Neural Network (GNN), can model arbitrary-order feature interactions on the graph-structured features by stacking layers. Experimental results on several real-world datasets have demonstrated the rationality and effectiveness of our proposed approach. The code and data are available at https://github.com/CRIPAC-DIG/GraphCTR}{https://github.com/CRIPAC-DIG/GraphCTR
BibTeX
@article{wu2025graphfm,
  author = {Shu Wu and Zekun Li and Yunyue Su and Zeyu Cui and Xiaoyu Zhang and Liang Wang},
  title = {{GraphFM: Graph Factorization Machines for Feature Interaction Modeling}},
  journal = {Int. J. Autom. Comput.},
  year = {2025},
  doi = {10.1007/s11633-024-1505-5},
}
Figure