Skip to content

perf(retrieval): prune unused fact counts and reuse request embeddings - #542

Merged
fazpu merged 8 commits into
mainfrom
fix/scalable-fact-retrieval
Nov 6, 2026
Merged

fazpu merged 8 commits into
mainfrom
fix/scalable-fact-retrieval

Conversation

@fazpu

@fazpu fazpu commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Fact candidate queries spent about 12 seconds in SQL, and claims/sources embedded the identical question twice (combined three times). Retrieval now prunes unrequested evidence counts, checks entity provenance from bounded candidate IDs, follows indexed merge links in both directions, bounds final hydration and removes obsolete join-planner overrides, and embeds identical text once within a request.

Preserve source visibility, latest-unsuperseded decision order, merge/cycle/deployment semantics, temporal eligibility before truncation, final evidence counts and provider-call accounting. Remove the instance-wide vector shortcut. No ingestion generation, extraction key, embedding model/dimensions or document identity changes (D56). Normal setup publishes the changed manifest and revalidates saved SQL under the existing contract.

Validation on an isolated copy of the existing conv-47 store:

  • PostgreSQL 19 RC1, analyzed after logical restore: relation candidate confirmation 3.535s → 0.068s; observation confirmation 3.257s → 0.709s; scoped nomination statement 5.060s → 0.080s. Returned counts unchanged (72/804/201).
  • All stored rows and complete published fact/entity values match the original definitions. Add 0/10k/100k unrelated entities: actual scoped adapter returns identical 201 candidates in 0.35–0.52s. This holds facts/mentions fixed; it is not a million-document traversal claim. The existing 50k scoped-fact boundary remains explicit.
  • 26 saved retrieval requests: no errors; median fact SQL 2.22s (formerly 12.30s), SQL/vector-replay wall time facts 2.30s, claims/sources 1.49s, resolve 0.047s. The complete 100k-unrelated-entity request takes 2.32s with 50 facts and 46 evidence records. Saved vectors isolate SQL from provider noise; no answer or grade was generated in these checks.
  • Real embedding transport trace: TCP+TLS ~27ms, upstream response wait 2–7s. Request-local reuse removes duplicate calls; provider latency is still external variability.
  • Offline unit pack: 3120 passed, 11 skipped. Pyright: zero errors/warnings. RC1 metering/resolve/query-space/P1 checks: 108 passed; two Unix-socket test URL helpers corrected and rerun, both passed. All required final-head CI passed, including workers, surfaces, adapters and Compose quickstart.
  • Actual Claude Code review: claude-opus-5-5, high effort, APPROVE at final 52de399, with prior full/delta approvals at 6a07bb8 and ff84740. No blocking findings. Review explicitly checked D56 and the expanded SQL/metering changes.

Sources: D142 search design, D91 metering design, query engine/operation executor, current and historical authority DDL, existing merge/deletion/temporal tests, archived diagnostic SQL and new RC1 measurements. Operational evidence and the subsequent separately saved conv-47 answer/judge replay are tracked in writeitai/ultimate-memory-cloud#783. The full benchmark remains paused. Autoboard checklist status could not be read because BOARD_API_KEY is not configured.

@fazpu
fazpu marked this pull request as ready for review November 6, 2026 23:25
@fazpu
fazpu marked this pull request as draft November 6, 2026 23:27
@fazpu
fazpu marked this pull request as ready for review November 6, 2026 23:52
@fazpu
fazpu merged commit 8cd181f into main Nov 6, 2026
22 checks passed
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