CARAG: Context-Aware Retrieval-Augmented Generation for Railway Operation and Maintenance Question Answering over Spatial Knowledge Graph
Wenkui Zheng, Mengzheng Yang, Yanfei Ren, Haoyu Wang, Zeng Chun, Yong Zhang · ISPRS International Journal of Geo-Information · 2026
General-purpose large language models excel at open-domain question answering, but in railway operation and maintenance (O&M) scenarios they still suffer from hallucinated knowledge and poor domain adaptation. In practice, railway O&M knowledge mainly arises from two heterogeneous sources: spatio-temporal data such as train trajectories, which are organized along the spatial layout of railway lines, and domain documents such as operating rules, which exhibit varying degrees of structural regularity. Traditional retrieval-augmented generation (RAG) systems usually flatten these multi-source data into a single unstructured text space and perform global retrieval in one embedding space, which easily introduces noisy context and makes it difficult to precisely target knowledge for specific lines, sections, or equipment states. To overcome these limitations, we propose CARAG, a context-aware RAG framework tailored to railway O&M data. CARAG treats domain documents and spatial data as a unified knowledge substrate and builds a spatial knowledge graph with concept and instance levels. On top of this knowledge graph, a GraphReAct-based multi-turn interaction mechanism guides the LLM to reason and act over the concept knowledge graph, dynamically navigating to spatially and semantically relevant candidate regions, within which vector retrieval and instance-level graph retrieval are performed. Experiments show that CARAG significantly outperforms baseline RAG methods on RAGAS metrics, confirming the effectiveness of structure-guided multi-step reasoning for question answering over multi-source heterogeneous railway O&M data.