Expand description
Local embeddings and a persistent cosine vector store.
Feature boundaries: inference (ONNX text embedder) and vector (SQLite-backed
cosine store). Both are default-on; a vector-only build does not pull ort or tokenizers.
Structs§
- Accelerator
Parity - Result of the load-time vector parity check an accelerator passed; see
Embedder::accelerator_parity. - Core
MlUnits - The compute units of each Core ML function (
embed_32..embed_512). - Core
MlUnits Parse Error - An unreadable compute-unit or unit-map specification.
- Embedder
- Embedder
Config - Load
Timings - Where an E40 load spent its time; see
Embedder::load_timings. Phases are wall-clock durations of the work asEmbedder::loadran it; they nest (session_createshappen inside the probe and the parity check) and do not add up tototalexactly. - Nearest
- Resident
Index - An in-memory int8 snapshot of the vectors of one model. See the module documentation.
- Session
Create - One graph build during an E40 load.
- Vector
Store
Enums§
- Core
MlCompute Unit - Which Core ML compute units run one function (
MLComputeUnits). - Embed
Error - Execution
Provider - Where inference runs.
- Parity
Cache Outcome - What the load-time parity check did with the opt-in verdict cache
(
EmbedderConfig::with_parity_cache_dir). - Vector
Error
Constants§
- ACCELERATOR_
PARITY_ MIN_ COSINE - An accelerator is admitted only if every parity prompt’s native-dimension vector has at least this cosine similarity to the CPU provider’s vector for the same prompt. Two correct runs of the same Q4 graph agree at about 0.999; a DirectML run of EmbeddingGemma 2 Q4 measured 0.58-0.72.
- DEFAULT_
INGEST_ BATCH - Default static batch of the E40 ingest graphs on DirectML (4 or 8 are accepted).
- DEFAULT_
MAX_ BATCH - Default rows per ONNX call for
embed_batch/embed_query_batch. - DEFAULT_
VECTOR_ DIM - EMBEDDINGGEMM
A2_ COREML_ MODEL_ ID - EmbeddingGemma 2 Core ML build (macOS 15+):
EmbeddingGemma2Text.mlpackage(one fixed-shape function per length 32, 64, 128, 256, 512) and a host-side bf16 token table, run through the Core ML framework directly (an.mlpackagecannot be loaded through ONNX Runtime). Selected when the model directory holds that layout. Same weights, different numerics from the Q4 and E40 models, so a different pipeline id. - EMBEDDINGGEMM
A2_ E40_ MODEL_ ID - EmbeddingGemma 2 E40 export: fp16, five fixed-length graphs and a host-side token
table (
embed_tokens.f16.npy), run on DirectML (Windows) or CPU. Selected when the model directory holds that layout. Same weights as the Q4 model, different numerics, so a different pipeline id. - EMBEDDINGGEMM
A2_ MODEL_ ID - EmbeddingGemma 2 text-only Q4 export (b64, accuracy level 4). Selected when
the model directory’s top-level
config.jsonmodel_typeisembedding_gemma2. - EMBEDDINGGEMMA_
MODEL_ ID - NEURAL_
ENGINE_ MAX_ TOKENS - Longest graph (in tokens) the default map sends to the Neural Engine; longer graphs use the GPU.
- RRF_K
- The damping constant of the original RRF paper (Cormack, Clarke and Büttcher, 2009).
Functions§
- bundle_
files - The files a model bundle in
dirmust hold, relative todir, for the layoutloadwould pick: the Core ML package (macOS), the E40 bundle (its manifest and the files it names, or the legacy graphs) or the single-file Q4 model (model_q4.onnx).Nonewhendirholds none of these. Every listed file must exist: a missing one isMissingArtifact, as inload. A Core ML package on a non-macOS host is anInvalidConfigerror. - cosine_
similarity - installed_
model_ dir - Model directory for
subdirof an installed application, derived from its executable only: the resources directoryrightkit_onnx::installed_resource_dirnames, joined withsubdir. It returns the candidate without checking that it exists.Nonefor a relative executable path, or whensubdiris not exactly one plain name (empty, an absolute path,..,.or a nested path such asa/b). - reciprocal_
rank_ fusion - Fuses ranked lists, best first, by reciprocal rank. An item scores
sum(1 / (k + rank))over every list that holds it, with rank starting at 1, so an item near the top of several lists beats one at the top of only one. Returns each item once, best score first. Items with equal scores keep the order in which they first appear across the lists. - truncate_
and_ normalize