GRASP: Plan-Guided Graph Retrieval with Adaptive Fusion and Reranking on Semi-Structured Knowledge Bases

Yicheng Tao1, Yiqun Wang2, Xiangchen Song1, Xin Luo2, Kai Liu2, Jie Liu1,2
1Department of Electrical Engineering and Computer Science, University of Michigan
2Department of Computational Medicine and Bioinformatics, University of Michigan


Abstract

Semi-structured knowledge bases (SKBs) embed textual documents in a typed graph of entities and relations, and underpin applications such as product search, academic paper search, and precision-medicine inquiries. Existing hybrid retrieval systems on SKBs either use the graph only for query expansion, mix textual and structural branches under a global weighting, or rely on fine-tuned graph-traversal generators. We present GRASP, a three-stage SKB retrieval framework unifying plan-based graph retrieval, plan-conditioned fusion with a dense retriever, and a fine-tuned reranker over the fused candidates. GRASP substantially advances the state of the art on every metric across the three STaRK benchmarks, lifting average Hit@1 from \(62.0\) to \(73.9\). Ablation and sensitivity studies further confirm the effectiveness and robustness of GRASP.

1 Introduction↩︎

Many real-world queries combine free-form textual descriptions with structural constraints over typed relations. A shopper may look for “a push-along tricycle from Radio Flyer that is both fun and safe for my kid”; a medical researcher may ask “what disease is associated with the PNPLA8 gene and presents with hypotonia as a symptom?” [1]. Answering such queries requires retrieval over semi-structured knowledge bases (SKBs): collections of textual documents (e.g., product descriptions, paper abstracts, and gene/disease detail dictionaries) embedded in a richly typed graph of entities and relations. SKBs underpin a wide range of applications, including e-commerce product search, academic literature search, and precision-medicine inquiries [1][3], where neither pure text nor pure graph retrieval alone is sufficient: textual signals resolve free-form descriptions but ignore relational constraints, while graph traversals enforce relational constraints but cannot match nuanced textual properties. STaRK [1] formalizes three such benchmarks, i.e., Amazon for product search, MAG for academic paper search, and Prime for biomedical retrieval. Although both text-based and graph-based methods have been mature and diverse [4][13], STaRK shows that purely textual retrievers (sparse or dense embeddings) and purely structural retrievers (graph neural networks) leave significant headroom for improvement. This motivates hybrid retrieval systems that integrate the two signals.

Prior hybrid systems on STaRK take several forms. AvaTaR [14], KAR [15], and HybGRAG [16] layer an LLM on top of a textual retriever, using the model to expand or rewrite the query and/or to score relations. mFAR [2] trains a dense multi-field retriever that conditions on the per-document field schema. MoR [17] learns a mixture over a structural and a textual branch. GraphRAFT [18] fine-tunes a generator on graph traversals. AF-Retriever [3] pipelines a planning LLM with focused graph retrieval. None of these systems unifies a robust plan-execution backbone that admits a per-query confidence estimate, plan-conditioned fusion with a strong dense retriever, and a trained reranker that lifts the fused candidate list to top-1.

In this paper we present GRASP, an end-to-end framework that integrates all three. GRASP consists of three stages, each addressing one aspect of the prior gap. First, an LLM converts the query into a structured plan, which is executed against a graph database to retrieve candidates and rescored with a dense encoder. Second, the graph-based ranking is fused with a separately trained dense retriever via RRF [19], with fusion weights optionally conditioned on the planner’s outputs. Last, a fine-tuned LLM-based reranker scores the fused candidates and is then fused again with the upstream ranking. Overall, GRASP achieves the best result on every metric across the three STaRK datasets. Average Hit@1, Hit@5, Recall@20, and MRR improve by 11.9, 13.7, 17.2, and 12.9 absolute points over the strongest prior, respectively.

Our contributions are three-fold: (1) a simple but effective framework GRASP that substantially advances the previous state-of-the-art on SKB retrieval; (2) we show that the results of graph and dense retrieval are complementary and can be fused to boost performance, and the comprehensive fused pool benefits a subsequent fine-tuned reranker; (3) GRASP is robust to its hyperparameter choices.

2 Related Work↩︎

2.0.0.1 Textual retrievers.

Classical sparse retrieval BM25 [20] remains a competitive baseline on STaRK [1]. Dense passage retrieval DPR [21] learns query/document encoders end-to-end; commercial encoders such as ada-002 [22] provide strong off-the-shelf baselines. Recent open-source families (e.g. Qwen3-Embedding series [23]) match or exceed ada-002 on web text; in the biomedical domain, SapBERT [24] remains the standard “embedding” baseline because it has been pretrained on UMLS [25] synonyms.

2.0.0.2 Structural retrievers.

Structural retrievers reason over typed entity/relation graphs. QAGNN [26] jointly reasons over text and a sparsified subgraph. Think-on-Graph [27] uses an LLM as a beam-search controller over graph paths; it is competitive on small knowledge graphs but struggles on STaRK’s million-node graphs where the branching factor is high.

2.0.0.3 Hybrid retrievers on STaRK.

AvaTaR [14] optimizes tool-use prompts so that an LLM can interleave structural lookups with textual scoring. KAR [15] expands the query with knowledge-aware terms before a dense retriever. mFAR [2] uses a multi-field adaptive dense retriever that jointly encodes a document’s textual fields and its 1-hop neighborhood. It is the strongest dense retriever and we adopt it as the dense partner in our fusion. HybGRAG [16] routes between a structural and a textual branch. MoR [17] learns a mixture of structural and textual scoring. GraphRAFT [18] fine-tunes a generator on graph traversals using a Neo4j [28] backend. AF-Retriever [3] couples a planning LLM with focused graph retrieval and is the strongest published prior on average Hit@1.

3 Method↩︎

GRASP consists of three stages. Stage 1 produces a graph plan, executes it against the SKB, and rescores the executed candidates based on residual textual information. Stage 2 fuses the Stage-1 ranking with a separately trained multi-field retriever using one of two RRF variants: query-independent or -dependent. Stage 3 reranks the Stage-2 ranking with a fine-tuned LLM-based reranker and fuses it with the reranker output. Figure 1 gives an overview of GRASP with a concrete example.

Figure 1: Overview of GRASP with a concrete Amazon example.

3.1 Stage 1: Plan generation, execution, and dense rescoring↩︎

Stage 1 produces a graph-based ranking in three steps: a planner converts the query into a structured plan, an executor runs the plan against the SKB to obtain candidates and anchor scores, and a dense rescorer refines those scores using residual textual constraints. We use Qwen3-Embedding-4B on Amazon and MAG, and SapBERT on Prime, as the dense encoders throughout the stage.

3.1.0.1 Plan generation.

Given a query \(q\), an instruction-tuned LLM emits a single JSON plan. The prompt is composed of four shared modules: a role declaration that fixes the model as a structural parser; the KG schema, listing node and relation types available in the SKB; a plan-structure definition for the three core slots anchors (text entities mentioned in \(q\)), hops (graph walks among anchors toward the target variable T), and target (T’s possible node types and residual text constraints that the hops cannot encode); and a fusion-control block asking the planner to self-report a risk_level that governs how strongly the graph branch is mixed in Stage 2. Specifically, each plan has the form

{"anchors": [{"var", "text", "label",
              "match_mode"}, ...],
 "hops":    [{"from", "rel", "to_var",
              "to_label"}, ...],
 "target":  {"var": "T", "labels": [...],
             "relevance_text": ...},
 "risk_level": ...}

where var, from, and to_var are variable identifiers referring to anchors or the target; label and to_label take values from the SKB’s node types; labels is a list of node types; rel is one of the SKB’s relation types; relevance_text carries text constraints; and \(\texttt{risk\_level} {\in} \{\texttt{no\_trade}, \texttt{weak}, \texttt{normal}, \texttt{aggressive}\}\). On top of this shared skeleton, each dataset adds its own dataset-specific guidance, inspired by the metapath templates STaRK provides: MAG enumerates seven metapath templates as planner hints; Amazon adds six planning rules and five hand-curated (query, plan) few-shot examples; and Prime appends nineteen examples. Full prompts are provided in Appendix 8.

3.1.0.2 Plan execution.

The plan is executed in three steps. (1) Anchor linking. Each anchor’s text is embedded with the dataset’s dense encoder and looked up in a vector index over nodes of the declared type. Two lookup modes are supported: \(\texttt{match\_mode} {=} \texttt{name}\) hits a name-only index intended for short entity strings (e.g., “Sony”), while \(\texttt{match\_mode} {=} \texttt{doc}\) hits a full-document index intended for descriptive phrases (e.g., “headphones with long battery life”). The top-\(K\) matches above a per-anchor similarity threshold form the candidate bindings, each carrying its cosine score (Appendix 7). (2) Plan compilation. The plan is compiled into a single Cypher [29] query: anchors expand to UNWIND over their bindings, hops expand to undirected MATCH patterns, and the target variable is returned with a per-row anchor score equal to the sum of cosine scores along the matched path. When several paths reach the same target, we keep the maximum. (3) Cypher execution. The compiled query runs against a Neo4j backend hosting the SKB and yields one anchor score per target candidate. The candidate-set size \(\mathtt{n\_cand}\) together with \(\mathtt{risk\_level}\) are exposed to Stage 2 as the metadata for ranking fusion.

