Rhynio
AI & development

Embedding prefix missing or added twice? Trace the text through your application and encoder

A prefix in your code may be added again by your embedding library, while a prompt name may be mistaken for literal text. Trace ingestion and search separately to see what is known before changing either path.

Identify the layer that owns each prefix

Start with the original text, then record the application’s exact outgoing string, the encoder method and its resolved prompt. Keep an unobserved service step unknown. A model identifier alone cannot establish what reached the encoder, especially when an index was created months ago.

For Nomic’s configuration below, prompt_name="passage" selects "search_document: ". Passing prompt="passage" instead supplies those seven literal letters. It does not select the configured value. Inspect the pinned Nomic configuration.

Trace both paths with the same text

These synthetic presets model only literal input expansion in SentenceTransformer.encode(), inspected at v5.1.2, commit dfcbbd93056c6292ee6a245c0740683a270df0b1. They assume Nomic nomic-embed-text-v2-moe prompt values at revision f6a8873b415144a69ffc529ec1e234d1e00ee765, no constructor overrides and default_prompt_name=None. They do not run that library or a model.

Read each case, predict the final two strings, then compare the visible answer. Quotes delimit strings; spaces inside them are significant. No separator is inserted for you. Pinned prompt resolution and concatenation source.

1. Raw text, plain encode()

Query / search

Original
"When does the library open?"
Application prefix
""
Application sends
"When does the library open?"
Selected prompt_name
None
Explicit prompt
None
Resolved prompt value
None
Effective text before tokenization
"When does the library open?"

Document / ingestion

Original
"The library opens at nine."
Application prefix
""
Application sends
"The library opens at nine."
Selected prompt_name
None
Explicit prompt
None
Resolved prompt value
None
Effective text before tokenization
"The library opens at nine."

Answer: No prefix is added here: plain encode() has no selected prompt and this saved configuration has no default. This is not evidence that the model needs no task prefix.

2. Named prompts, once

Query / search

Original
"When does the library open?"
Application prefix
""
Application sends
"When does the library open?"
Selected prompt_name
"query"
Explicit prompt
None
Resolved prompt value
"search_query: "
Effective text before tokenization
"search_query: When does the library open?"

Document / ingestion

Original
"The library opens at nine."
Application prefix
""
Application sends
"The library opens at nine."
Selected prompt_name
"passage"
Explicit prompt
None
Resolved prompt value
"search_document: "
Effective text before tokenization
"search_document: The library opens at nine."

Answer: query resolves to search_query: and passage resolves to search_document:. Each resolved value ends with one space. The key passage is not the literal prefix.

3. Application adds it, once

Query / search

Original
"When does the library open?"
Application prefix
"search_query: "
Application sends
"search_query: When does the library open?"
Selected prompt_name
None
Explicit prompt
None
Resolved prompt value
None
Effective text before tokenization
"search_query: When does the library open?"

Document / ingestion

Original
"The library opens at nine."
Application prefix
"search_document: "
Application sends
"search_document: The library opens at nine."
Selected prompt_name
None
Explicit prompt
None
Resolved prompt value
None
Effective text before tokenization
"search_document: The library opens at nine."

Answer: The application supplies the prefix. No library prompt is selected. The final strings match case 2, but this alone does not establish vector equivalence.

4. Application plus named prompt

Query / search

Original
"When does the library open?"
Application prefix
"search_query: "
Application sends
"search_query: When does the library open?"
Selected prompt_name
"query"
Explicit prompt
None
Resolved prompt value
"search_query: "
Effective text before tokenization
"search_query: search_query: When does the library open?"

Document / ingestion

Original
"The library opens at nine."
Application prefix
"search_document: "
Application sends
"search_document: The library opens at nine."
Selected prompt_name
"passage"
Explicit prompt
None
Resolved prompt value
"search_document: "
Effective text before tokenization
"search_document: search_document: The library opens at nine."

Answer: The same task prefix appears twice. The inspected encode() branch concatenates; it does not inspect the text to remove duplicates.

5. Explicit prompt overrides the name

Query / search

Original
"When does the library open?"
Application prefix
""
Application sends
"When does the library open?"
Selected prompt_name
"query"
Explicit prompt
"audit: "
Resolved prompt value
"audit: "
Effective text before tokenization
"audit: When does the library open?"

Document / ingestion

