Rat 281/dense search#89
Open
bercaakbayir wants to merge 8 commits into
Open
Conversation
… caching mechanism with registry process, used bge-small-en-v1.5 for embedding
…nner; subpackage + manifest bumps
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
Replaces lexical (BM25) tool/skill retrieval with dense semantic retrieval and
ships it as
ratel-ai-corev0.3.0-rc.1..search()now embeds query andcatalog text into a shared vector space and cosine-ranks — closing the "missing
gold" recall gap where a query and the right tool describe the same concept with
different words ("remove a file" vs "delete a path"). Core stays in-process, no
infra. See ADR-0013.
Per the experiment-line convention, the version is the experiment:
.search()is dense unconditionally (no feature flag), and the BM25 baseline remains available
as v0.2.0. The benchmark compares engines by swapping the crate version alone.
What's in it
Retrieval engine
C++/ONNX dep) with
BAAI/bge-small-en-v1.5(BERT-family, 384-dim, CLS pooling,L2-normalized; asymmetric query prefix). Cosine = dot product over precomputed
vectors.
ToolRegistryandSkillRegistry; vectors precomputed atregister(), ranked brute-force in-memory (no vector DB). Emits the existingtrace schema with a
"dense"stage — no schema break.hf-hubat a pinned revision into theshared HF cache (offline/deterministic after the first fetch); loaded once per
process. BM25
search.rs/tool_search.rsremoved from this line.Embedder resilience (fail loud, never abort)
EmbedderError(with a remediationhint) surfaces as a catchable
Error/ValueErrorin the SDKs instead of an.expect()panic that aborted the whole host process across the FFI.blip retries on the next call.
HF_HOME/HF_ENDPOINThonored.TraceEvent::EmbedderLoad { status: ok|slow|failed, took_ms, reason }; a slow cold load (RATEL_EMBED_SLOW_MS,default 5s) is flagged and logged. OOM is an uncatchable OS kill (documented).
Release / packaging (v0.3.0-rc.1)
manifests; npm
optionalDependenciesintegrity; native arm64 release runner;fancy-regex. Per-package CHANGELOGs updated.CI hardening
hf-hub's non-blocking
flockgiv0 MB weights arestill downloading; added retry-with-backoff on lock contention + a vitest
testTimeoutfor the cold first-score-0 assertion was BM25-specifthe declared tool
so it can only enter via the skill).
Behavior changes
.search()semantics differ by v.2.0) — intentionalfor the experiment line; pin deliberately.
register/searchnow **throw ar failure wherethey previously aborted the process. SDK method signatures are unchanged.
Testing
fmt/clippy -D warnings/test --workspace(incl. dense ranking,error classification, non-poisoniision).
build/typecheck/lint/test; Python:ruff/mypy/pytest(both add cold-cache resilience tror, not a crash).
Out of scope (follow-ups)
User-supplied/external embedding futs/selection, and a
dimension-consistency guard — deferred.