Nomic Embed Text V2 is the latest powerful multilingual Mixture of Experts (MoE) based text embedding model designed for high-performance retrieval and representation learning. With 475M total parameters, it achieves state-of-the-art (SoTA) multilingual performance while remaining efficient. Unlike traditional models, it supports flexible embedding dimensions (768 to 256), reducing storage costs by 3x with minimal performance loss. Additionally, it has been trained on over 1.6 billion text pairs across 100 different languages, offering unmatched accuracy in cross-lingual retrieval. This type of architecture makes it ideal for semantic search and retrieval systems such as search engines, recommendation systems, and AI-powered assistants. As a fully open-source model, it provides transparency and flexibility for developers to fine-tune and deploy based on their needs.
Model | Params (M) | Emb Dim | BEIR | MIRACL | Pretrain Data | Finetune Data | Code |
---|
Nomic Embed v2 | 305 | 768 | 52.86 | 65.80 | ✅ | ✅ | ✅ |
mE5 Base | 278 | 768 | 48.88 | 62.30 | ❌ | ❌ | ❌ |
mGTE Base | 305 | 768 | 51.10 | 63.40 | ❌ | ❌ | ❌ |
Arctic Embed v2 Base | 305 | 768 | 55.40 | 59.90 | ❌ | ❌ | ❌ |
| | | | | | | |
BGE M3 | 568 | 1024 | 48.80 | 69.20 | ❌ | ✅ | ❌ |
Arctic Embed v2 Large | 568 | 1024 | 55.65 | 66.00 | ❌ | ❌ | ❌ |
mE5 Large | 560 | 1024 | 51.40 | 66.50 | ❌ | ❌ | ❌ |
In this guide, you’ll learn how to install Nomic Embed Text V2 locally, unlock its multilingual capabilities, and optimize it for your own text processing applications.
Prerequisites
The minimum system requirements for this use case are:
- GPUs: RTX 4090 or RTX A6000 (for smooth execution).
- Disk Space: 100 GB
- RAM: At least 8 GB.
- Jupyter Notebook installed.
Note: The prerequisites for this are highly variable across use cases. A high-end configuration could be used for a large-scale deployment.
Step-by-step process to install & run Nomic Embed Text V2
For the purpose of this tutorial, we’ll use a GPU-powered Virtual Machine by NodeShift since it provides high compute Virtual Machines at a very affordable cost on a scale that meets GDPR, SOC2, and ISO27001 requirements. Also, it offers an intuitive and user-friendly interface, making it easier for beginners to get started with Cloud deployments. However, feel free to use any cloud provider of your choice and follow the same steps for the rest of the tutorial.
Step 1: Setting up a NodeShift Account
Visit app.nodeshift.com and create an account by filling in basic details, or continue signing up with your Google/GitHub account.
If you already have an account, login straight to your dashboard.
Step 2: Create a GPU Node
After accessing your account, you should see a dashboard (see image), now:
- Navigate to the menu on the left side.
- Click on the GPU Nodes option.
- Click on Start to start creating your very first GPU node.
These GPU nodes are GPU-powered virtual machines by NodeShift. They are highly customizable and allow you to control different environmental configurations for GPUs ranging from H100s to A100s, CPUs, RAM, and storage, according to your needs.
Step 3: Selecting configuration for GPU (model, region, storage)
- For this tutorial, we’ll be using the RTX 4090 GPU; however, you can choose any GPU of your choice based on your needs.
- Similarly, we’ll opt for 200GB storage by sliding the bar. You can also select the region where you want your GPU to reside from the available ones.
Step 4: Choose GPU Configuration and Authentication method
- After selecting your required configuration options, you’ll see the available VMs in your region and according to (or very close to) your configuration. In our case, we’ll choose a 1x RTX 4090 GPU node with 12 vCPUs/96GB RAM/200 GB SSD.
2. Next, you’ll need to select an authentication method. Two methods are available: Password and SSH Key. We recommend using SSH keys, as they are a more secure option. To create one, head over to our official documentation.
Step 5: Choose an Image
The final step would be to choose an image for the VM, which in our case is Jupyter Notebook, where we’ll deploy and run the inference of our model.
That’s it! You are now ready to deploy the node. Finalize the configuration summary, and if it looks good, click Create to deploy the node.
Step 6: Connect to active Compute Node using SSH
- As soon as you create the node, it will be deployed in a few seconds or a minute. Once deployed, you will see a status Running in green, meaning that our Compute node is ready to use!
- Once your GPU shows this status, navigate to the three dots on the right and click on Connect with SSH. This will open a new tab with a Jupyter Notebook session in which we can run our model.
Step 7: Setting up Python Notebook
Start by creating a .ipynb notebook by clicking on Python 3 (ipykernel).
Next, If you want to check the GPU details, run the following command in the Jupyter Notebook cell:
!nvidia-smi
Output:
Step 8: Install Dependencies
- Install the following dependency packages to run the model.
!pip install torch
!pip install git+https://github.com/huggingface/transformers
!pip install git+https://github.com/huggingface/accelerate
!pip install huggingface_hub
Output:
2. Install einops
as a model dependency.
!pip install einops
Output:
Step 9: Load and run the model
After completing the above setup, we can proceed with loading and importing the model.
- Here’s the code snippet for downloading the model:
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("nomic-ai/nomic-embed-text-v2-moe")
model = AutoModel.from_pretrained("nomic-ai/nomic-embed-text-v2-moe", trust_remote_code=True)
Output:
2. Once the model has finished downloading, we’ll test the model with the following snippet:
sentences = ['search_document: Hello!', 'search_document: iHola!']
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0]
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
model.eval()
with torch.no_grad():
model_output = model(**encoded_input)
embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
embeddings = F.normalize(embeddings, p=2, dim=1)
print(embeddings)
similarity = F.cosine_similarity(embeddings[0], embeddings[1], dim=0)
print(similarity)
Output:
In the above prompt, we have given the word “hello” in two different languages, English and Spanish. This code above processes these two multilingual sentences and computes their similarity using the nomic model, which can be used for semantic search or retrieval tasks.
We have tried the same code for two more languages, Arabic and Hindi. However, we haven’t used the same word; instead, we have two different sentences to test whether we get a low similarity score this time.
In Arabic: يوم مشمس ; Translation: Sunny Day
In Hindi: तूफ़ानी रात ; Translation: Windy night
sentences = ['search_document: يوم مشمس', 'search_document: तूफ़ानी रात']
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0]
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
model.eval()
with torch.no_grad():
model_output = model(**encoded_input)
embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
embeddings = F.normalize(embeddings, p=2, dim=1)
print(embeddings)
similarity = F.cosine_similarity(embeddings[0], embeddings[1], dim=0)
print(similarity)
Output:
If you notice, the similarity score the similarity scohas significantly decreased compared to the previous test case because the sentences have different meanings.
Conclusion
In this guide, you’ll follow a step-by-step process for installing Nomic Embed Text V2 locally. This gives you access to a state-of-the-art multilingual embedding model that excels in retrieval, semantic search, and AI-driven applications. With its Mixture of Experts architecture and flexible embedding dimensions, it offers efficiency and high performance across 100 languages. While local installation provides full control, NodeShift Cloud simplifies deployment, offering a scalable, optimized, secure environment to run and integrate the model seamlessly.