Scaling GraphLLM with Bilevel-Optimized Sparse Querying

Yangzhe Peng, Haiquan Qiu, Quanming Yao, Kun HearXiv 2026

TL;DR

Integrating Large Language Models (LLMs) with Graph Neural Networks (GNNs) yields powerful representations for text-attributed graphs, but querying an LLM for every single node is computationally and financially ruinous. BOSQ (Bilevel-Optimized Sparse Querying) solves this by using bilevel optimization to intelligently select a tiny, task-critical budget of nodes for LLM explanation. This approach delivers up to a 167.9× speedup over dense querying methods, matching or exceeding state-of-the-art performance while scaling easily to million-node graphs.

What Problem Does This Paper Address?

Text-Attributed Graphs (TAGs)—where nodes represent entities with rich textual descriptions (like products on Amazon or user profiles on Instagram)—are everywhere. Recently, researchers have found success using the "LLM-as-Explainer" paradigm. In this setup, an LLM generates detailed semantic explanations for a node's text, which are then encoded into embeddings to supercharge a downstream GNN.

The catch? Scalability. Naively querying an LLM for every single node (dense querying) on even a medium-sized dataset like Amazon Photo (48k nodes) can take days of processing time and rack up massive API costs. Furthermore, graph data inherently contains structural and semantic redundancy; not every node needs an expensive LLM upgrade to achieve good downstream task performance. The challenge lies in figuring out exactly which nodes are worth the premium cost of an LLM query.

Methods

The authors introduce BOSQ, a framework that treats node selection as a bilevel optimization problem to enforce a strict, sparse query budget ($K \ll |V|$).

Figure 2: Overview of the BOSQ framework. Our method treats node selection as a bilevel optimization problem. The outer loop (purple) learns an Adaptive Selector to identify a sparse subset of nodes that benefit most from LLM explanations, while the inner loop (blue) optimizes a GNN on the resulting augmented graph. By using hypergradients to guide the selection mask m, BOSQ selectively invokes the LLM only for critical nodes (K ≪|V|). This mechanism achieves a superior trade-off between task performance and computational efficiency compared to previous dense querying baselines (see Comparison box).

The framework operates via two nested loops:

  1. The Inner Loop (GNN Training): Trains a standard GNN on the graph features, which are selectively augmented by LLM explanations based on a binary selection mask $m$.
  2. The Outer Loop (Adaptive Selector): Optimizes a continuous importance score vector ($\lambda$) for the nodes. It updates these scores by calculating hypergradients—gradients flowing backward from the downstream task's validation loss through the GNN's optimization process.

To bridge the gap between continuous importance scores and a hard, discrete binary mask (choosing exactly $K$ nodes), BOSQ utilizes a Gumbel-Softmax Top-K sampling strategy paired with a Straight-Through Estimator (STE). This mathematical trick ensures that the forward pass remains genuinely sparse (saving compute by only querying $K$ nodes), while still allowing smooth gradient signals to flow backward during training.

Datasets

The authors evaluated BOSQ across six real-world TAG datasets spanning two distinct node-level tasks, plus two additional large-scale graphs for scalability testing:

  • Node Classification: Photo (48,362 nodes), Instagram (11,339 nodes), and Computer (87,229 nodes).
  • Node Regression: User-ltv (35,772 nodes), Item-ltv (35,772 nodes), and Post-votes (40,947 nodes) from the RelBench benchmark.
  • Million-Scale Scalability: ogbn-products (2,449,029 nodes) and arXiv (169,343 nodes).

Key Insights and Ideas

  • Information Sparsity is Real: Brute-force dense querying is not just slow; it can introduce noise. Selectively filtering out low-gain textual information actually improves numerical precision in regression tasks.
  • Task-Driven Selection Beats Heuristics: Traditional selection methods rely on static heuristics like node degree or prediction entropy. BOSQ proves that letting the validation loss dynamically dictate node utility creates a far more robust and adaptable selection strategy.
  • Direct Replacement > Concatenation: When synthesizing the original text with the LLM explanation, directly replacing the raw text embedding with the explanation embedding yielded superior results. Concatenating them often introduced redundant noise that diluted task-specific signals.

Key Results

BOSQ dramatically alters the efficiency-performance trade-off curve for GraphLLMs, placing it squarely in the ideal "high accuracy, low execution time" quadrant.

Figure 1: BOSQ improves the efficiency-performance trade-off of existing GraphLLM frameworks. By learn- ing which nodes most benefit from LLM-generated ex- planations under a sparse query budget, BOSQ achieves substantially faster end-to-end execution than TAPE while preserving competitive task performance. Our method (red star) sits near the ideal top-left region, of- fering a practical and scalable solution for large-scale TAGs where dense GraphLLM baselines are infeasible. Please refer to Table 2 for detailed results.

Node Classification & Regression

On classification tasks, BOSQ achieved an identical average accuracy to the dense-querying baseline TAPE (80.42%) but reduced the average execution time from over 28 hours down to just 10 minutes (a 167.9× speedup). For regression tasks, BOSQ achieved Rank 1 performance (lowest Mean Absolute Error) across all datasets while remaining significantly faster than alternative LLM-augmented methods.

Million-Scale Scalability

The true test of BOSQ was the massive ogbn-products dataset (2.4M nodes). While state-of-the-art GraphLLM baselines like LLaGA and LLMExpl failed to finish within a 24-hour time limit, BOSQ successfully processed the entire graph in 7.4 hours, securing the highest accuracy of 78.42%.

Table 4: Scalability and efficiency analysis on the million-scale ogbn-products dataset. ’—’ indicates the method exceeded the 24-hour time limit. BOSQ achieves the best accuracy while remaining computa- tionally feasible.

Limitations and Future Work

While BOSQ represents a massive leap forward for practical GraphLLM deployment, the authors note a few limitations:

  • Paradigm Constraints: The current implementation is tailored to the generative "LLM-as-Explainer" setup. Future work could extend this selector to discriminative "LLM-as-Encoder" architectures.
  • Fixed Budgets: The query budget $K$ is currently a fixed hyperparameter. Implementing dynamic budgeting or nucleus-style sparse selection could allow finer graph-wise adaptability.
  • Linear Selectors: The selector currently uses a simple learnable vector parameterization. Upgrading to non-linear selectors (like an MLP) might capture richer topological dependencies, though at the cost of additional computational overhead.

Summary updated

BibTeX
@misc{peng2026scaling,
  author = {Yangzhe Peng and Haiquan Qiu and Quanming Yao and Kun He},
  title = {{Scaling GraphLLM with Bilevel-Optimized Sparse Querying}},
  year = {2026},
  eprint = {2602.09038},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.09038},
}
Figure