Embedding Models

View as Markdown

This page provides detailed technical specifications for the embedding model family supported by NeMo Customizer. For information about supported features and capabilities, refer to Tested Models.

Llama Nemotron Embedding 1B v2

PropertyValue
CreatorNVIDIA
ArchitectureTransformer encoder (fine-tuned Llama 3.2 1B, 16 layers)
DescriptionOptimized for multilingual and cross-lingual text question-answering retrieval with support for long documents (up to 8192 tokens) and dynamic embedding size (Matryoshka Embeddings). Reduces data storage footprint by 35x through dynamic embedding sizing. Ready for commercial use.
Max Sequence Length8192
Embedding Dimensions2048 (configurable: 384, 512, 768, 1024, or 2048)
Parameters1 billion
Supported LanguagesEnglish, Arabic, Bengali, Chinese, Czech, Danish, Dutch, Finnish, French, German, Hebrew, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean, Norwegian, Persian, Polish, Portuguese, Russian, Spanish, Swedish, Thai, Turkish (26 languages)
Training DataSemi-supervised pre-training on 12M samples and fine-tuning on 1M samples from public QA datasets with commercial licenses
LicenseNVIDIA Open Model License, Llama 3.2 Community License
Default Namenvidia/llama-nemotron-embed-1b-v2
HuggingFacenvidia/llama-nemotron-embed-1b-v2
NIMnvidia/llama-nemotron-embed-1b-v2

Model Entity Configuration

Create a Model Entity for this embedding model:

ConfigurationValue
Workspacedefault
Namellama-nemotron-embed-1b-v2
Base Modelnvidia/llama-nemotron-embed-1b-v2
Number of Parameters1,000,000,000
Precisionbf16-mixed

Training Options

  • LoRA (merged): 1x 80GB GPU, tensor parallel size 1
  • Full SFT: 1x 80GB GPU, tensor parallel size 1

Embedding models only support merged LoRA (peft with merge=True). Unmerged LoRA adapters are not supported because the embedding NIM requires ONNX format, which cannot represent standalone adapters.

Resource Requirements

  • Minimum GPU Memory: 80GB
  • Recommended GPU: A100
  • Training Time: Varies based on dataset size and epochs

Hyperparameter and Data Recommendations

This fine-tuning recipe supports full fine-tuning, updating all 1 billion parameters, and requires careful hyperparameter and data selection to prevent overfitting.

The following table provides conservative hyperparameter defaults specifically optimized to prevent overfitting for embedding models:

ParameterAPI Field NameTypeDescriptionRecommended Value
Learning Ratelearning_ratenumberStep size for updating model parameters. Lower values help prevent overfitting in embedding models.5e-6
Weight Decayweight_decaynumberRegularization parameter to prevent overfitting by penalizing large weights.0.01
Number of EpochsepochsintegerNumber of complete passes through the training dataset. Limited to prevent overfitting.1
Training Data SizeN/AN/ANumber of training examples to prevent overfitting while maintaining model performance.5,000-10,000 examples

NVIDIA recommends evaluating fine-tuned embedding models against the baseline to detect overfitting and potential performance degradation.

Deployment Configuration

  • Full SFT and LoRA (merged):
  • NIM Image: nvcr.io/nim/nvidia/llama-nemotron-embed-1b-v2:1.13.0
  • GPU Count: 1x 80GB

Deployment and Inference

This model supports inference deployment through NVIDIA Inference Microservices (NIM). After customization, access your model through the Inference Gateway:

  1. Deploy the model: Create a ModelDeploymentConfig and ModelDeployment to deploy your fine-tuned model. See about for details.
  2. Access through Inference Gateway: The Inference Gateway provides unified access to all deployed models via three routing patterns:
  • Model Entity routing: /v2/workspaces/{workspace}/inference/gateway/model/{name}/-/v1/embeddings
  • Provider routing: /v2/workspaces/{workspace}/inference/gateway/provider/{deployment}/-/v1/embeddings
1import os
2from nemo_platform import NeMoPlatform
3
4client = NeMoPlatform(
5 base_url=os.environ.get("NMP_BASE_URL", "http://localhost:8080"),
6 workspace="default",
7)
8
9# Get pre-configured OpenAI client for inference
10oai_client = client.models.get_openai_client()

The embedding model requires NIM container images that support embedding inference. When the deployment reaches READY state, a ModelProvider is automatically created for routing inference requests.

Example Usage

After fine-tuning and deployment, you can use the model for embedding tasks:

1import os
2from nemo_platform import NeMoPlatform
3
4client = NeMoPlatform(
5 base_url=os.environ.get("NMP_BASE_URL", "http://localhost:8080"),
6 workspace="default",
7)
8
9MODEL_NAME = "llama-nemotron-embed-1b-v2"
10DEPLOYMENT_NAME = "my-embedding-deployment"
11
12# Call embeddings via Inference Gateway
13response = client.inference.gateway.provider.post(
14 "v1/embeddings",
15 name=DEPLOYMENT_NAME,
16 workspace="default",
17 body={
18 "model": MODEL_NAME,
19 "input": ["What is the capital of France?"],
20 "input_type": "query",
21 },
22)
23
24embedding = response["data"][0]["embedding"]
25print(f"Embedding dimension: {len(embedding)}")

For detailed fine-tuning instructions, refer to the Embedding Customization tutorial.

For more information about formatting training datasets for the embedding model, refer to Dataset Format Requirements.