Skip to main content

arabic-embed-bench

A small CLI that answers one question: which embedding model retrieves best on your Arabic documents? Give it a corpus and questions with evidence quotes; it reports Hit@k, MRR with bootstrap confidence intervals, and encoding time per model.

tests

TL;DR — e5-small matches bge-m3 on Arabic retrieval within error at ~9× less encode time; a paraphrase model is far worse. Run the same comparison on your own documents.

Why not just read MTEB?

Leaderboards average over tasks and languages. Retrieval quality on your own Arabic text (MSA, dialect-heavy, religious, legal…) can rank models differently, and a model's required prompt prefixes silently change results — multilingual-e5 needs query: / passage: , and omitting them degrades accuracy without any error. This tool bakes the prefixes into config.MODEL_SPECS and a test guards them.

Example result

Arabic Wikipedia sample from arabic-rag-bench — 227 articles, 1,096 paragraph chunks, 442 LLM-generated questions:

Model Dim Encode s Hit@1 Hit@3 Hit@5 MRR MRR 95% CI
intfloat/multilingual-e5-base 768 66 0.790 0.930 0.957 0.865 0.84–0.89
BAAI/bge-m3 1024 230 0.792 0.932 0.955 0.863 0.84–0.89
intfloat/multilingual-e5-small 384 26 0.796 0.914 0.939 0.861 0.83–0.89
paraphrase-multilingual-MiniLM-L12-v2 384 7 0.333 0.514 0.572 0.448 0.41–0.49

Reading it honestly: the top three are statistically indistinguishable (MRR intervals overlap almost entirely; Hit@1 differs by 0.006). The practical finding is that e5-small (384-d) matches bge-m3 here at roughly 9× less encoding time, while the paraphrase MiniLM model is far worse for retrieval — it is trained for sentence similarity, not question→passage search. Encode seconds are wall-clock for chunks + questions on a laptop that was busy with other jobs: trust the ratios, not the absolute values.

Use

pip install "arabic-embed-bench[models]"
arabic-embed-bench --corpus corpus.jsonl --questions questions.jsonl --out results.md
arabic-embed-bench ... --models BAAI/bge-m3 intfloat/multilingual-e5-small --device cpu

Input (JSONL):

  • corpus.jsonl: {"pageid": 1, "title": "...", "text": "..."}
  • questions.jsonl: {"pageid": 1, "question": "...", "quote": "verbatim sentence from that document containing the answer"}

A chunk counts as correct if it comes from the right document and contains the middle word-window of the quote (the middle, so a chunk boundary cutting the quote's edge doesn't unfairly penalise a model). Chunking is fixed to paragraphs so the model is the only variable.

Add a model by adding its prompt prefixes to config.MODEL_SPECS; unknown models exit with an error rather than running unprefixed.

Test

pytest tests

Limits

  • Small sample → wide intervals; use your own larger question set before deciding.
  • Questions are LLM-generated, which can favour models that paraphrase like the generator.
  • e5 models truncate at 512 tokens; long paragraphs (≤250 words) may be cut for them.

Metadata

Release files for arabic-embed-bench 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arabic-embed-bench 0.1.0
File Size Uploaded Provenance Actions
arabic_embed_bench-0.1.0.tar.gz 8.2 kB Without provenance Details for arabic_embed_bench-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arabic-embed-bench 0.1.0
File Interpreter ABI Platform Actions
arabic_embed_bench-0.1.0-py3-none-any.whl Python 3 none any Details for arabic_embed_bench-0.1.0-py3-none-any.whl

Total release size: 16.5 kB

Release files / arabic_embed_bench-0.1.0.tar.gz

Download URL arabic_embed_bench-0.1.0.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d616c7d6ed563b298632f4034f55549e83727a3810bd0b97e3e48ff7798f3f0d
BLAKE2b-256 checksum
How to use checksums
758a17d4f060f9bcf845ae440670124b724dfd3ff874d8f91464b33af6e68ddf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / arabic_embed_bench-0.1.0-py3-none-any.whl

Download URL arabic_embed_bench-0.1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
148cbda37a403783ddc012bc59ca449d16789c22c71fcdc1491a06c8bcbf6e54
BLAKE2b-256 checksum
How to use checksums
00db10855de6a40004519d5ed04c4d279968188a4fdebaacbd690c483de10c3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for arabic-embed-bench 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page