/ Модель

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

Лицензия
Gemma
Базовая модель
gemma-4-e4b-it
Библиотека
transformers
Опубликована
14 июл 2026

gemma4-e4b-claims-comparison

Генерация текстаТекст → текст3 профессии

Дообученная Gemma 4 E4B Instruct классифицирует семантическую связь между двумя утверждениями на диалектном арабском языке.

405 тыс.скачиваний за 30 дней2лайкавеса обновлены5 авг 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

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

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

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

Это дообученная на арабских данных модель Google Gemma 4 E4B Instruct, созданная автором репозитория k-chirkunov для сравнения утверждений на диалектном арабском языке. Она принимает два утверждения в заданном формате диалога и относит их к одной из семи категорий семантической связи, включая эквивалентность, противоречие и частичное пересечение. Модель предназначена для задач естественного логического вывода и сравнения формулировок утверждений.

Модель получена методом LoRA SFT и адаптер объединён с базовой моделью; доступны полные веса bf16 в формате safetensors. В README указан формат входа с системной инструкцией и двумя утверждениями, а результатом служит название категории. Карточка описывает обучение на наборе диалогов сравнения утверждений и лицензию Gemma. Результаты могут зависеть от соблюдения заданного шаблона; модель настроена на диалектный арабский и не заявлена как универсальный классификатор для других языков или задач.

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

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

Ограничения

Для получения ожидаемой категории требуется чат-шаблон с системной инструкцией и двумя утверждениями; модель обучена для диалектного арабского. README не приводит метрик качества, а английский указан в метаданных среди языковых тегов, но не подтверждён как целевой язык задачи.

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

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

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

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

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

Открыть на Hugging Face

gemma4-e4b-claims-comparison

A fine-tuned google/gemma-4-e4b-it that acts as a Dialectal Arabic Natural Language Inference (NLI) engine. Given two Arabic claims (claim_a, claim_b), it reasons inside its thinking channel and outputs exactly one of seven semantic-relationship categories.

This checkpoint is the LoRA adapter merged back into the base model (full bf16 weights).

Categories

#CategoryMeaning
1EquivalentSame scope and fact; differ only in linguistic form (paraphrase).
2ContradictoryThe claims explicitly violate or contradict each other.
3OverlapIncomparableShare common elements, but each has independent facts absent from the other.
4DifferentFactsCompletely distinct facts with no meaningful semantic overlap.
5UncertainAmbiguous, pronoun-heavy without referents, or lacking context to judge.
6A-MoreSpecificSame core fact, but claim_a adds compatible, granular details.
7B-MoreSpecificSame core fact, but claim_b adds compatible, granular details.

Ties are resolved to the lowest numerical index.

Prompt format

The model expects a system turn with the task instructions and a user turn with the two claims. It emits its reasoning in a thinking channel (<|channel>thought … <channel|>) and then the final category name.

System message:

You are an expert Dialectal Arabic Natural Language Inference (NLI) engine.
Your task is to compare two Arabic claims (claim_a and claim_b) and categorize their semantic relationship into exactly ONE of seven categories.

Categories:
1) Equivalent: Same scope and fact; differing only in linguistic form (paraphrase).
2) Contradictory: The claims explicitly violate or contradict each other.
3) OverlapIncomparable: Share common elements, but each contains independent facts absent from the other.
4) DifferentFacts: Completely distinct facts with no meaningful semantic overlap.
5) Uncertain: Text is ambiguous, pronoun-heavy without referents, or lacks necessary context to judge.
6) A-MoreSpecific: Same core fact, but claim_a adds compatible, granular details.
7) B-MoreSpecific: Same core fact, but claim_b adds compatible, granular details.

Protocol:
1. Analyze the semantic core, entities, temporal modifiers, and negation markers in both claims inside your thinking channel. Always reason in ENGLISH, even though the claims are in Arabic.
2. Determine the exact logical relationship category.
3. If a claim pair exhibits characteristics of multiple categories, you must resolve the tie by strictly selecting the category with the lowest numerical index (e.g., if a pair could be interpreted as both Contradictory [2] and DifferentFacts [4], you must output Contradictory).
4. Output ONLY the category name as your final response outside the thought block. It MUST be EXACTLY one of: Equivalent, Contradictory, OverlapIncomparable, DifferentFacts, Uncertain, A-MoreSpecific, B-MoreSpecific. No other text, no punctuation.

User message:

