---
title: "Embedding English Wikipedia in under 15 minutes"
description: "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."
url: "https://swe.quest/articles/embedding-english-wikipedia-in-under-15-minutes-fa4a10822ac9f853"
canonical: "https://modal.com/blog/embedding-wikipedia"
source: "Modal"
published: "2024-01-23"
difficulty: "medium"
kind: "How-to"
reading_minutes: 11
tags: ["inference","serverless","rag","python"]
---

# Embedding English Wikipedia in under 15 minutes

A post on [Modal](https://swe.quest/sources/modal.md), published 2024-01-23, 11 min read, How-to. Original: [https://modal.com/blog/embedding-wikipedia](https://modal.com/blog/embedding-wikipedia)

## Summary

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.

Written by swe.quest, not by the author.

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

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [RAG & retrieval](https://swe.quest/tags/rag.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- Python ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- text embeddings basics ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))

## Keywords

Modal, Text Embeddings Inference, Hugging Face, bge-small-en-v1.5, Wikipedia, A10G

## Related posts

- [Deploy Embedding Models with Hugging Face Inference Endpoints](https://swe.quest/articles/deploy-embedding-models-with-hugging-face-inference-endpoints-e85e7e272a9c97bc.md): Hugging Face · 2023-10-24 · Medium · 5 min read · Inference & serving, RAG & retrieval, ML platforms
  Open-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.
- [Beating proprietary models with a quick fine-tune](https://swe.quest/articles/beating-proprietary-models-with-a-quick-fine-tune-f1b25612d0019a9d.md): Modal · 2024-04-26 · Medium · 11 min read · Model training, Machine learning, RAG & retrieval, Serverless, Python
  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.
- [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.
- [Run Embedding Models and Unlock Semantic Search with Docker Model Runner](https://swe.quest/articles/run-embedding-models-and-unlock-semantic-search-with-docker-model-runner-9d62d61c93466830.md): Docker · 2025-12-01 · Medium · 6 min read · Vector search, Inference & serving, Search, RAG & retrieval, Containers
  Docker 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.

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)
