EmbedAnything is a minimalist, yet highly performant, modular, lightning-fast, lightweight, multisource, multimodal, and local embedding pipeline built in Rust. Whether you're working with text, images, audio, PDFs, websites, or other media, EmbedAnything streamlines the process of generating embeddings from various sources and seamlessly streaming (memory-efficient-indexing) them to a vector database. It supports dense, sparse, ONNX, model2vec and late-interaction embeddings, offering flexibility for a wide range of use cases.
🚀 Key Features
- No Dependency on Pytorch: Easy to deploy on cloud, comes with low memory footprint.
- Highly Modular : Choose any vectorDB adapter for RAG, with
1 line1 word of code - Candle Backend : Supports BERT, Jina, ColPali, Splade, ModernBERT, Reranker, Qwen
- ONNX Backend: Supports BERT, Jina, ColPali, ColBERT Splade, Reranker, ModernBERT, Qwen
- Cloud Embedding Models:: Supports OpenAI, Cohere, and Gemini.
- MultiModality : Works with text sources like PDFs, txt, md, Images JPG and Audio, .WAV
- GPU support : Hardware acceleration on GPU as well.
- Chunking : In-built chunking methods like semantic, late-chunking
- Vector Streaming: Separate file processing, Indexing and Inferencing on different threads, reduces latency.
💡What is Vector Streaming
Embedding models are computationally expensive and time-consuming. By separating document preprocessing from model inference, you can significantly reduce pipeline latency and improve throughput.
Vector streaming transforms a sequential bottleneck into an efficient, concurrent workflow.
The embedding process happens separetly from the main process, so as to maintain high performance enabled by rust MPSC, and no memory leak as embeddings are directly saved to vector database. Find our blog.
🦀 Why Embed Anything
➡️Faster execution. ➡️No Pytorch Dependency, thus low-memory footprint and easy to deploy on cloud. ➡️True multithreading ➡️Running embedding models locally and efficiently ➡️In-built chunking methods like semantic, late-chunking ➡️Supports range of models, Dense, Sparse, Late-interaction, ReRanker, ModernBert. ➡️Memory Management: Rust enforces memory management simultaneously, preventing memory leaks and crashes that can plague other languages
🍓 Our Past Collaborations:
We have collaborated with reputed enterprise like Elastic, Weaviate, SingleStore, Milvus and Analytics Vidya Datahours
You can get in touch with us for further collaborations.
Benchmarks
Inference Speed benchmarks.
Only measures embedding model inference speed, on onnx-runtime. Code
Benchmarks with other fromeworks coming soon!! 🚀
⭐ Supported Models
We support any hugging-face models on Candle. And We also support ONNX runtime for BERT and ColPali.
How to add custom model on candle: from_pretrained_hf
# Load a custom BERT model from Hugging Face
=
# Configure embedding parameters
=
# Embed a file (supports PDF, TXT, MD, etc.)
=
# Access the embeddings and text
# First 100 characters
| Model | HF link |
|---|---|
| Jina | Jina Models |
| Bert | All Bert based models |
| CLIP | openai/clip-* |
| Whisper | OpenAI Whisper models |
| ColPali | starlight-ai/colpali-v1.2-merged-onnx |
| Colbert | answerdotai/answerai-colbert-small-v1, jinaai/jina-colbert-v2 and more |
| Splade | Splade Models and other Splade like models |
| Model2Vec | model2vec, minishlab/potion-base-8M |
| Qwen3-Embedding | Qwen/Qwen3-Embedding-0.6B |
| Reranker | Jina Reranker Models, Xenova/bge-reranker, Qwen/Qwen3-Reranker-4B |
Splade Models (Sparse Embeddings)
Sparse embeddings are useful for keyword-based retrieval and hybrid search scenarios.
# Load a SPLADE model for sparse embeddings
=
# Configure the embedding process
=
# Embed text files
=
# Sparse embeddings are useful for hybrid search (combining dense and sparse)
ONNX-Runtime: from_pretrained_onnx
ONNX models provide faster inference and lower memory usage. Use the ONNXModel enum for pre-configured models or provide a custom model path.
BERT Models
# Option 1: Use a pre-configured ONNX model (recommended)
=
# Option 2: Use a custom ONNX model from Hugging Face
=
# Embed files with ONNX model
=
=
ModernBERT (Quantized)
ModernBERT is a state-of-the-art BERT variant optimized for efficiency.
# Load quantized ModernBERT for maximum efficiency
=
# Use it like any other model
=
ColPali (Document Embedding)
ColPali is optimized for document and image-text embedding tasks.
# Load ColPali ONNX model
=
# Embed a PDF file (ColPali processes pages as images)
=
# Query the embedded document
=
=
# Calculate similarity scores
=
=
# Find most relevant pages
=
=
ColBERT (Late-Interaction Embeddings)
ColBERT provides token-level embeddings for fine-grained semantic matching.
# Load ColBERT ONNX model
=
# Embed sentences
=
# ColBERT returns token-level embeddings
=
# Each embedding is a matrix: [num_tokens, embedding_dim]
# Shape: (num_tokens, embedding_dim)
ReRankers
Rerankers improve retrieval quality by re-scoring candidate documents.
# Load a reranker model
=
# Query and candidate documents
=
=
# Rerank documents (returns top-k results)
: =
# Access reranked results
: =
Cloud Embedding Models (Cohere Embed v4)
Use cloud models for high-quality embeddings without local model deployment.
# Set your API key
=
# Initialize the cloud model
=
# Use it like any other model
=
Qwen 3 - Embedding
Qwen3 supports over 100 languages including various programming languages.
# Initialize Qwen3 embedding model
=
# Configure embedding
=
# Embed a file
=
# Query embedding
=
=
# Calculate similarities
=
=
# Get top results
=
For Semantic Chunking
Semantic chunking preserves meaning by splitting text at semantically meaningful boundaries rather than fixed sizes.
# Main embedding model for generating final embeddings
=
# Semantic encoder for determining chunk boundaries
# This model analyzes text to find natural semantic breaks
=
# Configure semantic chunking
=
# Embed with semantic chunking
=
# Chunks will be split at semantically meaningful boundaries
For Late-Chunking
Late-chunking splits text into smaller units first, then combines them during embedding for better context preservation.
# Load your embedding model
=
# Configure late-chunking
=
# Embed a file with late-chunking
: =
# Late-chunking helps preserve context across sentence boundaries
🧑🚀 Getting Started
💚 Installation
pip install embed-anything
For GPUs and using special models like ColPali
pip install embed-anything-gpu
🚧❌ If it shows cuda error while running on windowns, run the following command:
os.add_dll_directory("C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin")
📒 Notebooks
| End-to-End Retrieval and Reranking using VectorDB Adapters |
| ColPali-Onnx |
| Adapters |
| Qwen3- Embedings |
| Benchmarks |
Usage
➡️ Usage For 0.3 and later version
Basic Text Embedding
# Load a model from Hugging Face
=
# Simple file embedding with default config
=
# Access results
Advanced Usage with Configuration
# Load model
=
# Configure embedding parameters
=
# Embed with custom configuration
=
# Process embeddings
Embedding Queries
# Load model
=
# Embed a query
=
=
# Use embeddings for similarity search
Embedding Directories
# Load model
=
# Configure
=
# Embed all files in a directory
=
Using ONNX Models
ONNX models provide faster inference and lower memory usage. You can use pre-configured models via the ONNXModel enum or load custom ONNX models.
Using Pre-configured ONNX Models (Recommended)
# Use a pre-configured ONNX model (tested and optimized)
=
# Embed files
=
=
Using Custom ONNX Models
For custom or fine-tuned models, specify the Hugging Face model ID and path to the ONNX file:
# Load a custom ONNX model from Hugging Face
=
# Use the model
=
Note: Using pre-configured models (via ONNXModel enum) is recommended as these models are tested and optimized. For a complete list of supported ONNX models, see ONNX Models Guide.
⁉️FAQ
Do I need to know rust to use or contribute to embedanything?
The answer is No. EmbedAnything provides you pyo3 bindings, so you can run any function in python without any issues. To contibute you should check out our guidelines and python folder example of adapters.
How is it different from fastembed?
We provide both backends, candle and onnx. On top of it we also give an end-to-end pipeline, that is you can ingest different data-types and index to any vector database, and inference any model. Fastembed is just an onnx-wrapper.
We've received quite a few questions about why we're using Candle.
One of the main reasons is that Candle doesn't require any specific ONNX format models, which means it can work seamlessly with any Hugging Face model. This flexibility has been a key factor for us. However, we also recognize that we’ve been compromising a bit on speed in favor of that flexibility.
🚧 Contributing to EmbedAnything
First of all, thank you for taking the time to contribute to this project. We truly appreciate your contributions, whether it's bug reports, feature suggestions, or pull requests. Your time and effort are highly valued in this project. 🚀
This document provides guidelines and best practices to help you to contribute effectively. These are meant to serve as guidelines, not strict rules. We encourage you to use your best judgment and feel comfortable proposing changes to this document through a pull request.
🏎️ RoadMap
Accomplishments
One of the aims of EmbedAnything is to allow AI engineers to easily use state of the art embedding models on typical files and documents. A lot has already been accomplished here and these are the formats that we support right now and a few more have to be done.
🖼️ Modalities and Source
We’re excited to share that we've expanded our platform to support multiple modalities, including:
-
Audio files
-
Markdowns
-
Websites
-
Images
-
Videos
-
Graph
This gives you the flexibility to work with various data types all in one place! 🌐
⚙️ Performance
We now support both candle and Onnx backend ➡️ Support for GGUF models
🫐Embeddings:
We had multimodality from day one for our infrastructure. We have already included it for websites, images and audios but we want to expand it further to.
➡️ Graph embedding -- build deepwalks embeddings depth first and word to vec ➡️ Video Embedding ➡️ Yolo Clip
🌊Expansion to other Vector Adapters
We currently support a wide range of vector databases for streaming embeddings, including:
- Elastic: thanks to amazing and active Elastic team for the contribution
- Weaviate
- Pinecone
- Qdrant
- Milvus
- Chroma
How to add an adpters: https://starlight-search.com/blog/2024/02/25/adapter-development-guide.md
💥 Create WASM demos to integrate embedanything directly to the browser.
💜 Add support for ingestion from remote sources
➡️ Support for S3 bucket ➡️ Support for azure storage ➡️ Support for google drive/dropbox
But we're not stopping there! We're actively working to expand this list.
Want to Contribute? If you’d like to add support for your favorite vector database, we’d love to have your help! Check out our contribution.md for guidelines, or feel free to reach out directly turingatverge@gmail.com . Let's build something amazing together! 💡
AWESOME Projects built on EmbedAnything.
- A Rust-based cursor like chat with your codebase tool: https://github.com/timpratim/cargo-chat
- A simple vector-based search engine, also supports ordinary text search : https://github.com/szuwgh/vectorbase2
- Semantic file tracker in CLI operated through daemon built with rust.: https://github.com/sam-salehi/sophist
- FogX-Store is a dataset store service that collects and serves large robotics datasets : https://github.com/J-HowHuang/FogX-Store
- A Dart Wrapper for EmbedAnything Crate: https://github.com/cotw-fabier/embedanythingindart
- Generate embeddings in Rust with tauri on MacOS : https://github.com/do-me/tauri-embedanything-ios
- RAG with EmbedAnything and Milvus: https://milvus.io/docs/v2.5.x/build_RAG_with_milvus_and_embedAnything.md
