Skip to content

refactor(embed): the code model is the only embedding; the vector signal is off without it - #755

Merged
ajianaz merged 1 commit into
developfrom
refactor/code-model-only
Nov 16, 2026
Merged

ajianaz merged 1 commit into
developfrom
refactor/code-model-only

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

What

  • Removed the hashing and pretrained (nomic-distilled) embeddings: src/embed/tokens.rs, token_vocab.rs, the pretrained-embed feature, the 31 MB vendored/nomic/ table, scripts/extract_code_tokens.py and the vector weights table.
  • Backend is now Potion or Off. When the model is not available (offline before the first download, CORA_EMBED_OFFLINE=1, brain.embedding: off) no vectors are built, cora brain answers from keyword and call-graph signals, and says vector signal is off (the code embedding model is not available).
  • brain.embedding is auto or off. potion still loads (= auto); hashing and pretrained load, mean auto and print one warning.
  • Fix found on the way: a question whose words the model does not know embeds to the zero vector, which vecq refuses with a panic. Such a question now finds nothing from vectors, and a zero-vector symbol is left out of the file.
  • Docs, THIRD_PARTY.md (now the potion model) and the changelog updated.

Why

Measured on 1,639 queries, the fallbacks were neutral on this repository and harmful elsewhere (down to -0.09 MRR@10) when fused with keyword search; the code model is the only embedding that helps. Keeping them cost maintenance, a build feature and 31 MB of vendored data for a signal that is better off than weak. Closes #751.

Testing

  • cargo fmt --all -- --check, cargo clippy --all-targets --features tree-sitter -- -D warnings, cargo test --features tree-sitter pass locally.
  • Integration tests (tiny fixture model, no network): no vector files and keyword search still answers without the model; the model arriving builds them without a file change; a missing model dir warns that the vector signal is off; embedding: off builds nothing; embedding: hashing warns and still uses the model. Unit tests for the off warning and for zero and non-finite vectors.

Generated by Claude Code

…nal is off without it

Remove the hashing and pretrained backends, the pretrained-embed feature,
the vendored nomic token table and its extraction script. brain.embedding
is auto or off. A zero query or symbol vector no longer panics vecq.

Closes #751.
@ajianaz
ajianaz merged commit 091c071 into develop Nov 16, 2026
13 checks passed
@ajianaz
ajianaz deleted the refactor/code-model-only branch November 17, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant