perf(remember): reuse embeddings for identical merge text - #495
Conversation
…en-reuse-write-embeddings
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
…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
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
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):
df271f25a3aa8a850371555490b12236473be975.ca32ba50is 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
44d2455885d51b981c5f3f0a433a010c3e1b75aeis identical toece9a1fa471e04893279dec95d845ffb44a6e7de. The composed benchmark uses frozen commit5000f75e5d1ee14c5dd62db709a99f86792dab2d, whose tree matches final PR #502.