Skip to content

Wire vendored nomic-embed-code (pretrained-embed) to brain search — replace hashing-trick 256d #455

Closed

Description

@ajianaz

Goal

Replace the current hashing-trick 256-dim static embedding in brain search with the vendored nomic-embed-code model (already in codebase via pretrained-embed feature flag, 31MB, 768-dim).

Context

  • Current: embed_code() in src/embed/tokens.rs uses a deterministic hashing trick (256-dim vectors)
  • Already exists: vendored nomic-embed-code model in vendored/nomic/ (768-dim, 31MB binary)
  • Feature flag pretrained-embed already gates this code path
  • Brain search (FTS5 + vector + graph RRF fusion) in src/index/brain.rs has no_provider mode fallback

Scope

  1. In src/index/brain.rs: replace no_provider mode with pretrained_embed provider
  2. Ensure 768-dim vectors are stored in usearch index instead of 256-dim
  3. Handle migration: if existing index has 256-dim vectors, flag for re-index
  4. Keep hashing-trick as ultimate fallback (no model available scenario)

Files

  • src/index/brain.rs — core brain/index logic, provider selection
  • src/embed/mod.rs — embed module entry
  • src/embed/tokens.rs — current hashing-trick + pretrained model interface

Trade-offs

  • +768-dim real embeddings (vs 256-dim hashing-trick) → better semantic search
  • +31MB binary overhead (vendored model)
  • +ONNXRuntime dependency for pretrained path
  • Fallback chain: pretrained-embed → hashing-trick → FTS5-only
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

    enhancementNew feature or requestphase-1Phase 1: Quick Winspriority:highscope:code-intelCode intelligence — indexing, graph, impact analysis

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions