Providing structured information to large language models (LLMs) has been shown to improve multi-step reasoning and factual accuracy (e.g., StructRAG, ICLR 2025; RAS, ICLR 2026); recent retrieval-augmented generation (RAG) systems reconstruct structure from retrieved text on every query. When the corpus is already structured, as in JSON Lines (JSONL), used for LLM prompts, chemical compounds, and geospatial objects, this per-query rebuilding can be replaced by direct structural retrieval. Its core operation is substructure search: finding all JSON objects in a collection that contain a given query tree. Existing approaches index each object separately, so index space and query time grow with collection size; XML-based engines add conversion overhead and semantic mismatches. We propose jXBW, a compressed index for fast substructure search over JSONL, combining three innovations: (i) a merged tree representation that consolidates repeated structures across objects, (ii) a succinct tree encoding based on the eXtended Burrows-Wheeler Transform (XBW), and (iii) a three-phase substructure search algorithm on this encoding. Together they achieve query-dependent complexity in compressed space: the search avoids a full scan of the collection, and its cost grows with the numbers of candidate matches and results. Experiments on seven real-world datasets, including PubChem (1 million compounds) and OpenStreetMap (6.6 million objects), show that jXBW outperforms the strongest tree-based baseline by 16x on the smallest dataset and by up to 2,800x on the largest, while the XML-based engine Saxon does not complete the 1,000-query workload on PubChem within 24 hours. jXBW brings substructure search over million-object JSONL collections into the sub-millisecond range.
翻译:暂无翻译