Skip to content

refactor(code-intel): retire the hashing and pretrained embeddings; the code model is the only vector signal #751

Closed

Description

@ajianaz

What problem does this solve?

Three embedding backends exist: hashing (256-d bag-of-tokens), pretrained (768-d static nomic vocabulary, behind the pretrained-embed feature, 31 MB of vendored data in the repository) and, since the code model landed, potion-code-16M-v2. Measured on 1,639 retrieval queries (this repository, 8 Rust crates, the Python standard library), the first two are neutral on this repository and harmful elsewhere when fused with keyword search (down to -0.09 MRR@10 at half weight; still -0.04 at a quarter of a vote on Python). The code model beats keyword search alone by +0.07 to +0.12 everywhere.

Keeping them costs a second and third code path, dimension-mismatch handling for 256 versus 768, a feature flag that default builds do not enable, 31 MB in the working tree, and a fallback that is worse than having no vector signal.

Proposed solution

  1. The code model is the only embedding. brain.embedding becomes auto (default, same as potion) or off. The old values hashing and pretrained are accepted for one release with a warning and mean auto.
  2. When the model is not available (offline first run, blocked network, CORA_EMBED_OFFLINE=1 without a model), the vector signal is switched off: brain returns keyword and graph results, the output says so once and how to get the model. No weak substitute.
  3. Delete src/embed/tokens.rs (the hashing tokenizer; nothing else in cora uses it), src/embed/token_vocab.rs, the pretrained-embed feature, vendored/nomic/ and scripts/extract_code_tokens.py, and the weights table in brain_search_report (one vector signal, one weight).
  4. Keep a small test model fixture so tests need no network.
  5. Update docs, CHANGELOG, THIRD_PARTY.md (the nomic notice goes away).

Alternatives considered

Keep hashing as an offline fallback at a quarter weight: measured at about zero to slightly negative, so it only adds code. Keep pretrained for people who built it: it needs a custom build, and the code model is better and smaller.

Before submitting

  • Depends on the per-project vecq storage issue for the vector files; can land before or after it.

Activity

  1. added
    enhancement
    scope:code-intel
    epic:code-intelligence
    on Nov 16, 2026
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

    enhancementepic:code-intelligencepriority:mediumscope:code-intel

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions