---
title: "Build a Domain-Specific Embedding Model in Under a Day"
description: "The tutorial presents a pipeline for adapting a general-purpose embedding model when it misses fine-grained distinctions in domain documents and labeled query–document data is unavailable. It generates synthetic question–answer pairs with NeMo Data Designer, filters them for quality, mines hard negatives with a 95% positive-score margin ceiling, and unrolls multi-hop queries for contrastive training. The recipe fine-tunes Llama-Nemotron-Embed-1B-v2, evaluates base and adapted models with BEIR metrics, and exports the result to ONNX or TensorRT. On the reported datasets, it improved Recall@10 and NDCG@10 by more than 10%; Atlassian increased Recall@60 from 0.751 to 0.951 on JIRA data. The complete workflow can run in roughly 2–3 hours for about 500 documents, using a single 80GB Ampere-or-newer GPU."
---

# Build a Domain-Specific Embedding Model in Under a Day

[Hugging Face](https://yomu.fyi/company/hugging-face) · Steve Han, Rucha Apte, Sean Sodha, Oliver Holworthy · Mar 20, 2026

**Type:** Tutorial

## Summary

The tutorial presents a pipeline for adapting a general-purpose embedding model when it misses fine-grained distinctions in domain documents and labeled query–document data is unavailable. It generates synthetic question–answer pairs with NeMo Data Designer, filters them for quality, mines hard negatives with a 95% positive-score margin ceiling, and unrolls multi-hop queries for contrastive training. The recipe fine-tunes Llama-Nemotron-Embed-1B-v2, evaluates base and adapted models with BEIR metrics, and exports the result to ONNX or TensorRT. On the reported datasets, it improved Recall@10 and NDCG@10 by more than 10%; Atlassian increased Recall@60 from 0.751 to 0.951 on JIRA data. The complete workflow can run in roughly 2–3 hours for about 500 documents, using a single 80GB Ampere-or-newer GPU.

## Context

General-purpose embedding models may capture broad semantic similarity without representing the fine-grained distinctions required by domain-specific retrieval. The post also identifies the lack of manually labeled query–document pairs as a costly, slow, and potentially biased obstacle to fine-tuning.

## Approach / What changed

The workflow uses an LLM to generate and quality-filter synthetic question–answer pairs from domain documents, mines hard negatives with the base embedding model, unrolls multi-hop positives, fine-tunes Llama-Nemotron-Embed-1B-v2, evaluates it with BEIR, and exports and deploys it through ONNX, TensorRT, and NVIDIA NIM.

## Takeaways

- Hard-negative mining embeds queries and passages, masks labeled positives, excludes candidates above 95% of the minimum positive score, and selects the top five surviving non-positive passages by default.
- Synthetic questions support configurable complexity levels from 2–5 and hop counts from 1–3; quality scoring covers relevance, accuracy, context support, and clarity before pairs enter training.
- NVIDIA NIM exposes the exported model through an OpenAI-compatible /v1/embeddings endpoint, while a BEIR-based verification step checks for accuracy changes after ONNX or TensorRT conversion.

**Tags:** [Deployment](https://yomu.fyi/topic/deployment), [LLMs](https://yomu.fyi/topic/llm), [Machine Learning](https://yomu.fyi/topic/machine-learning), [Performance](https://yomu.fyi/topic/performance), [Search](https://yomu.fyi/topic/search)

- Source: [Hugging Face](https://huggingface.co/blog/nvidia/domain-specific-embedding-finetune)
- Source URL: https://huggingface.co/blog/nvidia/domain-specific-embedding-finetune
- Ingested by Yomu: 2026-08-29T01:46:43.234Z

[Read original post](https://huggingface.co/blog/nvidia/domain-specific-embedding-finetune)
