[perf] TOPK_RETRIEVE=60 dilutes 1-hop graph neighbours on small vaults (bridge Recall@12 0.066 at topk=60 -> 0.141 at topk=20 -> 0.267 at topk=10)

Aperta
#92 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, sqlite
Ambito
data, search

Direzione di ricerca

Start by reading retrieve_candidates, expand_1hop, and the TOPK_RETRIEVE/GHOPS settings; the issue does not name their files. Reproduce the reported sweep with eval/build_gold.py bench/vault --n-per-class 30 --seed 42 and compare bridge Recall@12 and 1-hop slots. Done means choosing and implementing a retrieval-pool adjustment, then showing before-and-after evaluation results.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What

Following up on @tonydzi's observation in https://github.com/tonydzi/sqlite-graph-memory/pull/86#issuecomment-6612611484:

"the topk-20 bridge result (Recall@12 0.068 to 0.141) is worth its own issue: on a small vault a 60-note pool may be drowning the graph neighbours."

We swept topk in [10, 15, 20, 30, 40, 60, 80] across the 100-question bench/vault gold set (eval/build_gold.py bench/vault --n-per-class 30 --seed 42; 202 notes / 204 chunks) for both 0-hop (vector) and 1-hop (graph) and measured both the candidate pool composition and how many 1-hop graph neighbours survive into the cross-encoder's top-12.


Measured Curve on bench/vault (100 gold questions: 30 title, 30 body, 30 bridge, 10 temporal)
1. bridge (n=30) & overall (n=100) Recall@12 / MRR / nDCG@12 across topk
topk bridge 0-hop (R@12 / MRR / nDCG@12) bridge 1-hop (R@12 / MRR / nDCG@12) bridge ΔRecall@12 bridge ΔnDCG@12 overall 0-hop (R@12 / MRR / nDCG@12) overall 1-hop (R@12 / MRR / nDCG@12) overall ΔnDCG@12
10 0.130 / 0.086 / 0.073 0.267 / 0.154 / 0.155 +0.137 +0.082 0.739 / 0.652 / 0.667 0.770 / 0.670 / 0.687 +0.020
15 0.136 / 0.092 / 0.077 0.179 / 0.125 / 0.106 +0.043 +0.030 0.731 / 0.650 / 0.663 0.744 / 0.659 / 0.671 +0.008
20 0.091 / 0.072 / 0.055 0.141 / 0.107 / 0.085 +0.050 +0.029 0.717 / 0.644 / 0.657 0.732 / 0.653 / 0.664 +0.008
30 0.069 / 0.081 / 0.047 0.075 / 0.081 / 0.052 +0.006 +0.005 0.711 / 0.647 / 0.654 0.712 / 0.645 / 0.654 +0.000
40 0.075 / 0.084 / 0.050 0.075 / 0.081 / 0.051 +0.000 +0.001 0.713 / 0.646 / 0.653 0.712 / 0.645 / 0.654 +0.000
60 0.068 / 0.074 / 0.045 0.066 / 0.076 / 0.047 -0.002 +0.001 0.711 / 0.643 / 0.652 0.710 / 0.644 / 0.652 +0.000
80 0.066 / 0.075 / 0.047 0.066 / 0.075 / 0.047 +0.000 +0.000 0.710 / 0.643 / 0.652 0.710 / 0.643 / 0.652 +0.000

(No other class degrades when shrinking topk from 60 to 10..20: title stays at 1.000 / 1.000 / 1.000, temporal stays at 1.000 / 0.700 / 0.779, and body improves slightly from 0.967 / 0.836 / 0.868 at topk=60 to 0.967 / 0.844 / 0.875 at topk=10.)

2. Candidate Pool & Top-12 Composition on bridge (n=30, 1-hop)
topk base Pool Distractor meeting-* in base (of 40) 1-hop Added (added) Gold Share in base Gold Share in added (1-hop) Total Gold Share in base ∪ added Top-12 meeting-* Slots Top-12 1-hop (+graph) Slots Top-12 Gold Hits (notes)
10 10.00 3.77 / 40 (9.4%) 35.10 0.130 0.837 0.967 2.63 3.87 1.47
15 15.00 5.97 / 40 (14.9%) 39.53 0.195 0.772 0.967 3.17 2.67 1.03
20 20.00 8.13 / 40 (20.3%) 38.90 0.255 0.711 0.967 3.53 1.87 0.80
30 30.00 12.83 / 40 (32.1%) 38.10 0.334 0.633 0.967 3.87 0.90 0.43
40 40.00 17.30 / 40 (43.3%) 37.17 0.451 0.519 0.971 3.77 0.67 0.43
60 60.00 23.73 / 40 (59.3%) 34.77 0.600 0.375 0.975 3.73 0.27 0.40
80 80.00 29.67 / 40 (74.2%) 32.27 0.685 0.294 0.979 3.70 0.07 0.40

Root Cause
  1. Candidate recall is already saturated at topk=10 (96.7% of all gold bridge link targets are in base ∪ added: 13.0% from base + 83.7% via expand_1hop).
  2. Dense pool dilution on small vaults: On a 202-note vault, TOPK_RETRIEVE = 60 scoops 30% of the entire vault into base before expand_1hop even runs (94.77 / 202 = 46.9% of the vault in base + added). That base pool pulls in 23.73 / 40 (59.3%) of the vault's distractor meeting-*.md notes plus dozens of unlinked notes from dense ranks 16..60 that share template phrasing with the query paragraph.
  3. Cross-encoder false positives crowd out 1-hop entity cards: Because rerank_candidates scores (query, title + '. ' + snippet) purely by pairwise text similarity without knowing whether a candidate came from top dense ranks, tail dense ranks (16..60), or a 1-hop [[wikilink]] from the #1 hit, unlinked tail candidates crowd out concise 1-hop target cards — dropping 1-hop slots in the top-12 from 3.87 (topk=10) and 1.87 (topk=20) down to 0.27 (topk=60).

Options to Consider
  1. Vault-proportional cap on retrieve_candidates (e.g., capping the default dense pool at min(TOPK_RETRIEVE, max(15, n_unique_files // 10)) when topk is not explicitly overridden), so a 200-note vault does not feed half the corpus into the cross-encoder while a 2,000+ note vault still uses 60.
  2. Aligning --graph dense pool with GHOPS = 15 (or 20), since expand_1hop only expands outgoing links from base_order[:ghops] (15 seeds) anyway — base_order[15:60] never seeds the graph hop.

Happy to take this on and run the before/after eval tables once you decide which direction you prefer!

— TangleClaw'd by Jason Vaughan
Human-directed. Agent-executed. Evidence-backed.
TangleClaw.com

Lingua principale
Python
Stelle
9
Fork
6
Merge medio
13h 8m
PR unite (30g)
40

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tonydzi/sqlite-graph-memory

Tutte le issue di tonydzi/sqlite-graph-memory

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.