claim_a: {a}
claim_b: {b}

Assistant message (what the model produces):

<|channel>thought
...English reasoning about the two claims...
<channel|>
Equivalent

Inference

from transformers import pipeline, GenerationConfig

MODEL_ID = "k-chirkunov/gemma4-e4b-claims-comparison"

SYSTEM_PROMPT = """\
You are an expert Dialectal Arabic Natural Language Inference (NLI) engine.
Your task is to compare two Arabic claims (claim_a and claim_b) and categorize their semantic relationship into exactly ONE of seven categories.

Categories:
1) Equivalent: Same scope and fact; differing only in linguistic form (paraphrase).
2) Contradictory: The claims explicitly violate or contradict each other.
3) OverlapIncomparable: Share common elements, but each contains independent facts absent from the other.
4) DifferentFacts: Completely distinct facts with no meaningful semantic overlap.
5) Uncertain: Text is ambiguous, pronoun-heavy without referents, or lacks necessary context to judge.
6) A-MoreSpecific: Same core fact, but claim_a adds compatible, granular details.
7) B-MoreSpecific: Same core fact, but claim_b adds compatible, granular details.

Protocol:
1. Analyze the semantic core, entities, temporal modifiers, and negation markers in both claims inside your thinking channel. Always reason in ENGLISH, even though the claims are in Arabic.
2. Determine the exact logical relationship category.
3. If a claim pair exhibits characteristics of multiple categories, you must resolve the tie by strictly selecting the category with the lowest numerical index (e.g., if a pair could be interpreted as both Contradictory [2] and DifferentFacts [4], you must output Contradictory).
4. Output ONLY the category name as your final response outside the thought block. It MUST be EXACTLY one of: Equivalent, Contradictory, OverlapIncomparable, DifferentFacts, Uncertain, A-MoreSpecific, B-MoreSpecific. No other text, no punctuation.
"""

USER_TEMPLATE = "claim_a: {a}\nclaim_b: {b}\n"

CATEGORIES = [
    "Equivalent", "Contradictory", "OverlapIncomparable",
    "DifferentFacts", "Uncertain", "A-MoreSpecific", "B-MoreSpecific",
]

pipe = pipeline(task="any-to-any", model=MODEL_ID, dtype="auto", device_map="auto")

gen = GenerationConfig.from_pretrained(MODEL_ID)
gen.max_new_tokens = 4096
gen.do_sample = True
gen.temperature = 0.3
gen.top_p = 0.95
gen.top_k = 64


def compare(claim_a: str, claim_b: str) -> str:
    messages = [
        {"role": "system", "content": [{"type": "text", "text": SYSTEM_PROMPT.strip()}]},
        {"role": "user", "content": [{"type": "text", "text": USER_TEMPLATE.format(a=claim_a, b=claim_b)}]},
    ]
    out = pipe(
        messages,
        return_full_text=False,
        skip_special_tokens=False,        # keep <channel|> so we can split off the reasoning
        chat_template_kwargs={"enable_thinking": True},
        generate_kwargs={"generation_config": gen},
    )
    raw = out[0]["generated_text"].strip()

    # Take only the text after the thinking channel closes.
    text = raw.rsplit("<channel|>", 1)[-1] if "<channel|>" in raw else raw
    for marker in ("<eos>", "<pad>", "<turn|>", "<|turn>", "<|think|>", "<|channel>"):
        text = text.replace(marker, "")
    text = text.strip().lower()

    # Pick the category mentioned last in the final answer.
    best, best_pos = "Uncertain", -1
    for c in CATEGORIES:
        pos = text.rfind(c.lower())
        if pos > best_pos:
            best, best_pos = c, pos
    return best


if __name__ == "__main__":
    a = "الطعام في المطعم كان لذيذاً جداً"
    b = "الأكل في المطعم كان طيب مرة"
    print(compare(a, b))   # -> Equivalent

Note on special tokens. This chat template uses <|turn>role / <turn|> turn markers and a <|channel>thought … <channel|> thinking channel — all registered special tokens. Pass skip_special_tokens=False so the <channel|> delimiter survives decoding, split the raw text on it to separate reasoning from the final answer, and only then strip the remaining marker tokens.

Training

License

Governed by the Gemma Terms of Use.

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

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

GPU в ailist

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

Нельзя запустить

Доступ к модели ограничен автором; у платформы нет доступа к весам.

Ревизия весов
99f161c

0 моделей