/ Модель

Характеристики

Контекст
514 токенов
Параметры
305 млн
Лицензия
MIT
Архитектура
xlm-roberta · dense
Базовая модель
multilingual-e5-base
Библиотека
sentence-transformers
Опубликована
7 авг 2026

e5-pakistani-legal

ЭмбеддингиТекст → embedding10 профессий
70скачиваний за 30 дней0лайковвеса обновлены25 окт 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Производная модели intfloat/multilingual-e5-base. Многоязычная модель, преобразующая текст в эмбеддинги для семантического поиска, сопоставления предложений и межъязыкового поиска.

Карточка модели usama1111/e5-pakistani-legal на Hugging Face совпадает с карточкой intfloat/multilingual-e5-base, поэтому описание составлено по ней.

Multilingual-E5-base — многоязычная модель для получения эмбеддингов текста, разработанная авторами технического отчёта Multilingual E5. Она основана на XLM-RoBERTa-base и продолжительно обучена на смеси многоязычных наборов данных. Модель имеет 12 слоёв, размер эмбеддинга 768 и около 305,2 млн параметров; поддерживает до 512 токенов текста и доступна в форматах PyTorch, Safetensors, ONNX и OpenVINO.

Модель предназначена для поиска по смыслу, сопоставления предложений и текстов, семантической близости, поиска парафразов и межъязыкового поиска. Для асимметричного поиска используйте префиксы «query: » и «passage: », а для симметричных задач и извлечения признаков — «query: »; без префиксов качество может снизиться. Поддерживается около 100 языков, включая русский, хотя для языков с малым объёмом данных качество может быть ниже. Лицензия — MIT.

Сценарии применения

  • семантический поиск по документам
  • поиск релевантных фрагментов для открытых вопросов
  • сопоставление смысловой близости предложений
  • поиск парафразов
  • поиск соответствий между текстами на разных языках
  • получение эмбеддингов для кластеризации текстов

Ограничения

Текст ограничен 512 токенами, более длинный ввод обрезается. Для низкоресурсных языков качество может снижаться; отсутствие рекомендованных префиксов query: и passage: также ухудшает результаты.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Бенчмарки пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь рядом с другими моделями теста

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Эмбеддинги» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы по шкале 0–100.

Для каких профессий подходит10

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

e5-pakistani-legal

A dense retriever for Pakistani statutory law, fine-tuned from intfloat/multilingual-e5-base on 4,692 verified question–statute pairs in English and Urdu script. It maps a legal question to the statute section that governs it.

This is the general model of the FIT 2026 paper In-Distribution Gains Do Not Transfer: Leakage-Free Evaluation of Retrieval Interventions for Low-Resource Legal Question Answering. The paper's headline finding is about this model, so please read Evaluation before relying on it. It improves strongly on questions like its training data, but not on every new source of questions.

Use revision 0efe7b2b (or later). Revision 445e441d of this repository, from before 2026-08-07 15:12 UTC, holds a different model: the constitutional-only model, now published as usama1111/e5-pak-legal-constitutional. The weights evaluated in the paper have SHA-256 a3e7e4c1b650051b….

How to use

As with the base model, prefix queries with query: and passages with passage: .

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("usama1111/e5-pakistani-legal", revision="0efe7b2b")
model.max_seq_length = 224  # the length used in training

queries = ["query: What is the punishment for theft?"]
passages = ["passage: 379. Punishment for theft. Whoever commits theft shall be punished ..."]

q = model.encode(queries, normalize_embeddings=True)
p = model.encode(passages, normalize_embeddings=True)
print(q @ p.T)  # cosine similarity

Training

Base modelintfloat/multilingual-e5-base
Training pairs4,692 (query, gold statute passage)
Held-out pairs1,191, split so that no gold passage appears in both halves
Legal domains5 (constitutional, criminal, evidence, civil procedure, family)
Urdu-script queries32%
LossMultiple-negatives ranking loss, with hard negatives mined from the deployed retriever
Hyperparameters2 epochs, batch size 12, learning rate 2 × 10⁻⁵, max sequence length 224
Runs1 (seed variance is unmeasured)

