Search

Search papers and lessons

LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation

Xiangnan He, Kuan Deng, Xiang Wang et al. · 2020

LightGCN shows that a graph recommender works better when its graph layers keep only neighbour averaging, so the only learned numbers are one ID vector per user and item.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Linear algebra
  • Calculus
  • Neural network basics
  • Representation learning
  • ReadReady to readNot yet

TL;DR

LightGCN is a recommender paper from 2020 that asks what the parts of a graph convolution network actually do for collaborative filtering. The authors remove feature transformations and nonlinear activations from the graph model used by NGCF, keep only the averaging of neighbour embeddings, and combine the layers with a weighted sum at the end. The result trains more easily, has only one learned vector per user and item, and beats NGCF by about 16 percent on average under the same experimental setting.

Builds on: Graph Convolutional Network, Node Embedding, Pairwise Ranking Loss · Leads to: the LightGCN lesson, which explains the model on its own

Why it mattered

Graph convolution networks had become the state of the art for collaborative filtering, with NGCF as the leading example. The LightGCN paper showed that much of that machinery was not helping. Its ablation on NGCF found that removing the feature transformations and the nonlinearity raised recall on Gowalla from 0.1547 to 0.1742 in its Table 1, so the heavier parts were making the model worse.

The simplified model became a reference point for graph-based recommenders. The paper has been cited more than 6,000 times according to Semantic Scholar. Its main lesson is practical: in a graph where nodes carry only an identifier, extra weight matrices have nothing to work on and make Overfitting or poor training more likely.

The problem

A recommender learns from implicit feedback: clicks, purchases, check-ins. The data is a user-item graph, and each node is described only by an ID. Earlier models used the one-hop history of a user, such as SVD++ and NAIS, and NGCF went further by propagating signals through several hops with a full graph convolution. That design came from node classification, where each node has rich input features such as the words in a paper's abstract.

Stacking several layers of feature transformation and nonlinearity makes sense when the input features carry meaning. An ID has no meaning beyond being an identifier, so the authors argue that the extra layers do not help and that they make training harder. The paper's claim is therefore about one task, collaborative filtering on ID-only graphs, and not about graph learning in general.

How it works

Take a tiny graph with two users and two items. User u clicked items i1 and i2. User v clicked only i1. We will use single numbers instead of vectors and run one layer of propagation with equal layer weights. The paper's model has the same steps with vectors of length 64.

  1. Input: the interaction graph. Build the user-item matrix R, with a 1 for each click. Here R has rows for u and v and columns for i1 and i2. The degrees are: u has 2 neighbours, v has 1, i1 has 2 and i2 has 1. Check: each click adds one to the degree of both of its endpoints.
  2. Start with ID embeddings. Each node gets a learned starting value, the layer-0 embedding. Say u starts at 1, v at 0, i1 at 2 and i2 at 0. These four numbers are all the model learns. Check: there are no weights to multiply them by, so nothing else is trainable.
  3. Propagate to users. The new value of u is the sum of its items' values, each scaled by 1 over the square root of the two degrees. From i1: the scale is 1 over the square root of (2 times 2), which is 0.5, times 2, giving 1.0. From i2: the scale is 1 over the square root of (2 times 1), about 0.71, times 0, giving 0. So u at layer 1 is 1.0. Check: the item with the larger value contributed, and the zero item contributed nothing.
  4. Propagate to items. The new value of i1 is the sum over its users, scaled the same way. From u: the scale is 0.5, times 1, giving 0.5. From v: about 0.71, times 0, giving 0. So i1 at layer 1 is 0.5. Check: v had no signal to give, so only u moved i1. The same rule gives i2 the value 1 over the square root of (2 times 1), about 0.71, times the 1 from its only user u, so i2 at layer 1 is about 0.71.
  5. Combine the layers. The final vector averages layer 0 and layer 1 with weights 1/2 each. The final value of u is (1 + 1.0) / 2 = 1.0. The final value of i1 is (2 + 0.5) / 2 = 1.25. The final value of i2 is (0 + 0.71) / 2, about 0.35. Check: the layer-0 value stays in the average, which is why the model keeps each node's own identity.
  6. Score the pairs. The score is the dot product of the final vectors. For u and i1 it is 1.0 times 1.25, giving 1.25. For u and i2 it is 1.0 times 0.35, about 0.35. Check: the clicked item scores above the unclicked one, which the training should make the normal case.
  7. Train on the pair. The paper uses the BPR loss from BPR: Bayesian Personalized Ranking from Implicit Feedback. For the triple (u, i1, i2) the score difference is 1.25 minus 0.35, about 0.90. The sigmoid of 0.90 is about 0.71, and the loss is minus the natural log of 0.71, about 0.34. A gradient step moves the starting values so that the score of the clicked pair rises and the score of the unclicked pair falls. Check: a larger difference would give a smaller loss.
