Skip to content

feat: add Arctic Embed 2.0 (M and L) models - #656

Open
dyiapanis wants to merge 2 commits into
qdrant:mainfrom
dyiapanis:feat/add-arctic-embed-2.0
Open

feat: add Arctic Embed 2.0 (M and L) models#656
dyiapanis wants to merge 2 commits into
qdrant:mainfrom
dyiapanis:feat/add-arctic-embed-2.0

Conversation

@dyiapanis

@dyiapanis dyiapanis commented Aug 2, 2026

Copy link
Copy Markdown

Add Snowflake/snowflake-arctic-embed-m-v2.0 (768 dims, GTE-based, multilingual, 8192 tokens) and Snowflake/snowflake-arctic-embed-l-v2.0 (1024 dims, XLM-RoBERTa-based, multilingual, 8192 tokens).

Arctic Embed 2.0 adds multilingual support (100+ languages) without sacrificing English performance. Both models support 8192 token context (16x longer than Arctic Embed 1.0's 512 tokens).

Canonical vectors generated via:

  • M: ONNX runtime inference (same execution path as fastembed)
  • L: sentence-transformers + PyTorch (reference implementation)

Both models use Apache-2.0 license and are available on HuggingFace with pre-built ONNX exports.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  • Does your submission pass the existing tests?
  • Have you added tests for your feature?
  • Have you installed pre-commit with pip3 install pre-commit and set up hooks with pre-commit install?

New models submission:

  • Have you added an explanation of why it's important to include this model?
  • Have you added tests for the new model? Were canonical values for tests computed via the original model?
  • Have you added the code snippet for how canonical values were computed?
  • Have you successfully ran tests with your changes locally?

Add Snowflake/snowflake-arctic-embed-m-v2.0 (768 dims, GTE-based,
multilingual, 8192 tokens) and Snowflake/snowflake-arctic-embed-l-v2.0
(1024 dims, XLM-RoBERTa-based, multilingual, 8192 tokens).

Arctic Embed 2.0 adds multilingual support (100+ languages) without
sacrificing English performance. Both models support 8192 token context
(16x longer than Arctic Embed 1.0's 512 tokens).

Canonical vectors generated via:
- M: ONNX runtime inference (same execution path as fastembed)
- L: sentence-transformers + PyTorch (reference implementation)

Both models use Apache-2.0 license and are available on HuggingFace
with pre-built ONNX exports.
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 730f3e13-5c5c-4ac1-85cc-6c4950e4f727

📥 Commits

Reviewing files that changed from the base of the PR and between 9077980 and aab21e6.

📒 Files selected for processing (1)
  • fastembed/text/onnx_embedding.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • fastembed/text/onnx_embedding.py

📝 Walkthrough

Walkthrough

The PR adds medium and large Snowflake Arctic Embed v2.0 multilingual ONNX models to the supported model registry. It defines their embedding dimensions, token limits, licenses, sizes, sources, and file paths. It also adds canonical test vectors for both models.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • qdrant/fastembed#602: Adds other multilingual ONNX embedding models and corresponding canonical test vectors.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the addition of the Arctic Embed 2.0 medium and large models.
Description check ✅ Passed The description directly explains the added models, their capabilities, licensing, and test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@fastembed/text/onnx_embedding.py`:
- Line 175: Update the model descriptors for
Snowflake/snowflake-arctic-embed-m-v2.0 and
Snowflake/snowflake-arctic-embed-l-v2.0 to state “74 languages” instead of “100+
languages,” unless a revision-specific source in the descriptors substantiates
the broader claim.
- Line 177: Update the Snowflake Arctic-Embed v2.0 handling in OnnxTextModel so
query inputs receive the required “query: ” prefix before tokenization, or
revise both query/document prefix descriptions to clearly require callers to add
it. Ensure the documented contract matches the actual preprocessing behavior for
v2.0 models.
- Around line 194-195: Update the large model descriptor in the relevant model
configuration to include onnx/model.onnx_data alongside onnx/model.onnx in its
allowed/downloaded model files, ensuring the external ONNX data file is cached
with the model.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f2f124ae-7a9f-4327-9f08-cb0c33a1a8f5

📥 Commits

Reviewing files that changed from the base of the PR and between 0892291 and 9077980.

📒 Files selected for processing (2)
  • fastembed/text/onnx_embedding.py
  • tests/test_text_onnx_embeddings.py

Comment thread fastembed/text/onnx_embedding.py Outdated
Comment thread fastembed/text/onnx_embedding.py Outdated
description=(
"Text embeddings, Unimodal (text), Multilingual (100+ languages), "
"8192 input tokens truncation, "
"Prefixes for queries/documents: not necessary, 2025 year."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate and inspect the referenced source, related model registrations, and base embedding behavior.
git ls-files | rg '(^|/)fastembed/(text/onnx_embedding.py|text/text_embedding_base.py|.*\.py)$' | head -200

echo '--- onnx_embedding references around Snowflake/arctic ---'
rg -n "snowflake|arctic|Prefixes for queries/documents|query:|document" fastembed/text/onnx_embedding.py fastembed/text -S || true

echo '--- snippets ---'
if [ -f fastembed/text/onnx_embedding.py ]; then
  nl -ba fastembed/text/onnx_embedding.py | sed -n '140,210p'
fi
if [ -f fastembed/text/text_embedding_base.py ]; then
  nl -ba fastembed/text/text_embedding_base.py | sed -n '1,260p'
fi

Repository: qdrant/fastembed

Length of output: 14796


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import re, urllib.request
target='https://raw.githubusercontent.com/Snowflake-Labs/snowflake-arctic-embed-m-v2.0/main/model_card.md'
try:
    text=urllib.request.urlopen(target, timeout=20).read().decode()
    print('--- raw model card excerpt ---')
    for i,line in enumerate(text.splitlines(),1):
        if 'query' in line.lower() or 'document' in line.lower() or 'prefix' in line.lower():
            print(f'{i}: {line}')
except Exception as exc:
    print(f'FETCH_ERROR {exc}')

hug='https://huggingface.co/Snowflake/snowflake-arctic-embed-m-v2.0'
query='https://huggingface.co/api/models/Snowflake/snowflake-arctic-embed-m-v2.0'
try:
    text=urllib.request.urlopen(query, timeout=20).read().decode()
    import json
    data=json.loads(text)
    print('--- huggingface model tags ---', data.get('tags'))
except Exception as exc:
    print(f'HF_API_ERROR {exc}')
PY

Repository: qdrant/fastembed

Length of output: 449


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate model definitions and embedding entrypoints without external network calls.
printf '--- onnx_embedding.py model metadata and implementations ---\n'
awk 'NR>=90 && NR<=220 {printf "%4d: %s\n", NR, $0}' fastembed/text/onnx_embedding.py

printf '\n--- base/embedding query/document flow ---\n'
awk 'NR>=20 && NR<=190 {printf "%4d: %s\n", NR, $0}' fastembed/text/onnx_text_model.py
awk 'NR>=130 && NR<=190 {printf "%4d: %s\n", NR, $0}' fastembed/text/text_embedding.py
awk 'NR>=35 && NR<=55 {printf "%4d: %s\n", NR, $0}' fastembed/text/text_embedding_base.py

printf '\n--- OnnxTextModel constructor fields relevant to query document handling ---\n'
awk 'NR>=1 && NR<=90 {printf "%4d: %s\n", NR, $0}' fastembed/text/onnx_text_model.py

Repository: qdrant/fastembed

Length of output: 245


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate model definitions and embedding entrypoints without external network calls.
printf '%s\n' '--- onnx_embedding.py model metadata and implementations ---'
awk 'NR>=90 && NR<=220 {printf "%4d: %s\n", NR, $0}' fastembed/text/onnx_embedding.py

printf '%s\n' ''
printf '%s\n' '--- base/embedding query document flow ---'
awk 'NR>=20 && NR<=190 {printf "%4d: %s\n", NR, $0}' fastembed/text/onnx_text_model.py
awk 'NR>=130 && NR<=190 {printf "%4d: %s\n", SR, $0}' fastembed/text/text_embedding.py
awk 'NR>=35 && NR<=55 {printf "%4d: %s\n", NR, $0}' fastembed/text/text_embedding_base.py

printf '%s\n' ''
printf '%s\n' '--- OnnxTextModel constructor fields relevant to query document handling ---'
awk 'NR>=1 && NR<=90 {printf "%4d: %s\n", NR, $0}' fastembed/text/onnx_text_model.py

Repository: qdrant/fastembed

Length of output: 20989


🌐 Web query:

Snowflake/snowflake-arctic-embed-m-v2.0 Snowflake/snowflake-arctic-embed-l-v2.0 query: prefix query embeddings

💡 Result:

For Snowflake's Arctic-Embed v2.0 series (including both the medium and large variants), it is recommended to use a query prefix for optimal retrieval quality [1][2]. The specific prefix to use for these v2.0 models is "query: " (note the space after the colon) [1][2][3]. This prefix should be applied only to the query text, not to the documents [1][2]. When using the Hugging Face transformers library, you prepend this string to your query before tokenization [1][2]. Alternatively, if you are using the sentence-transformers library, you can encode queries by specifying prompt_name="query" in the model.encode() method, which handles the prefix automatically [1][3]. It is important to note that this requirement is specific to the v2.0 models. While earlier versions (such as v1.5) also required a prefix for optimal performance, they used a different, longer instruction string ("Represent this sentence for searching relevant passages: ") [4][5][6]. Using the incorrect prefix or failing to use one can negatively impact retrieval performance [7].

Citations:


Update the v2.0 query-prefix contract.

The Snowflake Arctic-Embed v2.0 model cards recommend query: only for query text. The Prefixes for queries/documents: not necessary descriptions at lines 177 and 190 are misleading. If these models use the default OnnxTextModel path, raw query text is tokenized without that prefix, so add explicit query preprocessing or update both descriptions to document that callers must add query: .

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@fastembed/text/onnx_embedding.py` at line 177, Update the Snowflake
Arctic-Embed v2.0 handling in OnnxTextModel so query inputs receive the required
“query: ” prefix before tokenization, or revise both query/document prefix
descriptions to clearly require callers to add it. Ensure the documented
contract matches the actual preprocessing behavior for v2.0 models.

Source: MCP tools

Comment thread fastembed/text/onnx_embedding.py
…, and L model external data

- Change '100+ languages' to '74 languages' (per HuggingFace model card metadata)
- Update prefix description: Arctic Embed 2.0 recommends 'query: ' prefix for retrieval queries
- Add additional_files=['onnx/model.onnx_data'] for L model (external ONNX data file required for loading)
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.

1 participant