---
title: "Beating proprietary models with a quick fine-tune"
description: "Fine-tuning an open-source embedding model on a few hundred labeled pairs can beat OpenAI's text-embedding-3-small on duplicate-question detection, at lower cost."
url: "https://swe.quest/articles/beating-proprietary-models-with-a-quick-fine-tune-f1b25612d0019a9d"
canonical: "https://modal.com/blog/fine-tuning-embeddings"
source: "Modal"
published: "2024-04-26"
difficulty: "medium"
kind: "Research"
reading_minutes: 11
tags: ["model-training","machine-learning","rag","serverless","python"]
---

# Beating proprietary models with a quick fine-tune

A post on [Modal](https://swe.quest/sources/modal.md), published 2024-04-26, 11 min read, Research. Original: [https://modal.com/blog/fine-tuning-embeddings](https://modal.com/blog/fine-tuning-embeddings)

## Summary

Fine-tuning an open-source embedding model on a few hundred labeled pairs can beat OpenAI's text-embedding-3-small on duplicate-question detection, at lower cost. A grid search on the Quora duplicates dataset covered three base models (bge-base-en-v1.5, all-mpnet-base-v2, jina-embeddings-v2-small-en), dataset sizes from 100 to ~100k examples, and 256 vs 512 output dimensions, with each run on its own GPU in parallel via Modal's map. bge-base passed the baseline by 200 examples and kept improving, reaching about 13% error versus 17%. mpnet plateaued early, jina never beat the baseline, and the larger dimension gave no accuracy gain, so 256 dimensions is the cheaper choice.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [RAG & retrieval](https://swe.quest/tags/rag.md) (AI & ML)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- text embeddings ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- fine-tuning basics ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))
- hyperparameters

## Keywords

Modal, bge-base-en-v1.5, all-mpnet-base-v2, jina-embeddings-v2-small-en, text-embedding-3-small, Quora duplicates dataset, MTEB, Hugging Face

## Related posts

- [Build a Domain-Specific Embedding Model in Under a Day](https://swe.quest/articles/build-a-domain-specific-embedding-model-in-under-a-day-f4f33fdd5dd688e6.md): Hugging Face · 2026-03-20 · Medium · 13 min read · RAG & retrieval, Model training, Search, Inference & serving
  A single-GPU pipeline fine-tunes Llama-Nemotron-Embed-1B-v2 for a specific domain in under a day without manual labels.
- [Embedding English Wikipedia in under 15 minutes](https://swe.quest/articles/embedding-english-wikipedia-in-under-15-minutes-fa4a10822ac9f853.md): Modal · 2024-01-23 · Medium · 11 min read · Inference & serving, Serverless, RAG & retrieval, Python
  Embedding all of English Wikipedia with the open-source BAAI/bge-small-en-v1.5 model takes about 15 minutes and just over $15 when Hugging Face's Text Embeddings Inference server runs across many parallel GPUs on Modal.
- [Welcome EmbeddingGemma, Google's new efficient embedding model](https://swe.quest/articles/welcome-embeddinggemma-google-s-new-efficient-embedding-model-6dfba9cbb9b4eedd.md): Hugging Face · 2025-09-04 · Medium · 30 min read · RAG & retrieval, Vector search, Model training, LLMs, Python
  EmbeddingGemma is Google's 308M-parameter multilingual text embedding model.
- [Mistral 7B and BAAI on Workers AI vs. OpenAI Models for RAG](https://swe.quest/articles/mistral-7b-and-baai-on-workers-ai-vs-openai-models-for-rag-30d70a2c28e85606.md): Neon · 2023-12-11 · Medium · 7 min read · RAG & retrieval, LLMs, Evaluation, Inference & serving
  Swapping gpt-3.5-turbo for mistral-7b-instruct-v0.1 and text-embedding-ada-002 for BAAI's bge-base-en-v1.5 (both on Cloudflare Workers AI) in Neon's docs chatbot shows embeddings are close to interchangeable but text generation is not.
- [Matryoshka embeddings: faster OpenAI vector search using Adaptive Retrieval](https://swe.quest/articles/matryoshka-embeddings-faster-openai-vector-search-using-adaptive-retrieval-739d1a8595798695.md): Supabase · 2024-02-13 · Medium · 17 min read · Vector search, PostgreSQL, RAG & retrieval, Performance engineering
  OpenAI's text-embedding-3 models are trained with Matryoshka Representation Learning, so an embedding can be shortened by truncating trailing dimensions and renormalizing, which reproduces the API's \`dimensions\` output.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
