1
KGAT: Knowledge Graph Attention Network for Recommendation Xiang Wang , Xiangnan He , Yixin Cao , Meng Liu * , Tat-Seng Chua National University of Singapore, University of Science and Technology of China, * Shandong University Collaborative Knowledge Graph (CKG) Shape of You I See Fire Skin Castle on the Hill Interact Interact Interact Ed Sheeran ÷ Pop Folk IsSongOf SungBy Genre Genre Figure 1: Incorporating knowledge graph into user-item bipartite graph. Components of CKG Knowledge Graph Item-Item External Connections " $ % " User-Item Bipartite Graph User-Item Direct Interactions " $ ( " Collaborative Knowledge Graph High-order connectivity between users and items " $ ( " $ % " )$ % * è " $ ( * Possible reasons on potential recommendations Figure 2: Interlinks of CKG, especially high-order relations, bring benefits to rec- ommendation and explanations. How Prior Works Leverage CKG for Recommendation? Summary & Limitations of Three-type Works Supervised Learning- based Path- based Regularization- based Knowledge Usage Item knowledge è a generic feature vector Connectivity è paths connecting users & items Graph structure è an additional item representations or loss Relation Usage - To define meta-path Or select qualified paths To regularize the learning of KG embeddings Limitations Fail to capture CF signals Ignore semantic & structure information Require labor- intensive feature engineering Have rather high complexity Lack explicit modeling of high-order relations Examples FM, NFM, TEM, Wide&Deep … MCRec, RippleNet, FMG, KPRN … KTUP, CFKG, CKE … Figure 3: Due to the characteristics of these models, high-order relations have not been fully and properly explored. Our Goal: Develop a model that can exploit high-order information in KG in an efficient, explicit, and end-to-end manner. How to Achieve High-order Relation Modeling in an Explicit & End-to-End Manner? Inspired by the recent success of graph neural networks, we propose Knowledge Graph Attention Network (KGAT) for KG-based Recommendation. Knowledge Graph Attention Network (KGAT) () () () () * , - . / Concatenate Concatenate Attentive Embedding Propagation Layers Prediction Layer CKG Embedding Layer = = = = = () () () = () () () Figure 4: Illustration of the proposed KGAT model. I. CKG Embedding Layer We adopt TransR to parameterize entities and relations of CKG as vector represen- tations, considering direct connectivity of each triplet (h, r, t). g(h, r, t)= W r e h + e r - W r e t 2 2 , (1) L KG = X (h,r,t,t )∈T - ln σ g(h, r, t )- g(h, r, t) . (2) II. Attention Embedding Propagation Layer 1 Information Propagation: We perform information propagation between an entity h and its neighbors N h : e N h = X (h,r,t)∈N h π(h, r, t)e t , (3) where π(h, r, t) controls how much information being propagated from tail entity t to head entity h conditioned to relation r. 2 Knowledge-aware Attention: We implement π(h, r, t) via relational attention mechanism, which is formulated as follows: π(h, r, t)=(W r e t ) tanh (W r e h + e r ) . (4) 3 Information Aggregation: The final phase is to aggregate the entity representation e h and its ego-network representations e N h as the new representation of entity h: e (1) h =LeakyReLU W 1 (e h + e N h ) + LeakyReLU W 2 (e h e N h ) . (5) 4 High-order Propagation: We can further stack more propagation layers to explore the high-order connectivity information, gathering the information propagated from the higher-hop neighbors: e (l-1) N h = X (h,r,t)∈N h π(h, r, t)e (l-1) t . (6) III. Model Prediction After performing L layers, we obtain multiple representations for user node u, namely {e (1) u , ··· , e (L) u }; analogous to item node i, e * u = e (0) u ···e (L) u , e * i = e (0) i ···e (L) i . (7) Finally, we conduct inner product of user and item representations, so as to predict their matching score: ^ y(u, i)= e * u e * i , (8) L CF = X (u,i,j)∈O - ln σ ^ y(u, i)-^ y(u, j) . (9) IV. Model Optimization Finally, we have the objective function to learn Equations (2) and (9) jointly, as follows: L KGAT = L KG + L CF . (10) Results Overall Performance Comparison Amazon-Book Last-FM Yelp2018 recall ndcg recall ndcg recall ndcg FM 0. 1345 0. 0886 0. 0778 0. 1181 0. 0627 0. 0768 NFM 0. 1366 0. 0913 0. 0829 0. 1214 0. 0660 0. 0810 CKE 0. 1343 0. 0885 0. 0736 0. 1184 0. 0657 0. 0805 CFKG 0. 1142 0. 0770 0. 0723 0. 1143 0. 0522 0. 0644 MCRec 0. 1113 0. 0783 - - - - RippleNet 0. 1336 0. 0910 0. 0791 0. 1238 0. 0664 0. 0822 GC-MC 0. 1316 0. 0874 0. 0818 0. 1253 0. 0659 0. 0790 KGAT 0. 1489 0. 1006 0. 0870 0. 1325 0. 0712 0. 0867 %Improv. 8. 95% 10. 05% 4. 93% 5. 77% 7. 18% 5. 54% Figure 5: KGAT consistently yields the best performance on all the datasets. Interaction Sparsity Levels (a) ndcg on Amazon-Book (b) ndcg on Last-FM Figure 6: KGAT outperforms the other models in most cases, especially on the two sparsest user groups in Amazon-Book and Yelp2018. Case Study for Explainable Recommendation ! "#$ % &'(" How Few Remain Old Man’s War % &$") English * "+##, Novel * "+'', The Last Colony % ,"(' - # Interact #. &## #. #(( - && Original Language - &' Genre −- && Original Language −- &' Genre #. #(" #. #($ #. ##$ #. ##( John Scalzi * ",(&( Speculative Fiction * "+#'0 - &, Author #. #(& - &' Genre #. #(0 −- &' Genre #. #+( #. ##$ −- &, Author ! "#$ % '#0( Oath of Swords Old Man’s War % &$") ! ,")( ! "$)0 The Last Colony % ,"(' - # Interact #. #$" #. #() −- # Interact - # Interact - # Interact #. ##0 #. ##) #. #"$ #. #'+ ! ')(' ! ,,#& −- # Interact #. ##0 #. ##, #. #0" #. #"& - # Interact Figure 7: KGAT captures the behavior-based and attribute-based high-order con- nectivity, which play a key role to infer user preferences. Datasets & Codes Figure 8: Scan me to get three public datasets and KGAT codes. 25th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, Anchorage, Alaska

KGAT: Knowledge Graph Attention Network for …staff.ustc.edu.cn/~hexn/slides/kdd19-KGAT-poster.pdfRippleNet outperforms MCRec by a large margin in Amazon-book. One possible reason

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: KGAT: Knowledge Graph Attention Network for …staff.ustc.edu.cn/~hexn/slides/kdd19-KGAT-poster.pdfRippleNet outperforms MCRec by a large margin in Amazon-book. One possible reason

KGAT: Knowledge Graph Attention Network forRecommendation

Xiang Wang†, Xiangnan He‡, Yixin Cao†, Meng Liu∗, Tat-Seng Chua†† National University of Singapore, ‡ University of Science and Technology of China, ∗ Shandong University

Collaborative Knowledge Graph (CKG)Collaborative Knowledge Graph

𝒖𝟏 𝒖𝟐

𝒊𝟏Shape of You

𝒊𝟐I See Fire

𝒊𝟑Skin

𝒊𝟒Castle on the Hill

𝒓 𝟏Intera

ct 𝒓𝟏Interact

𝒓𝟏Interact

𝒆𝟏Ed Sheeran

𝒆𝟐÷ 𝒆𝟑

Pop

𝒆𝟒Folk

𝒓𝟐IsSongOf 𝒓𝟑

SungBy𝒓𝟒

Genre

𝒓𝟓Genre

Figure 1: Incorporating knowledge graph into user-item bipartite graph.

Components of CKG

Collaborative Knowledge Graph

Knowledge Graph• Item-Item External Connections

𝑖" →$% 𝑒"

User-Item Bipartite Graph• User-Item Direct Interactions

𝑢" →$( 𝑖"

Collaborative Knowledge Graph• High-order connectivity between users and items

𝑢" →$( 𝑖" →

$% 𝑒")$% 𝑖* è 𝑢" →

$( 𝑖*

• Possible reasons on potential recommendationsFigure 2: Interlinks of CKG, especially high-order relations, bring benefits to rec-ommendation and explanations.

How Prior Works Leverage CKG forRecommendation?

Summary & Limitations of Three-type WorksLimited Model Capacity of Prior Works

Supervised Learning-based

Path-based

Regularization-based

KnowledgeUsage

Item knowledgeèa generic featurevector

Connectivityèpaths connectingusers & items

Graph structureèan additional itemrepresentations orloss

RelationUsage

- To define meta-pathOr select qualifiedpaths

To regularize thelearning of KGembeddings

Limitations • Fail to capture CFsignals

• Ignore semantic &structureinformation

• Require labor-intensive featureengineering

• Have rather highcomplexity

• Lack explicitmodeling ofhigh-orderrelations

Examples FM, NFM, TEM,Wide&Deep …

MCRec, RippleNet,FMG, KPRN …

KTUP, CFKG, CKE …

Figure 3: Due to the characteristics of these models, high-order relations have notbeen fully and properly explored.

Our Goal: Develop a model that can exploit high-order information in KG in anefficient, explicit, and end-to-end manner.

How to Achieve High-order Relation Modeling inan Explicit & End-to-End Manner?

Inspired by the recent success of graph neural networks, we propose KnowledgeGraph Attention Network (KGAT) for KG-based Recommendation.

Knowledge Graph Attention Network (KGAT)

𝒆𝒊𝟑(𝟎)

𝒆𝒖𝟏(𝟏)𝒆𝒖𝟏(𝟐)𝒆𝒖𝟏(𝟑)

*𝑦,-./

Concatenate

Concatenate

Attentive Embedding Propagation Layers Prediction LayerCKG Embedding Layer

𝒍 = 𝟏

𝒍 = 𝟐𝒍 = 𝟑

𝒍 = 𝟐𝒍 = 𝟑

𝒆𝒊𝟑(𝟏)𝒆𝒊𝟑(𝟐)𝒆𝒊𝟑(𝟑)

𝒍 = 𝟏𝒆𝒖𝟏(𝟎)

𝒆𝒖𝟏(𝟎)

𝒆𝒊𝟑(𝟎)

𝒖𝟒𝒖𝟏 𝒖𝟓

𝒊𝟏 𝒊𝟐 𝒊𝟑 𝒊𝟒

𝒖𝟐 𝒖𝟑

𝒆𝟏 𝒆𝟐 𝒆𝟑

Figure 4: Illustration of the proposed KGAT model.

I. CKG Embedding LayerWe adopt TransR to parameterize entities and relations of CKG as vector represen-tations, considering direct connectivity of each triplet (h, r, t).

g(h, r, t) = ‖Wreh + er − Wret‖22 , (1)

LKG =∑

(h,r,t,t ′)∈T− lnσ

g(h, r, t ′) − g(h, r, t). (2)

II. Attention Embedding Propagation Layer

1 Information Propagation: We perform information propagation betweenan entity h and its neighbors Nh:

eNh =∑

(h,r,t)∈Nh

π(h, r, t)et, (3)

where π(h, r, t) controls how much information being propagated from tailentity t to head entity h conditioned to relation r.

2 Knowledge-aware Attention: We implement π(h, r, t) via relationalattention mechanism, which is formulated as follows:

π(h, r, t) = (Wret)>tanh(Wreh + er)

. (4)

3 Information Aggregation: The final phase is to aggregate the entityrepresentation eh and its ego-network representations eNh as the newrepresentation of entity h:

e(1)h =LeakyReLUW1(eh + eNh)

+ LeakyReLUW2(eh � eNh)

. (5)

4 High-order Propagation: We can further stack more propagation layers toexplore the high-order connectivity information, gathering the informationpropagated from the higher-hop neighbors:

e(l−1)Nh =∑

(h,r,t)∈Nh

π(h, r, t)e(l−1)t . (6)

III. Model PredictionAfter performing L layers, we obtain multiple representations for user node u,namely {e(1)u , · · · , e(L)u }; analogous to item node i,

e∗u = e(0)u ‖ · · · ‖e(L)u , e∗i = e(0)i ‖ · · · ‖e(L)i . (7)

Finally, we conduct inner product of user and item representations, so as to predicttheir matching score:

y(u, i) = e∗u>e∗i , (8)

LCF =∑

(u,i,j)∈O− lnσ

y(u, i) − y(u, j). (9)

IV. Model Optimization

Finally, we have the objective function to learn Equations (2) and (9) jointly, asfollows:

LKGAT = LKG + LCF. (10)

Results

Overall Performance Comparison

(a) ndcg on Amazon-Book (b) ndcg on Last-FM (c) ndcg on Yelp2018Figure 3: Performance comparison over the sparsity distribution of user groups on different datasets. The backgroundhistograms indicate the density of each user group; meanwhile, the lines demonstrate the performance w.r.t. ndcg@20.

Table 2: Overall Performance Comparison.Amazon-Book Last-FM Yelp2018recall ndcg recall ndcg recall ndcg

FM 0.1345 0.0886 0.0778 0.1181 0.0627 0.0768NFM 0.1366 0.0913 0.0829 0.1214 0.0660 0.0810CKE 0.1343 0.0885 0.0736 0.1184 0.0657 0.0805CFKG 0.1142 0.0770 0.0723 0.1143 0.0522 0.0644MCRec 0.1113 0.0783 - - - -RippleNet 0.1336 0.0910 0.0791 0.1238 0.0664 0.0822GC-MC 0.1316 0.0874 0.0818 0.1253 0.0659 0.0790KGAT 0.1489∗ 0.1006∗ 0.0870∗ 0.1325∗ 0.0712∗ 0.0867∗

%Improv. 8.95% 10.05% 4.93% 5.77% 7.18% 5.54%

4.3.1 Overall Comparison. The performance comparison resultsare presented in Table 2. We have the following observations:• KGAT consistently yields the best performance on all the datasets.In particular, KGAT improves over the strongest baselines w.r.t.recall@20 by 8.95%, 4.93%, and 7.18% in Amazon-book, Last-FM, and Yelp2018, respectively. By stacking multiple attentiveembedding propagation layers, KGAT is capable of exploringthe high-order connectivity in an explicit way, so as to capturecollaborative signal effectively. This verifies the significance ofcapturing collaborative signal to transfer knowledge. Moreover,compared with GC-MC, KGAT justifies the effectiveness ofthe attention mechanism, specifying the attentive weights w.r.t.compositional semantic relations, rather than the fixed weightsused in GC-MC.• SL methods (i.e., FM and NFM) achieve better performance thanthe CFKG and CKE in most cases, indicating that regularization-based methods might not make full use of item knowledge. Inparticular, to enrich the representation of an item, FM and NFMexploit the embeddings of its connected entities, while CFKGand CKE only use that of its aligned entities. Furthermore, thecross features in FM and NFM actually serve as the second-orderconnectivity between users and entities, whereas CFKG and CKEmodel connectivity on the granularity of triples, leaving high-order connectivity untouched.• Compared to FM, the performance of RippleNet verifies thatincorporating two-hop neighboring items is of importance toenrich user representations. It therefore points to the positiveeffect of modeling the high-order connectivity or neighbors.However, RippleNet slightly underperforms NFM in Amazon-book and Last-FM, while performing better in Yelp2018. Onepossible reason is that NFM has stronger expressiveness, since the

hidden layer allows NFM to capture the nonlinear and complexfeature interactions between user, item, and entity embeddings.• RippleNet outperforms MCRec by a large margin in Amazon-book. One possible reason is that MCRec depends heavily onthe quality of meta-paths, which require extensive domainknowledge to define. The observation is consist with [29].• GC-MC achieves comparable performance to RippleNet in Last-FM and Yelp2018 datasets. While introducing the high-orderconnectivity into user and item representations, GC-MC forgoesthe semantic relations between nodes; whereas RippleNet utilizesrelations to guide the exploration of user preferences.

4.3.2 Performance Comparison w.r.t. Interaction SparsityLevels. One motivation to exploiting KG is to alleviate the sparsityissue, which usually limits the expressiveness of recommendersystems. It is hard to establish optimal representations for inactiveusers with few interactions. Here we investigate whether exploitingconnectivity information helps alleviate this issue.

Towards this end, we perform experiments over user groups ofdifferent sparsity levels. In particular, we divide the test set intofour groups based on interaction number per user, meanwhile tryto keep different groups have the same total interactions. TakingAmazon-book dataset as an example, the interaction numbers peruser are less than 7, 15, 48, and 4475 respectively. Figure 3 illustratesthe results w.r.t. ndcg@20 on different user groups in Amazon-book,Last-FM, and Yelp2018. We can see that:

• KGAT outperforms the other models in most cases, especially onthe two sparsest user groups in Amazon-Book and Yelp2018.It again verifies the significance of high-order connectivitymodeling, which 1) contains the lower-order connectivity usedin baselines, and 2) enriches the representations of inactive usersvia recursive embedding propagation.• It is worthwhile pointing out that KGAT slightly outperformssome baselines in the densest user group (e.g., the < 2057 groupof Yelp2018). One possible reason is that the preferences of userswith too many interactions are too general to capture. High-orderconnectivity could introducemore noise into the user preferences,thus leading to the negative effect.

