/ Модель

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

Контекст
8 192 токена
Параметры
2,7 млрд
Размер весов
10,5 ГБ
Лицензия
Gemma
Архитектура
gemma2 · dense
Базовая модель
slm-gemma-2b-qa
Библиотека
transformers
Опубликована
3 авг 2026

gemma-2-2b-legal-dpo

Генерация текстаТекст → текст3 профессии
14скачиваний за 30 дней0лайковвеса обновлены15 авг 2026

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

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

Дообученная Gemma 2 на 2,7 млрд параметров для ответов на правовые и финансовые вопросы по предоставленному пользователем контексту.

abhishekai/gemma-2-2b-legal-dpo — плотная авторегрессионная модель Gemma 2 на 2,7 млрд параметров, дообученная методом DPO на предпочтениях, полученных с помощью ИИ-обратной связи. Она предназначена для ответов на вопросы по правовым и финансовым темам, когда пользователь предоставляет исходный фрагмент текста. Модель поддерживает диалог, генерирует текст на английском языке и имеет контекстное окно 8192 токена; в README обучение и оценка описаны для контекста 1024 токена.

В описанной оценке ответы оказались на уровне исходной модели thesreedath/slm-gemma-2b-qa; преимущество по win rate не было статистически значимым. Для использования нужны предоставленные пользователем материалы: модель не предназначена для ответов без опоры на контекст. Точность чисел требует проверки, а ответы не являются юридической или финансовой консультацией. Лицензия — Gemma.

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

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

Ограничения

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Открыть на Hugging Face

gemma-2-2b-legal-dpo

A 2.61B-parameter Gemma-2 model for grounded legal/financial Q&A, preference-tuned with DPO on AI-generated feedback (RLAIF).

⚠️ Gemma license — read before use

This is a derivative of Google's Gemma-2. It is governed by the Gemma Terms of Use and the Gemma Prohibited Use Policy, which apply to this model and to anything you derive from it. It is not Apache-2.0 or MIT.

Provenance note: the immediate parent, thesreedath/slm-gemma-2b-qa, declares no license of its own. The upstream Gemma terms attach regardless, so this derivative is published under them.

Independent absolute score (2026-08-15)

Scored by Claude Sonnet on four axes out of 10 — a different model family from the Gemini judge behind the win-rate above, and one that had no hand in writing this project's training data. 300 held-out prompts, the same prompts and the same scale used for all twelve checkpoints, so this number is comparable across models in a way no win-rate here is.

mean score8.62 / 10
95% CI (bootstrap over per-prompt scores)[8.41, 8.82]
paired step+0.62 against its SFT (8.00), CI [+0.38, +0.88] - a real improvement, and the highest score of any checkpoint here.

The full twelve-checkpoint table, with every stage-to-stage interval, is in MODEL_INDEX.md in the project repository.

Honest headline

This model performs at parity with the SFT model it was trained from, with a positive lean that is not statistically significant.

win-rate vs thesreedath/slm-gemma-2b-qa0.530
decisive comparisons37 wins / 31 losses / 32 ties (n=100)
two-sided binomial p0.545
95% CI on decisive win-rate[0.426, 0.662]

The interval straddles 0.5. Judged by Gemini 2.5 Flash on 100 held-out grounded prompts, order randomized to cancel position bias.

The actual finding: RLAIF damage shrinks with scale

Identical pipeline across three models — same prompt pool, same judge, same preference thresholds, same DPO recipe:

modelparamsDPO win-rate vs its own SFT
125M126M0.455 (degraded)
500M518M0.480 (parity)
Gemma-2-2B (this)2,614M0.530 (parity, trending positive)

DPO rises monotonically with scale, crossing from harmful to slightly positive. At 125M, distilling toward a stronger teacher pushed the model into fluent prose form it could not fill with substance. At 2.6B that failure mode disappears. No single point is significant at n=100; the trend is.

PPO, by contrast, failed. A PPO run from the same reward model scored 0.33 (24/58/18, p < 0.001) — a real degradation, even after the run itself was made numerically healthy (KL 5.5 vs a target of 6, stable value function). That PPO checkpoint is deliberately not published. Fixing the optimization fixed the optimization, not the model.

Preference data

628 triplets (528 train / 100 eval), mined on-policy from the frozen SFT model: 4 samples per prompt → Gemini scores 1–10 → best/worst kept when the gap is ≥2 → an independent pairwise judge confirms (94.4% agreement) → embedding dedup.

Training

DPO with an RPO-style NLL anchor. beta 0.1, LR 5e-6, 2 epochs, effective batch 16 (micro-batch 1 × accum 16 — Gemma's 256k vocab makes one sequence's fp32 logits ~1GB), 58 steps, 1×H100, 3.8 min, $0.25. Final eval preference accuracy 0.782, margin 1.449.

Prompt format — NOT the standard Gemma template usage

Gemma-2's chat template raises an exception on a system role, so the system instruction is folded into the user turn. The assistant turn ends with <end_of_turn> (id 107), not <eos> — generation must stop on that.

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

m = "abhishekai/gemma-2-2b-legal-dpo"
tok = AutoTokenizer.from_pretrained(m)
model = AutoModelForCausalLM.from_pretrained(m).eval()
model.config.use_cache = True   # the published config ships use_cache=false

system = ("You are a precise legal and financial assistant. Answer using only the "
          "provided context. If the context does not contain the answer, say you "
          "cannot answer from the context.")
question = "What standard of proof applies to the plaintiff?"
context = ("In a civil negligence action the plaintiff must prove duty, breach, "
           "causation, and damages by a preponderance of the evidence.")

# system folded into the user turn — Gemma-2 has no system role
messages = [{"role": "user",
             "content": f"{system}\n\n{question}\n\nContext:\n{context}"}]
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
ids = tok(text, add_special_tokens=False, return_tensors="pt").input_ids
out = model.generate(ids, max_new_tokens=160, do_sample=False,
                     eos_token_id=tok.convert_tokens_to_ids("<end_of_turn>"),
                     pad_token_id=tok.convert_tokens_to_ids("<pad>"))
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))

Limitations

  • Grounded only. The user turn must contain the passage.
  • Parity, not an upgrade. See the headline; the SFT parent is an equally reasonable choice.
  • LLM-judged preferences. Labels come from Gemini 2.5 Flash, not humans.
  • Number fidelity is not guaranteed. Verify any figure it produces.
  • Not legal or financial advice.
  • Trained and evaluated at a 1,024-token context.

License

Gemma Terms of Use. Use is subject to the Gemma Prohibited Use Policy. Gemma is a trademark of Google LLC.

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
Gemma2ForCausalLM
Ревизия весов
03f182c

0 моделей