3.1.0.3 Dense rescoring.

When relevance_text is not empty, each candidate is additionally scored by the cosine similarity between the embedding of relevance_text and the candidate’s document embedding, and then added to the anchor score. The mechanism handles textual constraints the hops cannot express, for instance “at least 30 hours of battery life” on a product already constrained to brand “Sony” by a HAS_BRAND hop. When it is empty (typical when the hops alone fully specify the query), this step is skipped and candidates are ranked by the anchor score alone.

3.2 Stage 2: Plan-conditioned fusion with the multi-field dense retriever↩︎

Alongside the graph-based ranking from Stage 1, we run the multi-field dense retriever mFAR over the same corpus to produce a complementary text-focused ranking. The two rankings are then fused via one of two RRF variants: one with fixed weights and one with query-dependent weights.

3.2.0.1 Static RRF.

A standard two-input form with a global graph weight \(w {\in} [0,1]\) and RRF constant \(k\): \[\mathrm{score}(c) \;=\; \frac{w}{k + \mathrm{rank}_{g}(c)} + \frac{1-w}{k + \mathrm{rank}_{m}(c)},\] where \(c\) is a candidate and \(\mathrm{rank}_g\), \(\mathrm{rank}_m\) are its per-query ranks from the graph and mFAR branches.

3.2.0.2 Dynamic RRF.

The graph weight is computed per query \(q\) from the planner’s \((\texttt{n\_cand}, \texttt{risk\_level})\) outputs: \[\begin{align} \hat{w}_{\mathrm{graph}}(q) &= \mathbf{w}_{\mathrm{bucket}}[b(q)] \cdot \mathbf{m}_{\mathrm{risk}}[r(q)],\\ \mathrm{score}(c) &= \frac{\hat{w}_{\mathrm{graph}}(q)}{k + \mathrm{rank}_g(c)} + \frac{1}{k + \mathrm{rank}_m(c)}, \end{align}\] where \(b(q) {\in} \{[1,10], [11,50], [51,100], [101,500], {>}500\}\) is the n_cand bucket, \(r(q)\) is the risk_level label, and \(\mathbf{w}_{\mathrm{bucket}}\), \(\mathbf{m}_{\mathrm{risk}}\) are lookup vectors tuned on validation. When \(\hat{w}_{\mathrm{graph}} {=} 0\), the score collapses to pure mFAR, giving the planner a built-in opt-out for unreliable graph rankings.

For each dataset, we grid-search the hyperparameters of both variants over the ranges in Appendix 7 and select the one with the highest validation Hit@1. In practice, Amazon and Prime select dynamic RRF, while MAG selects static RRF (Table 2); the per-query \((\texttt{n\_cand}, \texttt{risk\_level})\) distribution and chosen weights are shown in Figure 2.

3.3 Stage 3: Reranking and final fusion↩︎

For each training query, the candidate pool consists of the top-100 candidates from the Stage-2 fused list. Each query’s training record stores all of its positives in the pool together with the top-30 hardest negatives. Each candidate is serialized into a single text document containing (i) the node’s type and dataset-specific text fields, and (ii) its 1-hop neighbors grouped by relation type, with a per-relation cap of 10 neighbors (formatting details in Appendix 8.6). At each training step, the listwise collator builds a group of \(G{=}24\) candidates by uniformly sampling one positive and 23 hard negatives from the query’s stored set. Sampling is independent per step, so each positive is paired with a different negative subset on every visit, which acts as a mild stochastic regularizer.

We fine-tune an LLM-based reranker with LoRA adapters under a listwise softmax loss. The reranker emits one logit per candidate; the loss is the cross-entropy of identifying the positive position among the \(G\) logits, which pulls the positive’s score up while pushing all 23 sampled negatives down. Training details are in Appendix 7.

At inference, the trained reranker scores the top-100 candidates of the Stage-2 fused list, and its output is fused with the Stage-2 ranking via static RRF with \((w, k)\) tuned on validation. We also report a variant that uses the base non-fine-tuned reranker, which serves as a zero-shot version of GRASP and isolates the effect of fine-tuning.

4 Experiments↩︎

4.1 Datasets and metrics↩︎

We evaluate on the three STaRK datasets: Amazon (product search), MAG (academic paper search), and Prime (precision-medicine queries). Dataset statistics are summarized in Table 3. The SKBs of these datasets vary dramatically in graph density and in the relative importance of textual versus relational information [1]. Amazon’s is the most textual, with product nodes carrying rich content from product descriptions, customer reviews, and Q&A data, while its relational structure is limited to a few types such as also_bought and has_brand. Prime’s is the most relational and graph-heavy, with ten entity types and eighteen relation types spanning diseases, drugs, genes, and pathways, but with comparatively sparse text. MAG’s sits in between: its paper nodes carry titles and abstracts, while the graph is dominated by high-cardinality cites and writes relations. These differences make the three datasets a natural testbed for studying when graph structure helps over text alone. For evaluation, we report Hit@1, Hit@5, Recall@20, and MRR, all in percent.

4.2 Baselines and variants↩︎

We consider baselines across three categories (textual, structural, and hybrid) and two settings (zero-shot and supervised).

4.2.0.1 Textual (zero-shot).

BM25 [20]; ada-002 and multi-ada-002 [22]; DPR (with RoBERTa, [21]); and Qwen3/SapBERT, using Qwen3-Embedding-4B [23] on Amazon/MAG and SapBERT [24] on Prime.

4.2.0.2 Structural (zero-shot).

QAGNN [26] and ToG [27].

4.2.0.3 Hybrid.

AvaTaR (supervised, [14]); KAR (zero-shot, [15]); mFAR (supervised, [2]); HybGRAG (zero-shot, [16]); MoR (supervised, [17]); GraphRAFT (supervised, [18]); and AF-Retriever (zero-shot, [3]). We additionally report mFAR\(^*\), our re-run of mFAR as the dense partner in Stage-2 fusion.

4.2.0.4 GRASP ablations.

We report full GRASP and three ablations: w/o RR f.t. replaces the fine-tuned reranker with its zero-shot base; w/o RR removes the reranker stage entirely (Stage-2 output); and w/o RR & FS additionally removes the fusion with mFAR, leaving only the graph branch (Stage-1 output). The Qwen3/SapBERT baseline can also be viewed as an extreme ablation that shares GRASP’s dense encoders but ignores the graph entirely.

Results for BM25, ada-002, multi-ada-002, DPR, and QAGNN are taken from the STaRK paper; ToG is taken from the MoR paper; AvaTaR, KAR, mFAR, HybGRAG, MoR, GraphRAFT, and AF-Retriever are taken from their original papers. GRASP (full and ablations), Qwen3/SapBERT, and mFAR\(^*\) are from our own runs.

4.3 Main results↩︎

Table 1 reports performance across all three datasets. GRASP achieves the top result on every reported metric, with average Hit@1 reaching \(73.9\) versus \(62.0\) for the strongest prior, a gain of \(+11.9\) points. Averaged across datasets, Hit@1, Hit@5, Recall@20, and MRR improve by \(+11.9\), \(+13.7\), \(+17.2\), and \(+12.9\) absolute points, respectively, over the strongest prior on each metric. GRASP also achieves the best average performance over zero-shot baselines alone. These results establish GRASP as the new state of the art on SKB retrieval by a large margin.

The per-dataset breakdown shows that GRASP delivers consistent improvements regardless of each SKB’s textual-versus-relational character. On Amazon, gains on all four metrics are roughly \(+10\) points each (\(+10.0\), \(+13.1\), \(+10.0\), \(+11.4\)), confirming that GRASP excels on text-heavy SKBs by leveraging both the dense partner and the trained reranker. On Prime, the gains on Hit@1 (\(+4.1\)) and MRR (\(+7.9\)) are smaller, while Hit@5 (\(+12.6\)) and Recall@20 (\(+11.7\)) remain above \(+10\), showing that GRASP handles relation-heavy SKBs well, with the bulk of its advantage in expanding the relevant candidate pool. On MAG, the gap is the tightest (\(+4.2\), \(+3.7\), \(+2.4\), \(+4.3\)), which may be because MAG appears the easiest of the three, and its citation structure suits graph-walking pipelines like GraphRAFT and AF-Retriever. Yet, GRASP still surpasses them on every metric, and extends the lead substantially on broader candidate retrieval (\(+22.8\) Recall@20 over the best zero-shot system).

The advantage widens further on the human-curated test subset (Table 4), a more authentic probe of real-world queries. Averaged across the three datasets, GRASP’s gains over the strongest prior reach \(+17.3\), \(+23.7\), \(+18.1\), and \(+20.0\) absolute points on Hit@1, Hit@5, Recall@20, and MRR, respectively, substantially larger than on the synthesized test set. This demonstrates that GRASP’s design transfers especially well to real-world query distributions, beyond the synthesized benchmark used for training.

Table 1: Main results on Amazon, MAG, and Prime. We report Hit@1 (H@1), Hit@5 (H@5), Recall@20 (R@20), and MRR for each dataset, along with the average across datasets. Bold indicates the best result and underline indicates the second-best, per metric per dataset. Our method, GRASP, achieves the best performance on all metrics across all three datasets. The two \(\Delta\) vs. best rows report GRASP’s absolute improvement over the strongest baseline: the ZS row compares against zero-shot baselines only, while the Both row compares against all baselines regardless of settings. Abbreviations: Cat.= Category; Struct.= Structural; Set.= Setting; ZS = Zero-shot; Sup = Supervised; RR = reranker; f.t.= fine-tuning; FS = fusion with mFAR\(^*\). “-”: numbers not available.
Cat. Set. Method Amazon MAG Prime Average
4-7 (lr)8-11 (lr)12-15 (lr)16-19 H@1 H@5 R@20 MRR H@1 H@5 R@20 MRR H@1 H@5 R@20 MRR H@1 H@5 R@20 MRR
ZS BM25 44.9 67.4 53.8 55.3 25.9 45.3 45.7 34.9 12.8 27.9 31.3 19.8 27.8 46.9 43.6 36.7
ZS ada-002 39.2 62.7 53.3 50.4 29.1 49.6 48.4 38.6 12.6 31.5 36.0 21.4 27.0 47.9 45.9 36.8
ZS multi-ada-002 40.1 65.0 55.1 51.6 25.9 50.4 50.8 36.9 15.1 33.6 38.1 23.5 27.0 49.7 48.0 37.3
ZS DPR 15.3 47.9 44.5 30.2 10.5 35.2 42.1 21.3 4.5 21.9 30.1 12.4 10.1 35.0 38.9 21.3
ZS Qwen3/SapBERT 44.6 67.2 54.8 54.9 32.6 55.7 55.4 43.4 9.0 21.3 26.7 15.0 28.7 48.1 45.6 37.7
ZS QAGNN 26.6 50.0 52.1 37.8 12.9 39.0 47.0 29.1 8.9 21.4 29.6 14.7 16.1 36.8 42.9 27.2
ZS ToG - - - - 13.2 16.2 11.3 14.2 6.1 15.7 13.1 10.2 - - - -
Sup AvaTaR 49.9 69.2 60.6 58.7 44.4 59.7 50.6 51.2 18.4 36.7 39.3 26.7 37.6 55.2 50.2 45.5
ZS KAR 54.2 68.7 57.2 61.3 50.5 69.6 60.3 58.7 30.4 49.3 50.8 39.2 45.0 62.5 56.1 53.1
Sup mFAR 41.2 70.0 58.5 54.2 49.0 69.6 71.7 58.2 40.9 62.8 68.3 51.2 43.7 67.5 66.2 54.5
Sup mFAR\(^*\) 48.3 72.1 58.4 58.9 49.7 71.6 71.2 59.6 39.0 62.6 67.7 49.7 45.7 68.7 65.7 56.1
ZS HybGRAG - - - - 65.4 75.3 65.7 69.8 28.6 41.4 43.6 34.5 - - - -
Sup MoR 52.2 74.7 59.9 62.2 58.2 78.3 75.0 67.1 36.4 60.0 63.5 46.9 48.9 71.0 66.1 58.8
Sup GraphRAFT - - - - 69.6 84.3 89.1 76.2 63.7 75.4 76.4 69.0 - - - -
ZS AF-Retriever 61.2 75.2 35.5 67.3 78.6 91.4 61.4 84.0 46.2 63.7 51.2 54.0 62.0 76.8 49.4 68.4
Sup GRASP (ours) 71.2 88.3 70.6 78.7 82.8 95.1 91.5 88.3 67.8 88.0 88.1 76.8 73.9 90.4 83.4 81.3
ZS    w/o RR f.t. 57.4 83.9 68.3 68.9 69.3 89.8 88.5 78.5 60.2 81.1 84.2 69.5 62.3 85.0 80.3 72.3
ZS    w/o RR 51.2 74.5 63.1 61.9 65.9 88.9 88.1 76.3 60.2 81.1 84.2 69.5 59.1 81.5 78.5 69.2
ZS    w/o RR & FS 37.2 55.4 45.3 45.6 63.2 79.3 82.2 70.6 43.8 58.1 62.0 50.3 48.1 64.3 63.2 55.5
ZS \(\Delta\) vs. best -3.8 +8.7 +11.1 +1.6 -9.3 -1.6 +22.8 -5.5 +14.0 +17.4 +33.0 +15.5 +0.3 +8.2 +24.2 +3.9
Both \(\Delta\) vs. best +10.0 +13.1 +10.0 +11.4 +4.2 +3.7 +2.4 +4.3 +4.1 +12.6 +11.7 +7.9 +11.9 +13.7 +17.2 +12.9

4.4 Ablation study↩︎

The lower block of Table 1 reports the three GRASP ablations defined in Section 4.2. Reading them bottom-up builds GRASP back up one component at a time: graph-only (\(\text{w/o RR \& FS}\)) \(\to\) +fusion (\(\text{w/o RR}\)) \(\to\) +zero-shot reranker (\(\text{w/o RR f.t.}\)) \(\to\) +trained reranker (full GRASP). We focus on Hit@1 and Recall@20, since Hit@5 and MRR track Hit@1 closely.

4.4.0.1 Graph and dense are complementary, and their fusion boosts performance.

Adding the mFAR fusion to the graph branch lifts Recall@20 sharply on every dataset: \(+17.8\) on Amazon, \(+5.9\) on MAG, and \(+22.2\) on Prime. The Hit@1 lift follows the same pattern but with dataset-specific magnitude (\(+14.0\), \(+2.7\), \(+16.4\), respectively), reflecting how much new information the dense branch contributes once the graph branch has filtered the search space. The gain is largest where the two branches are least correlated: on Amazon, the graph alone is weak (Hit@1 \(37.2\)) because the dataset is heavily text-leaning, so the dense branch carries most of the new evidence; on Prime, the graph alone already covers \(62.0\%\) of relevant candidates, but the dense branch surfaces another \(22.2\) points of recall, indicating that the two branches retrieve substantially different candidates. MAG is the only dataset where the graph branch already secures a high recall pool (\(82.2\)), leaving less room for fusion to help on Recall@20.

4.4.0.2 The fused pool benefits the trained reranker.

After fusion, the candidate pool has high Recall@20 on every dataset (\(63.1\) Amazon / \(88.1\) MAG / \(84.2\) Prime), which gives the reranker enough relevant candidates to re-order. The zero-shot reranker, however, leaves most of this potential untapped: it adds only \(+6.2\), \(+3.4\), and \(+0.0\) Hit@1 on Amazon, MAG, and Prime, with the Prime case being a clean failure (the validation grid for the zero-shot reranker collapses to pure fused, \(w{=}0\)). The trained reranker recovers the missing precision: \(+13.8\), \(+13.5\), and \(+7.6\) Hit@1 over the zero-shot reranker on the three datasets, respectively, while changing Recall@20 only marginally (\(+2.3\), \(+3.0\), \(+3.9\)). The contrast confirms two things at once: a high-recall fused pool is what makes top-rank precision recoverable, and fine-tuning is what actually recovers it, by utilizing the high-quality hard negatives the pool supplies.

4.4.0.3 All three stages are necessary.

On one hand, the two paragraphs above show that performance improves as we add stages, confirming that each stage contributes positively. On the other hand, the dominant contributor stage differs by dataset. Fusion contributes the most on Amazon: the dataset is text-heavy and the graph branch alone is weak, so the dense partner brings in most of the new evidence. The graph branch contributes the most on MAG, whose citation structure already provides a strong retrieval signal on its own. Fusion and the trained reranker share the load on Prime, where domain-specific fine-tuning is essential because the base reranker lacks biomedical knowledge. Hence, GRASP needs all three stages to perform best.

4.5 Hyperparameter sensitivity↩︎

GRASP exposes a small number of hyperparameters (fusion mode, fusion weights, reranker training budget), and we check that the final performance is robust to reasonable choices on each, which makes GRASP easy to deploy without per-dataset hyperparameter expertise. All sensitivity studies are reported on the validation split, with the chosen operating point then frozen for test.

4.5.0.1 Fusion mode is not a sensitive choice on most datasets.

Table 2 compares static against dynamic RRF for fusing the graph branch with mFAR. On Amazon and Prime, the two variants are within \(1.5\) points of each other, meaning the choice of fusion mode is not a sensitive lever once the underlying branches are in place. MAG is the only exception, where static RRF wins by more than 2 points; the asymmetry is explained by the bucket/risk distribution (Figure 2b): most MAG queries fall into the same \((\text{bucket}, \text{risk})\) cell, so dynamic weighting reduces to a near-constant and adds noise. We therefore freeze static for MAG and dynamic for the other two; in all cases, the wrong choice would still likely keep GRASP ahead of prior baselines.

4.5.0.2 Static RRF \((w, k)\) has a broad flat region.