Original
"The library opens at nine."
Application prefix
""
Application sends
"The library opens at nine."
Selected prompt_name
"passage"
Explicit prompt
"audit: "
Resolved prompt value
"audit: "
Effective text before tokenization
"audit: The library opens at nine."

Answer: The fictional literal audit: wins over both selected names. This demonstrates precedence only; audit: is not a recommended Nomic task prefix.

6. A key supplied as literal text

Query / search

Original
"When does the library open?"
Application prefix
""
Application sends
"When does the library open?"
Selected prompt_name
None
Explicit prompt
"passage"
Resolved prompt value
"passage"
Effective text before tokenization
"passageWhen does the library open?"

Document / ingestion

Original
"The library opens at nine."
Application prefix
""
Application sends
"The library opens at nine."
Selected prompt_name
None
Explicit prompt
"passage"
Resolved prompt value
"passage"
Effective text before tokenization
"passageThe library opens at nine."

Answer: A literal prompt is not looked up. passage is concatenated directly, with no colon or added space. Use the configured name through prompt_name when that is your intent.

Method choice matters too. In the pinned source, encode_query() can select the query prompt automatically; encode_document() tries document, passage, then corpus. Record the exact call rather than assuming every encode method has the plain-call behavior shown in case 1. A configured default can also supply a prompt. An explicit empty prompt "" overrides a named/default prompt with no added text; an unknown selected name raises an error.

A hosted service is a separate step

Qdrant Cloud Inference documents automatic task prefixes for supported Qdrant-hosted models. Its E5 example uses query: for search and passage: for upsert; an already-correct prefix is preserved. This policy does not cover every provider or local inference route.

Documented E5 policy example

Application adds no prefix; the hosted model is supported and requests use the documented search/upsert routes.

Search sends
"When does the library open?"
Documented expansion
"query: When does the library open?"
Upsert sends
"The library opens at nine."
Documented expansion
"passage: The library opens at nine."

These are policy illustrations, not observed endpoint outputs. The Nomic preset is a different configuration.

Unknown provider behavior

Application sends the same raw question and document, but provider, route and preprocessing are unrecorded.

Query effective text
Unknown
Document effective text
Unknown

Answer: Do not infer either prefix from a model name or a successful response. Obtain route-specific documentation and a non-sensitive preprocessing trace, if the owner can expose one.

The historical Qdrant prefix report was closed as implemented in September 2026. It is not evidence of a current missing feature.

Keep text evidence separate from retrieval evidence

Matching strings do not establish matching vectors. Tokenization, truncation, pooling, router/task selection, weights, normalization and runtime configuration can still differ. These exercises inspect no vectors and establish no recall gain.

  1. Trace a neutral fixture through the actual ingestion and search calls. Check wrapper defaults and constructor overrides. Avoid logging private documents or credentials.
  2. Find the historical ingestion configuration, model revision and input transformation for the existing index. Current query settings cannot establish how stored vectors were created.
  3. Changing a prefix today does not retroactively update stored vectors. They remain outputs of the inputs and configuration used at creation. Preserve unknown history as unknown.
  4. If replacement embeddings are warranted, evaluate a separate candidate index alongside the old index using the owner’s relevant queries and judgments. Retain a rollback path; do not rebuild blindly on the strength of this string exercise.
Optional provenance worksheet to copy into a document

Copy this record into your own document for printing. Check print preview first; this page’s print layout has not been verified. Leave missing evidence marked unknown.

  • Index/collection identifier and creation date; current versus historical evidence:
  • Model ID, immutable revision, weights and tokenizer revision:
  • Library, wrapper, client/server versions and exact import path:
  • Provider, hosted/local mode, request operation and documentation date:
  • Ingestion: neutral original, application prefix and outgoing text:
  • Ingestion: method, prompt_name, literal prompt, resolved value, default and overrides:
  • Query: neutral original, application prefix and outgoing text:
  • Query: method, prompt_name, literal prompt, resolved value, default and overrides:
  • Service preprocessing: documented / observed / unknown, separately for both paths:
  • Effective strings and evidence location; unknown steps:
  • Task/router, truncation, pooling, normalization and dimensions:
  • Candidate-index evaluation, relevant queries, judgments and rollback plan:

Sources and scope

Updated . AI documentation and source inspection plus synthetic string tests; no model inference, provider probe, retrieval benchmark or human learning study. This is an input-tracing guide, not a universal prefix registry.