Where the pairs come from. The pairs come from 11,195 Pakistani legal Q&A pairs with machine-parseable citations (e.g., PPC s.467). The answers were LLM-generated, so only the citation is used. Four filters were applied:

  1. LEGAL-UQA rows dropped, since that dataset is used for evaluation.
  2. Citations naming an unindexed section dropped.
  3. Citations validated by rarity-weighted vocabulary overlap with the answer; wrong citations dropped.
  4. Exact duplicates removed.

5,883 pairs survive. Passages are statute chunks from the Pakistan Laws Dataset (ODC-BY) and the official Pakistan Code.

Evaluation

Every number below is dense retrieval only (no BM25). It ranks a fixed 9,042-passage corpus, with normalised embeddings and the prefixes above. A gold passage below rank 10 counts as a miss. Significance is McNemar's exact test on paired Hit@1 outcomes, and intervals are 95% bootstrap CIs.

Test setnHit@1, base → this modelΔ Hit@1 (95% CI)pMRR@10, base → this model
Own held-out citation pairs1,19141.5% → 68.0%+26.5 (23.5 to 29.6)< 10⁻⁵⁰0.516 → 0.758
… Urdu-script queries38916.7% → 64.0%+47.3< 10⁻⁴⁷0.255 → 0.718
… English queries80253.5% → 70.0%+16.5< 10⁻¹⁷0.643 → 0.778
LEGAL-UQA questions (a different generator), English12852.3% → 54.7%+2.3 (−6.2 to 10.9)0.720.605 → 0.632
Same LEGAL-UQA questions, Urdu (the dataset's own translation)12818.0% → 42.2%+24.2< 10⁻⁵—
Same LEGAL-UQA questions, Roman Urdu (LLM-written)12621.4% → 38.9%+17.50.0003—
Developer-written queries (a third source)2520.0% → 60.0%+40.00.0020.285 → 0.620

What this means.

  • On questions like its training data, the model gains a lot (+26.5 Hit@1), most of all on Urdu-script queries.
  • On English questions written by a different generator (LEGAL-UQA), the gain is not distinguishable from zero, even within the same domain and script: English constitutional citation questions gain +23.3 in-distribution (n = 236).
  • Rewording questions (layperson English, keywords) does not change this. The failure is tied to the source of the questions, not their wording.
  • The Urdu and Roman Urdu renderings of those same questions, and an independent developer-written set, do show gains.

An in-distribution number does not predict which of these you will see. Evaluate on your own questions before deploying.

Zero-shot BAAI/bge-m3 (dense, length 512) scores 51.9% on the held-out citation pairs, against 68.0% for this model. It matches this model on Urdu LEGAL-UQA (41.4% vs 42.2%).

Limitations

  • Coverage. Provincial coverage is Punjab only; federal law is covered. There are no amendment dates: the corpus is a snapshot.
  • Weak domains. No improvement over the base model on civil procedure (n = 19, −5.3) or family law (n = 21, −4.8). These samples are small and not significant.
  • Evaluation data. All evaluation sets are generator-derived or developer-built. No independent, human-labelled benchmark exists yet.
  • Retrieval only. It returns passages, not legal advice. Retrieved law must be checked by a qualified practitioner.

Citation

@inproceedings{usama2026indistribution,
  title     = {In-Distribution Gains Do Not Transfer: Leakage-Free Evaluation of Retrieval
               Interventions for Low-Resource Legal Question Answering},
  author    = {Usama, Muhammad and Khan, Muhammad Amir Zarmaan Ullah},
  booktitle = {Proc. International Conference on Frontiers of Information Technology (FIT)},
  year      = {2026},
  note      = {To appear}
}

Base model: L. Wang et al., Multilingual E5 Text Embeddings: A Technical Report, arXiv:2402.05672 (MIT licence).

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · sentence-transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
XLMRobertaModel
Ревизия весов
42a3fbb

0 моделей