Skip to content

view diff #219

Open
mashenjun wants to merge 21 commits into
mainfrom
shenjun/recall-imporvement-0x02-strategy-router
Open

view diff #219
mashenjun wants to merge 21 commits into
mainfrom
shenjun/recall-imporvement-0x02-strategy-router

Conversation

@mashenjun

Copy link
Copy Markdown
Collaborator

No description provided.

Bosn and others added 20 commits April 7, 2026 00:45
Signed-off-by: Shenjun <[email protected]>
…and LLM fallback

Implement pre-retrieval query strategy routing that classifies incoming
recall queries into one of four strategy classes (exact_event_temporal,
set_aggregation, count_query, default_mixed) and executes class-specific
retrieval and reranking logic.

Detection pipeline:
- Step 1: vector + FTS search against control-plane recall_strategy_prototypes
  table, RRF merge, class-score aggregation with confidence thresholds
- Step 2: LLM fallback (5s timeout) for low-confidence / ambiguous cases
- Structural fallback to default_mixed when both steps are unresolved

Execution model:
- Per-strategy executors with entity-aware and answer-family-aware reranking
- Fanout merge for the set_aggregation + count_query pair (60/40 budget split
  with dedup, backfill, and correct post-merge pagination)
- All executors guard explicit-session paths on memory_type=="" to prevent
  returning session turns for insight-only queries

Operational:
- Router gated on TiDB backend with auto-embedding (not FTS-only)
- Vector index bootstrap via EnsurePrototypeVectorIndex() at startup with
  duplicate-index error handling (rerunnable, no unconditional ALTER TABLE)
- Prometheus counters for strategy/source/mode/fallback/fanout/duration
- Bilingual prototype seed set (88 rows: en+zh across 4 strategy classes)

Includes 21 focused unit tests covering step1/step2 threshold resolution,
fanout pagination, memory_type guard regressions, and merge dedup semantics.
Preserve benchmark-provided message seq values in raw session storage so LoCoMo ingest keeps conversation-global ordering.

Also tighten strategy router step-1 resolution by switching to weighted prototype similarity, tracking best class score, and falling back more often on weak prototype matches.

Add focused tests for both paths.
Preserve the current Cat3-focused routing, retrieval, and answer-shape improvements as a rollbackable checkpoint before the next experiment round.

This is not the final solution. It establishes a known-good baseline for subsequent benchmark-driven attempts, including explicit-session thread-chase and related Cat3 retrieval experiments.
Preserve the current Cat3 behavioral fixes as a rollbackable checkpoint before the next structural experiment.

This round adds strategy-scoped explicit-session thread chase and related retrieval execution tuning, but it is not the final Cat3 solution. The next step may introduce a dedicated exact-entity lookup strategy if benchmark results still plateau.
Preserve the current server-side Cat3 structural split after salvaging exact_entity_lookup to keep the raw question as the primary retrieval leg and use the shaped exact-entity query as additive support. This is a rollbackable benchmark checkpoint, not the final Cat3 solution.
@netlify

netlify Bot commented Apr 13, 2026

Copy link
Copy Markdown

👷 Deploy request for mem9 pending review.

A Netlify team Owner will need to approve the deploy before you can run your build.

Are you a team Owner? Visit the deploys page to approve it

Need more help? Learn more in the Netlify docs

Name Link
🔨 Latest commit 00aa4dd

…ied-routed-recall-executor-proposal.md proposal

Signed-off-by: Shenjun <[email protected]>
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.

2 participants