Embedding English Wikipedia in under 15 minutes
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. The walkthrough covers Modal Functions, Volumes, and class lifecycle hooks (@enter/@exit). It also shows code for downloading the dataset to a persistent volume, launching the TEI server inside an A10G container, and chunking text into fixed-size pieces. Batched async requests are fanned out with .map. Fast regeneration of embeddings is pitched as the enabler for frequent fine-tuning of open-source embedding models instead of relying on rate-limited closed APIs.
Related posts
- Deploy Embedding Models with Hugging Face Inference Endpoints
Hugging Face mediumAdeptOpen-source embedding models such as BAAI/bge-base-en-v1.5 can be deployed on Hugging Face Inference Endpoints using Text Embeddings Inference (TEI), which offers token-based dynamic batching, Flash Attention, Candle and cuBLASLt kernels, safetensors loading, small images for fast boot, and OpenTelemetry/Prometheus support. Deployment is click-through: pick a model, cloud, region and instance, such as an Nvidia A10G instead of the suggested CPU instance. Batch requests are sent over HTTP with `truncate: true`, because TEI does not truncate inputs by default. A benchmark at sequence length 512 and batch size 32 reached 450+ req/sec, about $0.00000156 per 1k tokens, which Hugging Face says is 64x cheaper than OpenAI embeddings.
- Beating proprietary models with a quick fine-tune
Modal mediumAdept
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.
- Welcome EmbeddingGemma, Google's new efficient embedding model
Hugging Face mediumAdeptEmbeddingGemma is Google's 308M-parameter multilingual text embedding model. It is built on a Gemma3 backbone modified to use bidirectional attention, with mean pooling and two dense layers producing 768-dimensional vectors. It supports a 2K-token context and over 100 languages, runs in under 200 MB of RAM when quantized, and ranks highest among text-only multilingual models under 500M parameters on MMTEB. Because it was trained with Matryoshka Representation Learning, embeddings can be truncated to 512, 256 or 128 dimensions, and inputs need task-specific prompts such as "task: search result | query: " to get correct results. Code examples cover Sentence Transformers, LangChain, LlamaIndex, Haystack, txtai, Transformers.js, TEI and ONNX, plus a finetuning walkthrough on the MIRIAD medical dataset whose resulting model outperforms models twice its size on that task.
- Mistral 7B and BAAI on Workers AI vs. OpenAI Models for RAG
Neon mediumAdept
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. Across eight Postgres questions, the two embedding models returned the same retrieved chunks 46% of the time at k=3 (42% at k=10), with Jaccard and TF-IDF cosine scores indicating substantial context overlap. Expert raters scored GPT-3.5 answers 3.8/5 versus 2.5/5 for Mistral 7B. Migrating embeddings to BGE looks viable and can cut vector storage, while replacing the generation model would noticeably hurt answer quality.
- Run Embedding Models and Unlock Semantic Search with Docker Model Runner
Docker mediumAdeptDocker Model Runner can serve embedding models locally, so semantic search and RAG pipelines run without sending private data to a hosted API and without per-call costs. Embeddings map text and code to vectors where semantically related items cluster, and cosine similarity ranks documents against a query. Getting started takes two steps: pull a model such as ai/qwen3-embedding, then call the OpenAI-style /engines/v1/embeddings endpoint on localhost. A sketched code-search workflow chunks a codebase, embeds the chunks, stores the vectors (a file in the demo, a vector database like Milvus, Qdrant or pgvector in practice) and ranks them by cosine similarity.