New Tool Radar

Local AI

How to Run BGE-M3 with Ollama for Multilingual Search

Run BGE-M3 locally with Ollama and search documents in more than one language.

Schematic illustration with three step boxes for How to Run BGE-M3 with Ollama for Multilingual Search.

BGE-M3 is BAAI’s multilingual embedding model: 567M parameters, 1,024 dimensions, an 8,192-token input limit, and support for more than 100 languages. It is the pick when your documents are not all in English. This guide pulls it, embeds texts in two languages, and checks that the right document wins.

Before you start

  • Ollama installed and running.
  • About 2 GB of free disk for the model.
  • A terminal, and curl or Python for the API call.

Pull the model

Download BGE-M3:

ollama pull bge-m3

BGE-M3 needs no instruction prefix, unlike some other embedding models.

Embed a query and two documents

Call http://localhost:11434/api/embed with the model name and the input text, once per text. Keep each input under 8,192 tokens.

curl http://localhost:11434/api/embed -d '{"model": "bge-m3", "input": "how to renew a passport"}'

Compare the vectors

Compare the returned 1,024-number vectors with cosine similarity. The document in either language that answers the query should score closest.

Worked example

Sample texts:

Text Role
how to renew a passport Query (English)
To renew a passport, submit the old passport, a photo and the fee at the passport office. Document A (English)
La meilleure recette de soupe a la tomate utilise des tomates fraiches. Document B (French)

Document A should score much closer to the query than Document B. If B wins, check that you embedded the right texts.

Expected result

UNTESTED in this guide: no API call was run while writing it. The expected result is that the embed endpoint returns a 1,024-number vector for each text, and Document A scores closer to the query than Document B.

Limitations

BGE-M3 is a larger download than Nomic Embed and slower on a plain CPU. It supports dense, sparse and multi-vector retrieval, but Ollama’s embed endpoint returns dense vectors only. Vectors from one model cannot be compared with vectors from another.

Sources

See all