Skip to content

perf(remember): reuse embeddings for identical merge text - #495

Merged
cdeust merged 17 commits into
mainfrom
perf/green-reuse-write-embeddings
Sep 8, 2026
Merged

perf(remember): reuse embeddings for identical merge text#495
cdeust merged 17 commits into
mainfrom
perf/green-reuse-write-embeddings

Conversation

@cdeust

@cdeust cdeust commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Reuse the incoming embedding when a merge produces identical text, preserving scalar encoding for changed text.

General batching is outside this delivered scope. Main now defines numerical equivalence in benchmarks/lib/numeric_equivalence.py.

Validation and review (2026-09-08):

  • Reviewed the implemented diff for correctness, security, lifecycle and ordering; no unresolved source finding.
  • Integrated current main (including deps: refresh compatible dependencies and align plugin launcher pins #491) and every updated parent. Reviewed head: df271f25a3aa8a850371555490b12236473be975.
  • Combined runtime tree: locked Ruff/format, craftsmanship and Pyright pass; full suite 8,013 passed, 257 skipped, one stale private dependency-fixture failure. Correcting that fixture without changing assertions yields 4/4 launcher tests passing. The added baseline setup and matrix tests pass 8/8. GitHub CI is running on each new head.
  • Full LongMemEval/LoCoMo comparison against main ca32ba50 is running on separate disposable databases with identical public datasets. It uses the repository's existing 0.005 tolerance; no acceptance result is claimed before completion.

Historical measurements apply to their recorded revisions and scopes. The current PR is authorized for merge after applicable checks; remaining optimization targets above are not presented as completed benefits.

The latest commit only triggers main-targeted security checks. Its tree 44d2455885d51b981c5f3f0a433a010c3e1b75ae is identical to ece9a1fa471e04893279dec95d845ffb44a6e7de. The composed benchmark uses frozen commit 5000f75e5d1ee14c5dd62db709a99f86792dab2d, whose tree matches final PR #502.

Brings in #503 (floor check non-blocking + --no-regression gate) and
#505 (mcp-host-config timeout sized to its measured tail), so this PR
is verified against the CI its merge will actually land on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StMBvNd7eVJGtpnC2zNsx1
Brings in #506 (docker-smoke cache export skipped on pull_request), the
fix for the Docker Smoke timeout that was the only red check on this
branch's last run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StMBvNd7eVJGtpnC2zNsx1
pull Bot pushed a commit to asleekgeek/Cortex that referenced this pull request Sep 8, 2026
…rance

Retracts docs/provenance/green-w3-2-encoding-identity.md's "no tolerance
adopted" decision (PR cdeust#495). That gate required bitwise-exact equality
between a scalar-path and a batched-path float32 computation, which no
batched implementation can pass by construction: IEEE 754 float32
addition/multiplication isn't associative, so a batched matmul reduces in
a different element order than N scalar calls and won't reproduce the
same bit pattern even when both results are correct.

Evidence this is what happened, not a coincidence: every delta PR cdeust#495
and PR cdeust#497 recorded as a rejection (1.64e-7, 1.19e-7, 1.06e-7, 9.31e-8,
1.40e-7) is within ~1.4x of float32 machine epsilon (2**-23 =
1.1920928955078125e-07) — the PR cdeust#495 score delta equals it exactly.

Adds benchmarks/lib/numeric_equivalence.py: vectors_equivalent() (ULP
tolerance per component) and rank_stable() (a score shift must not flip
which candidate wins unless they were already tied within tolerance).
Both are exercised in tests_py/benchmarks/test_numeric_equivalence.py
against the exact deltas above, reproduced from the two PR bodies.

Does not itself restore the batched code paths PR cdeust#495/cdeust#497 reverted —
this session had no torch/sentence-transformers available to re-run
either PR's own harness against the new gate. See the new doc's closing
section for what a maintainer with the pinned model needs to re-check
before doing that.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StMBvNd7eVJGtpnC2zNsx1
@cdeust
cdeust marked this pull request as ready for review September 8, 2026 19:37

@cdeust cdeust left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed source review of this implemented scope and its parent integration. No unresolved correctness, security or lifecycle finding. The description records limitations rather than claiming unmet optimization targets. Merge remains gated on current required CI and applicable baseline quality evidence. Review includes independent read-only review of the per-PR diff and combined locked local tests.

@cdeust
cdeust changed the base branch from perf/green-resident-capture to main September 8, 2026 20:53

@cdeust cdeust left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the CI-trigger commit: git diff from ece9a1f is empty and Git tree 44d2455885d51b981c5f3f0a433a010c3e1b75ae is unchanged. Previous source review and test evidence apply to this identical tree. Required main-targeted checks are now running; no protection bypass is used.

@cdeust
cdeust merged commit ab1df19 into main Sep 8, 2026
28 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.

2 participants