Skip to content

Embedding resolution: local-default + light + cache #4

Closed

Description

@thorwhalen

Refs #1.

ir.embed.resolve_embedder(spec):

  • 'default'/'local'/'minilm' -> ef.embedder_adapters.sentence_transformers_embedder('all-MiniLM-L6-v2'), set USE_TF=0 before import (avoids TF/numpy ABI crash), wrapped in ef.CachedEmbedder over a dol cache at ~/.cache/ir/embeddings/<model>/ keyed by (model, ef.content_hash).
  • 'light'/'hashing' -> ef.HashingEmbedder (numpy-only) for fast tests.
  • callable / Embedder -> ef.as_embedder.
  • Graceful fallback to hashing with a warning if sentence-transformers unavailable.

Embedder must carry an input_type distinction (query vs document) — ef already supports this.

Activity

  1. thorwhalen commented on Jun 5, 2026

    @thorwhalen
    MemberAuthor

    Decisions (done in PR #14):

    • Default = all-MiniLM-L6-v2 (384-d) via ef.embedder_adapters.sentence_transformers_embedder(..., normalize=True).
    • USE_TF=0 is set on import ir.embed — without it, transformers auto-imports TensorFlow, which crashes on this stack's numpy ABI (numpy.core.umath failed to import). Import ir before anything that imports transformers.
    • Wrapped in ef.CachedEmbedder over a dol numpy store at ~/.cache/ir/embeddings/<model_id> — each model gets its own dir, so the cache key is effectively (model, content_hash) with no cross-model collisions.
    • "light"/"hashing" → ef.HashingEmbedder (numpy only) for fast tests; graceful fallback to it (with a warning) if sentence-transformers is missing.
    • First call loads the model (~18s) then is warm; the disk cache makes re-indexing near-instant. A persistent embedding server is a later optimization if cold CLI latency matters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions