fix: retrieval quality - query expansion overfitting and bidirectional substring matching - #30
Closed
krishna3554 wants to merge 3 commits into
Closed
krishna3554 wants to merge 3 commits into
krishna3554 wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Devin Review found 1 potential issue.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| """ | ||
| tokens = SQLiteMemoryRepository._expanded_tokens(query) | ||
| # This is a static method - can't use instance analyzer. Uses plain tokens. | ||
| tokens = SQLiteMemoryRepository._expanded_tokens_static(query) |
Contributor
There was a problem hiding this comment.
🟡 Domain synonyms never reach retrieval
With the domain analyzer, _to_fts_query omits expanded terms when selecting candidates. Synonym-only memories never reach filtering, breaking domain retrieval and its benchmark.
Prompt for agents
Make SQLiteMemoryRepository._to_fts_query use the repository's configured analyzer instead of the static plain-token helper. The FTS candidate query and the later precision filter must use the same expanded query-token set. Update the method shape as needed, remove the redundant static helper if appropriate, and add coverage proving that DomainAnalyzer retrieves a memory containing only a mapped expansion while PlainAnalyzer does not.
Was this helpful? React with 👍 or 👎 to provide feedback.
…l substring matching - Add pluggable Analyzer interface with PlainAnalyzer (default) and DomainAnalyzer - PlainAnalyzer uses prefix-only token matching to prevent false positives (e.g., 'api' matching 'rapid', 'cat' matching 'category') - _QUERY_EXPANSIONS moved behind DomainAnalyzer, not used by default - Add AnalyzerKind config (DMA_ANALYZER_KIND env var) to opt-in to domain expansions - Update _to_fts_query to use >= 3 char prefix matching (was > 3) - Add adversarial test cases for prefix-only matching (cat/category, api/rapid, art/particle) - Use DomainAnalyzer in benchmark runner for corpus parity Fixes #27
krishna3554
force-pushed
the
fix/retrieval-quality-query-expansion-substring-matching
branch
from
August 31, 2026 17:25
f70139b to
15f28ef
Compare
krishna3554
force-pushed
the
fix/retrieval-quality-query-expansion-substring-matching
branch
from
August 31, 2026 17:37
160943c to
15f28ef
Compare
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
Fixes issue #27 by addressing two retrieval quality problems:
1. Query Expansion Overfitting
2. Bidirectional Substring Token Matching
Changes
Testing
Run the new adversarial test:
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/krishna-lokhande
collecting ... collected 0 items
============================ no tests ran in 0.00s =============================