Figure 4 shows the Hit@1 heatmap over the static-RRF grid \((w, k)\) for fusing the trained reranker with the Stage-2 fused ranking. The best \((w, k)\) per dataset is \((0.65, 2)\) on Amazon, \((0.50, 5)\) on MAG, and \((0.50, 2)\) on Prime, but the high-performance region is broad rather than peaked: Hit@1 stays within \(1\) point of the optimum across a wide range of \((w, k)\) values around the maximum on every dataset. The shape of the optimum has a sensible interpretation: Amazon’s higher \(w\) reflects that its Stage-2 upstream is the weakest of the three, so the reranker carries more weight.

4.5.0.3 Reranker fine-tuning is robust to the training budget.

Figure 3 reports metrics over the reranker fine-tuning steps. The curves rise monotonically on Amazon, peak then plateau on MAG, and rise smoothly without a clear plateau on Prime. In every case, performance is substantially above the zero-shot base by the midpoint of training, and the gap between any late-training checkpoint and the chosen one is small. These indicate that our fine-tuning recipe is both robust and effective. The Amazon curve is still rising at the final step, suggesting that further training would help; we hold the budget fixed across datasets for fairness rather than chase additional gains.

a
b
c

Figure 2: Validation query distributions over \(\texttt{n\_cand}\) bucket \(\times\) \(\texttt{risk\_level}\), the basis for dynamic RRF weight computation. The right column and bottom row give row and column totals; the bottom-right cell is the grand total. Bucket label 0 aggregates queries with empty graph candidate set; column <invalid> marks queries with failed plan generation, for which dynamic RRF reduces to pure mFAR. The selected hyperparameters are: Amazon: \(k{=}5\), \(\mathbf{w}_{\mathrm{bucket}}{=}(1.0,1.4,0.8,0.0,0.0)\), \(\mathbf{m}_{\mathrm{risk}}{=}(0.0,0.5,0.75,1.0)\); MAG: \(k{=}300\), \(\mathbf{w}_{\mathrm{bucket}}{=}(1.4,0.8,0.6,0.1,0.05)\), \(\mathbf{m}_{\mathrm{risk}}{=}(0.0,1.25,0.75,1.0)\) (not used in the final model, where static RRF outperforms dynamic on validation); Prime: \(k{=}300\), \(\mathbf{w}_{\mathrm{bucket}}{=}(2.0,0.8,0.2,0.05,0.05)\), \(\mathbf{m}_{\mathrm{risk}}{=}(0.5,0.5,1.25,1.0)\).. a — Amazon, b — MAG, c — Prime

Table 2: Comparison of static and dynamic RRF strategies for fusing the graph and mFAR branch on the validation set. \(\bar{w}\) is the weight for the graph branch. For static RRF, \(\bar{w}\) reduces to a fixed scalar weight \(w\); for dynamic RRF, \(\bar{w}{=}\hat{w}_{\mathrm{graph}}{/}(\hat{w}_{\mathrm{graph}}{+}1)\) denotes the average of per-query weights. \(k\) is the rank constant in the RRF formula. \(^\star\) marks the better strategy per dataset, selected based on Hit@1. Bold indicates the better result per metric per dataset.
Fusion strategy Amazon MAG Prime
2-4 (lr)5-7 (lr)8-10 \((\bar{w}, k)\) H@1 R@20 \((\bar{w}, k)\) H@1 R@20 \((\bar{w}, k)\) H@1 R@20
Static RRF \((0.35, 5)\) 59.43 68.33 \((0.50, 2)^{\star}\) 66.79 88.48 \((0.50, 10)\) 56.49 84.31
Dynamic RRF \((0.37, 5)^{\star}\) 59.50 68.47 \((0.29, 300)\) 64.17 85.63 \((0.33, 300)^{\star}\) 57.79 82.93

5 Discussion↩︎

5.0.0.1 When does graph structure help?

We isolate graph structure’s contribution with a controlled diagnostic: a single dense embedder run over the full corpus, with no plan, no graph walk, no fusion, and no reranker (the Qwen3/SapBERT row of Table 1). Since GRASP’s graph branch uses the same encoder, the gap between the two isolates what the graph adds. On Amazon, the embedding-only Hit@1 (\(44.6\)) is even higher than that of the graph branch (\(37.2\)), which may be because product descriptions dominate the query semantics, and the graph walk often discards relevant candidates the text encoder could have surfaced. On MAG, the graph branch lifts Hit@1 from \(32.6\) (embedding-only) to \(63.2\), supplying the relational signal (writes, cites) that text cannot recover. On Prime, the graph branch lifts Hit@1 from \(9.0\) to \(43.8\), since its SKB’s biomedical relations carry most of the signal and the encoder was not pretrained for long-document biomedical retrieval.

5.0.0.2 Case studies.

To illustrate how each stage contributes, we show one query per dataset, annotated with the (mFAR, graph-only)\(\to\)+fusion\(\to\)+zero-shot reranker\(\to\)+trained reranker rank progression of the gold answer.

Amazon (multi-attribute product search). Query: “Looking for unique and eye-catching golf club headcovers; endearing, made from durable, colorfast fabric, with good quality stitching.” Gold: Butthead Golf Club Headcovers. Rank progression: \(\mathbf{(19, 17) \to 13 \to 10 \to 1}\). mFAR alone matches generic quality terms (“durable”, “colorfast”) against thousands of premium-branded headcovers; the distinctive “endearing” is too weak alone. The graph branch anchors to “headcovers” via category edges but has no notion of brand character. Fusion averages the two failure modes; the zero-shot reranker recognizes the cross-field alignment between “endearing/eye-catching” in the query and humor-themed feature/review text in the gold; fine-tuning teaches the reranker to weight distinctive-brand cues over generic premium ones.

MAG (shared-author + topic constraint). Query: “Look for papers with shared authors to Longitudinal study of retinal degeneration in a rat using spectral domain optical coherence tomography, focusing on the same area, retinal imaging, and discuss the use of a multi-modal retinal imaging system.” Gold: Multispectral scanning laser ophthalmoscopy combined with optical coherence tomography for simultaneous in vivo mouse retinal imaging. Rank progression: \(\mathbf{(8, 9) \to 6 \to 4 \to 1}\). mFAR matches topic terms but has no representation of “shared authors”. The graph branch returns co-authored papers but cannot separate topic-aligned from topic-unrelated ones. Fusion intersects co-authorship (graph) with topic (dense). The zero-shot reranker reads each candidate’s 1-hop neighbors (author overlap with the seed, field-of-study tags), making the joint constraint explicit in the input; fine-tuning teaches it to weight (co-author overlap, topic overlap) as a joint feature.

Prime (gene-disease relation + phenotype filter). Query: “What disease is linked to the B3GALT6 gene, often presenting as focal epilepsy in a person’s teens?” Gold: Ehlers-Danlos syndrome with periventricular heterotopia. Rank progression: \(\mathbf{(64, 9) \to 2 \to 2 \to 1}\). mFAR has no awareness of gene-disease links and matches only on the thin phenotype clause. The graph branch executes the gene-disease hop but cannot disambiguate among several diseases linked to B3GALT6. Fusion gives a small high-precision pool where even a weak dense signal can favor the disease whose detail dictionary mentions epilepsy/teen-onset terms. The zero-shot reranker does not help (domain-blind on biomedical entities); the trained reranker reads the candidate’s serialized 1-hop [ASSOCIATED WITH] line listing gene neighbors (including B3GALT6), and learns to align this structural signal with the phenotype clause, a feature pure dense matching cannot recover.

5.0.0.3 Per-query metadata explains where dynamic RRF helps.

The dynamic RRF weight \(\hat{w}_{\mathrm{graph}}(q)\) is computed from each query’s \((\text{bucket}, \text{risk})\) metadata; Figure 2 reports the validation distribution over this metadata. On MAG, \(73\%\) of queries fall in a single bucket and \(98\%\) are labeled risk_level=normal, so dynamic weighting reduces to a near-constant and adds noise relative to static RRF; static therefore wins by \(+2.6\) Hit@1. On Prime, both axes are genuinely heterogeneous and the per-query weighting compensates for highly variable plan quality, where dynamic wins by \(+1.3\) Hit@1. Amazon is in between and the two variants tie within noise. The \(\mathbf{m}_{\mathrm{risk}}[\texttt{no\_trade}] {=} 0\) entries on Amazon and MAG also mean that queries the planner self-flags as unreliable collapse to pure mFAR, giving the planner a built-in opt-out.

6 Conclusion↩︎

GRASP is a three-stage retrieval framework for semi-structured knowledge bases. It converts the query into a structured plan, executes the plan against a graph database with dense rescoring, fuses with a separately trained multi-field retriever via plan-conditioned RRF, and reranks the fused top candidates with a fine-tuned reranker that is again fused with the upstream. On STaRK, GRASP sets a new state of the art on every metric across three datasets, with average Hit@1 reaching \(73.9\) versus \(62.0\) for the strongest prior. Per-component ablations show that the graph and dense branches are complementary, and that the fused candidate pool supplies high-quality hard negatives that a downstream reranker can exploit to push top-rank precision substantially higher. The headline performance of GRASP is stable across reasonable choices of hyperparameters, making it easy to deploy without per-dataset hyperparameter expertise.

