Can an LLM Induce a Graph? Investigating Memory Drift and Context Length
Raquib Bin Yousuf, Aadyant Khatri, Shengzhe Xu, Mandar Sharma, Naren Ramakrishnan · 2025 · 4 citationsRead the paper
Recently proposed evaluation benchmarks aim to characterize the effective context length and the forgetting tendencies of large language models (LLMs). However, these benchmarks often rely on simplistic “needle in a haystack” retrieval or continuation tasks that may not accurately reflect the performance of these models in information-dense scenarios. Thus, rather than simple next token prediction, we argue for evaluating these models on more complex reasoning tasks that requires them to induce structured relational knowledge from the text - such as graphs from potentially noisy natural language content. While the input text can be viewed as generated in terms of a graph, its structure is not made explicit and connections must be induced from distributed textual cues, separated by long contexts and interspersed with irrelevant information. Our findings reveal that LLMs begin to exhibit memory drift and contextual forgetting at much shorter effective lengths when tasked with this form of relational reasoning, compared to what existing benchmarks suggest. With these findings, we offer recommendations for the optimal use of popular LLMs for complex reasoning tasks. We further show that even models specialized for reasoning, such as OpenAI o1, remain vulnerable to early memory drift in these settings. These results point to significant limitations in the models' ability to abstract structured knowledge from unstructured input and highlight the need for architectural adaptations to improve long-range reasoning. Our codebase to support reproducibility is publicly available.11https://github.com/DiscoveryAnalyticsCenter/MemoryDrift.
What the full text shows
Shown in the lab- Memory drift (performance decay) increases sharply for GPT-4o and Gemini-2 after a specific token threshold. — Onset at ~2000 tokens (GPT-4o) and ~2500 tokens (Gemini-2) (Relational reasoning/edge discovery tasks)
- Increased information density negatively impacts model performance, causing lower F1 scores and higher memory drift even at short contexts. — Poor robustness beyond 5 connections (GPT-4o) and 7 connections (Gemini-2) (Varying connection densities per sample)
- Models generally adopt a conservative prediction strategy, where degradation is driven by declining recall rather than increased hallucinations. — High precision remains stable while recall declines sharply (Increasing context length in GPT-4o)
- Chain-of-Thought (CoT) prompting does not improve structural extraction and can worsen results. — Expanded CoT performed the worst in score, recall, and F1 (Edge discovery task for GPT-4o)
- Reasoning-specialized models do not overcome early memory drift compared to general-purpose models. — Similar or worse degradation as context length increases (OpenAI o1 on relational reasoning tasks)
- Different graph subtasks exhibit different drift patterns, with clique recovery declining more slowly than edge or subgraph discovery. (GPT-4o across edge, subgraph, and clique discovery)
- Setup
- Five LLMs (GPT-4o, OpenAI o1, Llama-3, Mistral-7B, Gemini-2) tested across varying token lengths, connection densities, and three graph discovery subtasks.
- How
- The researchers developed a benchmark requiring LLMs to induce latent graph structures (edges, subgraphs, cliques) from noisy natural language. They introduced a 'Memory Drift' metric to quantify global performance degradation by weighting true positives, false positives, and false negatives.
- Limitations
- Mistral-7B fails even at low relational density (3+ connections). · Complete graph reconstruction remains elusive even in low-memory-stress settings.
Summarized by Gemma 4 from the open-access full text · 8 Nov 2026. Read it