4.4 Study of KGAT (RQ2)To get deep insights on the attentive embedding propagation layerof KGAT, we investigate its impact. We first study the influenceof layer numbers. In what follows, we explore how different

Figure 5: KGAT consistently yields the best performance on all the datasets.

Interaction Sparsity Levels

(a) ndcg on Amazon-Book (b) ndcg on Last-FM (c) ndcg on Yelp2018Figure 3: Performance comparison over the sparsity distribution of user groups on different datasets. The backgroundhistograms indicate the density of each user group; meanwhile, the lines demonstrate the performance w.r.t. ndcg@20.

Table 2: Overall Performance Comparison.Amazon-Book Last-FM Yelp2018recall ndcg recall ndcg recall ndcg

FM 0.1345 0.0886 0.0778 0.1181 0.0627 0.0768NFM 0.1366 0.0913 0.0829 0.1214 0.0660 0.0810CKE 0.1343 0.0885 0.0736 0.1184 0.0657 0.0805CFKG 0.1142 0.0770 0.0723 0.1143 0.0522 0.0644MCRec 0.1113 0.0783 - - - -RippleNet 0.1336 0.0910 0.0791 0.1238 0.0664 0.0822GC-MC 0.1316 0.0874 0.0818 0.1253 0.0659 0.0790KGAT 0.1489∗ 0.1006∗ 0.0870∗ 0.1325∗ 0.0712∗ 0.0867∗

