RAG construction method for heterogeneous graph-hierarchical text corpus analysis
Abstract
Analysis of document corpora with complex internal and inter-document links requires not only retrieval of relevant texts but also construction of a compact, verifiable and traceable set of fragments sufficient for downstream reasoning and citation. The purpose of this work is to propose a fragment retrieval method for document corpora in which the meaning of a fragment is determined by its local content, position in the document hierarchy and links to other fragments. The method is based on a joint representation of the corpus as a tree of structural units and a directed link graph as well as on hybrid ranking that combines lexical search, vector similarity, and a link signal. The monotonicity and submodularity of the objective function are shown, which makes it possible to use greedy algorithms with a known approximation guarantee and to perform budgeted context selection for a Retrieval-Augmented Generation (RAG) system. In addition, an evaluation protocol is introduced that separates retrieval quality at the document, fragment, and citation levels. The method is formally validated on tests of lexical mismatch robustness and budgeted selection efficiency compared with simple strategies. Examples from the legal domain are used to illustrate the method. The method can be used as a retrieval layer for RAG systems in question answering, evidence retrieval, regulatory compliance, and analysis of large structurally connected corpora.