/ Модель

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

Контекст
514 токенов
Параметры
305 млн
Лицензия
Apache 2.0
Архитектура
xlm-roberta · dense
Библиотека
sentence-transformers
Опубликована
24 сен 2026

BENKHLOUF

ЭмбеддингиТекст → embedding4 профессии
133скачиваний за 30 дней3лайкавеса обновлены18 ноя 2026

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

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

BENKHLOUF — модель эмбеддингов для семантического поиска и сопоставления коротких фраз на алжирском дариже в арабском письме и Arabizi.

BENKHLOUF — модель эмбеддингов предложений, разработанная algerian-nlp для поиска по смыслу и сопоставления текстов на алжирском дариже. Она построена на XLM-RoBERTa как двунаправленный энкодер с 12 слоями и mean pooling; в метаданных указано 305,3 млн параметров. Модель обучена на парах предложений с использованием Matryoshka Representation Learning и поддерживает векторы размером от 768 до 64 измерений.

Модель предназначена для семантического поиска, оценки сходства и сопоставления фраз, записанных арабским письмом или латинским Arabizi, в том числе при переключении между дарижей и французским. В README приведены результаты проверки на 1 000 парах предложений, включая кросс-скриптовое сопоставление. Репозиторий распространяется по лицензии Apache-2.0.

Контекст модели ограничен 128 токенами в README; метаданные указывают native context в 514 токенов. Она ориентирована на короткие тексты на алжирском дариже, поэтому хуже подходит для длинных документов, литературного арабского и других арабских диалектов. Результаты приведены для одного обучающего запуска; безопасность, смещения и токсичность не оценивались.

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

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

Ограничения

Модель ориентирована на короткие тексты на алжирском дариже и менее подходит для длинных документов, литературного арабского и диалектов за пределами Магриба. Метрики получены в одном запуске, а безопасность, смещения и токсичность не оценивались.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Открыть на Hugging Face

BENKHLOUF

BENKHLOUF (بن خلوف) is a 278.1M-parameter Matryoshka sentence embedding model for Algerian Darija (arq) across Arabic script, Latin Arabizi, and French code-switching, trained with Matryoshka Representation Learning (MRL) over Multiple Negatives Ranking Loss on 123,602 decontaminated sentence pairs.

On 1,000 held-out Algerian Darija validation pairs, BENKHLOUF achieves 0.853 mean positive cosine similarity at 768 dimensions and 0.897 at its 64-dimensional Matryoshka slice (a 12× reduction in vector storage), with 0.001 mean negative cosine (+0.852 contrastive margin) and 0.708 cross-script Arabizi-to-Arabic alignment.

TaskSentence Embeddings, Cross-Script Retrieval & Semantic Similarity
Architecture12L × 768 Mean-Pooled Bi-Encoder with Matryoshka Slices (768 → 64d)
Parameters278,075,904 (209.6M backbone + 68.4M expanded embeddings)
Input / ScriptsArabic script (arq-Arab), Latin Arabizi (arq-Latn), FR/EN code-switch (max 128 tokens)
License (Weights)Apache-2.0
Author(s)Abderahmane Ainouche, Algerian NLP Collective

Quickstart

Install dependencies:

pip install sentence-transformers torch

Standard 768d Embeddings (sentence-transformers)

from sentence_transformers import SentenceTransformer

REPO = "algerian-nlp/BENKHLOUF"
model = SentenceTransformer(REPO)

sentences = [
    "واش راك خويا لابس عليك؟",          # Arabic script
    "wesh rak khoya cava chwiya?",      # Latin Arabizi
    "السوق راه بعيد على الدار بزاف",     # Unrelated negative
]

embeddings = model.encode(sentences, normalize_embeddings=True)
similarity = embeddings @ embeddings.T

print(similarity.shape)
# (3, 3)
print(f"Arabic script <-> Arabizi similarity: {similarity[0, 1]:.3f}")
# Arabic script <-> Arabizi similarity: 0.424
print(f"Arabic script <-> Unrelated similarity: {similarity[0, 2]:.3f}")
# Arabic script <-> Unrelated similarity: 0.034

Matryoshka 64d Truncation (12× Smaller Index)

import numpy as np
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("algerian-nlp/BENKHLOUF")
sentences = [
    "واش راك خويا لابس عليك؟",
    "wesh rak khoya cava chwiya?",
]

embeddings = model.encode(sentences)
embeddings_64d = embeddings[:, :64]
embeddings_64d = embeddings_64d / np.linalg.norm(embeddings_64d, axis=1, keepdims=True)

