multilingual-e5-small for Kjarni
This is Microsoft (intfloat)'s multilingual-e5-small, unchanged, hosted so it runs locally with Kjarni: text embeddings from one native library, with no Python runtime, PyTorch, ONNX Runtime or server. It maps text to 384 dimensions and reads up to 512 tokens. The model is about 470 MB and downloads on first use.
Usage
In Kjarni the model is called multilingual-e5-small. Each example compares a question with three texts.
Command line
curl -fsSL https://kjarni.ai/install.sh | sh # Windows: irm https://kjarni.ai/install.ps1 | iex
kjarni similarity -q -m multilingual-e5-small "query: How do I reset my password?" "passage: Wie setze ich mein Passwort zurück?"
0.904462
Python
# pip install kjarni
from kjarni import Embedder
embedder = Embedder(model="multilingual-e5-small", quiet=True)
query = "query: How do I reset my password?"
for text in [
"passage: Wie setze ich mein Passwort zurück?",
"passage: ¿Cómo restablezco mi contraseña?",
"passage: What time does the shop open?",
]:
print(f"{embedder.similarity(query, text):.3f} {text}")
0.904 passage: Wie setze ich mein Passwort zurück?
0.901 passage: ¿Cómo restablezco mi contraseña?
0.752 passage: What time does the shop open?
Rust
// cargo add kjarni anyhow tokio --features tokio/full
use kjarni::Embedder;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let embedder = Embedder::new("multilingual-e5-small").await?;
let query = "query: How do I reset my password?";
for text in [
"passage: Wie setze ich mein Passwort zurück?",
"passage: ¿Cómo restablezco mi contraseña?",
"passage: What time does the shop open?",
] {
println!("{:.3} {text}", embedder.similarity(query, text).await?);
}
Ok(())
}
C#
// dotnet add package Kjarni
using Kjarni;
using var embedder = new Embedder("multilingual-e5-small", quiet: true);
var query = "query: How do I reset my password?";
foreach (var text in new[] { "passage: Wie setze ich mein Passwort zurück?", "passage: ¿Cómo restablezco mi contraseña?", "passage: What time does the shop open?" })
Console.WriteLine($"{embedder.Similarity(query, text):F3} {text}");
C++ (C++23)
#include <kjarni.hpp>
#include <cstdio>
int main() {
kjarni::EmbedderOptions options;
options.model = "multilingual-e5-small";
auto embedder = kjarni::Embedder::create(options);
if (!embedder) return 1;
auto query = embedder->encode("query: How do I reset my password?");
if (!query) return 1;
for (const char* text : {"passage: Wie setze ich mein Passwort zurück?",
"passage: ¿Cómo restablezco mi contraseña?",
"passage: What time does the shop open?"}) {
auto e = embedder->encode(text);
if (!e) return 1;
std::printf("%.3f %s\n", kjarni::cosine(*query, *e), text);
}
}
Go
// go get github.com/kjarni-ai/kjarni-go
package main
import (
"fmt"
"log"
kjarni "github.com/kjarni-ai/kjarni-go"
)
func main() {
embedder, err := kjarni.NewEmbedder("multilingual-e5-small", kjarni.WithQuiet(true))
if err != nil {
log.Fatal(err)
}
defer embedder.Close()
query := "query: How do I reset my password?"
for _, text := range []string{
"passage: Wie setze ich mein Passwort zurück?",
"passage: ¿Cómo restablezco mi contraseña?",
"passage: What time does the shop open?",
} {
score, err := embedder.Similarity(query, text)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%.3f %s\n", score, text)
}
}
Each prints the similarities above. embed (embedder.encode in Python) gives the
vectors themselves, normalised, for a search index; Kjarni's Indexer and Searcher
build one from a folder of documents, with keyword, meaning and hybrid search. See the
Kjarni documentation for installation details.
What changed from the original
Nothing in the model. The safetensors weights, configuration and tokenizer files are byte
for byte the same as in intfloat/multilingual-e5-small at revision
614241f622f53c4eeff9890bdc4f31cfecc418b3. This README replaces the original model card; the PyTorch, ONNX and OpenVINO
copies of the weights are left out.
About the model
multilingual-e5-small is a 118-million-parameter E5 model for about 100 languages, so a question in one language finds its answer in another. It maps text to 384 dimensions and reads up to 512 tokens. Each text starts with query: or passage: , as in the examples.
See the original model card for training data, benchmarks and intended use.
License
The MIT License, as the original. Kjarni and this hosting are not affiliated with or endorsed by Microsoft (intfloat).
- Downloads last month
- 5
Model tree for kjarni-ai/multilingual-e5-small
Base model
intfloat/multilingual-e5-smallEvaluation results
- mteb/arguana leaderboard
- ArguAna Default Test View evaluation resultssource
Obtained using MTEB v1.36.2639.09 * - ArguAna View evaluation resultssource
Obtained using MTEB v1.36.2639.09 * - mteb/BRIGHT leaderboard
- BrightAopsRetrieval Default Standard View evaluation resultssource
Obtained using MTEB v2.10.127.92 * - BrightAopsRetrieval View evaluation resultssource
Obtained using MTEB v2.10.127.92 * - BrightBiologyLongRetrieval Default Long View evaluation resultssource
Obtained using MTEB v2.10.129.71 *