Knowledge Discovery
Session 11

Knowledge Modeling, Querying and Inference

4 hours · Week 11 · from graphs to reasoning over knowledge

Learning Objectives

  • Model knowledge as a graph of entities and relations, and reason about what a triple does and does not encode
  • Compare knowledge graph embedding models (TransE, TransR, DistMult, ComplEx, RotatE) and their inductive biases
  • Apply GNNs to recommendation as link prediction over a bipartite user–item graph
  • Understand relational deep learning: learning directly over multi-table relational databases
  • Reason about KG foundation models and transferable, inductive reasoning over unseen graphs

Topics

Hands-on demos

A self-contained PyTorch Geometric notebook with two independent demos — runnable on a laptop in seconds. Code lives in docs/11_knowledge_modeling/demos/.

D1 · Heterogeneous GCN & knowledge-graph embeddings

Part A — a heterogeneous / multi-relational GCN. A small synthetic academic graph (papers, authors, venues with cites, writes, published_in) is classified by topic with an R-GCN (Schlichtkrull et al. 2018) from only 3 labels per topic, and compared against a relation-blind baseline so the class can see what typed edges buy you. Hidden states are projected with PCA to watch the topics separate.

Part B — KG embeddings, inference and queries. A fully human-readable knowledge graph is embedded with TransE. The demo then (1) infers missing facts by link prediction, (2) answers 1-hop tail queries by ranking, and (3) answers a 2-hop query directly in vector space by adding relation vectors — recovering which country a person lives in even though that fact is never stored — motivating the Query2box lecture.

Lecture slides and videos

This session follows Stanford CS224W: Machine Learning with Graphs (Fall 2025). Slides below link directly to the official course materials; videos are the public 2023 recordings, which remain the best openly available match.

Topic Official slides (CS224W 2025) Public video
Knowledge graph embeddings
TransE, TransR, DistMult, ComplEx, RotatE
Lecture 10 — Knowledge graphs CS224W 2023 — KG Embeddings
Querying & reasoning over KGs
multi-hop logical queries, box embeddings
Lecture 11 — Reasoning over KGs (2024) CS224W playlist
GNNs for recommender systems
NGCF, LightGCN, PinSAGE
Lecture 11 — GNNs for RecSys CS224W 2023 — GNNs for RecSys
Relational deep learning
GNNs over relational databases
Lecture 12 — Relational Deep Learning Leskovec — Relational Deep Learning
Advanced RDL architectures
RelGNN, Relational Graph Transformer
Lecture 13 — Advanced topics in RDL RelBench overview
Foundation models for KGs
ULTRA, InGram, inductive reasoning
Lecture 15 — KG Foundation Models Towards Foundation Models for KG Reasoning

Full course site: CS224W Fall 2025 · public video playlist: YouTube