Skip to content

perf(embeddings): batch codebase imports and preserve cache contexts - #497

Merged
cdeust merged 39 commits into
mainfrom
perf/green-batch-embedding-paths
Sep 8, 2026
Merged

cdeust merged 39 commits into
mainfrom
perf/green-batch-embedding-paths

Conversation

@cdeust

@cdeust cdeust commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Batch independent codebase import embeddings while preserving the existing scalar cache context and capacity.

Other writer conversions and cache reduction remain outside this change. Includes the latest corrected prefix guard from #496.

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: 1be0f388d2324c179a2dba4fb9e950d368429115.
  • 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 b4233ce5b5d9d9e1718d63367bac8141c5c31df9 is identical to 29f74c66d37ce18ca49c0a276fb2ecdaf2f925ac. 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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-embedding-prefix-audit 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 29f74c6 is empty and Git tree b4233ce5b5d9d9e1718d63367bac8141c5c31df9 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 341c80f into main Sep 8, 2026
28 checks passed
@cdeust
cdeust deleted the perf/green-batch-embedding-paths branch September 9, 2026 07:37
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