flowchart LR
  A["Interaction graph R"] --> B["Layer-0 ID embeddings E(0)"]
  B --> C["Light graph convolution: degree-weighted sum over neighbours, K layers"]
  C --> D["Layer combination: weighted sum of E(0) to E(K)"]
  D --> E["Score: dot product of user and item vectors"]
  E --> F["BPR loss on observed vs unobserved items, update E(0)"]
  F --> B

The math

The notation follows the paper. There are M users and N items. R is the M by N interaction matrix, N_u is the set of items user u interacted with, and N_i is the set of users who interacted with item i. The matrix A is the (M+N) by (M+N) adjacency matrix of the user-item graph, and D is the diagonal degree matrix. The layer-0 embeddings are e_u^(0) and e_i^(0), with embedding size T.

Stage 2 in symbols: light graph convolution

Each layer replaces a node's vector with a degree-normalised sum of its neighbours' vectors, with no weights and no nonlinearity:

eu(k+1)=∑i∈Nu1∣Nu∣∣Ni∣ ei(k),ei(k+1)=∑u∈Ni1∣Ni∣∣Nu∣ eu(k).\mathbf{e}_u^{(k+1)} = \sum_{i \in \mathcal{N}_u} \frac{1}{\sqrt{|\mathcal{N}_u|}\sqrt{|\mathcal{N}_i|}}\, \mathbf{e}_i^{(k)}, \qquad \mathbf{e}_i^{(k+1)} = \sum_{u \in \mathcal{N}_i} \frac{1}{\sqrt{|\mathcal{N}_i|}\sqrt{|\mathcal{N}_u|}}\, \mathbf{e}_u^{(k)}.

The square-root factor is the symmetric normalisation from standard GCNs. The paper's ablation tests this symmetric normalisation as one of its design choices. In the walkthrough both factors are 1 over the square root of the product of the two degrees, which gave the 0.5 and 0.71 values. The paper does not add a self-loop: the target node's own value comes back through the layer combination.

In matrix form, with A-tilde equal to D to the power minus one half, times A, times D to the power minus one half, the layers are E(k+1) = A-tilde E(k).

Stage 3 in symbols: layer combination

After K layers the final embedding is a weighted sum of all layers:

eu=∑k=0Kαkeu(k),ei=∑k=0Kαkei(k).\mathbf{e}_u = \sum_{k=0}^{K} \alpha_k \mathbf{e}_u^{(k)}, \qquad \mathbf{e}_i = \sum_{k=0}^{K} \alpha_k \mathbf{e}_i^{(k)}.

The paper sets alpha_k to 1 over K+1 for every layer, which is the choice used in the walkthrough. The paper notes that tuning αk\alpha_k can improve results further, but it keeps the uniform setting in the main comparison to avoid over-tuning.

Stage 4 in symbols: prediction and matrix form

The score is the dot product y-hat(u, i) = e_u transposed times e_i. Writing all embeddings as one matrix gives E = alpha_0 E(0) + alpha_1 A-tilde E(0) + ... + alpha_K A-tilde^K E(0). Each power of A-tilde reaches one hop further in the graph, so the final embedding mixes neighbourhoods of every size up to K.

Stage 5 in symbols: the BPR loss and training

The only trainable parameters are E(0). The loss is the Bayesian Personalized Ranking objective, which needs an observed item i and an unobserved item j for each user:

LBPR=−∑u=1M∑i∈Nu∑j∉Nuln⁡σ(y^ui−y^uj)+λ∥E(0)∥2.L_{BPR} = -\sum_{u=1}^{M} \sum_{i \in \mathcal{N}_u} \sum_{j \notin \mathcal{N}_u} \ln \sigma(\hat{y}_{ui} - \hat{y}_{uj}) + \lambda \lVert \mathbf{E}^{(0)} \rVert^2.

