perf(memory): copy only requested embedding dimensions#96952
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 26, 2026, 5:50 PM ET / 21:50 UTC. Summary Reproducibility: yes. by source inspection: current main converts the full local embedding vector before truncating to a positive outputDimensionality. I did not run a live local embedding setup in this read-only review. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the focused bounded-copy optimization, but require redacted real local embedding output or logs before merge. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: current main converts the full local embedding vector before truncating to a positive outputDimensionality. I did not run a live local embedding setup in this read-only review. Is this the best way to solve the issue? Yes for the code shape: copying the requested prefix before sanitize/normalize is the narrowest fix on the in-process local provider path. It is not merge-ready until the contributor adds real behavior proof. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d4a01e48bcc5. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
905c66c to
7fde731
Compare
|
Merged via squash.
|
* perf(memory): copy only requested embedding dimensions * perf(memory): copy only requested embedding dimensions --------- Co-authored-by: ly-wang19 <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
* perf(memory): copy only requested embedding dimensions * perf(memory): copy only requested embedding dimensions --------- Co-authored-by: ly-wang19 <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
* perf(memory): copy only requested embedding dimensions * perf(memory): copy only requested embedding dimensions --------- Co-authored-by: ly-wang19 <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
* perf(memory): copy only requested embedding dimensions * perf(memory): copy only requested embedding dimensions --------- Co-authored-by: ly-wang19 <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Local embedding normalization truncated vectors with Array.from(vector).slice(0, outputDimensionality). That copies the full embedding vector before discarding the tail, so large vectors still pay the full read/copy cost even when a smaller output dimensionality is requested.
Why This Change Was Made
This adds a bounded vector copy helper that copies only the requested dimensions before normalization. The existing no-truncation path still copies the full vector into a normal number array for sanitize/normalize behavior.
User Impact
Local memory embeddings with outputDimensionality configured avoid unnecessary tail-coordinate reads and full-vector copies before normalization. Normal embedding values and normalization semantics are intended to stay unchanged.
Evidence