feat(memory-v2): cross-encoder rerank as additive boost#29555
Merged
Conversation
Adds an opt-in (`memory.v2.rerank.enabled: false` by default) cross-encoder rerank step that runs locally via the existing embedding-runtime worker infrastructure. When enabled, simBatch wraps the dense+sparse fused score with `boosted = clamp01(fused + alpha · normalized_rerank)` for the top-K candidates of the user and assistant similarity channels — NOW keeps pure fused since structured context is outside the cross-encoder's training distribution. Default model `Xenova/bge-reranker-base` (278M, MIT, ONNX); long-term target is `BAAI/bge-reranker-v2-m3` once a public ONNX export ships.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a619c20b5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
2 tasks
siddseethepalli
added a commit
that referenced
this pull request
May 9, 2026
…p tokenizer flag (#30091) Address review feedback on #29555: - Reranker cache key now hashes model + dtype alongside query and candidate slugs. Previously, switching memory.v2.rerank.model or rerank.dtype could return stale scores from the prior model for up to the 2m TTL window, since cache hits bypass getOrCreateRerankBackend. - Drop return_tensors: 'pt' from the generated rerank-worker.mjs tokenizer call. 'pt' is the Python transformers PyTorch flag; the JS port (@huggingface/transformers) returns its own Tensor type and ignores this option today, but a future strict validation could turn it into a silent fail-open via the reranker's catch-and-return-empty path. - Bump RUNTIME_VERSION worker suffix to v3 so existing installs regenerate the rerank worker on next daemon start. Co-authored-by: Vellum Assistant <assistant@vellum.ai>
Contributor
Author
|
Addressed in follow-up PR #30091:
The P1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Original prompt
implement /Users/sidd/.claude/plans/memory-v2-cross-encoder-rerank.md