arXiv:2610.11592cs.CLOct 2026

Manuscript Offprint

arXiv:2610.11592

Probing for Long-Horizon Deductive Reasoning Capabilities in Language Models with Prolog

Hadeel Al-Negheimish, Jasna Ilieva, Yoon Kim

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

Abstract

Current frontier LLMs can theoretically process long contexts with 1M tokens or more. But to what extent can they go beyond simple retrieval and perform deeper reasoning over such long contexts? We empirically investigate long-horizon reasoning capabilities of LLMs, focusing on deductive logic expressed in Prolog. We construct PROLONG, a synthetic testbed to probe Prolog Long Reasoning, which systematically varies the complexity (reasoning depth) of problems, where the hardest case has a reasoning depth of 22 and 62k context length. We study 8 reasoning models across 5 families of frontier LLMs, and find that performance degrades substantially as reasoning depth grows, with the majority of models approaching chance beyond depth 10.

1 Introduction

Logical reasoning is central to tasks where reasoning models are increasingly expected to excel, such as in mathematical reasoning and coding. Large language models (LLMs) equipped with reasoning capabilities have shown impressive performance on a range of mathematical, logical, and coding tasks (Jaech et al., 2024; Guo et al., 2025; Yang et al., 2025, inter alia). At what scale does the reasoning break down? We investigate this question through the lens of deductive logical reasoning, in which conclusions are derived necessarily from a set of premises by applying valid rules of inference.

We operationalize deductive reasoning as a query-answering problem over simple Prolog-style logic programs (Bratko, 2001), where the proof tree can be represented as a simple chain. As illustrated in Figure 1, each problem consists of a set of rules (implications) and facts (ground literals), together with a query: can the query be proven given the program, or not? Framing this as an LLM reasoning

Figure

Figure 1: Example problem of depth-4, with an excerpt from the Qwen-3-30B-Thinking model 1^{1}(left). The symbolic derivation involves backward chaining through four rules until all subgoals are satisfied (right). See Appendix B for an instantiation of this program as a policy compliance problem.

task allows us to investigate how well LLMs can reason given explicitly specified context; do they make sound and consistent inferences? In addition to domains such as mathematics, such logical inferences are important for real-world applications, for example in policy compliance problems. 2^{2}

Answering correctly requires tracing a proof tree: starting from the query and recursively resolving each subgoal against the rules until all branches terminate in facts or fail. This process is algorithmic; a model that has learned a robust implementation of this algorithm should, in principle, generalize beyond the shallow depths seen in previous

1^{1}Full example in Appendix H

2^{2}We show an instantiation of such an example in Appendix B.

benchmarks (Clark et al., 2020; Tafjord et al., 2021; Saparov and He, 2023).

In order to correctly answer the query, the model must correctly unify variables, follow argument orderings through rule heads and bodies (note the swapped arguments in “p(X,Y) :- q(Y,X), s(X).”), and track which subgoals have and have not been established. At greater depths, this process must be sustained throughout many steps and longer contexts.

This paper systematically studies such deductive reasoning capabilities, with depth as a primary axis of complexity, by constructing PROLONG 3^{3}, a benchmark of 2,400 logic programs in Prolog with reasoning depths up to 22. Crucially, this is also a long-horizon and long-context reasoning benchmark: context length scales as the number of rules and facts in the program grows with depth, reaching a median of 62k tokens.

Evaluating these problems simultaneously stresses a model’s ability to reason over extended chains and to locate and use relevant information within long contexts. We perform a systematic evaluation and analysis of 8 frontier reasoning models, and find that even the best-performing frontier model, GPT-5.5, degrades to 67% accuracy at depth-20, with the majority of models failing to perform above chance beyond depth-10. This reveals that even when logical inference is simple, frontier reasoning models struggle to maintain the required chain of substitutions and fact lookups as proof depth and context size scale.