The sigmoid sigma turns the score difference into a probability, as in the walkthrough. The term lambda sets the strength of the L2 penalty. The paper trains with Adam in mini-batches, uses Xavier initialisation for the embeddings, and does not use dropout, because there are no weight matrices to regularise beyond the embedding penalty.

Results

The paper evaluates on three public datasets. Gowalla has 29,858 users, 40,981 items and 1,027,370 interactions. Yelp2018 has 31,668 users, 38,048 items and 1,561,406 interactions. Amazon-Book has 52,643 users, 91,599 items and 2,984,108 interactions. The metrics are recall at 20 and NDCG at 20, computed by ranking all items that a user has not interacted with.

  • Overall comparison (Table 4). On Gowalla, LightGCN reaches recall 0.1830 and NDCG 0.1554. NGCF reaches 0.1570 and 0.1327, Mult-VAE 0.1641 and 0.1335, and GRMF 0.1477 and 0.1205.
  • Yelp2018. LightGCN reaches recall 0.0649 and NDCG 0.0530. NGCF reaches 0.0579 and 0.0477, and Mult-VAE 0.0584 and 0.0450.
  • Amazon-Book. LightGCN reaches recall 0.0411 and NDCG 0.0315. NGCF reaches 0.0344 and 0.0263, and Mult-VAE reaches 0.0407 and 0.0315. Mult-VAE matches LightGCN on NDCG here.
  • Average gain over NGCF. The text reports an average improvement of 16.52 percent in recall and 16.87 percent in NDCG across the three datasets, which is where the 16 percent figure comes from. Under 2 layers on Amazon-Book, LightGCN's recall of 0.0411 against NGCF's 0.0330 is a relative gain of about 24.5 percent. The gain shrinks on Yelp2018 at 2 layers, where the paper reports 9.89 percent.
  • Layer count. Going from 0 layers (matrix factorisation) to 1 gives the largest gain. The paper reports that 3 layers is satisfactory in most cases.
  • Training behaviour. LightGCN reaches a lower training loss than NGCF throughout training, and that lower loss carries over to better test recall. Raising NGCF's learning rate lowers its training loss but does not improve its test recall.

The limits are real and the paper states some of them. The study is offline, with the all-ranking protocol, on three datasets. The Yelp2018 data is a revised version that filters cold-start items from the test set, so NGCF was re-run on it. The layer weights are fixed at 1/(K+1) in the main table, so the comparison does not tune them. The paper's layer-combination ablation shows that LightGCN-single, which uses only the last layer, peaks at layer 2 and then declines, while LightGCN keeps improving with depth. Finally, the argument that feature transformations are useless applies to ID-only graphs. It does not show what happens when nodes carry rich features.

Reading guide

Check yourself

QuestionRecall: which parameters does LightGCN learn, and why is there no need for dropout?Show answer

Only the layer-0 embeddings E(0), one vector for each user and each item. The propagation has no weight matrices, so the penalty on these embeddings is the only regulariser the paper needs, and dropout is not used.

QuestionCompute: a user has layer-0 value 2 and layer-1 value 4, with K = 1 and uniform layer weights. What is the final user value?Show answer

The final value is (2 + 4) / 2 = 3. The layer-0 term stays in the average, which is how the model keeps the node's own identity.

QuestionCompute: on Amazon-Book at 2 layers, LightGCN has recall 0.0411 and NGCF has 0.0330. What is the relative improvement?Show answer

The difference is 0.0411 minus 0.0330, which is 0.0081. Dividing by 0.0330 gives about 0.245, so LightGCN is about 24.5 percent higher, which matches the paper's figure.

QuestionWhy does the paper average over all layers instead of using only the last layer?Show answer

Repeated neighbour averaging over many layers pulls connected nodes toward the same value, which is over-smoothing. Averaging over all layers keeps the layer-0 value and mixes in neighbourhoods of different sizes. The paper finds that a last-layer-only variant peaks at layer 2 and then declines, while the averaged model keeps improving with depth.

QuestionScenario: a reader concludes that LightGCN beats every graph recommender on every dataset. Which limits should be stated?Show answer

The comparison is offline, on three public datasets, under the all-ranking recall and NDCG protocol at 20. The Yelp2018 data is a revised version and NGCF was re-run on it. The layer weights were fixed at uniform values rather than tuned, and the paper does not test nodes with rich input features. The claim is strongest for ID-only interaction graphs.

Sources

Read the full paper

Xiangnan He, Kuan Deng, Xiang Wang et al., 2020. arXiv:2002.02126