← All guides

Text Embedding API

A text embedding API turns text into a vector so you can compare meanings numerically — the foundation of semantic search, RAG retrieval, deduplication, clustering, and recommendations.

On Replicate the practical lineup: all-mpnet-base-v2 (2.4M+ runs, the dependable English default), BGE-Large (the stronger English retriever), BGE-M3 (multilingual + multi-mode), and CLIP features (163M+ runs — embeddings that bridge text and images).

Quick Recommendation

For English semantic search or a first RAG pipeline, start with replicate/all-mpnet-base-v2 — fast (~1s example runs), well understood, supports batch input via text_batch.

Step up to nateraw/bge-large-en-v1.5 when retrieval quality matters — BGE models consistently outrank MPNet on retrieval benchmarks, and example runs are sub-second.

Use lucataco/bge-m3 when your corpus is multilingual (100+ languages) or you want its unusual trick: dense, sparse, and multi-vector retrieval modes from one model (embedding_type input).

Use andreasjansson/clip-features when the job involves images — CLIP embeds text and images into the same space, so "find images matching this sentence" becomes a vector lookup.

Keyword-Matched Use Cases

Search intent What the user likely needs Best starting point
Text embedding API General-purpose sentence vectors all-mpnet-base-v2
Embeddings for RAG Best retrieval quality for chunks BGE-Large
Multilingual semantic search One model across languages BGE-M3
Hybrid search (dense + sparse) Both vector and lexical-style signals BGE-M3 embedding_type
Image search by text Text ↔ image similarity CLIP features
Duplicate / similarity detection Cheap fast vectors at scale all-mpnet-base-v2 or BGE-Large

Model Comparison

Model Runs on Replicate Example speed Languages Distinctive strength
replicate/all-mpnet-base-v2 2.4M+ ~1s English Dependable default, batch input
nateraw/bge-large-en-v1.5 312K+ <1s English Stronger retrieval quality
lucataco/bge-m3 new on Replicate slower per call 100+ Dense + sparse + multi-vector in one model
andreasjansson/clip-features 163M+ <1s English Shared text–image embedding space

Choosing in practice

RAG pipelines: embedding quality caps retrieval quality. BGE-Large over MPNet is one of the cheapest upgrades available. Keep chunks within each model's context limit and embed queries with the same model as documents — mixing models breaks similarity.

Multilingual corpora: don't machine-translate then embed — BGE-M3 embeds 100+ languages into one space, so a German query can retrieve French documents directly. Its max_length also stretches to long passages, reducing chunking pressure.

Hybrid retrieval: BGE-M3's sparse mode approximates keyword-style matching from the same model that produces dense vectors — a pragmatic path to hybrid search without running a separate BM25 stack.

Text-image: CLIP's 163M+ runs reflect how central it is — product search, moderation pipelines, and image dedup all reduce to CLIP vectors plus a vector database.

Note the Replicate wrapper detail: lucataco/bge-m3 takes two sentence lists (sentences_1, sentences_2) and is oriented to comparing them; for bulk index-building, batch your calls accordingly.

Practical Decision

Default to BGE-Large for English retrieval and RAG; keep all-mpnet-base-v2 where ecosystem familiarity or batch shape fits better. Go BGE-M3 for multilingual or hybrid retrieval, and CLIP features whenever images enter the picture. Above all: embed queries and documents with the same model, always.

FAQ

What is the best embedding model for RAG?

On Replicate, BGE-Large (nateraw/bge-large-en-v1.5) for English — BGE models lead retrieval benchmarks at this size. BGE-M3 if the corpus is multilingual.

Can I mix embedding models in one index?

No — vectors from different models live in incompatible spaces. Pick one model per index and re-embed everything if you switch.

What are sparse vs dense embeddings?

Dense vectors capture meaning in a few hundred dimensions; sparse vectors approximate keyword matching. BGE-M3 produces both, enabling hybrid search from a single model.

How do I search images with text?

Embed images and queries with CLIP (andreasjansson/clip-features) — both land in the same vector space, so nearest-neighbor search returns matching images for a text query.