Abstract
Long-context capabilities are essential for large language models (LLMs) totackle complex and long-input tasks. Despite numerous efforts made to optimizeLLMs for long contexts, challenges persist in robustly processing long inputs.In this paper, we introduce GraphReader, a graph-based agent system designed tohandle long texts by structuring them into a graph and employing an agent toexplore this graph autonomously. Upon receiving a question, the agent firstundertakes a step-by-step analysis and devises a rational plan. It then invokesa set of predefined functions to read node content and neighbors, facilitatinga coarse-to-fine exploration of the graph. Throughout the exploration, theagent continuously records new insights and reflects on current circumstancesto optimize the process until it has gathered sufficient information togenerate an answer. Experimental results on the LV-Eval dataset reveal thatGraphReader, using a 4k context window, consistently outperforms GPT-4-128kacross context lengths from 16k to 256k by a large margin. Additionally, ourapproach demonstrates superior performance on four challenging single-hop andmulti-hop benchmarks.