# Stella

> Compact English text embedding models that rank high on MTEB with a small footprint

- Category: Retrieval & Knowledge (RAG) / Embedding Models & Inference
- Language: Python
- Licence: MIT
- Repository: https://github.com/DunZhang/Stella
- Canonical page: https://ai-tldr.dev/tools/stella/

## In short

Stella is a family of English text embedding models that turn sentences and documents into vectors you can compare for meaning. The line includes a 1.5B-parameter model and a smaller 400M variant, both built on the GTE and Qwen2 base models from Alibaba. It sits in the Embedding Models & Inference category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed MIT.

## Overview

Stella is a family of English text embedding models that turn sentences and documents into vectors you can compare for meaning. The line includes a 1.5B-parameter model and a smaller 400M variant, both built on the GTE and Qwen2 base models from Alibaba.

The models are aimed at developers building retrieval, semantic search, and similarity features who want strong MTEB benchmark results without running a 7B-parameter model. They support Matryoshka representations, so you can pick a smaller embedding size (for example 1024 instead of 8192) and trade a little accuracy for cheaper storage and faster comparison.

As an embedding model, Stella slots into the encoding step of a search or RAG pipeline: you embed your documents once, store the vectors, and embed each query at request time to find the closest matches. It loads through the standard sentence-transformers and transformers libraries.

## What it does

- Two model sizes: a 1.5B-parameter model and a smaller 400M variant for tighter resource budgets
- Strong MTEB retrieval scores for its size, competitive with much larger models
- Matryoshka (MRL) embeddings: choose a dimension from 256 up to 8192, with 1024 a good default
- Separate prompts for retrieval (s2p_query) and similarity (s2s_query) tasks
- Loads with the standard sentence-transformers and transformers APIs
- Built on Alibaba's gte-large-en-v1.5 and gte-Qwen2-1.5B-instruct base models

## Getting started

Stella runs through the sentence-transformers library. Install it, load the model, and encode queries and documents to compare them.

1. Install sentence-transformers

   Stella loads through the standard sentence-transformers package.

```bash
pip install sentence-transformers
```

2. Embed queries and documents

   Load the model with trust_remote_code, use the s2p_query prompt for queries, and compare against document embeddings.

```python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("NovaSearch/stella_en_1.5B_v5", trust_remote_code=True)

queries = ["What are some ways to reduce stress?"]
docs = ["There are many effective ways to reduce stress..."]

query_embeddings = model.encode(queries, prompt_name="s2p_query")
doc_embeddings = model.encode(docs)
similarities = model.similarity(query_embeddings, doc_embeddings)
print(similarities)
```

## When to use it

- Power semantic search over a document collection by embedding documents once and matching each query against them
- Provide the retrieval step in a RAG pipeline that feeds relevant context to a language model
- Cluster or deduplicate text by comparing embedding similarity
- Get strong embedding quality on a smaller GPU or memory budget than a 7B-parameter model would need
