> ## Documentation Index
> Fetch the complete documentation index at: https://www.meilisearch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Binary quantization

> Compress embedding vectors to reduce storage and improve indexing speed while using larger, more capable models.

Binary quantization compresses embedding vectors by representing each dimension with a single bit instead of a full floating-point number. This dramatically reduces storage requirements and speeds up vector operations, making it practical to use larger, higher-quality embedding models that produce more dimensions.

## Why use binary quantization

Larger embedding models (1536+ dimensions) generally produce better semantic search results because they capture more nuance in the meaning of text. However, storing and comparing high-dimensional vectors is expensive in terms of disk space, memory, and CPU time.

Binary quantization solves this trade-off:

| Without BQ | With BQ |
| - | - |
| Each dimension stored as 32-bit float | Each dimension stored as 1 bit |
| 1536-dim vector = 6 KB | 1536-dim vector = 192 bytes |
| Slower indexing at high dimensions | Significantly faster indexing |
| Full precision similarity | Approximate similarity (still effective) |

The key insight is that **a large model with binary quantization often outperforms a small model without it**. For example, OpenAI's `text-embedding-3-large` (3072 dimensions) with binary quantization typically produces better search results than `text-embedding-3-small` (1536 dimensions) at full precision, while using less storage.

## When to use it

Binary quantization is most effective when:

* Your dataset contains **more than 1M documents** with embeddings
* You use a model with **1400+ dimensions** (the more dimensions, the better BQ works, because there is more information to preserve even after quantization)
* You want to **reduce disk usage** and **speed up indexing** without switching to a smaller model
* Storage or memory is a constraint in your deployment

Binary quantization is less effective with low-dimensional models (under 512 dimensions), where the information loss from quantization has a more noticeable impact on search quality.

## Enable binary quantization

Set `binaryQuantized` to `true` in your embedder configuration:

```bash theme={null}
curl \
  -X PATCH 'MEILISEARCH_URL/indexes/products/settings/embedders' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  --data-binary '{
    "default": {
      "binaryQuantized": true
    }
  }'
```

This works with any embedder source ([OpenAI](https://www.meilisearch.com/docs/capabilities/hybrid_search/how_to/configure_openai_embedder.md), [Cohere](https://www.meilisearch.com/docs/capabilities/hybrid_search/how_to/configure_cohere_embedder.md), [HuggingFace](https://www.meilisearch.com/docs/capabilities/hybrid_search/how_to/configure_huggingface_embedder.md), [REST](https://www.meilisearch.com/docs/capabilities/hybrid_search/how_to/configure_rest_embedder.md), or user-provided).

### Example: OpenAI with a large model

Use OpenAI's largest embedding model with binary quantization for the best balance of quality and efficiency:

```bash theme={null}
curl \
  -X PATCH 'MEILISEARCH_URL/indexes/products/settings/embedders' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer MEILISEARCH_KEY' \
  --data-binary '{
    "default": {
      "source": "openAi",
      "apiKey": "OPEN_AI_API_KEY",
      "model": "text-embedding-3-large",
      "binaryQuantized": true
    }
  }'
```

> [!WARNING]
>
> **Activating binary quantization is irreversible.** Once enabled, Meilisearch converts all vectors and discards the original full-precision data. The only way to recover the original vectors is to re-index all documents in a new embedder without binary quantization.

## Impact on search quality

Binary quantization reduces the precision of vector similarity calculations. In practice, the impact on search quality depends on the model and dataset:

* **High-dimensional models (1500+ dims)**: minimal quality loss, often imperceptible
* **Medium-dimensional models (512-1500 dims)**: slight quality reduction, acceptable for most use cases
* **Low-dimensional models (under 512 dims)**: noticeable quality reduction, not recommended

The [ranking pipeline](https://www.meilisearch.com/docs/capabilities/full_text_search/advanced/ranking_pipeline.md) mitigates this further in [hybrid search](https://www.meilisearch.com/docs/capabilities/hybrid_search/overview.md) mode, where keyword matching compensates for any precision loss in the vector component.

## Recommended models with binary quantization

| Provider | Model | Dimensions | Good with BQ? |
| - | - | - | - |
| OpenAI | `text-embedding-3-large` | 3072 | Excellent |
| OpenAI | `text-embedding-3-small` | 1536 | Good |
| Cohere | `embed-english-v3.0` | 1024 | Good |
| Cohere | `embed-multilingual-v3.0` | 1024 | Good |
| HuggingFace | `BAAI/bge-large-en-v1.5` | 1024 | Good |
| HuggingFace | `BAAI/bge-small-en-v1.5` | 384 | Not recommended |

## Next steps

> [card] [Choose an embedder](https://www.meilisearch.com/docs/capabilities/hybrid_search/how_to/choose_an_embedder.md)
>
> Compare embedding providers for your use case

> [card] [Custom hybrid ranking](https://www.meilisearch.com/docs/capabilities/hybrid_search/advanced/custom_hybrid_ranking.md)
>
> Tune the balance between keyword and vector search

> [card] [Composite embedders](https://www.meilisearch.com/docs/capabilities/hybrid_search/advanced/composite_embedders.md)
>
> Use different models for indexing and search

> [card] [Performance tuning](https://www.meilisearch.com/docs/capabilities/full_text_search/advanced/performance_tuning.md)
>
> Optimize overall search performance


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.