%Improv. 8.95% 10.05% 4.93% 5.77% 7.18% 5.54%

4.3.1 Overall Comparison. The performance comparison resultsare presented in Table 2. We have the following observations:• KGAT consistently yields the best performance on all the datasets.In particular, KGAT improves over the strongest baselines w.r.t.recall@20 by 8.95%, 4.93%, and 7.18% in Amazon-book, Last-FM, and Yelp2018, respectively. By stacking multiple attentiveembedding propagation layers, KGAT is capable of exploringthe high-order connectivity in an explicit way, so as to capturecollaborative signal effectively. This verifies the significance ofcapturing collaborative signal to transfer knowledge. Moreover,compared with GC-MC, KGAT justifies the effectiveness ofthe attention mechanism, specifying the attentive weights w.r.t.compositional semantic relations, rather than the fixed weightsused in GC-MC.• SL methods (i.e., FM and NFM) achieve better performance thanthe CFKG and CKE in most cases, indicating that regularization-based methods might not make full use of item knowledge. Inparticular, to enrich the representation of an item, FM and NFMexploit the embeddings of its connected entities, while CFKGand CKE only use that of its aligned entities. Furthermore, thecross features in FM and NFM actually serve as the second-orderconnectivity between users and entities, whereas CFKG and CKEmodel connectivity on the granularity of triples, leaving high-order connectivity untouched.• Compared to FM, the performance of RippleNet verifies thatincorporating two-hop neighboring items is of importance toenrich user representations. It therefore points to the positiveeffect of modeling the high-order connectivity or neighbors.However, RippleNet slightly underperforms NFM in Amazon-book and Last-FM, while performing better in Yelp2018. Onepossible reason is that NFM has stronger expressiveness, since the

hidden layer allows NFM to capture the nonlinear and complexfeature interactions between user, item, and entity embeddings.• RippleNet outperforms MCRec by a large margin in Amazon-book. One possible reason is that MCRec depends heavily onthe quality of meta-paths, which require extensive domainknowledge to define. The observation is consist with [29].• GC-MC achieves comparable performance to RippleNet in Last-FM and Yelp2018 datasets. While introducing the high-orderconnectivity into user and item representations, GC-MC forgoesthe semantic relations between nodes; whereas RippleNet utilizesrelations to guide the exploration of user preferences.

4.3.2 Performance Comparison w.r.t. Interaction SparsityLevels. One motivation to exploiting KG is to alleviate the sparsityissue, which usually limits the expressiveness of recommendersystems. It is hard to establish optimal representations for inactiveusers with few interactions. Here we investigate whether exploitingconnectivity information helps alleviate this issue.

Towards this end, we perform experiments over user groups ofdifferent sparsity levels. In particular, we divide the test set intofour groups based on interaction number per user, meanwhile tryto keep different groups have the same total interactions. TakingAmazon-book dataset as an example, the interaction numbers peruser are less than 7, 15, 48, and 4475 respectively. Figure 3 illustratesthe results w.r.t. ndcg@20 on different user groups in Amazon-book,Last-FM, and Yelp2018. We can see that:

