缺失动词/关系词提取导致特定属性查询检索失败
尊敬的作者,您好:
首先,非常感谢你们开源了 LinearRAG 这样优秀的项目。将图检索与线性复杂度结合的想法非常有创新性,代码结构也很清晰。我已经成功在本地部署并跑通了自己的中文数据集。 但是,我在测试过程中发现了一个关于检索的问题,希望向您请教或反馈。 目前的检索机制高度依赖命名实体识别(NER),而 NER 通常只关注名词(人名、地名、机构名)。然而,系统倾向于忽略动词或关系关键词(如“出生”、“位于”)。 当查询针对一个“中心实体(Hub Entity)”(连接度极高的实体,如“周杰伦”)的特定属性时,系统仅提取出该中心实体作为种子。由于该实体连接了绝大多数段落,图传播算法(PageRank)默认会根据中心性/热度来排序,而不是根据与查询中“关系词”的语义相关性。 复现示例 问题 :someone的出生于那日和出生于哪里 系统行为 :
- NER 提取 :仅提取出 [someone】 。动词 [出生] 被忽略。
- 图传播 :种子 [someone] 激活了数百个相连段落。
- 排序 :系统返回了关于他的“热门歌曲”、“奖项”或“演唱会”等高 PageRank 分数的段落,完全错过了包含“出生”信息的段落。 “出生”这一语义约束在种子提取阶段就丢失了。图检索因此退化成了一个通用的“告诉我关于someone的重要信息”的查询,而不是特定的“告诉我someone的出生信息”的查询。 请问对于这种情况有什么解决方法吗
I'm not the author, but I have a few thoughts.
As stated in the paper, the retrieval algorithm is specifically tuned for multi-hop questions and outperforms classical (naive) RAG and other graph-based implementations exactly in such cases. For plain questions, you could use classical retrieval without applying the graph from the dense_passage_retrieval method.
In my practice, I will add a similarity measure of the embedding of an entity/sentence to the entire question in an attempt to alleviate this problem. I don't know if this might be of any inspiration to you.
Thanks a lot for the clear explanation from @Kekuaka. Based on our findings, GraphRAG is not a universal solution for all retrieval-based tasks. It benefits the retrieval systems only when the questions or the background corpus are complex. We verify this point in our benchmark paper [1].
Back to your question, a hybrid retrieval method that integrates traditional semantic-based and graph-based RAG may be a potential solution.
[1] When to use Graphs in RAG: A Comprehensive Analysis for Graph Retrieval-Augmented Generation.
Thanks for the detailed discussion here, I’d like to contribute a small, low-risk improvement that keeps LinearRAG’s baseline behavior intact.
Proposed approach (opt-in, not default):
- Add a config flag for an attribute-query fallback/hybrid mode.
- Detect attribute-style queries (e.g., where/when/born/located/founded) with lightweight heuristics.
- For those cases only, rebalance final passage scoring (graph + dense semantic signal and/or relation-keyword overlap boost) to avoid hub-entity over-broad retrieval.
- Keep default behavior unchanged to preserve paper-faithful baseline.
Validation plan:
- add a targeted regression case for hub-entity attribute query
- add a no-regression case for multi-hop retrieval behavior
- add parity check with fallback disabled
If this direction sounds good, I can open a focused PR with this feature as disabled-by-default.