Skip to content

feat(rag): relevance floor (min_score) for advanced_search (#10703) - #10704

Merged
mrveiss merged 4 commits into
Dev_new_guifrom
issue-10703
Jun 30, 2026
Merged

mrveiss merged 4 commits into
Dev_new_guifrom
issue-10703

Conversation

@mrveiss

@mrveiss mrveiss commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Thinking Path

Subtask 4.3 of #10600 (umbrella #10603). advanced_rag_optimizer.advanced_search applied no minimum relevance, so non-chat callers (cag_service, graph_rag_service, knowledge/service) ingest whatever top-k returns regardless of score → low-relevance chunks distract/hallucinate. Add a configurable floor — done safe (default off) since the other #10600 flips (MMR/BM25/RLM/reranker-swap) need an eval harness or touch opaque config.

What Changed

  • advanced_search(..., min_score: float = 0.0) — drops results scoring below min_score (rerank_score if present, else hybrid_score) via the extracted _apply_relevance_floor() helper.
  • min_score added to the cache key so floored/unfloored results don't collide.
  • Default 0.0 = no-op → every existing caller is byte-for-byte unaffected; callers/config opt in to a floor.

Verification

  • advanced_rag_optimizer_test.py — floor drops sub-threshold (rerank_score preferred over hybrid_score), 0.0 is a no-op (returns the same list), cache key includes min_score (3 new; 7 existing pass).
  • flake8 --max-line-length=120 clean; black/isort clean.

Out of scope (need eval / opaque config)

MMR enable (§4.1 — mmr_lambda is an opaque dynamic model_config and may be disconnected from the optimizer path), BM25 (§4.2), RLM (§4.5), reranker swap (§4.6).

Closes #10703. Part of #10600 / umbrella #10603.

Model Used

Claude Opus 4.8 (1M context)

advanced_search applied no minimum relevance, so non-chat callers ingested
whatever top-k returned regardless of score. Add a configurable floor:

- advanced_search(..., min_score: float = 0.0): drops results scoring below
  min_score (rerank_score if present, else hybrid_score) via the extracted
  _apply_relevance_floor() helper. min_score in the cache key so floored and
  unfloored results don't collide.
- Default 0.0 = no-op → existing callers unaffected; callers/config opt in.

Tests: floor drops sub-threshold (rerank_score preferred over hybrid), 0.0 is a
no-op (same list), cache key includes min_score (3 new; 7 existing pass).

Closes #10703. Part of #10600 / umbrella #10603.
@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

@mrveiss
mrveiss merged commit 7960e3b into Dev_new_gui Jun 30, 2026
26 checks passed
@mrveiss
mrveiss deleted the issue-10703 branch June 30, 2026 11:38
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.

1 participant