Limitations↩︎

6.0.0.1 Generalization beyond STaRK.

Our experiments cover three SKB benchmarks (Amazon, MAG, Prime) that share the STaRK construction protocol and a common English schema. Transfer to other SKBs (e.g., industrial product catalogs, non-English biomedical KGs, or KGs with substantially deeper relation hierarchies) remains untested; we expect plan generation to be the component most sensitive to such shifts, since it relies on the LLM recognizing the dataset schema in-context.

6.0.0.2 Interpretability.

While our ablations attribute performance to specific stages (plan, fusion, reranker) and our case studies illustrate how each stage helps on individual queries, we do not provide a systematic account of why a given top-\(1\) prediction emerges from the interaction of all three stages. Mapping each retrieval decision back to a chain of (plan, fusion weight, reranker score) interactions is left to future work.

6.0.0.3 Dependence on a strong instruction-tuned LLM.

Plan generation is zero-shot prompting of a frontier LLM; if the schema or the queries are too far from the LLM’s pretraining distribution, the planner may emit invalid or low-quality plans more often than the \(1\%\)\(2\%\) rate we observe on STaRK. Recovery from such failures (retries, self-critique, ensembling) is a natural follow-up we did not explore.

7 Implementation Details↩︎

7.0.0.1 Models.

Stage 1 plan generation uses Qwen3-27B-Instruct [23]. The trained reranker is Qwen3-Reranker-0.6B [23]. The SKB is hosted in Neo4j [28]; per-node embeddings are pre-computed at indexing time with doc_max_len 512 (Amazon, MAG) or 256 (Prime). The top-\(K\) matches whose cosine similarity is at least \(\tau\) times the top-1’s similarity become candidate bindings for that anchor variable, each with its cosine score; we use \((K, \tau) = (5, 0.95)\) for name-mode and \((10, 0.90)\) for doc-mode, identical across the three datasets.

7.0.0.2 Fusion sweeps.

Static RRF: \(w {\in} \{0, 0.05, \ldots, 1\}\) and \(k {\in} \{1, 2, 5, 10, 20, 40, 60, 80, 100\}\). Dynamic RRF: \(k {\in} \{5, 10, 20, 40, 80, 150, 300\}\), \(\mathbf{w}_{\mathrm{bucket}}\) (in the order \([1,10], [11,50], [51,100], [101,500], {>}500\)) lies in \(\{1.0, 1.2, 1.4, 1.6, 2.0\} {\times} \{0.8, 1.0, 1.2, 1.4\} {\times} \{0.2, 0.4, 0.6, 0.8\} {\times} \{0, 0.05, 0.1\} {\times} \{0, 0.05, 0.1\}\), and \(\mathbf{m}_{\mathrm{risk}}\) (in the order \(\texttt{no\_trade}, \texttt{weak}, \texttt{normal}, \texttt{aggressive}\)) lies in \(\{0, 0.25, 0.5, 0.75\} {\times} \{0.5, 0.75, 1.0, 1.25\} {\times} \{0.75, 1.0, 1.25, 1.5\} {\times} \{1.0, 1.25, 1.5, 2.0\}\).

7.0.0.3 Reranker training.

LoRA adapters with rank \(r=32\) and scaling \(\alpha=64\) attached to all linear layers. Schedule: 2 epochs of cosine LR decay from \(3{\times}10^{-5}\), warmup 5%, global batch 16. Max sequence length is 1024 for Amazon and MAG and 2048 for Prime (its detail dictionaries are longer); per-field truncation max_text_field_tokens is 300 (Amazon, Prime) and 512 (MAG).

7.0.0.4 Hardware.

All experiments were conducted on a Linux server equipped with an AMD EPYC 9575F CPU (16 cores), 128 GB of RAM, and four NVIDIA RTX PRO 6000 Blackwell GPUs (96 GB VRAM each).

Table 3: STaRK dataset statistics.
Dataset Nodes Relations Avg.deg. Node types Rel.types Tokens Queries Train/Val/Test (%)
Amazon 1.04M 9.44M 18.2 4 5 592.1M 9,100 65 / 17 / 18
MAG 1.87M 39.8M 43.5 4 4 212.6M 13,300 60 / 20 / 20
Prime 0.13M 8.10M 125.2 10 18 31.8M 11,200 55 / 20 / 25
Table 4: Results on the human-generated subset across three datasets, including only baselines that report these numbers. GRASP achieves the best results across all metrics and datasets, with even larger margins than on the full test set. Bold = best, underline = second-best per metric per dataset. Abbreviations follow Table 1.
Cat. Set. Method Amazon MAG Prime Average
4-7 (lr)8-11 (lr)12-15 (lr)16-19 H@1 H@5 R@20 MRR H@1 H@5 R@20 MRR H@1 H@5 R@20 MRR H@1 H@5 R@20 MRR
ZS BM25 27.2 51.9 29.2 18.8 32.1 41.7 32.5 37.4 22.5 41.8 42.3 30.4 27.3 45.1 34.7 28.9
ZS ada-002 39.5 64.2 35.5 52.7 28.6 41.7 36.0 35.8 17.4 34.7 41.1 26.4 28.5 46.9 37.5 38.3
ZS multi-ada-002 46.9 72.8 40.2 58.7 23.8 41.7 39.9 31.4 24.5 39.8 47.2 33.0 31.7 51.4 42.4 41.1
ZS DPR 16.1 39.5 15.2 27.2 4.7 9.5 25.0 7.9 2.0 9.2 10.7 7.1 7.6 19.4 17.0 14.1
ZS Qwen3/SapBERT 43.9 70.7 56.0 55.2 35.3 56.4 56.6 45.5 11.4 20.0 27.6 16.6 30.2 49.0 46.7 39.1
Struct. ZS QAGNN 22.2 49.4 21.5 31.3 20.2 26.2 28.8 25.5 6.1 13.3 17.6 9.4 16.2 29.6 22.6 22.1
Sup AvaTaR 58.0 76.5 - 65.9 33.3 42.9 - 38.6 33.0 51.4 - 41.0 41.5 56.9 - 48.5
ZS KAR 61.7 72.8 40.6 66.3 51.2 58.3 46.6 54.5 45.0 60.6 59.9 51.9 52.6 63.9 49.0 57.6
Sup mFAR\(^*\) 47.6 68.3 57.1 57.4 43.6 68.1 69.0 54.9 37.1 62.9 67.8 48.5 42.8 66.4 64.6 53.6
ZS AF-Retriever 58.0 69.1 - 63.5 52.4 60.7 - 55.9 57.1 69.4 - 62.7 55.8 66.4 - 60.7
Sup GRASP (ours) 70.7 90.2 69.1 79.1 79.7 91.7 89.6 85.4 68.9 88.2 89.5 77.7 73.1 90.1 82.8 80.7
ZS    w/o RR f.t. 59.8 81.1 67.1 69.7 67.3 85.3 87.1 76.2 61.1 83.6 85.4 70.8 62.7 83.3 79.8 72.3
ZS    w/o RR 53.1 72.6 61.0 61.9 63.5 85.0 86.6 73.6 61.1 83.6 85.4 70.8 59.2 80.4 77.7 68.8
ZS    w/o RR & FS 41.7 58.3 46.9 50.3 65.6 81.1 84.2 72.9 54.4 73.5 77.8 62.7 53.9 70.9 69.6 62.0
ZS \(\Delta\) vs. best -2.0 +8.3 +11.1 +3.4 +14.9 +24.6 +30.5 +20.3 +4.0 +14.2 +25.5 +8.1 +6.9 +16.9 +30.8 +11.6
Both \(\Delta\) vs. best +9.0 +13.7 +12.0 +12.8 +27.3 +23.7 +20.6 +29.5 +11.8 +18.8 +21.7 +15.0 +17.3 +23.7 +18.1 +20.0
a
b
c

Figure 3: Validation metrics across checkpoints during reranker fine-tuning. Step 0 is the un-finetuned base reranker. Lines: H@1, H@5, R@20, MRR. \(\star\) marks the best checkpoint per dataset selected by H@1.. a — Amazon, b — MAG, c — Prime

a
b
c

Figure 4: Validation H@1 over the static RRF grid for integrating the reranker into GRASP. \(w_\mathrm{reranker}\) is the weight for the reranker branch. \(\star\) marks the best \((w, k)\) per dataset.. a — Amazon, b — MAG, c — Prime

8 Prompts↩︎

