Default dense order: a graph-hop note can never reach the top 12, and the README demo only reproduces with --rerank
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 56/100
Hướng nghiên cứu
Start in src/sqlite_graph_memory/brain_ask.py with retrieve_candidates, expand_1hop, rerank_candidates, and the rerank() closure in main(); compare the ranking flow with the fusion step in src/sqlite_graph_memory/ppr.py. Read tests/test_brain_ask.py and eval/run_ablation.py, then check the “Three commands” section in README.md. Done means the default graph ordering can place an outside-pool linked note in the top 12, the README demo matches its command, and the ablation results are reported.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
Since 0.3.7 the cross-encoder rerank is off by default and candidates are ordered by dense similarity. In that mode the 1-hop graph expansion adds candidates, but none of them can enter the result.
Reproduction on a clone of master (0.3.9), Windows 11, Python 3.12, [lite] backend, with the 202-note vault from bench/vault copied to ./notes, exactly as the README section "Three commands" says:
sgm-index ./notes
sgm-ask --ab "In which programming language is the tool behind Project Ouzel written?"
Actual output (first lines of each list):
A/B RECALL: In which programming language is the tool behind Project Ouzel written?
(Direct=60 vector / Associative=+36 graph; Associative promoted 0 new notes into top-12, 0 of them via graph)
--- DIRECT memory (vector) ---
1. [ 0.86] project-ouzel
2. [ 0.80] project-kestrel
3. [ 0.80] tool-cobbleset
...
--- ASSOCIATIVE memory (vector+graph) ---
1. [ 0.86] project-ouzel
2. [ 0.80] project-kestrel
3. [ 0.80] tool-cobbleset
All 12 rows of the two lists are the same. The README block "Real output, top 5 of 12" shows [ 1.66] project-ouzel and 2. [ 1.14] tool-lanternfish <== +graph. I get exactly that output only after adding --rerank to the command. The three documented commands do not produce it.
The cause is structural, not specific to this question. retrieve_candidates() keeps the top 60 files by similarity (brain_ask.py, TOPK_RETRIEVE = 60). expand_1hop() only adds notes that are not already in that pool, so every added note has a similarity no higher than any of the 60 pool members. rerank_candidates() with ce=None sorts by that same similarity and cuts to 12 (TOPN = 12), so an added note cannot reach the top 12.
Measured over all 91 questions in bench/questions.jsonl with the default pipeline functions (retrieve_candidates -> expand_1hop -> rerank_candidates(None, ..., sims=sims)):
questions=91 graph_candidates_added=2587 graph_notes_in_top12=0
The MCP tool is affected the same way. mcp_server.py runs --graph --ask for the default associative mode and --ask for direct. For the question above the two answer files are identical after the two header lines (e5 60 files -> dense versus /graph+36; e5 96 files -> dense), and tool-lanternfish has no section in the 8-note bundle.
Related: #92 discusses pool size diluting graph neighbours, and a comment there notes that neighbours compete by dense cosine unless --rerank is passed. This issue is the consequence for the default path: as long as the pool is at least as large as the cut, the hop cannot change the dense-order result, and the README demo no longer matches. A smaller --pool does not fix it, for the same reason.
Why it matters
The README promises that the tool follows wikilinks to the note a vector search misses. On a default install, through both the CLI and the MCP server, that does not happen. A newcomer who runs the three commands sees two identical lists and no <== +graph line.
Suggested approach
Two steps. The first one is small and can be a PR on its own:
- Make the README demo true again: either add
--rerankto the command in "Three commands" and say why, or re-record the block from the default command. - Give graph neighbours a way into the dense-order result. Options to discuss here before coding: reserve a small number of the top-N slots for the best graph neighbours; score a neighbour by its parent's similarity times a decay factor; or fuse the dense list and the hop list by rank, as the PageRank lane in
ppr.pydoes. Any of them should be measured witheval/run_ablation.pyonbench/vaultbefore it becomes the default.
Done when
- The command printed in README "Three commands" produces the output block printed under it on
bench/vault. - A new offline test (no model, hand-built
simsandmetain the style oftests/test_brain_ask.py) builds more than 60 files plus one linked note outside the pool, and asserts that the default--graphordering puts the linked note inside the top 12. The test fails on current master. - A before/after table from
eval/run_ablation.pyonbench/vaultis in the PR body. python -m pytest -qshows no new failures.
Where to start
src/sqlite_graph_memory/brain_ask.py:retrieve_candidates,expand_1hop,rerank_candidates, and thererank()closure inmain()src/sqlite_graph_memory/ppr.pyfor the existing fusion stepsrc/sqlite_graph_memory/mcp_server.py: mode to flag mappingREADME.md: section "Three commands"tests/test_brain_ask.py,eval/run_ablation.py
New here? Comment that you are taking it and ask anything in this thread; small PRs are reviewed within a day.
- Ngôn ngữ chính
- Python
- Star
- 9
- Fork
- 6
- Merge trung bình
- 13 giờ 8 phút
- Pull request đã merge (30 ngày)
- 40
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tonydzi/sqlite-graph-memory
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
tonydzi/sqlite-graph-memory#133 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
tonydzi/sqlite-graph-memory#131 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sgm-index on a mistyped or empty folder overwrites the existing index with an empty one and exits 0Đang mởbug good first issue
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
tonydzi/sqlite-graph-memory#130 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
tonydzi/sqlite-graph-memory#126 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
tonydzi/sqlite-graph-memory#125 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của tonydzi/sqlite-graph-memory
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
LearningCircuit/local-deep-research#10161 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
chore: contact address [email protected]Có thể đã có người làm @larsrollik đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Gustavo-Galvao-e-Silva/panchi#228 ·
Maintainer thường phản hồi trong vòng 1 ngày