sim_64d = np.dot(embeddings_64d[0], embeddings_64d[1])
print(f"64d cosine similarity: {sim_64d:.3f}")
# 64d cosine similarity: 0.463

Direct transformers Usage

import torch
import torch.nn.functional as F
from transformers import AutoModel, AutoTokenizer

REPO = "algerian-nlp/BENKHLOUF"
tokenizer = AutoTokenizer.from_pretrained(REPO)
model = AutoModel.from_pretrained(REPO).eval()

def mean_pooling(model_output, attention_mask):
    token_embeddings = model_output[0]
    mask = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
    return torch.sum(token_embeddings * mask, 1) / torch.clamp(mask.sum(1), min=1e-9)

texts = ["واش راك خويا", "wesh rak khoya"]
inputs = tokenizer(texts, padding=True, truncation=True, max_length=128, return_tensors="pt")

with torch.inference_mode():
    outputs = model(**inputs)
    embeddings = F.normalize(mean_pooling(outputs, inputs["attention_mask"]), p=2, dim=1)

print(embeddings.shape)
# torch.Size([2, 768])

Evaluation

Evaluated on 1,000 held-out Algerian Darija validation sentence pairs (2,000 sentences across distinct semantic clusters) after 3 epochs (2,898 global steps, batch size 64, single deterministic pass, seed 42).

Semantic Alignment & Contrastive Margin

Evaluation DimensionDimMeasured ValueTargetProperty
Positive pair cosine7680.853> 0.800Paraphrase and parallel alignment
Matryoshka compressed slice640.897> 0.80012× compressed vector search
Cross-script transfer7680.708> 0.650Arabizi ↔ Arabic script alignment
Negative pair cosine7680.001< 0.050Unrelated pair orthogonality
Contrastive margin768+0.852> +0.750Positive–negative separation
Embedding isotropy (mean cosine)7680.013< 0.100Isotropic space (no collapse)

Training & Generalization Trajectory

CheckpointStepTrain LossValidation LossMean Cosine (Isotropy)
Initial5014.9100——
Epoch 19660.06392.17700.0261
Epoch 21,9320.02262.06400.0168
Epoch 3 (Final)2,8980.01252.03300.0160

Note on anchor suites: Collective suites such as DziriEval and MADAR evaluate multiple-choice QA and dialect classification rather than sentence retrieval / STS; standardized public Algerian Darija retrieval benchmarks remain an open community gap.


Intended Use & Scope

Recommended uses:

  • Dense retrieval, semantic search, and Retrieval-Augmented Generation (RAG) over Algerian Darija content.
  • Cross-script matching between Arabizi queries and Arabic-script documents without transliteration.
  • Semantic deduplication, FAQ matching, and customer-support routing.

Out-of-scope uses:

  • Text generation or machine translation.
  • Long-document encoding beyond 128 tokens.
  • Languages or dialects outside Algerian Darija, or automated decisions about individuals.

Training pairs include informal social-media vernacular. The model has not been evaluated for bias, toxicity, or factuality.


Architecture

ComponentSpecification
Parameters278,075,904 (209,635,584 backbone + 68,440,320 embeddings)
Backbone12 layers, hidden size 768, 12 attention heads, GELU FFN (dim 3,072), initialized from XLM-RoBERTa base
Tokenizer250,044 BPE tokens (expanded by 42 tokens over 250,002)
Pooling & SlicesMean pooling; Matryoshka dimensions 768, 512, 256, 128, 64
Context Length128 tokens (learned absolute positions)
ObjectiveMatryoshkaLoss wrapping MultipleNegativesRankingLoss
Release Precisionfloat32 (trained with fp16 mixed precision)

Dialectal character expansion: 42 tokens were added to the BPE vocabulary to provide single-token entries for Algerian Darija characters missing from standard multilingual vocabularies, including ڨ (U+06A8, voiced velar stop /g/, occurring 1,112 times in training pairs), ڢ (U+06A2), and ڋ (U+068B), preventing <unk> fallback.


Training Data

Trained on 123,602 deduplicated, decontaminated Algerian Darija sentence pairs across 62,301 semantic clusters (with 1,000 held-out validation pairs). Paraphrases and translation variants are grouped into disjoint semantic clusters so mini-batches sample strictly across distinct clusters, preventing false negatives. Text normalization applies Unicode NFC and collapses redundant whitespace while preserving Arabizi phoneme digits (3, 7, 9), tatweel (ـ), diacritics, and French accented characters.