• KGAT outperforms the other models in most cases, especially onthe two sparsest user groups in Amazon-Book and Yelp2018.It again verifies the significance of high-order connectivitymodeling, which 1) contains the lower-order connectivity usedin baselines, and 2) enriches the representations of inactive usersvia recursive embedding propagation.• It is worthwhile pointing out that KGAT slightly outperformssome baselines in the densest user group (e.g., the < 2057 groupof Yelp2018). One possible reason is that the preferences of userswith too many interactions are too general to capture. High-orderconnectivity could introducemore noise into the user preferences,thus leading to the negative effect.

4.4 Study of KGAT (RQ2)To get deep insights on the attentive embedding propagation layerof KGAT, we investigate its impact. We first study the influenceof layer numbers. In what follows, we explore how different

Figure 6: KGAT outperforms the other models in most cases, especially on the twosparsest user groups in Amazon-Book and Yelp2018.

Case Study for Explainable Recommendation

!"#$

%&'("How Few Remain Old Man’s War

%&$")

English*"+##,

Novel*"+'',

The Last Colony%,"('

-# Interact#. &## #. #((

-&& Original Language -&' Genre

−-&& Original Language −-&' Genre

#. #(" #. #($

#. ##$ #. ##(

John Scalzi*",(&(

Speculative Fiction*"+#'0

-&, Author#. #(&

-&' Genre#. #(0

−-&' Genre

#. #+(#. ##$

−-&, Author

!"#$

%'#0(Oath of Swords Old Man’s War

%&$")

!,")( !"$)0

The Last Colony%,"('

-# Interact#. #$" #. #()

−-# Interact

-# Interact -# Interact

#. ##0 #. ##)

#. #"$ #. #'+

!')(' !,,#&

−-# Interact

#. ##0 #. ##,

#. #0"#. #"&

-# Interact

Figure 7: KGAT captures the behavior-based and attribute-based high-order con-nectivity, which play a key role to infer user preferences.

Datasets & Codes

Figure 8: Scan me to get three public datasets and KGAT codes.

25th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, Anchorage, Alaska