Menu

1 / 3

E5 Embeddings Expect 'query:' and 'passage:' Prefixes. Drop Them and Measure Recall in Node

DEV Community: typescript·Gabriel Anhaia·8 days ago
#ulD9kJ4G
#devtotypescript#devto#dev#model#query
Reading 0:00
15s threshold

Book: AI That Reads

The series: AI in TypeScript — 5 books, from your first LLM call to agents in production — all five here

My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools

Me: xgabriel.com | GitHub

The e5-small-v2 model card has an FAQ entry that asks whether you need to add "query: " and "passage: " to your input texts. The answer is one word and one sentence: "Yes, this is how the model is trained, otherwise you will see a performance degradation."

Now open the Transformers.js port of the same model . Its usage example is extractor('This is a simple test.') . No prefix. If you copy that into a Node RAG service, you index every chunk raw, embed every user question raw, and get vectors that look fine. Nothing errors. Retrieval just quietly runs below what the model can do.

E5 and nomic-embed-text were both trained to expect a marker on each side.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.