Manuscript Offprint

arXiv:2610.06650

Wikidata Search Traces: A Dataset for Training Knowledge Graph Search Agents

Mohamed Chenene, Carlos Rosas-Hinostroza, Pierre-Carl Langlais, Anastasia Stasenko

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Wikidata is one of the largest open knowledge bases, yet answering a complex question over it still requires a SPARQL query that names the right entities and properties and chains their relations. Language models offer a natural-language alternative but answer largely from memory, which is least reliable for less prominent entities. We study agents that instead answer by exploring the graph, and argue that two obstacles limit them: the lack of training data recording how a solver explores, and interfaces that add large graph results directly to the model's context. We test three hypotheses: that the difficulty of graph search can be controlled through the structure of a question rather than only through obscure entities or wording; that much of the failure on long-horizon search comes from how retrieved evidence is managed rather than from the model itself; and that, in a suitable environment, open-weight models can match commercial closed ones. We construct multi-hop questions on a frozen Wikidata snapshot by replacing named entities with nested conditions, checking after each expansion that the target remains unique and that every new condition is necessary. We release 10,235 solving traces over single-entity and multi-hop questions, together with the recursive language model (RLM) harness that produced them, in which models batch graph calls, keep results in persistent Python state and interpret selected evidence through sub-calls. On 100 questions, the harness improves both models we ran under both interfaces compared with direct tool calling over the same functions: gpt-6-luna rises from 49 to 61 correct answers, doubling its multi-hop accuracy, and Qwen3.8-27B, an open-weight model served on a single GPU, from 60 to 74.

1 Introduction

Wikidata has become the leading infrastructure for the semantic web and for general-purpose structured open data [1]. It describes more than 100 million entities and is maintained by a volunteer community. Originally built for Wikimedia projects, it is now used by cultural heritage institutions, researchers, commercial services. It is also a major common ground for semantic databases in multiple industrial sectors, either through straight data integration, inspiration for data harmonization and ontology or query federation.

Conversational language models are becoming a common way to ask factual questions and rely more and more on internet or local databases. Yet, Wikidata and the wider semantic web remain poorly integrated in this emerging search environment. A language model answers mostly from what it memorized during training, which is least reliable for less prominent entities [2, 3], and it gives no account of where an answer comes from. A knowledge graph holds explicit, sourced statements, but only users who can write structured queries can combine them. A model that answers by consulting the graph rather than recalling it would bring together the accessibility of the first and the verifiability of the second.

Consulting the graph is itself difficult. To write a SPARQL query, a user must identify the relevant entities and properties, follow the direction of their relations and express joins between the conditions of the question. Natural-language interfaces have mostly framed this as semantic parsing: LC-QuAD 2.0 and KQA Pro pair questions with executable representations, and the Wikidata Query Logs dataset (WDQL) derives question-query pairs from real query logs [4, 5, 6]. This framing assumes that a question can be mapped to its query in one step. It becomes fragile when a question describes its answer through several unnamed intermediates, for example a race held at a venue described only by its type, during a season identified through another event. The solver must then discover which entities and relations are involved, compare candidates and combine evidence gathered across many calls. The task becomes one of exploration.

Agents that interleave reasoning with retrieval are a natural fit for this task [7], but two obstacles limit them on knowledge graphs. The first concerns data. Training an agent to explore requires traces of exploration over tasks whose difficulty can be varied and whose answers can be checked. Recent synthetic datasets for search agents raise difficulty by obscuring entities, sampling rare seeds or dispersing evidence [15, 16, 17]. When the evidence lives on the open web, however, it is hard to certify that a question has exactly one answer and that each of its clues is needed. A frozen knowledge graph allows both checks. The second obstacle concerns the interface. One navigation step on a hub entity can return thousands of neighbours and statements. Tool-calling agents add these results to their conversation, and long-context studies show that models miss evidence depending on its position and lose accuracy as input grows [8, 9].

A third question concerns openness. The strongest agents are commercial models that hide their reasoning and whose terms restrict the use of their outputs for training. For a public resource such as Wikidata, and for the institutions that rely on it, what matters is whether open models running on modest hardware can do this work.

Recursive Language Models (RLMs) offer an alternative: the model inspects an external environment through code, keeps intermediate results in persistent state and delegates the reading of selected evidence to sub-calls [10]. Prime Intellect's nano-rlm and Prime Agent apply this approach to coding harnesses [11, 12]. While there is a natural convergence between the concept of depth in knowledge graph exploration (through graph traversal) and recursive language model (through persistent state and sub-calls), this remains untested so far.

We formulate three hypotheses.

H1 (Structure). The difficulty of a search task over a knowledge graph can be controlled through the structure of the question, meaning the number of nested dependencies to resolve and the ambiguity of each condition, provided every condition is needed to identify the answer. This would make structure a lever of difficulty alongside entity obscurity and obfuscated wording.

H2 (Evidence management). On long-horizon graph search, many failures come from how a model manages retrieved evidence rather than from missing knowledge or reasoning ability. Keeping graph results in persistent program state, which the model inspects selectively, should improve accuracy with the model held fixed, mostly on multi-hop questions.

H3 (Open models). In such an environment, an open-weight model served on a single GPU can match commercial models.

To test these hypotheses, we make three contributions.

  1. A construction method and dataset. We grow a question graph around a known answer. An LLM selects a named entity and replaces it with a bundle of conditions drawn from the graph. Code enumerates the bundles and certifies that the graph still identifies the target alone and that removing any new condition admits another target. From seeds that vary entity type, language and prominence, we retain 10,235 solving traces over single-entity questions and multi-hop questions of several answer types.

  2. An environment. We release the RLM harness that produced the traces, with 13 graph functions over a frozen February 2026 Wikidata snapshot. Others can replicate and extend the traces and evaluate further models in the same environment.

  3. A first evaluation. On 100 questions, we run two models under both the harness and direct tool calling over the same functions. The harness raises gpt-6-luna from 49 to 61 correct answers and Qwen3.8-27B, served on one H100 GPU, from 60 to 74. On multi-hop questions, it takes gpt-6-luna from 9 to 19 out of 50 and Qwen3.8-27B from 20 to 28.

References (24)