Making Chroma Work in Chinese A developer has published a follow-up to Chroma's official quick start guide explaining how to add Chinese-language support to the vector database, whose default all-MiniLM-L6-v2 embedding model is English-only. The writeup compares local and online embedding models, recommends BAAI/bge-small-zh-v1.5 as the cheapest local option, and shows how to swap models via the embedding_function argument of client.create_collection(), including pointing Hugging Face downloads at the hf-mirror.com mirror for users in China. Note : This tutorial picks up where Chroma's official quick start guide https://docs.trychroma.com/docs/overview/getting-started leaves off. So you've finished Chroma's quick start — congratulations. Everything works, right up until you feed Chroma some Chinese text. Then it doesn't. Chroma's default embedding model, all-MiniLM-L6-v2 , is English-only. Given Chinese or Japanese input, it embeds it as though the language were noise. You need a model that was trained on the language you care about. You have two ways to get one: | | Local model | Online model | |---|---|---| | Runs where | on your machine | vendor's server | | Network | not needed | required | | Setup | install packages, download weights | an API key | | Cost | disk space hundreds of MB | per query | | Offline | works | does not | This tutorial walks through both, and then a third option that fixes a problem neither of them solves: ranking . To be concrete, we'll assume Chinese is the language you need to add. Swap the model name and the same code supports any language. Whatever you choose, the hook into Chroma is the same: the optional embedding function argument of client.create collection . Replace with your own class ef = YourEmbeddingFunction ... collection = client.create collection name="my collection", embedding function=ef That's the whole interface. The rest of this tutorial is about what to put in place of YourEmbeddingFunction . Assuming you want Chinese support from a local model, these are the usual candidates: | Model | Language | Dim. | Notes | |---|---|---|---| | paraphrase-multilingual-MiniLM-L12-v2 | Multilingual | 384 | lightweight | | BAAI/bge-small-zh-v1.5 | Chinese | 512 | good for Chinese | | BAAI/bge-base-zh-v1.5 | Chinese | 768 | same family, stronger | | BAAI/bge-m3 | Multilingual | 1024 | multilingual | | text2vec-base-chinese | Chinese | 768 | | | m3e-base | Chinese | 768 | | | all-MiniLM-L6-v2 | English | 384 | Chroma's default for reference | Roughly: More dimensions means better quality and a bigger download. bge-m3 is 1024-dimensional and will cost you well over 2 GB. bge-small-zh-v1.5 is the cheapest thing that works properly, so that's what we'll use below. To use a local model you need one extra Python package, sentence-transformers . Chroma deliberately does not ship it, for a good reason: embedding functions.SentenceTransformerEmbeddingFunction . sentence-transformers package. torch PyTorch transformers huggingface-hub tokenizers numpy , scipy and friends. That's a deep-learning stack — hundreds of MB of dependencies. If your environment already has PyTorch, fine. If your project is, say, a small web service that just happens to need a vector store, that stack is a bit of overkill. So Chroma makes you opt in: pip install sentence-transformers Now we can actually build the embedding function. The first time you construct SentenceTransformerEmbeddingFunction 'BAAI/bge-small-zh-v1.5' , it downloads the weights from huggingface.co , where the model lives by default. If you live in China, or anywhere the connection to huggingface.co is poor, point it at a mirror first. On Linux: export HF ENDPOINT="https://hf-mirror.com" On Windows PowerShell: $env:HF ENDPOINT="https://hf-mirror.com" Or set it from inside Python, which is often the most convenient: python from chromadb.utils import embedding functions import os os.environ "HF ENDPOINT" = "https://hf-mirror.com" ef = embedding functions.SentenceTransformerEmbeddingFunction model name="BAAI/bge-small-zh-v1.5" The output is like this: D:\app\anaconda3\envs\ai\lib\site-packages\tqdm\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user install.html from .autonotebook import tqdm as notebook tqdm Loading weights: 100%|███████████████████████████████████████████████████████████████| 71/71 00:00<00:00, 9559.74it/s What to notice in that output: By default the model lands in ~/.cache/huggingface/hub on Linux, or C:\Users\