Learning Chain Of Thoughts Prompts for Predicting Entities, Relations, and even Literals on Knowledge Graphs

Alkid Baci, Luke Friedrichs, Caglar Demir, N'Dah Jean Kouagou, Axel-Cyrille Ngonga Ngomo
4/14/2026
cs.CLcs.AI

Official code: dice-group/RALP (1 star, Python, last commit 2026-06-11).

Abstract

Knowledge graph embedding (KGE) models perform well on link prediction but struggle with unseen entities, relations, and especially literals, limiting their use in dynamic, heterogeneous graphs. In contrast, pretrained large language models (LLMs) generalize effectively through prompting.

Show full abstract

We reformulate link prediction as a prompt learning problem and introduce RALP, which learns string-based chain-of-thought (CoT) prompts as scoring functions for triples. Using Bayesian Optimization through MIPRO algorithm, RALP identifies effective prompts from fewer than 30 training examples without gradient access. At inference, RALP predicts missing entities, relations or whole triples and assigns confidence scores based on the learned prompt. We evaluate on transductive, numerical, and OWL instance retrieval benchmarks. RALP improves state-of-the-art KGE models by over 5% MRR across datasets and enhances generalization via high-quality inferred triples. On OWL reasoning tasks with complex class expressions (e.g., $\exists hasChild.Female$, $\geq 5 \; hasChild.Female$), it achieves over 88% Jaccard similarity. These results highlight prompt-based LLM reasoning as a flexible alternative to embedding-based methods. We release our implementation, training, and evaluation pipeline as open source: https://github.com/dice-group/RALP .

View on arXivView PDF

Code Implementations(1)

dice-group/RALPOfficial100%
10PythonMay 14, 20255 months ago

Similar Papers

Cite this paper

@article{baci2026learning,
  title  = {Learning Chain Of Thoughts Prompts for Predicting Entities, Relations, and even Literals on Knowledge Graphs},
  author = {Alkid Baci and Luke Friedrichs and Caglar Demir and N'Dah Jean Kouagou and Axel-Cyrille Ngonga Ngomo},
  year   = {2026},
  eprint = {2604.12651},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2604.12651v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2604.12651.svg)](https://codeofpaper.com/paper/2604.12651)

Discussion