ChainGram: Discovering A Structural Grammar for Knowledge Graph Foundation Models
Anonymous authors
ICLR 2027
Abstract. Knowledge graph foundation models (KGFMs) are emerging as a promising paradigm for transferable reasoning over knowledge graphs. By learning invariant patterns, they enable zero-shot inference on new KGs with unseen entities and relations. Existing KGFMs capture these patterns through relational interactions. However, these patterns are often implicitly encoded in learned representations, making them difficult to identify, organize, and reuse explicitly. Inspired by natural language grammar, we ask whether invariant patterns across KGs can be explicitly abstracted and organized into a transferable structural grammar. To this end, we propose ChainGram, a chain-based KGFM that learns such a grammar from relational chains across KGs for query-specific reasoning. Specifically, we propose a hierarchical codebook encoder to learn word-level structural codes and chain-level prototypes from relational chains. These prototypes are further aggregated into a relation-specific structural grammar. A grammar-guided reasoner then selects relevant patterns based on query-specific chains and aggregates pattern-consistent evidence for entity prediction. Experimental results across 54 KGs demonstrate that ChainGram achieves the best performance across all six evaluation settings, improving overall MRR over the strongest baseline by 2.82% under zero-shot inference and 5.84% with full fine-tuning. Our code is available at https://anonymous.4open.science/r/ChainGram-2857/.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
ICLR 2027
Under review · 3 reviews · OpenReview
Updated 25 Nov 2026, 10:35 UTC.
- Rating
- 3/4(+1)
- Confidence
- 3/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
Summary
This paper studies cross-graph link prediction with knowledge graph foundation models (KGFMs) and proposes ChainGram. The method converts relational chains sampled around support facts into identity-independent structural tokens and constructs shared structural codebooks through word-level and chain-level vector quantization. These representations are aggregated into relation-specific structural patterns, which guide the matching and weighting of chains rooted at the query entity. The resulting chain evidence refines the entity predictions of a query-conditioned GNN.
The main contribution is the integration of relational-chain representations, hierarchical discrete structural abstraction, and query-specific evidence selection into a reasoning architecture with parameters shared across knowledge graphs.
The authors pretrain the model on three source KGs and evaluate it on 54 target benchmark configurations spanning three transfer settings under zero-shot and full fine-tuning protocols. The main results report relative improvements in overall MRR of 2.82% and 5.84%, respectively, over the strongest baseline. Ablation studies, codebook perturbation experiments, and controlled structural probes provide additional evidence that the hierarchical codebooks and chain-matching mechanism contribute to predictive performance.
Strengths
- A well-motivated mechanism for structural transfer
The hierarchical codebooks organize local relational roles and whole-chain patterns into shared structural units, which are subsequently used for relation initialization and query-specific evidence matching. This design directly addresses a central challenge in cross-KG transfer: entity and relation identities need not be shared, whereas structural patterns may be transferable.
The performance degradation observed when the structure–code assignments are perturbed provides stronger evidence of the codebooks’ predictive utility than clustering visualizations alone.
This is an important methodological strength because the approach offers a concrete mechanism for organizing transferable structural knowledge, rather than merely improving prediction through a less structured representation.
- Broad evaluation with consistent aggregate improvements
The main evaluation covers 54 target benchmark configurations, including unseen-entity, unseen-entity-and-relation, and transductive settings, under both zero-shot and fine-tuning protocols. The aggregate results in the main table consistently favor the complete model over the compared methods.
This breadth is particularly relevant to the overall assessment because transferability is the central objective of KGFMs. Evaluation across multiple target settings provides substantially stronger support for that objective than improvements on a small number of individual datasets.
Weaknesses
- The method specification does not yet adequately support the central claims of ordered relational composition and grammar matching
There are two related technical concerns.
First, the preservation of relational information is unclear. According to Eq. (4), two chains with the same sequence of entity distance labels and the same query-relation indicators could receive identical token sequences even if the types or repetition patterns of their non-query relations differ. Subsequent Transformer encoding and quantization cannot recover information that is absent from the input.
This does not imply that the AAAB/AABA/ABAA probe is necessarily indistinguishable under the proposed tokenization: the patterns could still be distinguished if A or B is marked as the query relation. However, the authors need to specify the query relation and the resulting tokens used in this probe. Without this information, it is difficult to determine whether the experiment tests general relational-composition capabilities or primarily the ability to identify the position of a query-relation marker.
Second, the attention-based matching mechanism requires clarification. If is a single vector, the attention weight over the single key in Eq. (16) is necessarily one. In that case, the attention operation itself cannot select among different patterns based on the query chain. The subsequent matching network can still depend on the query chain, so this concern does not imply that the entire reasoner is ineffective. Nevertheless, the explanation of pattern matching through attention needs to be revised or made more precise.
These concerns are important because they affect whether the specified model implements the paper’s central mechanism, rather than merely reflecting minor presentation issues. If unresolved, they would weaken both the technical justification of the contribution and its reproducibility.
- The contribution of the structural grammar mechanism is not sufficiently disentangled from conventional chain modeling and additional computation
The model includes multiple Transformers, two levels of codebooks, and an additional chain-based prediction branch. Although the ablations provide useful evidence, they do not yet clearly establish whether the gains primarily arise from hierarchical discrete abstraction or from stronger continuous chain encoding and additional computation.
In particular:
- M1 and M4 are both described as removing chain reasoning or matching and relying on the base GNN; their actual architectural differences are unclear.
- Parameter-matched or compute-matched continuous chain baselines are not sufficiently reported.
- The main results do not include variability estimates or confidence intervals. While some appendix analyses use three random seeds, the statistical treatment of the main table remains unclear.
- Some reported advantages are very small. For example, under fine-tuning in the Inductive-E setting, Hits@10 is 0.5679 compared with 0.5678 for the strongest baseline. Statistical evidence is needed to assess the robustness of such differences.
Chain modeling and vector quantization are not themselves new techniques. Unless the paper establishes that their proposed combination provides distinctive benefits beyond conventional model enhancement, the contribution may be better characterized as an effective architectural integration than as evidence of structural grammar discovery.
Questions for the authors
A. Clarification of the Current Method
Question 1: What relational information is preserved by Eq. (4)?
Please provide the complete token sequence for a concrete example chain and clarify:
- Whether the tokenization encodes equality or differences among non-query relations;
- How forward and inverse relations are represented;
- How is specified in the AAAB/AABA/ABAA probe.
Question 2: What are the actual tensor shapes in Eqs. (12) and (16)?
Is a single vector or a collection of pattern representations? If it is a single vector, please explain the role of attention over a single key. If it is a collection, please specify how the individual patterns are constructed and aggregated.
B. Evidence Supporting the Current Conclusions
Question 3: Does the hierarchical discrete mechanism provide statistically robust improvements over continuous chain models under comparable resource budgets?
Please clarify the distinction between M1 and M4 and provide a directly comparable continuous chain control model, together with parameter counts, inference costs, and results across multiple random seeds.
Question 4: What are the exact evaluation sets and the rules governing access to graph information?
Please clarify:
- Why the target-set composition changes from 23/16/15 to 23/18/13 in the alternative pretraining experiment;
- Which target datasets are excluded or replaced when FB15k-237 and CoDEx-M are used for pretraining;
- Whether the prediction target triple and its inverse edge are removed from the reasoning context during training;
- Whether support sampling strictly uses only facts permitted by the evaluation protocol.
5 comments
W2. Disentangling the grammar mechanism from chain modeling and additional computation
Thank you for this valuable feedback. We (1) clarify the definitions of M1 and M4, (2) add controls for grammar guidance and discrete abstraction, (3) report parameter and inference costs, and (4) report multi-seed results.
Part 1: Definitions of M1 and M4.
- M1 (w/o chain reasoning) measures the overall contribution of chain-based reasoning. It removes both the grammar encoder (Eqs. 2–12) and the chain reasoner (Eqs. 15–18), so predictions are made solely by the base query-conditioned GNN.
- M4 (w/o grammar-guided reasoner) measures the contribution of query-side chain grammar. It keeps the grammar encoder for relation initialization and removes only the query-chain reasoner and its score correction (Eqs. 15–18).
Part 2: Contribution of grammar guidance and discrete abstraction. We add three controls that change only one component at a time:
- M4-U and M4-C keep the query-chain reasoner and its score correction but remove grammar matching, using uniform weights or weights learned from the chain representation alone.
- M5 removes both word-level and chain-level vector quantization and uses continuous representations instead, serving as a directly comparable continuous chain model.
M4-U and M4-C bring only marginal gains over M4 despite keeping the chain branch, and M5 underperforms the full model, showing that the gains come from grammar guidance and discrete abstraction rather than continuous chain encoding.
| Variant | Ind-E,R MRR | Ind-E,R H@10 | Ind-E MRR | Ind-E H@10 | Trans MRR | Trans H@10 | Overall MRR | Overall H@10 |
|---|---|---|---|---|---|---|---|---|
| M1: w/o chain reasoning | 0.4107 | 0.5897 | 0.4112 | 0.5437 | 0.3228 | 0.4670 | 0.3864 | 0.5420 |
| M4: w/o grammar-guided reasoner | 0.4194 | 0.6058 | 0.4165 | 0.5557 | 0.3251 | 0.4634 | 0.3923 | 0.5514 |
| M4-U: uniform chain weights | 0.4198 | 0.6027 | 0.4201 | 0.5553 | 0.3238 | 0.4687 | 0.3932 | 0.5514 |
| M4-C: chain-only weights | 0.4227 | 0.6046 | 0.4204 | 0.5554 | 0.3243 | 0.4680 | 0.3947 | 0.5521 |
| M5: continuous (w/o both VQ levels) | 0.4177 | 0.5915 | 0.4173 | 0.5500 | 0.3136 | 0.4683 | 0.3887 | 0.5450 |
| ChainGram (full) | 0.4247 | 0.6069 | 0.4227 | 0.5562 | 0.3280 | 0.4725 | 0.3973 | 0.5546 |
Part 3: Parameter and computational cost. ChainGram is computationally efficient. On 10 inductive KGs with an A100 GPU, the chain components add about 0.24M parameters over M1 but increase inference time by only 4.0%. M5 has nearly the same cost as the full model, so discrete abstraction brings its gains at negligible extra cost.
| Variant | #Params | Total time (10 KGs) | Time per query group |
|---|---|---|---|
| M1: w/o chain reasoning | 142,392 | 140.87 s | 4.108 ms |
| M4: w/o grammar-guided reasoner | 294,604 | 143.50 s | 4.185 ms |
| M5: continuous (w/o both VQ levels) | 374,974 | 146.30 s | 4.266 ms |
| ChainGram (full) | 381,886 | 146.44 s | 4.270 ms |
Part 4: Statistical robustness. We run ChainGram with three random seeds and report the zero-shot results below. The overall MRR of ChainGram (0.3980 ± 0.0013) exceeds that of the strongest baseline KG-ICL (0.3864) by a margin far larger than its standard deviation.
| Metric | Ind-E,R | Ind-E | Trans | Overall |
|---|---|---|---|---|
| MRR | 0.4260 ± 0.0014 | 0.4228 ± 0.0010 | 0.3289 ± 0.0013 | 0.3980 ± 0.0013 |
| H@10 | 0.6068 ± 0.0012 | 0.5556 ± 0.0008 | 0.4734 ± 0.0028 | 0.5546 ± 0.0015 |
We have clarified the definitions of M1 and M4 in Sec. 4.4 and added these variants to Appendix D.4 of the revised manuscript.
Q1. Relational information preserved by Eq. (4)
Thank you for this question. As it is closely related to W1 Part 1, we briefly answer each of its three sub-questions below.
- (1) Equality or differences among non-query relations. The tokens do not encode equality among non-query relations; instead, relational identity is recovered through the slot aggregation in Eq. (12), where positions occupied by the same relation are pooled into the same slot.
- (2) Forward and inverse relations. Each relation is augmented with an inverse relation as a separate relation, so direction is represented by relation identity and preserved in separate slots.
- (3) Query relation in the probe. is randomly assigned a relation ID distinct from both and , so the three patterns can only be distinguished through relational composition rather than a query marker.
For the complete token sequence of a concrete example and further details, please kindly refer to W1 Part 1.
Q2. Tensor shapes in Eqs. (12) and (16)
Thank you for this question. As it is closely related to W1 Part 2, we briefly clarify the tensor shapes and the construction of the pattern tokens below.
- (1) Single vector or collection. Eq. (12) produces a pattern for every relation, and the attention in Eq. (16) operates over a collection of four pattern tokens rather than a single vector.
- (2) Construction and aggregation. The patterns of all relations are averaged into a summary , which is then expanded into the four tokens through a learnable projection with token offsets.
For the full formulation, please kindly refer to W1 Part 2.
Q3. Robustness of the hierarchical discrete mechanism
Thank you for this question. We have conducted additional ablations, cost measurements, and multi-seed experiments, which are detailed in W2. We summarize the answers to each requested item below.
- (1) Distinction between M1 and M4. M1 removes all chain components, whereas M4 keeps the grammar encoder and removes only the query-chain reasoner.
- (2) Comparable continuous chain control. M5 replaces both levels of vector quantization with continuous representations and underperforms the full model.
- (3) Parameter counts and inference costs. M5 has nearly the same cost as the full model, and ChainGram increases inference time by only 4.0% over M1.
- (4) Multiple random seeds. Over three seeds, ChainGram achieves an overall MRR of 0.3980 ± 0.0013, well above the strongest baseline.
For the detailed results, please kindly refer to W2 Parts 1–4.
Q4. Evaluation sets and access to graph information
Thank you for these questions. We clarify the target-set composition under the alternative pretraining setting, the removal of target triples during training, and the graph information used for support sampling below.
(1)–(2) Target-set composition and replaced datasets. Under the alternative setting, FB15k-237, WN18RR, and CoDEx-M replace FB-v1, NELL-v1, and CoDEx-S as pretraining KGs, so these six KGs swap their pretraining and target roles:
| Target group | Main → Alternative | Added datasets | Removed datasets |
|---|---|---|---|
| Inductive-E,R | 23 → 23 | – | – |
| Inductive-E | 16 → 18 | FB-v1, NELL-v1 | – |
| Transductive | 15 → 13 | CoDEx-S | FB15k-237, WN18RR, CoDEx-M |
| Overall | 54 → 54 | 3 KGs | 3 KGs |
(3) Removal of target triples. During training, the target triple and its inverse edge are removed from the graph used for GNN message passing, and query-rooted chains that traverse either edge are discarded.
(4) Support sampling. Following KG-ICL [1], support facts and their chains are sampled only from the observed graph of each KG under the evaluation protocol, i.e., the training graph for transductive KGs and the inference graph for inductive KGs. Validation and test triples are never used as support facts.
We thank the reviewer again for the valuable comments, which have helped us improve the clarity and rigor of the paper.
[1] Yuanning Cui, Zequn Sun, and Wei Hu. A Prompt-Based Knowledge Graph Foundation Model for Universal In-Context Reasoning. Advances in Neural Information Processing Systems, 37:7095–7124, 2024.
- Rating
- 2/4
- Confidence
- 4/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
Summary
ChainGram learns a transferable structural grammar from relational chains for knowledge graph foundation models. It uses query-relative structural tokens, word-level and chain-level codebooks, and grammar-guided chain matching for entity prediction. Experiments on 54 target KGs show improvements over existing methods under both zero-shot and full fine-tuning protocols.
Strengths
1.Insightful hierarchical design. The Hierarchical Grammar Encoder organizes structural information into local structural roles, chain-level prototypes, and relation-specific grammar patterns. This design explicitly organizes structural patterns into a shared vocabulary and relation-specific grammar patterns for cross-KG reasoning.
2.Notable performance improvements. ChainGram achieves the best aggregate results across all six evaluation settings on 54 target KGs, with relative overall MRR gains over the strongest baseline of 2.82% under zero-shot inference and 5.84% after full fine-tuning.
3.Analysis of learned patterns. The paper examines prototype separability, chain-weight relevance, codebook utilization, and cross-KG pattern consistency. The controlled synthetic experiment provides evidence that the model preserves the tested four-hop patterns across different relation identities.
Weaknesses
1.The ablations do not clearly establish the contribution of the proposed components. The distinction between M1 and M4 is unclear. The paper should specify which modules are removed in M1 and how it differs from M4. In M4, removing grammar-guided chain matching also removes the query-chain score correction, so this comparison does not isolate the benefit of grammar guidance over simpler chain aggregation. Moreover, the chain-level perturbation in Fig. D.3(b) causes little MRR change, which does not clearly support the stated claim.
2.Lack of hyperparameter sensitivity analysis. The model uses four-hop support chains and query-rooted chains, but no results for other chain lengths are reported. The paper also does not examine sensitivity to the number of sampled chains or the word-level and chain-level codebook sizes. It is therefore unclear whether the reported gains are robust to these choices, especially across KGs with different structural properties.
3.Incomplete comparison under the standard pretraining configuration. The main experiments use FB-v1, NELL-v1, and CoDEx-S, rather than the commonly used FB15k-237, WN18RR, and CoDEx-M configuration. Although all methods share the same pretraining data in the main experiments, Table D.7 evaluates the alternative configuration only for five structure-based baselines under zero-shot inference. Comparisons with ProLink, SEMMA, and KRLM, as well as full fine-tuning results for all models under this configuration, are missing. It therefore remains unclear whether ChainGram’s reported advantages hold across baseline families and evaluation protocols when this pretraining configuration is used.
4.Missing discussion of closely related in-context learning work. ChainGram constructs relation-specific support contexts from observed triples sharing the query relation. The use of observed triples sharing the query relation as support contextis closely related to KGPFN, which also uses instances of the query relation and their local neighborhoods for in-context learning. Although the paper discusses KG-ICL, it does not address KGPFN. The authors should cite KGPFN and clarify the methodological differences between KGPFN and ChainGram, particularly in how they construct and use relation-specific context.
Questions for the authors
Please see the Weaknesses.
3 comments
We sincerely thank the reviewer for the detailed and constructive comments, and for recognizing the insightful hierarchical design, the notable performance improvements, and the analysis of learned patterns in ChainGram. We address each concern point by point below.
W1. Clarity of the ablation study
To address the concerns about the ablation study, we have made two improvements: (1) clarified the definitions of M1 and M4, (2) added fine-grained ablations on grammar guidance and discrete abstraction. We have also revised the claim about the chain-level perturbation.
(1) Definitions of M1 and M4.
-
M1 (w/o chain reasoning) measures the overall contribution of chain-based reasoning. It removes all chain components, including both the grammar encoder (Eqs. 2–12) and the chain reasoner (Eqs. 15–18). Consequently, relation representations are no longer initialized from grammar patterns, and predictions are made solely by the base query-conditioned GNN.
-
M4 (w/o grammar-guided reasoner) measures the contribution of query-side chain grammar. It retains the grammar encoder and removes only the query-chain reasoner together with its score correction (Eqs. 15-18).
(2) Fine-grained ablations of grammar guidance and discrete abstraction. To address the concern that M4 removes the score correction together with grammar guidance, we add three variants that change only one component at a time:
- M4-U (uniform weights) retains the query-chain reasoner and its score correction but removes grammar matching, assigning equal weights to all valid query chains.
- M4-C (chain-only weights) retains the query-chain reasoner and its score correction but removes grammar matching and learns chain weights from the query-chain representation alone, .
- M5 (continuous) removes both word-level and chain-level vector quantization and uses continuous representations instead.
As shown below, all three variants underperform the full model. M4-U and M4-C bring only marginal gains over M4, indicating that grammar guidance provides additional benefits beyond simple chain aggregation. M5 performs worse than removing either quantization level alone (M2: 0.3904, M3: 0.3936), demonstrating that discrete abstraction contributes beyond continuous chain encoding.
| Variant | Ind-E,R MRR | Ind-E,R H@10 | Ind-E MRR | Ind-E H@10 | Trans MRR | Trans H@10 | Overall MRR | Overall H@10 |
|---|---|---|---|---|---|---|---|---|
| M1: w/o chain reasoning | 0.4107 | 0.5897 | 0.4112 | 0.5437 | 0.3228 | 0.4670 | 0.3864 | 0.5420 |
| M4: w/o grammar-guided reasoner | 0.4194 | 0.6058 | 0.4165 | 0.5557 | 0.3251 | 0.4634 | 0.3923 | 0.5514 |
| M4-U: uniform chain weights | 0.4198 | 0.6027 | 0.4201 | 0.5553 | 0.3238 | 0.4687 | 0.3932 | 0.5514 |
| M4-C: chain-only weights | 0.4227 | 0.6046 | 0.4204 | 0.5554 | 0.3243 | 0.4680 | 0.3947 | 0.5521 |
| M5: continuous (w/o both VQ levels) | 0.4177 | 0.5915 | 0.4173 | 0.5500 | 0.3136 | 0.4683 | 0.3887 | 0.5450 |
| ChainGram (full) | 0.4247 | 0.6069 | 0.4227 | 0.5562 | 0.3280 | 0.4725 | 0.3973 | 0.5546 |
We have clarified the definitions of M1 and M4 in Sec. 4.4 and added variants to Table D.8 of the revised manuscript.
Chain-level perturbation in Fig. D.3(b). We have revised the corresponding statement in Appendix D.3.4. The contribution of chain-level prototypes is better reflected by retraining without them (M3), which reduces overall MRR from 0.3973 to 0.3936.
W2. Hyperparameter sensitivity
Thank you for this insightful suggestion. We have added a sensitivity analysis on the chain length, the numbers of sampled support and query chains, and the sizes of the word-level and chain-level codebooks, varying one hyperparameter at a time while keeping the others at their default values.
ChainGram is robust to all four hyperparameters: across the 13 configurations, overall MRR varies by less than 0.005 and always remains above the strongest baseline KG-ICL (0.3864). Chain length has the most visible effect across transfer settings, where Inductive-E,R performs best with and Transductive with . The overall zero-shot results are summarized below.
| Hyperparameter | Value | Overall MRR | Overall H@10 |
|---|---|---|---|
| Chain length | 2 | 0.3967 | 0.5539 |
| 3 | 0.3987 | 0.5525 | |
| 4 | 0.3973 | 0.5546 | |
| 5 | 0.3995 | 0.5553 | |
| Sampled chains / | 16 / 32 | 0.4009 | 0.5561 |
| 32 / 64 | 0.3973 | 0.5546 | |
| 64 / 128 | 0.3966 | 0.5557 | |
| 128 / 256 | 0.3996 | 0.5578 | |
| Word codebook size | 32 | 0.3983 | 0.5532 |
| 64 | 0.3973 | 0.5546 | |
| 128 | 0.3998 | 0.5552 | |
| 256 | 0.4002 | 0.5583 | |
| Chain codebook size | 4 | 0.3988 | 0.5563 |
| 8 | 0.4012 | 0.5564 | |
| 16 | 0.3973 | 0.5546 | |
| 32 | 0.3991 | 0.5576 |
We have added this analysis to Sec. 4.6 of the revised manuscript, with the per-setting results provided in Appendix D.6.
W3. Comparison under the standard pretraining configuration
Thank you for this valuable suggestion. We have extended the comparison under the FB15k-237, WN18RR, and CoDEx-M pretraining datasets with the LLM-enhanced baselines (ProLINK, SEMMA, and KRLM) and full fine-tuning results for all models.
ChainGram achieves the best overall MRR and Hits@10 under both zero-shot inference and fine-tuning, outperforming both structure-based and LLM-enhanced baselines. This indicates that its advantage holds across baseline families under the standard pretraining configuration. The overall results are summarized below.
| Model | ZS MRR | ZS H@10 | FT MRR | FT H@10 |
|---|---|---|---|---|
| ULTRA | 0.3551 | 0.5096 | 0.4078 | 0.5617 |
| KG-ICL | 0.4099 | 0.5668 | 0.4401 | 0.5906 |
| TRIX | 0.3901 | 0.5480 | 0.4177 | 0.5691 |
| MOTIF | 0.3659 | 0.5208 | 0.4167 | 0.5685 |
| FLOCK | 0.3900 | 0.5531 | 0.4275 | 0.5826 |
| ProLINK | 0.3547 | 0.5094 | 0.3959 | 0.5487 |
| SEMMA | 0.3741 | 0.5260 | 0.4447 | 0.5980 |
| KRLM | 0.3803 | 0.5400 | 0.4231 | 0.5825 |
| ChainGram | 0.4165 | 0.5748 | 0.4531 | 0.6033 |
We have added the detailed zero-shot results under this configuration to Table 2 in the main text, and updated both the zero-shot and full fine-tuning results in Appendix Table D.9 (Appendix D.5.1) of the revised manuscript.
W4. Discussion of KGPFN
Thank you for bringing this meaningful work [1] to our attention. We have cited KGPFN in the Introduction section and added a discussion of it to the Related Work (Appendix A) of the revised manuscript.
Both methods use observed instances of the query relation as context, but KGPFN captures structural patterns in continuous neighborhood features, whereas ChainGram represents them explicitly as relational chains abstracted into discrete units shared across KGs. Specifically:
- Context construction. KGPFN encodes labeled positive and negative triples with head-centric NBFNet features, whereas ChainGram abstracts chains around positive support facts via two-level codebooks.
- Context usage. KGPFN uses the context to score candidates in a prior-fitted transformer, whereas ChainGram uses it to initialize relations and select query-specific chain evidence.
We thank the reviewer again for the valuable comments, which have helped us improve the completeness of the paper.
[1] Yisen Gao, Jiaxin Bai, Haoyu Huang, Zhongwei Xie, Yufei Li, Hong Ting Tsang, Sirui Han, and Yangqiu Song. KGPFN: Unlocking the Potential of Knowledge Graph Foundation Model via In-Context Learning. arXiv preprint arXiv:2605.14907, 2026.
Dear Reviewer,
We sincerely thank you for your time and valuable feedback.
We have posted our detailed responses to your comments and submitted a revised manuscript. With three days left in the discussion period, we would appreciate your feedback on whether these responses and revisions resolve your concerns.
We would be happy to provide any further clarification if needed.
Thank you again for your consideration.
Best regards,
Authors
- Rating
- 3/4
- Confidence
- 3/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
Summary
This paper proposes ChainGram, a chain-based knowledge graph foundation model (KGFM) that aims to explicitly capture and reuse invariant structural patterns across knowledge graphs. The authors argue that existing KGFMs typically encode such patterns implicitly in learned representations, making them difficult to identify and organize for transferable reasoning. Inspired by natural language grammar, ChainGram introduces a hierarchical framework that abstracts relational chains into reusable structural patterns and uses them to guide query-specific entity prediction. The authors evaluate ChainGram on 54 target KGs across three transfer settings, considering both zero-shot inference and full fine-tuning. ChainGram achieves the best aggregate performance among the compared methods, with relative improvements of 2.82% and 5.84% in overall MRR over the strongest baseline under zero-shot and full fine-tuning, respectively. Additional experiments investigate the transferability of learned structural patterns and the contributions of individual components.
Strengths
-
Transferable reasoning across heterogeneous knowledge graphs is an important problem for KGFMs. Moving beyond implicit structural representations toward explicitly modeled and reusable structural patterns is an interesting research direction.
-
The combination of word-level structural codes, chain-level prototypes, and relation-specific pattern aggregation provides a clear representation hierarchy. Integrating these abstractions with query-dependent chain evidence is a well-motivated architectural design.
Weaknesses
-
Although KG-ICL achieves the highest overall MRR among the baselines in both the zero-shot and full fine-tuning settings in Table 1, the per-dataset comparisons in Fig. 3, Fig. D.1, and Table D.6 only include FLOCK and KRLM. This makes it difficult to assess whether ChainGram's improvements over KG-ICL are consistent across different KGs or concentrated in a subset of datasets. Including per-dataset results for KG-ICL would provide stronger support for the claimed robustness of cross-KG generalization.
-
Table D.6 reports zero-shot results for KRLM on AristoV4, whereas Appendix D.5.3 states that this result is unavailable and excludes it from the zero-shot analysis. The authors should clarify this discrepancy and verify whether the reported aggregate results are affected.
Questions for the authors
-
Eq 12 constructs grammar patterns from support chains sampled for the query relation, whereas Eq 13 requires representations for the relations involved in GNN message passing. How does the model handle relations that are not covered by the sampled support chains? Are their grammar patterns precomputed, constructed on demand, or initialized using a default representation?
-
In Eq 16, the relation-specific grammar pattern appears to be represented by a single vector. If it is used as a single key/value token, the attention weight is necessarily one, making the MHA output independent of the query-chain representation . Could the authors clarify the actual tensor shape of the grammar pattern and explain what role MHA plays in query-dependent chain matching?
3 comments
We sincerely appreciate the reviewer for the constructive feedback and positive assessment of ChainGram. We address each comment point by point below.
W1. Per-dataset comparison with KG-ICL
Thank you for this valuable suggestion. We re-ran KG-ICL and compared it with ChainGram on each of the 54 target KGs under both zero-shot inference and full fine-tuning.
The results are summarized below. ChainGram performs on par with or better than KG-ICL on 36 of the 54 KGs (67%) under zero-shot inference and on 46 of the 54 KGs (85%) after fine-tuning. These results indicate that its improvements are not concentrated in a small subset of KGs, supporting the robustness of its cross-KG generalization. Detailed per-dataset results are provided in Table D.7.
| Transfer setting | Zero-shot (≥ / <) | Fine-tuning (≥ / <) |
|---|---|---|
| Inductive-E,R (23) | 16 / 7 | 22 / 1 |
| Inductive-E (16) | 11 / 5 | 13 / 3 |
| Transductive (15) | 9 / 6 | 11 / 4 |
| Overall (54) | 36 / 18 | 46 / 8 |
We have added KG-ICL to the per-dataset comparisons in Fig. 3 and Fig. D.1, and to the newly added Table D.7 of the revised manuscript.
W2. KRLM on AristoV4
Thank you for pointing out this inconsistency. It arose from an oversight in Appendix D.5.3, where KRLM's zero-shot result on AristoV4 was mistakenly treated as unavailable. In fact, only its fine-tuned result is unavailable due to OOM, as stated in Appendix D.2. For ease of reference, we list the result below.
| KRLM on AristoV4 | MRR | Hits@10 |
|---|---|---|
| Zero-shot | 0.228 | 0.343 |
| Fine-tuning | N/A (OOM) | N/A (OOM) |
Including this result in the aggregates slightly changes KRLM's relative MRR drop on text-missing KGs, and the average degradation of LLM-enhanced methods changes from 43.0% to 43.1%, which does not affect the conclusion.
| Model | Relative MRR drop (original) | Relative MRR drop (corrected) |
|---|---|---|
| KRLM | 44.10% | 44.33% |
| LLM-enhanced average | 43.0% | 43.1% |
We have corrected the description and included AristoV4 in all KRLM aggregates of Appendix D.5.3, and updated the corresponding numbers in Fig. D.6 of the revised manuscript. We thank the reviewer again for the careful check, which has helped us improve the consistency of the paper.
Q1. Relations not covered by support chains (Eqs. 12–13)
Thank you for this question. Relations not covered by the sampled support chains are initialized with a default representation; their grammar patterns are neither precomputed nor constructed on demand.
In Eq. 12, the weighted relation states are aggregated by relation slot, so that every relation in the KG obtains its own pattern:
where is the weighted sum of the states of relation in the support chains of the -th support fact, and is the corresponding total weight. For an uncovered relation, and thus , which Eq. 13 maps to a shared learned default representation.
We have revised Eq. 12 to define for every relation rather than only , and clarified this initialization around Eqs. 12–13 in Sec. 3.2–3.3 of the revised manuscript.
Q2. Tensor shapes and the role of MHA in Eq. (16)
Thank you for this question, and we apologize for the confusion caused by the oversimplified notation in Eq. (16). In fact, in our uploaded code, the grammar pattern is not used as a single key; instead, it is summarized and expanded into four pattern tokens over which each query chain attends. All reported results are therefore unaffected.
Specifically, the patterns from Eq. (12) are averaged into a summary and expanded into tokens , and each query chain attends over them:
where and are learnable. Since the attention weights depend on both and , different query chains obtain different readouts , which are then scored by . As the four tokens are derived from the same summary, we describe them as learned views of the support grammar rather than independent patterns.
We have revised Eq. (16) in Sec. 3.3 to include this token expansion and state the tensor shapes. We thank the reviewer again for helping us improve the precision of our method description.
Supplement for Per-dataset comparison with KG-ICL
Supplement to W1: Per-dataset MRR comparison with KG-ICL
Following the reviewer's suggestion, we list the per-dataset MRR of KG-ICL and ChainGram on all 54 target KGs below. The better result under each protocol is shown in bold. Hits@10 results are provided in Table D.7 of the revised manuscript.
| Setting | KG | KG-ICL (ZS) | ChainGram (ZS) | KG-ICL (FT) | ChainGram (FT) |
|---|---|---|---|---|---|
| Inductive-E,R | WK-25 | 0.429 | 0.429 | 0.430 | 0.431 |
| WK-50 | 0.272 | 0.271 | 0.209 | 0.275 | |
| WK-75 | 0.445 | 0.452 | 0.427 | 0.457 | |
| WK-100 | 0.270 | 0.261 | 0.281 | 0.267 | |
| FB-25 | 0.405 | 0.418 | 0.420 | 0.430 | |
| FB-50 | 0.349 | 0.354 | 0.372 | 0.373 | |
| FB-75 | 0.438 | 0.435 | 0.434 | 0.438 | |
| FB-100 | 0.498 | 0.494 | 0.491 | 0.496 | |
| NL-0 | 0.558 | 0.570 | 0.550 | 0.567 | |
| NL-25 | 0.512 | 0.504 | 0.517 | 0.540 | |
| NL-50 | 0.523 | 0.530 | 0.513 | 0.527 | |
| NL-75 | 0.464 | 0.464 | 0.442 | 0.461 | |
| NL-100 | 0.564 | 0.553 | 0.549 | 0.557 | |
| MT1 tax | 0.299 | 0.364 | 0.366 | 0.418 | |
| MT1 health | 0.379 | 0.380 | 0.353 | 0.396 | |
| MT2 sci | 0.250 | 0.328 | 0.289 | 0.385 | |
| MT2 org | 0.092 | 0.092 | 0.099 | 0.102 | |
| MT3 art | 0.252 | 0.267 | 0.254 | 0.314 | |
| MT3 infra | 0.636 | 0.648 | 0.650 | 0.697 | |
| MT4 sci | 0.301 | 0.303 | 0.267 | 0.312 | |
| MT4 health | 0.677 | 0.671 | 0.557 | 0.712 | |
| Metafam | 0.392 | 0.458 | 0.999 | 1.000 | |
| FBNELL | 0.505 | 0.520 | 0.520 | 0.524 | |
| Inductive-E | HM Indigo | 0.357 | 0.352 | 0.371 | 0.387 |
| HM 5k | 0.051 | 0.056 | 0.052 | 0.059 | |
| HM 3k | 0.058 | 0.059 | 0.062 | 0.057 | |
| HM 1k | 0.063 | 0.065 | 0.056 | 0.052 | |
| ILPC2022 Large | 0.279 | 0.278 | 0.315 | 0.327 | |
| ILPC2022 Small | 0.299 | 0.300 | 0.316 | 0.321 | |
| FB-v2 | 0.541 | 0.539 | 0.550 | 0.549 | |
| FB-v3 | 0.508 | 0.509 | 0.514 | 0.515 | |
| FB-v4 | 0.492 | 0.490 | 0.501 | 0.504 | |
| WN-v1 | 0.640 | 0.670 | 0.707 | 0.717 | |
| WN-v2 | 0.648 | 0.661 | 0.692 | 0.702 | |
| WN-v3 | 0.381 | 0.399 | 0.439 | 0.445 | |
| WN-v4 | 0.596 | 0.603 | 0.648 | 0.659 | |
| NL-v2 | 0.603 | 0.599 | 0.598 | 0.606 | |
| NL-v3 | 0.586 | 0.615 | 0.583 | 0.610 | |
| NL-v4 | 0.557 | 0.569 | 0.556 | 0.567 | |
| Transductive | FB15k-237 | 0.353 | 0.347 | 0.341 | 0.394 |
| WN18RR | 0.428 | 0.459 | 0.536 | 0.570 | |
| CoDEx Medium | 0.341 | 0.327 | 0.359 | 0.384 | |
| WDsinger | 0.454 | 0.478 | 0.493 | 0.495 | |
| NELL23k | 0.320 | 0.276 | 0.329 | 0.285 | |
| FB15k-237(10) | 0.257 | 0.172 | 0.261 | 0.175 | |
| FB15k-237(20) | 0.272 | 0.186 | 0.282 | 0.198 | |
| FB15k-237(50) | 0.323 | 0.233 | 0.335 | 0.249 | |
| NELL995 | 0.487 | 0.514 | 0.524 | 0.547 | |
| ConceptNet100k | 0.243 | 0.288 | 0.375 | 0.390 | |
| AristoV4 | 0.166 | 0.232 | 0.372 | 0.452 | |
| YAGO310 | 0.357 | 0.401 | 0.555 | 0.583 | |
| CoDEx Large | 0.292 | 0.297 | 0.340 | 0.358 | |
| DBpedia100k | 0.413 | 0.432 | 0.478 | 0.512 | |
| Hetionet | 0.244 | 0.277 | 0.132 | 0.427 |
Dear Reviewer,
We sincerely thank you for your time and valuable feedback.
We have posted our detailed responses to your comments and submitted a revised manuscript. With three days left in the discussion period, we would appreciate your feedback on whether these responses and revisions resolve your concerns.
If any questions or concerns remain, please let us know. We would be happy to address them promptly.
Thank you again for your consideration.
Best regards,
Authors
Comments on the paper
1 comment
General Response by Authors
General Response by Authors
Dear Program Chairs, Area Chair, and Reviewers, we sincerely appreciate the time and effort that all reviewers have devoted to evaluating our submission. We are grateful that the reviewers have recognized the strengths of our work in terms of problem motivation, methodological design, and experimental results. We have carefully considered all comments and conducted additional experiments and analyses to address the concerns. Below, we summarize the acknowledged strengths of our work and our responses to the common questions.
Reviewer Acknowledgment
We are grateful that all reviewers have recognized the following strengths of our work:
1. Motivation: Addressing an important problem in transferable reasoning across knowledge graphs.
- Reviewer BiN1: "Transferable reasoning across heterogeneous knowledge graphs is an important problem for KGFMs..."
- Reviewer BiN1: "Moving beyond implicit structural representations toward explicitly modeled and reusable structural patterns is an interesting research direction."
- Reviewer 766C: "...entity and relation identities need not be shared, whereas structural patterns may be transferable."
2. Methodology: Well-designed hierarchical structural grammar and reasoning framework.
- Reviewer BiN1: "The combination of word-level structural codes, chain-level prototypes, and relation-specific pattern aggregation provides a clear representation hierarchy..."
- Reviewer fkMA: "Insightful hierarchical design... that organizes structural information into local structural roles, chain-level prototypes, and relation-specific grammar patterns."
- Reviewer 766C: "The hierarchical codebooks organize local relational roles and whole-chain patterns into shared structural units..."
3. Experimental Results: Broad evaluation and comprehensive evidence of structural pattern learning.
- Reviewer BiN1: "ChainGram achieves the best aggregate performance... with relative improvements of 2.82% and 5.84% in overall MRR..."
- Reviewer fkMA: "The controlled synthetic experiment provides evidence that the model preserves the tested four-hop patterns across different relation identities."
- Reviewer 766C: "The main evaluation covers 54 target benchmark configurations... the aggregate results... consistently favor the complete model."
Common Questions
We thank the reviewers for their constructive feedback. We have conducted additional experiments and clarified the methodology to address the following concerns.
Q1. Experimental robustness and the contributions of the proposed components (BiN1, fkMA, 766C).
We have expanded our experimental evaluation with additional baseline comparisons, fine-grained ablations, hyperparameter sensitivity analyses, and multi-seed experiments. The results demonstrate strong performance and robustness across diverse knowledge graphs and evaluation settings, providing further evidence of the effectiveness of our proposed approach.
Q2. Clarification of the structural grammar representation and matching mechanism (BiN1, 766C).
We have further clarified the formulation and implementation of ChainGram's structural grammar, including the construction of relation-specific patterns and the query-dependent matching mechanism. We have also revised the relevant equations and descriptions to improve the clarity and precision of the methodology.
Detailed point-by-point responses and additional experimental results are provided in our individual replies.
We sincerely thank all reviewers for their thoughtful feedback and constructive suggestions. We have provided detailed point-by-point responses to each reviewer and submitted a revised manuscript incorporating the corresponding changes. We hope our responses and revisions address the concerns raised, and would greatly appreciate it if the reviewers could revisit them and share any further thoughts or remaining concerns. We would be happy to provide additional clarifications if needed.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
We sincerely thank the reviewer for the thorough comments and for recognizing our well-motivated transfer mechanism and broad evaluation. The two central questions are whether the input representation preserves relational composition, and whether the gains come from discrete abstraction rather than additional computation. We address each comment point by point below.
W1. Method specification of relational composition and grammar matching
Thank you for raising these concerns. We clarify the method specification in two parts: (1) how relational information is preserved in Eq. (4) and (2) how attention-based matching is implemented in Eq. (16).
Part 1: Preservation of relational information in Eq. (4). The tokenization in Eq. (4) is designed to be identity-independent: since relation identities are not shared across KGs, the tokens encode only transferable structural roles, and relation identity is re-attached during the aggregation in Eq. (12).
where x(δk)=Eent[δk]+tent with δk=(min(d(ek,u),3), min(d(ek,v),3)), and ykm=trel+pk+m⋅eqry with m=1[rk=rq]. Each relation r has an inverse r−1 as a separate relation, so direction is represented by relation identity. The tokens mark only whether a relation equals rq.
Part 2: Attention-based matching in Eq. (16). We apologize for the confusion caused by the oversimplified notation in Eq. (16). In fact, in our code, the grammar pattern is not a single key but is expanded into four pattern tokens, so the reported results are unaffected. Specifically, the patterns hrpat∈Rd from Eq. (12) are averaged into uq∈Rd and expanded into Pq∈R4×d:
where Wp∈R4d×d and O∈R4×d are learnable. The attention weights depend on both the query chain gn and Pq, so each chain obtains its own readout an of the support grammar, which is then scored by fmatch([gn∥an∥gn⊙an]). Removing this matching while keeping the chain branch (M4-C in W2 Part 2) reduces overall MRR from 0.3973 to 0.3947.
We have revised Eq. (16) in Sec. 3.3 to match the implementation.