From c53c59234341c3d5fc5e5acb849402b87c31f6ea Mon Sep 17 00:00:00 2001 From: Alan Scherger Date: Mon, 19 Oct 2026 09:04:54 -0500 Subject: [PATCH] feat: Rank symbol queries with BM25 only Bare identifier queries ("MyService", "Sinatra::Base") are exact lookups: the dense list adds near-miss neighbours that the definition boost then has to outrank. Set _ALPHA_SYMBOL from 0.3 to 0.0 so symbol queries fuse BM25 only; NL queries are unchanged. --- src/semble/ranking/boosting.py | 2 +- tests/test_ranking.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/semble/ranking/boosting.py b/src/semble/ranking/boosting.py index dd88f402..96dcbca1 100644 --- a/src/semble/ranking/boosting.py +++ b/src/semble/ranking/boosting.py @@ -78,7 +78,7 @@ # Fraction of max_score added to each file's top chunk, scaled by its aggregate candidate score. _FILE_COHERENCE_BOOST_FRAC = 0.2 -_ALPHA_SYMBOL = 0.3 # lean BM25 for exact keyword matching +_ALPHA_SYMBOL = 0.0 # BM25 only: exact identifier lookups gain nothing from the dense list _ALPHA_NL = 0.5 # balanced semantic + BM25 # Common English stopwords excluded from file-stem matching for NL queries. diff --git a/tests/test_ranking.py b/tests/test_ranking.py index 8407a355..e3d4400d 100644 --- a/tests/test_ranking.py +++ b/tests/test_ranking.py @@ -42,7 +42,7 @@ def test_rerank_topk_demotes_penalised_paths(penalised_path: str) -> None: ("query", "alpha_in", "expected"), [ ("MyService", 0.7, 0.7), # explicit value returned as-is - ("MyService", None, 0.3), # symbol query → _ALPHA_SYMBOL + ("MyService", None, 0.0), # symbol query → _ALPHA_SYMBOL ("how does routing work", None, 0.5), # NL query → _ALPHA_NL ], )