arXiv:2607.28311cs.DBcs.LG2026-07中稿 · ISWC 2026

首个无需重训练即可泛化到新知识图谱的查询基数估算方法

Fully Inductive Cardinality Estimation

  • 基于因子图构建双分支GNN,通过局部消息传递编码实体与关系
  • 在10个知识图谱上将中位数q-error从13.54降至5.34,尾部误差显著优化
  • 适用于实时查询优化场景,推理延迟低于1毫秒,适合部署于真实三元组库

知识图谱上基本图模式(BGP)SPARQL查询的优化需要精确的基数估计。近期提出的学习型估计器优于传统统计和采样方法,但存在局限:它们为非归纳式,当底层图变化或应用于新图时需重新训练。我们提出FICE(完全归纳基数估计),首个无需重训练即可泛化至全新知识图谱(包括未见关系)的BGP查询学习型基数估计器。FICE采用图神经网络(GNN),包含两个耦合组件:首先,在知识图谱的因子图视图上使用编码器GNN生成实体与关系嵌入;我们证明了BGP基数是该视图中绑定项2跳邻域的局部函数,因此采用局部消息传递编码器。解码器GNN沿查询连接拓扑组合这些嵌入以预测对数基数。编码器与解码器联合训练,使嵌入专用于基数估计。FICE使用邻域采样训练,可扩展至含百万三元组的知识图谱,并解耦嵌入生成与基数解码,实现低于1毫秒的估计延迟。在10个知识图谱上的实验显示,相比学习型与非学习型基线,FICE将整体中位数q-error从13.54(最优竞争者)降至5.34,且在尾部行为上全面领先。

原文摘要 · Abstract (English)

Query optimization of Basic Graph Patterns (BGP) SPARQL queries over Knowledge Graphs (KG) requires accurate cardinality estimation. Recently published learned estimators outperform statistics- and sampling-based approaches, but share a limitation preventing their adoption in real-world triplestores: they are transductive and require retraining when the underlying graph changes or when applied to new graphs. We present FICE (Fully Inductive Cardinality Estimation), the first learned cardinality estimator for BGP queries over KGs that generalizes to entirely unseen graphs (including unseen relations), without any retraining. FICE is a graph neural network (GNN) with two coupled components. First, an encoder GNN over a factor-graph view of the KG produces entity and relation embeddings. We prove that BGP cardinality is a local function of the 2-hop neighborhood around bound terms in this view, motivating the local message-passing encoder. A decoder GNN then composes these embeddings along the join topology of the query to predict log-cardinality. The encoder and decoder are trained jointly, making the embeddings specialized for cardinality estimation. FICE is trained using neighborhood sampling to scale to KGs with millions of triples, and decouples embedding generation from cardinality decoding to enable estimation latency below a millisecond. Compared to learned and non-learned baselines over 10 KGs, FICE reduces the overall median q-error from 13.54 (for the best competitor) to 5.34 and dominates all approaches in tail behavior.

知识图谱基数估计图神经网络查询优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。