We’re living in an era where content is no longer just textual and users speak more than one language, retrieval models need to understand documents the way humans do, across both language and modality. Meet Jina Embeddings v4, a groundbreaking open-source universal embedding model that redefines what’s possible in search, retrieval, and semantic understanding. With 3.8B parameter backbone built on Qwen2.5-VL, v4 bridges the gap between text and images using a shared encoder that processes visually rich content like tables, charts, diagrams, screenshots, and even long documents with up to 32,768 tokens or 20MP images. It supports both single-vector and multi-vector embeddings, giving you flexibility between fast search and deep semantic matching. What sets it apart are its LoRA adapters trained for real-world tasks, from multilingual retrieval (outperforming OpenAI’s embedding models by 12%) to code search (15% better than Voyage-3), and even visual document retrieval (scoring 90.2 on ViDoRe). If you’re building a document search engine, a multi-language chatbot, or a visual search tool, this is the embedding model that can make your AI apps an all rounder for diverse users and usecases.
In this guide, we’re going to cover step-by-step process to install and run this model while generating embeddings for text and image prompts.
Prerequisites
The minimum system requirements for running this model are:
- GPU: 1x RTXA6000 or 1x A100
- Storage: 50 GB (preferable)
- VRAM: at least 16 GB
- Anaconda installed
Step-by-step process to install and run Jina Embeddings V4
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. These nodes are highly customizable and let you 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 1x A100 GPU, however, you can choose any GPU as per the prerequisites.
- Similarly, we’ll opt for 100GB 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 GPU nodes in your region and according to (or very close to) your configuration. In our case, we’ll choose a 1x A100 80GB GPU node with 32vCPUs/131GB RAM/100GB 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 is to choose an image for the VM, which in our case is Nvidia Cuda.
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, click on Connect with SSH, and copy the SSH details that appear.
As you copy the details, follow the below steps to connect to the running GPU VM via SSH:
- Open your terminal, paste the SSH command, and run it.
2. In some cases, your terminal may take your consent before connecting. Enter ‘yes’.
3. A prompt will request a password. Type the SSH password, and you should be connected.
Output:
Next, If you want to check the GPU details, run the following command in the terminal:
!nvidia-smi
Step 7: Set up the project environment with dependencies
- Create a virtual environment using Anaconda.
conda create -n jina python=3.11 -y && conda activate jina
Output:
2. Once you’re inside the environment, install necessary dependencies to run the model.
pip install torch>=2.6.0 torchvision torchaudio einops timm pillow
pip install --upgrade vllm
pip install transformers>=4.53.0
pip install git+https://github.com/huggingface/accelerate
pip install git+https://github.com/huggingface/diffusers
pip install huggingface_hub
pip install sentencepiece bitsandbytes protobuf decord numpy peft>=0.15.2
3. Install and run jupyter notebook.
conda install -c conda-forge --override-channels notebook -y
conda install -c conda-forge --override-channels ipywidgets -y
jupyter notebook --allow-root
4. If you’re on a remote machine (e.g., NodeShift GPU), you’ll need to do SSH port forwarding in order to access the jupyter notebook session on your local browser.
Run the following command in your local terminal after replacing:
<YOUR_SERVER_PORT>
with the PORT allotted to your remote server (For the NodeShift server – you can find it in the deployed GPU details on the dashboard).
<PATH_TO_SSH_KEY>
with the path to the location where your SSH key is stored.
<YOUR_SERVER_IP>
with the IP address of your remote server.
ssh -L 8888:localhost:8888 -p <YOUR_SERVER_PORT> -i <PATH_TO_SSH_KEY> root@<YOUR_SERVER_IP>
Output:
After this copy the URL you received in your remote server:
And paste this on your local browser to access the Jupyter Notebook session.
Step 8: Download and Run the model
- Open a Python notebook inside Jupyter.
2. Download the model checkpoints and run the model with prompts to generate embeddings.
import torch
from PIL import Image
from vllm import LLM
from vllm.config import PoolerConfig
from vllm.inputs.data import TextPrompt
# Initialize the vLLM embedding model
model = LLM(
model="jinaai/jina-embeddings-v4-vllm-retrieval",
task="embed",
override_pooler_config=PoolerConfig(pooling_type="ALL", normalize=False),
dtype="float16",
)
# Create text prompts separately
query_prompt = TextPrompt(prompt="Query: Overview of climate change impacts on coastal cities")
passage_prompt = TextPrompt(prompt="Passage: The impacts of climate change on coastal cities are significant..")
# Encode text prompts
text_outputs = model.encode([query_prompt, passage_prompt])
# Create image prompt separately
image = Image.open("./jina-test-image.jpg")
image_prompt = TextPrompt(
prompt="<|im_start|>user\n<|vision_start|><|image_pad|><|vision_end|>Describe the image.<|im_end|>\n",
multi_modal_data={"image": image},
)
# Encode image prompt separately
image_outputs = model.encode([image_prompt])
# Combine all outputs
outputs = text_outputs + image_outputs
# ============ Embedding Pooling Function ============
def get_embeddings(outputs):
VISION_START_TOKEN_ID = 151652
VISION_END_TOKEN_ID = 151653
embeddings = []
for output in outputs:
token_ids = torch.tensor(output.prompt_token_ids)
data = output.outputs.data.detach().clone()
if VISION_START_TOKEN_ID in token_ids:
# For vision input, pool between vision tokens
start = (token_ids == VISION_START_TOKEN_ID).nonzero()[0].item()
end = (token_ids == VISION_END_TOKEN_ID).nonzero()[0].item()
data = data[start : end + 1]
# Mean pool + normalize
pooled = data.sum(dim=0, dtype=torch.float32) / data.shape[0]
normed = torch.nn.functional.normalize(pooled, dim=-1)
embeddings.append(normed)
return embeddings
# Get pooled + normalized embeddings
embeddings = get_embeddings(outputs)
# Print shape info
for i, emb in enumerate(embeddings):
print(f"Embedding {i+1}: shape={emb.shape}, norm={torch.norm(emb):.4f}")
Output:
3. Initialize and load the model.
# Initialize SNAC decoder
snac_model = SNAC.from_pretrained("hubertsiuzdak/snac_24khz").eval().cuda()
# Control token IDs (fixed for Veena)
START_OF_SPEECH_TOKEN = 128257
END_OF_SPEECH_TOKEN = 128258
START_OF_HUMAN_TOKEN = 128259
END_OF_HUMAN_TOKEN = 128260
START_OF_AI_TOKEN = 128261
END_OF_AI_TOKEN = 128262
AUDIO_CODE_BASE_OFFSET = 128266
# Available speakers
speakers = ["kavya", "agastya", "maitri", "vinaya"]
def generate_speech(text, speaker="kavya", temperature=0.4, top_p=0.9):
"""Generate speech from text using specified speaker voice"""
# Prepare input with speaker token
prompt = f"<spk_{speaker}> {text}"
prompt_tokens = tokenizer.encode(prompt, add_special_tokens=False)
# Construct full sequence: [HUMAN] <spk_speaker> text [/HUMAN] [AI] [SPEECH]
input_tokens = [
START_OF_HUMAN_TOKEN,
*prompt_tokens,
END_OF_HUMAN_TOKEN,
START_OF_AI_TOKEN,
START_OF_SPEECH_TOKEN
]
input_ids = torch.tensor([input_tokens], device=model.device)
# Calculate max tokens based on text length
max_tokens = min(int(len(text) * 1.3) * 7 + 21, 700)
# Generate audio tokens
with torch.no_grad():
output = model.generate(
input_ids,
max_new_tokens=max_tokens,
do_sample=True,
temperature=temperature,
top_p=top_p,
repetition_penalty=1.05,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=[END_OF_SPEECH_TOKEN, END_OF_AI_TOKEN]
)
# Extract SNAC tokens
generated_ids = output[0][len(input_tokens):].tolist()
snac_tokens = [
token_id for token_id in generated_ids
if AUDIO_CODE_BASE_OFFSET <= token_id < (AUDIO_CODE_BASE_OFFSET + 7 * 4096)
]
if not snac_tokens:
raise ValueError("No audio tokens generated")
# Decode audio
audio = decode_snac_tokens(snac_tokens, snac_model)
return audio
def decode_snac_tokens(snac_tokens, snac_model):
"""De-interleave and decode SNAC tokens to audio"""
if not snac_tokens or len(snac_tokens) % 7 != 0:
return None
# De-interleave tokens into 3 hierarchical levels
codes_lvl = [[] for _ in range(3)]
llm_codebook_offsets = [AUDIO_CODE_BASE_OFFSET + i * 4096 for i in range(7)]
for i in range(0, len(snac_tokens), 7):
# Level 0: Coarse (1 token)
codes_lvl[0].append(snac_tokens[i] - llm_codebook_offsets[0])
# Level 1: Medium (2 tokens)
codes_lvl[1].append(snac_tokens[i+1] - llm_codebook_offsets[1])
codes_lvl[1].append(snac_tokens[i+4] - llm_codebook_offsets[4])
# Level 2: Fine (4 tokens)
codes_lvl[2].append(snac_tokens[i+2] - llm_codebook_offsets[2])
codes_lvl[2].append(snac_tokens[i+3] - llm_codebook_offsets[3])
codes_lvl[2].append(snac_tokens[i+5] - llm_codebook_offsets[5])
codes_lvl[2].append(snac_tokens[i+6] - llm_codebook_offsets[6])
# Convert to tensors for SNAC decoder
hierarchical_codes = []
for lvl_codes in codes_lvl:
device = next(snac_model.parameters()).device
tensor = torch.tensor(lvl_codes, dtype=torch.int32, device=device).unsqueeze(0)
if torch.any((tensor < 0) | (tensor > 4095)):
raise ValueError("Invalid SNAC token values")
hierarchical_codes.append(tensor)
# Decode with SNAC
with torch.no_grad():
audio_hat = snac_model.decode(hierarchical_codes)
return audio_hat.squeeze().clamp(-1, 1).cpu().numpy()
Output:
Here’s the shape of the embeddings generated by model for all three types of inputs which had the following image as the image prompt:

Seascape during sundown. Beautiful natural seascape
Conclusion
Jina Embeddings v4 brings a powerful shift in how we generate and use embeddings, seamlessly combining text and image understanding, multilingual capabilities, and dual embedding modes for both speed and semantic depth. Paired with NodeShift Cloud, deploying such an advanced model becomes effortless, no GPU management or complex cuda installation hassles, or any complex configuration needed. If you’re exploring semantic search, visual document retrieval, or multilingual QA systems, NodeShift empowers you to unlock the full potential of Jina v4 with just a few lines of code and a blazing-fast inference backend.