Section 3.1 describes the four-module structure of the Stage-1 plan-generation prompt (role, KG schema, plan-structure definition, fusion-control block) and the dataset-specific extensions layered on top. This appendix reproduces the runtime prompts verbatim. Each prompt is built by concatenating (a) a dataset-specific static system prompt body, (b) the shared fusion-control block (appended by _fusion_system_prompt(); the literal heading inside is ## Fusion overlay allocator), and (c) a per-query user message whose preamble differs slightly per dataset but whose final risk-level paragraph is shared verbatim. The two truly shared pieces are listed once below; the dataset-specific parts then follow.

8.1 Common building blocks↩︎

The two pieces below are identical across all three datasets. Everything else (role description, schema, examples, user-message preamble) differs per dataset and is reproduced verbatim in Appendices 8.28.4.

8.1.0.1 Fusion-control block (appended to every system prompt).

## Fusion overlay allocator In fusion eval, also include top-level ‘risk_level’. ‘risk_level’ must be one of ‘no_trade’, ‘weak’, ‘normal’, or ‘aggressive’; it sizes how strongly the graph result is overlaid with the frozen MFAR baseline. These fields do not change the graph traversal itself.

8.1.0.2 risk-level addendum (appended to every per-query user message).

Also include a top-level ‘risk_level’ field with one of ‘no_trade’, ‘weak’, ‘normal’, or ‘aggressive’. Use ‘no_trade’ when MFAR appears confident or the graph plan is uncertain; use ‘weak’ for small overlays; use ‘normal’ or ‘aggressive’ mainly when MFAR appears low-confidence and the graph evidence should have more influence.

8.2 Amazon↩︎

The Amazon Stage-1 plan prompt is composed of the static body below plus the fusion-control block from Appendix 8.1 appended at runtime.

8.2.0.1 Amazon-specific schema extensions.

Amazon extends the common plan schema (Section 3.1) with a top-level retrieval_mode field that classifies how strongly the graph branch should engage for a given query, taking one of four values described below. This reflects Amazon’s text-heaviness (textual \(>\) relational) relative to MAG and Prime: the planner needs an explicit way to declare “no graph entity anchors apply” or “use product-product co-occurrence edges”.

The four retrieval_mode values span a spectrum of graph engagement. doc_search is the degenerate case where the query has no named entity to anchor on; the planner falls back to a single doc-mode anchor with the query text, zero hops, and a dense rescore over the full product corpus — effectively pure dense retrieval, which suffices on Amazon since its product fields already carry most of the signal. graph_filter_doc is the canonical hybrid: a name-mode brand/category/color anchor plus a hop to T plus a non-empty relevance_text (the worked example in Section 3.1 is of this shape), analogous to what the MAG and Prime planners do implicitly. graph_expand exploits Amazon’s product-behaviour edges (ALSO_BUY, ALSO_VIEW) to expand a seed product into related items — this is the natural mode for “similar to / bought with \(X\)” queries and is the only mode without a direct analogue in the MAG / Prime prompts (whose graphs lack analogous user-behaviour edges). graph_strict is, schematically, graph_filter_doc with relevance_text set to empty, asserting that the graph hop alone is restrictive enough; in practice our planner never selects it and we keep it in the schema for completeness. The realised distribution on the Amazon test split (1,642 queries) is \(44.2\%\) doc_search, \(33.6\%\) graph_filter_doc, \(21.5\%\) graph_expand, \(0\%\) graph_strict, and \(0.7\%\) skip (an emergency fallback emitted when the planner cannot produce a usable plan; treated as risk_level=no_trade downstream).

8.2.0.2 System prompt (static body).

You are a STRUCTURAL PARSER for queries over the STaRK-Amazon product graph. Convert the natural-language product search query into exactly one JSON retrieval plan. Do not answer the query, recommend products, or add hidden reasoning.

## Graph metadata Candidate answers are product nodes.

Labels: - product - brand - category - color

Relations, all undirected; use these uppercase names only: - product -HAS_BRAND- brand - product -HAS_CATEGORY- category - product -HAS_COLOR- color - product -ALSO_BUY- product - product -ALSO_VIEW- product

Product text fields available to the retriever: - title - brand - description - feature - review - qa

## Retrieval modes Set top-level ‘retrieval_mode’ to exactly one of: - ‘doc_search’: descriptive product search with no explicit graph entity anchor. - ‘graph_filter_doc’: brand/category/color filters plus descriptive product text. - ‘graph_expand’: a named/identifiable product seed expanded through ALSO_BUY or ALSO_VIEW, optionally with brand/category/color filters or descriptive text. - ‘graph_strict’: graph filters or product-product expansion are sufficient; no additional product text rerank is needed.

## Output schema Emit one JSON object with: - retrieval_mode: one of the four values above - anchors: list of explicit entity anchors from the query. Each anchor has: - var: unique identifier such as "A1", or "T" only for doc_search - text: exact or compact query phrase to link - label: "product", "brand", "category", or "color" - match_mode: "name" for short precise names, "doc" for descriptive product phrases - hops: list of graph traversals. Each hop has: - from: existing variable - rel: "HAS_BRAND", "HAS_CATEGORY", "HAS_COLOR", "ALSO_BUY", or "ALSO_VIEW" - to_var: variable introduced or constrained - to_label: target label - target: - var: usually "T" - labels: ["product"] - relevance_text: intrinsic product requirements not captured by anchors and hops; use "" if none

## Planning rules - Do not invent anchors. Only create brand, category, color, or product anchors for entities explicitly mentioned or unambiguously named in the query. - Descriptive queries with no explicit brand/category/color/product entity use ‘doc_search’: one doc-mode product anchor with var "T", no hops, and the same compact product requirements in target.relevance_text. - Brand, category, and color are filters. Represent them as anchors plus HAS_BRAND, HAS_CATEGORY, or HAS_COLOR hops to "T"; do not bury them only in relevance_text. - Product seeds use expansion. If the query starts from a product and asks for similar, related, co-viewed, compatible, or alternative products, use ALSO_VIEW. If it asks what is bought with, bundled with, or purchased together with the seed, use ALSO_BUY. - Detailed attributes, use cases, qualitative requirements, exact model specs, and numeric constraints go to target.relevance_text. - Use ‘graph_strict’ when all constraints are represented by graph hops and target.relevance_text is empty. Use ‘graph_filter_doc’ when filters need a doc/text rerank. Use ‘graph_expand’ whenever a product seed expansion hop is present. - The target is always a product answer unless the user explicitly asks only to identify a non-product entity, which is outside this task.

## Few-shot examples

Q: "Can you suggest a prize wheel that is easy to put together for an event?" "retrieval_mode": "doc_search", "anchors": [ "var": "T", "text": "prize wheel that is easy to put together for an event", "label": "product", "match_mode": "doc" ], "hops": [], "target": "var": "T", "labels": ["product"], "relevance_text": "prize wheel that is easy to put together for an event"

Q: "Find Sony headphones with at least 30 hours of battery life." "retrieval_mode": "graph_filter_doc", "anchors": [ "var": "A1", "text": "Sony", "label": "brand", "match_mode": "name" ], "hops": [ "from": "A1", "rel": "HAS_BRAND", "to_var": "T", "to_label": "product" ], "target": "var": "T", "labels": ["product"], "relevance_text": "headphones with at least 30 hours of battery life"

Q: "What products are similar to Instant Pot Duo 7-in-1?" "retrieval_mode": "graph_expand", "anchors": [ "var": "A1", "text": "Instant Pot Duo 7-in-1", "label": "product", "match_mode": "name" ], "hops": [ "from": "A1", "rel": "ALSO_VIEW", "to_var": "T", "to_label": "product" ], "target": "var": "T", "labels": ["product"], "relevance_text": ""

Q: "What do customers usually buy along with the Logitech MX Master 3 mouse?" "retrieval_mode": "graph_expand", "anchors": [ "var": "A1", "text": "Logitech MX Master 3 mouse", "label": "product", "match_mode": "name" ], "hops": [ "from": "A1", "rel": "ALSO_BUY", "to_var": "T", "to_label": "product" ], "target": "var": "T", "labels": ["product"], "relevance_text": ""

Q: "Show me black backpacks in the hiking category." "retrieval_mode": "graph_strict", "anchors": [ "var": "A1", "text": "black", "label": "color", "match_mode": "name", "var": "A2", "text": "hiking", "label": "category", "match_mode": "name" ], "hops": [ "from": "A1", "rel": "HAS_COLOR", "to_var": "T", "to_label": "product", "from": "A2", "rel": "HAS_CATEGORY", "to_var": "T", "to_label": "product" ], "target": "var": "T", "labels": ["product"], "relevance_text": ""

Output only the JSON object for the user query. No markdown fences, no examples, no explanations, and no hidden reasoning in the answer.

8.2.0.3 Per-query user message.

Query: <query string>

Output exactly one JSON object matching the Amazon retrieval plan schema.

(followed by the risk-level addendum from Appendix 8.1.)

8.3 MAG↩︎

The MAG Stage-1 plan prompt is composed of the static body below plus the fusion-control block from Appendix 8.1.

8.3.0.1 System prompt (static body).

You are a structural parser for STaRK-MAG queries. Convert the natural-language query into a graph traversal plan over the MAG academic knowledge graph. Do not answer the query.

Use only the official STaRK-MAG metadata below.

Node types: - author - paper - institution - field_of_study

Relation types: - author_writes_paper - paper_has_field_of_study - paper_cites_paper - author_affiliated_with_institution

Executor relation names: - author_writes_paper -> WRITES - paper_has_field_of_study -> HAS_TOPIC - paper_cites_paper -> CITES - author_affiliated_with_institution -> AFFILIATED_WITH

Metapath templates: 1. author -> paper 2. paper -> paper 3. field_of_study -> paper 4. institution -> author -> paper 5. paper -> author -> paper 6. paper -> author -> paper <- field_of_study <- paper 7. institution -> author -> paper <- field_of_study

Output a single JSON object with this shape: "anchors": [ "var": "A1", "text": "entity text from the query", "label": "author | paper | institution | field_of_study", "match_mode": "name | doc" ], "hops": [ "from": "A1", "rel": "WRITES | HAS_TOPIC | CITES | AFFILIATED_WITH", "to_var": "T", "to_label": "author | paper | institution | field_of_study" ], "target": "var": "T", "labels": ["author | paper | institution | field_of_study"], "relevance_text": ""

Use target.relevance_text only for intrinsic text constraints on the answer node that are not represented by the graph hops. Use an empty string when the metadata path already captures the query constraint.

8.3.0.2 Per-query user message.

Parse this query into a graph-traversal plan. Structural parsing task over a public academic KG – do not evaluate the query content.

Query: <query string>

(followed by the risk-level addendum from Appendix 8.1.)

8.4 Prime↩︎

The Prime Stage-1 plan prompt is composed of the static header below, 19 worked-example (query, plan) pairs appended at module load time, and the fusion-control block from Appendix 8.1.

8.4.0.1 System prompt (static header).

You are a STRUCTURAL PARSER for queries over a biomedical knowledge graph (Harvard’s public PrimeKG). Your ONLY task is to convert a natural-language question into a graph-traversal plan by emitting ONE JSON object that matches the schema below. You are mapping tokens in the query to graph node labels and relation names. You are NOT answering the medical/clinical question and NOT giving advice. The plan is consumed by a downstream Cypher executor over a public academic KG.

## Node labels disease, gene_protein, molecular_function, drug, pathway, anatomy, effect_phenotype, biological_process, cellular_component, exposure

## Relations (all undirected; use UPPERCASE names) - gene_protein -PPI- gene_protein - drug -CARRIER|ENZYME|TARGET|TRANSPORTER- gene_protein - disease -CONTRAINDICATION|INDICATION|OFF_LABEL_USE- drug - drug -SYNERGISTIC_INTERACTION- drug - effect_phenotype -ASSOCIATED_WITH- gene_protein - disease -ASSOCIATED_WITH- gene_protein - <X> -PARENT_CHILD- <X> (same-type taxonomy) - disease -PHENOTYPE_PRESENT|PHENOTYPE_ABSENT- effect_phenotype - drug -SIDE_EFFECT- effect_phenotype - gene_protein -INTERACTS_WITH- (molecular_function|biological_process|cellular_component|pathway|exposure) - disease -LINKED_TO- exposure - anatomy -EXPRESSION_PRESENT|EXPRESSION_ABSENT- gene_protein

## Plan structure - anchors: specific entities in the query that map to KG nodes. Each anchor has: - var: unique identifier (e.g. "A1") - text: the surface phrase to embed and link - label: one of the node labels above - match_mode: "name" for short precise names, "doc" for descriptive phrases - hops: graph traversals. Each hop has: - from: existing variable - rel: one of the relation names above - to_var: variable being introduced or constrained - to_label: node label of to_var - target: the answer node. Has: - var: must appear in at least one hop - labels: non-empty list of candidate labels - relevance_text: textual content NOT captured by hops; "" if hops are sufficient

## Output contract Emit a SINGLE JSON object with keys "anchors", "hops", "target". No markdown fences, no <think> tags, no explanatory prose. The object will be parsed and validated against a strict schema.

8.4.0.2 19 worked examples (appended to the system prompt).

The 19 examples cover 19 distinct metapath templates from STaRK Appendix A.4 (template ids 2, 3, 4, 6–8, 11–13, 15, 17, 18, 21–23, 25–28). Each query text is a real STaRK PrimeKG training query (each shipped with a qid); the plans are hand-curated and verified to retrieve the gold answer in the top-10. We show one demo in full below; the query texts of the remaining 18 are listed after.

## Worked examples (STaRK Appendix A.4)

Q: "Which pharmaceutical agent shares a gene/protein carrier with Bismoth Subgallate and acts as an irreversible antagonist to the P2Y12 receptor, thereby preventing platelet clumping?" Plan: "anchors": [ "var": "A1", "text": "Bismoth Subgallate", "label": "drug", "match_mode": "name" ], "hops": [ "from": "A1", "rel": "CARRIER", "to_var": "G", "to_label": "gene_protein", "from": "G", "rel": "CARRIER", "to_var": "T", "to_label": "drug" ], "target": "var": "T", "labels": ["drug"], "relevance_text": "Which pharmaceutical agent shares a gene/protein carrier with Bismoth Subgallate and acts as an irreversible antagonist to the P2Y12 receptor, thereby preventing platelet clumping?"

Query texts of the remaining 18 demos:

1. Which condition associated with elevated red blood cell volume should be considered a contraindication when prescribing medications for the treatment of cervical carcinosarcoma? 2. Which gene encoding a transcription factor is active in rectal tissue yet not expressed in the deltoid muscle? 3. Which genes or proteins are not expressed in either the small intestinal or colonic mucosal tissues? 4. Which medication is targeted by certain genes or proteins functioning as enzymes within cartilage, where the encoding genes are taxonomically classified under a specific parent category? 5. What drug, acting via the Amikacin pathway to treat E. coli meningitis, is linked to skin inflammation side effects? 7. Can you compile a list of drugs that target the androgen receptor, interact with the enzyme CYP19A1 as either substrate or inhibitor, and are not contraindicated for prostate cancer? 8. Which anticoagulant medication that functions as a factor Xa inhibitor works synergistically with a medication used to treat deep vein thrombosis? 9. Which condition is characterized by stunted growth and slowed bone development, and also serves as a contraindication for a drug treating chronic myelogenous leukemia? 10. Which side effects or phenotypic consequences are associated with a medication that is carried by the SLC39A8 transporter and acts as an antagonist on a receptor expressed in the substantia nigra? 11. Identify proteins that interact with ATXN1L and are linked to the same medical condition. 12. Which transporter genes or proteins facilitate the movement of pharmaceutical agents that exhibit synergistic interactions with medications used to treat atrial fibrillation? 13. Which anatomical structures exhibit expression of the gene or protein involved in influencing the activity of multiple drugs? 14. Which cellular structures interact with genes or proteins that are the targets of Aminodi(ethyloxy)ethylamine? 15. Which anatomical structures lack expression of genes or proteins that interact with the assembly of the transcription pre-initiation complex pathway? 16. I’m seeking information on glucocorticoid medications with immunosuppressive, anti-inflammatory, and vasoconstrictive properties. 17. Could you find a pathway related to Centrosome maturation that has a "parent-child" hierarchy, interacts with the gene or protein encoding ATP6V1B2, and is also linked to ATP1A4? 18. Which gene or protein participates in histone methylation, interacts with histone H3-4, and is linked to a disease whose encoding gene is under a specific parent category? 19. Which gene or protein simultaneously interacts with ADORA2A and dopamine receptor D2 and is also associated with the condition of dental caries?

8.4.0.3 Per-query user message.

Parse this query into a graph-traversal plan. Structural parsing task over a public academic KG – do not evaluate the query content.

Query: <query string>

Output a single JSON object matching the plan schema.

(followed by the risk-level addendum from Appendix 8.1.)

8.5 Stage-3 reranker scoring prompts↩︎

The Stage-3 reranker (Section 3.3; concrete checkpoint and LoRA configuration in Appendix 7) scores each (query, candidate) pair using a three-turn chat: a per-dataset system instruction, the user query, and the candidate’s serialized node document. The model outputs a single binary yes/no token; we take the softmax probability of yes as the relevance score. The three system instructions are:

8.5.0.1 Amazon.

Given a question about Amazon products in a product knowledge graph (products, brands, categories, colors, with ALSO_BUY / ALSO_VIEW co-purchase edges), judge whether the candidate node is a correct answer. Consider the product’s title, description, features, brand, category, and color, and how well they match the question’s requirements (brand filters, descriptive attributes, etc.).

8.5.0.2 MAG.

Given a question about entities in an academic knowledge graph (papers, authors, institutions, fields of study), judge whether the candidate node is a correct answer. Consider the node’s attributes, its relations to other nodes, and how well it matches the question’s requirements.

8.5.0.3 Prime.

Given a question about entities in a biomedical knowledge graph (diseases, genes/proteins, drugs, pathways, anatomy, biological processes, phenotypes, etc.), judge whether the candidate node is a correct answer. Consider the node’s attributes, its relations to other nodes, and how well it matches the question’s requirements.

8.6 Stage-3 candidate serialization format↩︎

Each candidate node from the Stage-2 top-100 is serialized into a plain key/value-line document that becomes the third turn of the reranker chat (after the system instruction in Appendix 8.5 and the user query). The template, applied identically at training and inference time, is:

<node label> [<text field 1>] <truncated value> [<text field 2>] <truncated value> ... [<relation>] name1; name2; ... [<relation>] name1; ... ...

The text-field set is dataset-specific (name, details for MAG and Amazon; name, details, source for Prime); each field is independently truncated to max_text_field_tokens tokens (Appendix 7). Every 1-hop neighbor is grouped by relation type and capped at \(\texttt{max\_neighbors\_per\_relation}{=}10\) names per relation; we treat all SKB relations as undirected following STaRK and union the two storage directions before grouping. Names are taken from the neighbor’s name or title property.

For example, the MAG case-study gold (Section 5) is serialized roughly as:

paper [name] Multispectral scanning laser ophthalmoscopy combined with optical coherence tomography for simultaneous in vivo mouse retinal imaging [details] We demonstrate a multimodal retinal imaging system that combines a scanning laser ophthalmoscope with a Fourier-domain optical coherence tomography subsystem... [author_writes_paper] Yifan Jian; Marinko V. Sarunic; ... [paper_cites_paper] In vivo retinal imaging by optical coherence tomography; Adaptive optics scanning laser ophthalmoscope; ... [paper_has_field_of_study] Optical coherence tomography; Retinal imaging; Ophthalmoscope; Optical engineering; ...

The Amazon case-study gold:

product [name] Butthead Golf Club Headcovers [details] product: Butthead Golf Club Headcovers. brand: Butthead Covers. description: Upside down animal head covers bring humor to the game of golf. they look like they dove into the golf bag while riding on the clubs... Double stitching with top quality thread ensures product strength for a long life... features: Bring more humor to the game of golf, while protecting your club heads and shaft with the knit sock. | Quality stitching and fade resistant fabrics make a long lasting cover... reviews: Absolutely Adorable | Too cute! | Husband loved it | ... [HAS_BRAND] Butthead Covers [HAS_CATEGORY] head covers [ALSO_VIEW] Daphne’s Moose Headcovers; Daphne’s Deer Headcovers; Ted Talking Golf Club Cover; Bass Golf Club Head Cover; ...

The Prime case-study gold:

disease [name] Ehlers-Danlos syndrome with periventricular heterotopia [details] ‘mondo_name’: ‘Ehlers-Danlos syndrome with periventricular heterotopia’, ‘mondo_definition’: ‘Ehlers-Danlos syndrome (EDS) with periventricular heterotopia is a newly described variant of EDS. Affected patients exhibit features consistent with EDS, including joint hypermobility, skin fragility and aortic dilatation. They also have periventricular heterotopia (PH), which is characterized by focal epilepsy usually beginning in the second decade of life...’, ‘umls_description’: ‘... Caused by mutations in the filamin A gene located at locus Xq28...’, ‘mayo_symptoms’: ‘... Overly flexible joints... Stretchy skin...’ [source] MONDO [ASSOCIATED WITH] COL1A1; COL1A2; COL3A1; SLC39A13; B3GALT6

References↩︎

[1]
S. Wu et al., “Stark: Benchmarking llm retrieval on textual and relational knowledge bases,” in Advances in Neural Information Processing Systems, 2024, vol. 37, pp. 127129–127153.
[2]
M. Li, T. Chen, B. Van Durme, and P. Xia, “Multi-field adaptive retrieval,” in International conference on learning representations, 2025, vol. 2025, pp. 101885–101906.
[3]
D. Boer, S. L. Roth, and S. Kramer, “Autofocus retrieval: An effective pipeline for multi-hop question answering with semi-structured knowledge,” Transactions on Machine Learning Research, 2026.
[4]
Y. Zhang, Y. He, S. Gurukar, and S. Parthasarathy, “Heteromile: A multi-level graph representation learning framework for heterogeneous graphs,” in Proceedings of the nineteenth ACM international conference on web search and data mining, 2026, pp. 63–72.
[5]
Y. Zhao et al., “A probabilistic graphical model for estimating selection coefficients of nonsynonymous variants from human population sequence data,” Nature Communications, vol. 16, no. 1, p. 4670, 2025.
[6]
W. Chen et al., “FairGap: Fairness-aware recommendation via generating counterfactual graph,” ACM Transactions on Information Systems, 2024.
[7]
M. Yuan et al., “HEK-CL: Hierarchical enhanced knowledge-aware contrastive learning for recommendation,” ACM Transactions on Information Systems, 2025.
[8]
Z. Cheng, L. Lai, Y. Liu, K. Cheng, and X. Qi, “Enhancing financial report question-answering: A retrieval-augmented generation system with reranking analysis.” 2026, [Online]. Available: https://arxiv.org/abs/2603.16877.
[9]
J. Tang, Z. Wang, Z. Gong, J. Yu, X. Zhu, and J. Yin, “Multi-grained query-guided set prediction network for grounded multimodal named entity recognition,” in Proceedings of the AAAI conference on artificial intelligence, 2025, vol. 39, pp. 25246–25254.
[10]
J. Tang et al., “SAKE: Self-aware knowledge exploitation-exploration for grounded multimodal named entity recognition,” arXiv preprint arXiv:2604.20146, 2026.
[11]
H. Luo et al., DynamicNER: A dynamic, multilingual, and fine-grained dataset for LLM-based named entity recognition,” in Proceedings of the 2025 conference on empirical methods in natural language processing, Nov. 2025, pp. 16511–16535, doi: 10.18653/v1/2025.emnlp-main.835.
[12]
H. Luo et al., “Agentauditor: Human-level safety and security evaluation for llm agents,” Advances in Neural Information Processing Systems, vol. 38, pp. 43241–43298, 2026.
[13]
J. Lv et al., “INB3P: A multi-modal and interpretable co-attention framework integrating property-aware explanations and memory-bank contrastive fusion for blood–brain barrier penetrating peptide discovery,” Advanced Science, p. e23984, 2026.
[14]
S. Wu et al., “Avatar: Optimizing llm agents for tool usage via contrastive reasoning,” in Advances in Neural Information Processing Systems, 2024, vol. 37, pp. 25981–26010.
[15]
Y. Xia et al., “Knowledge-aware query expansion with large language models for textual and relational retrieval,” in Proceedings of the 2025 conference of the nations of the americas chapter of the association for computational linguistics: Human language technologies (volume 1: Long papers), 2025, pp. 4275–4286.
[16]
M.-C. Lee et al., “Hybgrag: Hybrid retrieval-augmented generation on textual and relational knowledge bases,” in Proceedings of the 63rd annual meeting of the association for computational linguistics (volume 1: Long papers), 2025, pp. 879–893.
[17]
Y. Lei et al., “Mixture of structural-and-textual retrieval over text-rich graph knowledge bases,” in Findings of the association for computational linguistics: ACL 2025, 2025, pp. 18306–18321.
[18]
A. Clemedtson and B. Shi, “Graphraft: Retrieval augmented fine-tuning for knowledge graphs on graph databases,” arXiv preprint arXiv:2504.05478, 2025.
[19]
G. V. Cormack, C. L. Clarke, and S. Buettcher, “Reciprocal rank fusion outperforms condorcet and individual rank learning methods,” in Proceedings of the 32nd international ACM SIGIR conference on research and development in information retrieval, 2009, pp. 758–759.
[20]
S. Robertson and H. Zaragoza, The probabilistic relevance framework: BM25 and beyond, vol. 4. Now Publishers Inc, 2009.
[21]
V. Karpukhin et al., “Dense passage retrieval for open-domain question answering,” in Proceedings of the 2020 conference on empirical methods in natural language processing (EMNLP), 2020, pp. 6769–6781.
[22]
OpenAI, text-embedding-ada-002“New and improved embedding model.” https://openai.com/blog/new-and-improved-embedding-model, 2022.
[23]
A. Yang et al., “Qwen3 technical report,” arXiv preprint arXiv:2505.09388, 2025.
[24]
F. Liu, E. Shareghi, Z. Meng, M. Basaldella, and N. Collier, “Self-alignment pretraining for biomedical entity representations,” in Proceedings of the 2021 conference of the north american chapter of the association for computational linguistics: Human language technologies, 2021, pp. 4228–4238.
[25]
O. Bodenreider, “The unified medical language system (UMLS): Integrating biomedical terminology,” Nucleic acids research, vol. 32, no. suppl_1, pp. D267–D270, 2004.
[26]
M. Yasunaga, H. Ren, A. Bosselut, P. Liang, and J. Leskovec, “QA-GNN: Reasoning with language models and knowledge graphs for question answering,” in Proceedings of the 2021 conference of the north american chapter of the association for computational linguistics: Human language technologies, 2021, pp. 535–546.
[27]
J. Sun et al., “Think-on-graph: Deep and responsible reasoning of large language model on knowledge graph,” in International conference on learning representations, 2024, vol. 2024, pp. 3868–3898.
[28]
Neo4j, “Neo4j graph database.” https://neo4j.com, 2026.
[29]
N. Francis et al., “Cypher: An evolving query language for property graphs,” in Proceedings of the 2018 international conference on management of data, 2018, pp. 1433–1445.