feat(embed): candle-backed semantic embeddings behind an embeddings feature#21
Merged
Conversation
…eature New frameshift-embed-candle crate: CandleEmbedder loads sentence-transformers/all-MiniLM-L6-v2 via hf-hub (download on first use, mmap thereafter), tokenizes with truncation at BERT's window, mean-pools and L2-normalizes into unit vectors implementing the orchestrator's Embedder trait. Degenerate inputs and inference failures return an empty vector (no semantic signal), never an error. Wiring: select_rich gains a _with_embedder variant; the CLI select command, MCP frameshift_select, and the daemon evaluation loop all use the embedder behind an off-by-default 'embeddings' cargo feature, with a process-wide once-loaded model in the daemon and MCP server. Model load failure degrades to lexical-only ranking with a warning. Verified end to end: the ignored model test downloads the real model and confirms related text out-scores unrelated text.
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.
A2 Phase 2: the semantic-selection scaffold gets a real engine.
New crate
frameshift-embed-candle--CandleEmbedderloads sentence-transformers/all-MiniLM-L6-v2 (~23 MB) through hf-hub (download on first use, mmap-cached thereafter), tokenizes with truncation at BERT's 512-token window, mean-pools and L2-normalizes into 384-dim unit vectors implementing the orchestrator'sEmbeddertrait. Degenerate inputs and inference failures return an empty vector, which the scorer already treats as "no semantic signal".Wiring --
select_richgains a_with_embeddervariant; the CLIselectcommand, MCPframeshift_select, and the daemon evaluation loop consume the embedder behind an off-by-defaultembeddingscargo feature. The daemon and MCP server load the model once per process (OnceLock); a failed load is remembered and selection degrades to lexical ranking with a warning. Default builds compile none of the ML stack into shipped binaries.Verification -- clippy -D warnings green with all features on; unit tests for pooling math; the ignored end-to-end test was run locally against the real downloaded model: 384-dim output confirmed, related text out-scores unrelated text for a borrow-checker task hint.
Audit note -- the candle tree adds one informational advisory:
paste(RUSTSEC-2024-0436, unmaintained build-time proc-macro), same class as the existing proc-macro-error ignore; non-blocking in CI.🤖 Generated with Claude Code