feat(retrieve): add knowledge-graph-aware scoring to retrieval pipeline#2555
Open
huang-yi-dae wants to merge 1 commit into
Open
feat(retrieve): add knowledge-graph-aware scoring to retrieval pipeline#2555huang-yi-dae wants to merge 1 commit into
huang-yi-dae wants to merge 1 commit into
Conversation
Integrate graph connectivity (from .relations.json and MEMORY_FIELDS links/backlinks) into the retrieval scoring pipeline. When graph_alpha > 0, top candidates get a graph_score blended via tanh saturation, boosting well-connected results. Default graph_alpha=0 preserves existing behavior. 🤖 Generated with [Qoder][https://qoder.com]
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
graph_alphaandgraph_saturation_kconfig fields toRetrievalConfig, enabling optional graph-aware scoringgraph_loader.pymodule loads relation data concurrently from two sources:.relations.jsonandMEMORY_FIELDS.links/backlinksHierarchicalRetriever._convert_to_matched_contextswith lazy loading (only top candidates), blendinggraph_score = tanh(total_relations / graph_saturation_k)into final scoreVikingFSpassesviking_fs=selfto bothfind()andsearch()retriever construction callsgraph_alpha=0preserves full backward compatibility - no behavior change when disabledTest plan
test_convert_to_matched_contexts_returns_empty_relations- backward compat, graph_alpha=0 keeps relations=[]test_graph_alpha_zero_returns_empty_relations- explicit zero, VikingFS present but not invokedtest_graph_scoring_with_relations_json- .relations.json loading + tanh blendingtest_graph_scoring_with_memory_file_links- MEMORY_FIELDS links/backlinks parsing from .md filestest_graph_lazy_loading- only top candidates trigger graph data I/OAll 14 tests pass (10 existing + 4 new).