SourceDomain / TypeLicense TierTrain PairsShare
Kamel Touati et al.Parallel English–Darija corpusPermissive (CC-BY-4.0)113,80492.07%
PADIC (Algerian component)Dialectal Arabic parallel corpusAcademic research use9,7987.93%
TotalTri-script Algerian Darija pairsMixed123,602100.00%

Training Data License Composition

The model weights are released under Apache-2.0. That grant applies to weights and code only and does not relicense the underlying training text.

TierPairsShare
Permissive (CC-BY-4.0)96,83078.34%
Academic research use26,77221.66%

Training Details

ParameterValue
ObjectiveMatryoshkaLoss (768, 512, 256, 128, 64) + MultipleNegativesRankingLoss
OptimizerAdamW (lr=2e-5, weight_decay=0.01, betas=(0.9, 0.999), eps=1e-8)
Batch Size64 pairs/step (128 sequences/step)
ScheduleLinear warmup (289 steps, 10%) + cosine decay to 0
Steps / Epochs2,898 steps (3 epochs, 370,806 pair exposures)
RegularizationDropout 0.10, gradient clipping 1.0
Precisionfp16 mixed precision
Hardware & Duration2× NVIDIA Tesla T4 (16 GB), 2.78 h (9,996.8 s)
Seed42

Limitations

  • 128-token context cap. Optimized for sentences, search queries, comments, and short messages rather than long documents.
  • Colloquial Algerian domain focus. Trained specifically on Algerian Darija; formal MSA and non-Maghrebi Arabic varieties are better served by general Arabic encoders.
  • Single training run. All reported metrics come from one seed-42 run; cross-seed variance is unmeasured.
  • No safety evaluation. Bias, toxicity, and factuality have not been evaluated.

Repository Contents

FileSizeDescription / SHA-256
model.safetensors1.11 GBFloat32 weights (199 tensors) · SHA-256 0d718427ea4437db4477f0e0dc77c3ba9bd6fd40c86018e86e26b6bf1c94f129
config.json742 BModel architecture configuration
config_sentence_transformers.json284 BSentenceTransformers metadata and similarity config
modules.json229 BPipeline definition (Transformer + Pooling)
1_Pooling/config.json90 BMean-pooling configuration
tokenizer.json17.1 MBFast BPE tokenizer (250,044 tokens) · SHA-256 d45fd5f5313b236c9edabcdd81258f6ffb9f788bf4639f2afd6bc4672294785c
sentencepiece.bpe.model5.07 MBSentencePiece BPE model · SHA-256 cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
tokenizer_config.json382 BTokenizer settings
special_tokens_map.json166 BSpecial token definitions
export_report.json1.7 KBVerified file sizes, SHA-256 checksums, and parameter count

Optimizer states and intermediate checkpoints are excluded. The published weights reload via SentenceTransformer("algerian-nlp/BENKHLOUF") with zero missing or unexpected keys.


The name

Sidi Lakhdar Ben Khlouf (c. 1479–c. 1585), from the Dahra region near Mostaganem, is celebrated as a foundational master of Algerian Malhun poetry. Writing in vernacular Algerian Arabic rather than classical court verse, his poetry preserved both popular memory and everyday speech across the 16th century. Naming a cross-script Darija embedding model after him honors that vernacular tradition: capturing shared meaning across written scripts.

The naming is homage and implies no endorsement.


Citation

@misc{algerian_nlp_benkhlouf_2026,
  title  = {BENKHLOUF: Matryoshka Sentence Embeddings for Algerian Darija},
  author = {Ainouche, Abderahmane and Algerian NLP Collective},
  year   = {2026},
  url    = {https://huggingface.co/algerian-nlp/BENKHLOUF}
}

Upstream backbone:

@inproceedings{conneau-etal-2020-unsupervised,
  title     = {Unsupervised Cross-lingual Representation Learning at Scale},
  author    = {Conneau, Alexis and Khandelwal, Kartikay and Goyal, Naman and Chaudhary, Vishrav and Wenzek, Guillaume and Guzm{\'a}n, Francisco and Grave, Edouard and Ott, Myle and Zettlemoyer, Luke and Stoyanov, Veselin},
  booktitle = {Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics},
  year      = {2020},
  url       = {https://aclanthology.org/2020.acl-main.747}
}

License

Weights and code are released under Apache-2.0. Refer to the Training Data License Composition section above regarding the underlying training text before redistributing derivatives.

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей