When your recommender needs to know that "The Matrix" is a sci-fi film
A KDD 2019 reference implementation that injects knowledge graph structure into collaborative filtering via graph attention networks.

What it does
KGAT fuses user-item interaction data with external knowledge graphs (Freebase entities and relations) to make recommendations. It treats users, items, and knowledge entities as nodes in a single graph, then propagates embeddings through the structure using attention-weighted message passing. The code includes five baseline models (BPR-MF, FM, NFM, CKE, CFKG) and three standard datasets: Amazon-book, Last-FM, and Yelp2018.
The interesting bit
The “collaborative knowledge graph” trick: instead of keeping user-item interactions and item knowledge in separate silos, KGAT merges them into one heterogeneous graph. This lets user embeddings flow through entity-relation paths—so a user’s taste for “The Matrix” can propagate through the “genre: sci-fi” node to reach “Blade Runner” even if nobody watched both. The attention mechanism learns which relations matter most for each hop.
Key highlights
- Reference implementation of a KDD 2019 paper with reproducible training logs and tuned hyperparameters for all three datasets
- Supports three GCN variants: KGAT attention, vanilla GCN, and GraphSage-style aggregation
- Includes preprocessed datasets with Freebase entity mappings for Amazon-book and Last-FM
- Strongly recommends BPR-MF pretraining (
--pretrain -1) to stabilize million-scale knowledge graph training - TensorFlow 1.12 codebase with explicit parser arguments and example commands for each dataset
Caveats
- Locked to TensorFlow 1.12 and Python 3.6.5—expect dependency archaeology if you’re on modern stacks
- Yelp2018 lacks Freebase mapping; its knowledge graph construction method isn’t detailed in the README
- The authors note that training from scratch requires “larger” epoch counts and early-stopping criteria, but don’t specify what “larger” means
Verdict
Worth a look if you’re building knowledge-aware recommenders or need a solid baseline for graph-based collaborative filtering. Skip it if you need production-ready code or a PyTorch port—this is research reproduction, not a framework.