# Serve embedding models for your RAG stack

Host embedding and reranking models on your own autoscaling endpoints instead of per-token third-party APIs. Beam runs the GPUs; your RAG pipeline just calls HTTPS.

## Your retrieval stack, your terms

Embeddings, rerankers, and the LLM itself — each piece deployed and scaled independently, all from Python.

**Your models, not per-token APIs**  
Serve BGE, GTE, or your own fine-tuned embedding model with flat per-second compute pricing instead of metered tokens.  
Explore docs

**Warm models, low latency**  
on_start keeps the model loaded per container, and keep_warm_seconds holds containers hot for query-time traffic.  
Explore docs

**Parallel corpus backfills**  
Embed millions of chunks by fanning a function out across containers with .map() — then scale back to zero.  
Explore docs

**Secrets for your data stores**  
Keep vector database credentials in Beam's secrets manager and connect from inside the container.  
Explore docs

**Scale each piece independently**  
Embedding endpoint, reranker, and LLM run as separate deployments, each with its own autoscaling policy.  
Explore docs

**Drops into any framework**  
Your endpoint is plain HTTPS — point LangChain, LlamaIndex, or hand-rolled pipelines at it with a custom endpoint class.  
Explore docs

## Stand up retrieval in three steps

01

### Wrap your embedding model

A few lines turn any sentence-transformers model into an endpoint definition with a GPU attached.

02

### Deploy it

beam deploy gives you an authenticated HTTPS URL that autoscales with query volume.

03

### Point your pipeline at it

Call it for query-time embeddings, and use .map() to backfill your corpus in parallel.

```python
$ beam deploy app.py:embed
=> Deployed 🎉
=> https://embeddings-abc123.app.beam.cloud

# Backfill your corpus in parallel
from beam import function

@function(gpu="T4")
def embed_chunk(chunk: list):
    return model.encode(chunk).tolist()

for vectors in embed_chunk.map(chunks):
    index.upsert(vectors)
```

## Frequently asked questions

### Which embedding models work?+
Any model sentence-transformers or transformers can load — BGE, GTE, E5, and your own fine-tuned variants included.

### Do I need a specific vector database?+
No. Beam serves the compute; your endpoint returns vectors and you store them anywhere — Postgres with pgvector, Pinecone, Qdrant, or your own index.

### How do I keep query latency low?+
Models load once per container with on_start, and keep_warm_seconds keeps containers hot so query-time embeddings skip the cold path entirely.

### Can I host the LLM side of RAG too?+
Yes. Run an OpenAI-compatible vLLM server on Beam next to your embedding endpoint, so the whole stack lives on one platform.

### Can I serve a fine-tuned embedding model?+
Yes — load weights from a persistent volume or the Hugging Face Hub exactly like any other model. Fine-tune it on Beam too, if you like.
