Skip to content

feat: add opt-in fallback for attribute-style hub-entity queries#21

Merged
LuyaoZhuang merged 1 commit intoDEEP-PolyU:mainfrom
pandego:feat/issue-19-attribute-fallback
Mar 4, 2026
Merged

feat: add opt-in fallback for attribute-style hub-entity queries#21
LuyaoZhuang merged 1 commit intoDEEP-PolyU:mainfrom
pandego:feat/issue-19-attribute-fallback

Conversation

@pandego
Copy link
Contributor

@pandego pandego commented Mar 3, 2026

Closes #19

Summary

This PR adds a small, opt-in retrieval fallback for attribute-style queries (e.g. where/when/born/located/founded) while keeping LinearRAG default behavior unchanged.

What changed

  • Added new config fields in src/config.py:
    • enable_hybrid_attribute_fallback (default False)
    • attribute_keyword_boost (default 0.25)
    • attribute_query_keywords (lightweight keyword list)
  • Updated retrieval path in src/LinearRAG.py:
    • pass question context into graph retrieval scoring
    • when fallback is enabled and query matches attribute-style intent, apply a small keyword-overlap score boost in passage ranking
  • Kept baseline behavior intact when fallback is disabled.

Why

Issue #19 reports hub-entity attribute queries retrieving broad/high-centrality passages while missing relation-specific information. This PR adds a graceful, optional mitigation without changing the paper-faithful default pipeline.

Validation

  • python3 -m py_compile src/LinearRAG.py src/config.py src/ner.py src/utils.py
  • Manual review of fallback gating path to ensure no behavior change when enable_hybrid_attribute_fallback=False.

If maintainers prefer, I can follow up with a tiny synthetic regression harness in a separate PR to quantify ranking changes on attribute-style examples.

@LuyaoZhuang LuyaoZhuang merged commit b0d4412 into DEEP-PolyU:main Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

缺失动词/关系词提取导致特定属性查询检索失败

2 participants