/ Модель

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

Контекст
1 024 токена
Параметры
126 млн
Лицензия
Apache 2.0
Архитектура
llama · dense
Базовая модель
slm-125m-legal-base
Библиотека
transformers
Опубликована
26 июл 2026

slm-125m-legal-sft

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

Компактная дообученная модель Llama для ответов на английском языке по предоставленным юридическим и финансовым текстам.

37скачиваний за 30 дней0лайковвеса обновлены15 авг 2026

Бенчмарки

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

Тесты пользователейпока нет

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

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

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

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

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

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

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

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

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

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

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

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

slm-125m-legal-sft — компактная языковая модель архитектуры Llama на 125,8 млн параметров, созданная abhishekai путём supervised fine-tuning модели abhishekai/slm-125m-legal-base. Она предназначена для ответов на вопросы по предоставленным фрагментам юридических и финансовых текстов в сценариях grounded QA и RAG; также обучалась суммированию, извлечению и перефразированию информации. Модель принимает текст, следует инструкциям и использует шаблон чата; контекст ограничен 1024 токенами.

По оценке на 300 отложенных вопросах модель получила средний балл 4,05 из 10, но стандартные отраслевые бенчмарки не проводились. Она требует контекстный фрагмент, слабо подходит для закрытых вопросов и может галлюцинировать или ошибаться в арифметике. Модель ориентирована на английский язык и преимущественно на право США. Распространяется по лицензии Apache-2.0; автор описывает её как исследовательский и учебный артефакт, непригодный для юридических, финансовых или иных производственных решений.

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

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

Ограничения

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

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

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

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

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

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

Открыть на Hugging Face

slm-125m-legal-sft

A 125M-parameter Llama-architecture model, supervised fine-tuned from abhishekai/slm-125m-legal-base for grounded question answering over legal and financial passages.

Unlike the base model (a text completer), this one follows instructions — but in a RAFT / retrieval-augmented style: it answers a question from a context passage you provide, which is the reliable behaviour a model this small can actually deliver. Remove the context and it has little to stand on.

How it was tuned

The base model was fine-tuned on ~9,100 grounded Q&A pairs (plus an 800-pair held-out eval split). The data was generated by a teacher LLM (Gemini 2.5 Flash) reading passages sampled from the same legal/financial corpus the base model was pretrained on, then aggressively filtered:

  • Grounding / faithfulness — an LLM-judge self-check; only answers scored fully supported by their source passage were kept.
  • Deduplication — near-identical questions removed by embedding similarity.
  • Length / format / schema — truncated, empty, or malformed rows dropped.
  • Task & difficulty balance — five task types (grounded QA, multi-step QA, summarization, extraction, rewriting) at a fixed mix, spanning easy → hard.
  • Eval decontamination — n-gram and embedding overlap between the training and eval splits removed, so reported eval numbers are not leaked training data.

Reused the base model's own 16K byte-level BPE tokenizer (no re-tokenization). A chat template is bundled and used at both training and inference.

Independent absolute score (2026-08-15)

Scored by a Claude Sonnet judge on four axes out of 10, over 300 held-out grounded Q&A prompts, on the same scale as every other checkpoint in this project.

mean score4.05 / 10
95% CI[3.73, 4.37]
paired step+2.59 over the 125M pretrain base (1.46), CI [+2.26, +2.91]

Per axis: QA 3.16, instruction following 3.27, grounding 4.24, refusal 5.52. Both RLAIF stages built on this checkpoint score no better — DPO 3.52 (a real regression) and PPO 4.08 (indistinguishable). At this scale the SFT is the model to use.

Training procedure

Methodfull-parameter SFT, loss on answer tokens only (prompt masked)
Examples9,096 train / 794 eval
Epochs3 (1,704 steps, micro-batch 16)
OptimizerAdamW (beta 0.9/0.95)
LR schedule3% warmup to 2e-5, cosine decay to 2e-6
Formatchat template; context folded into the user turn, RAFT-style
Hardware1x H100
Compute cost~$0.32 (data generation ~$2.44 on top)

Evaluation

Cross-entropy over answer tokens only on the held-out eval split:

MetricValue
Eval loss (answer tokens)1.213
Eval perplexity (answer tokens)3.36

This is not comparable to the base model's 9.155 — that is general next-token perplexity over the whole sequence; this is loss over supervised answer tokens on grounded QA, an easier target. No downstream task benchmarks (LegalBench, CaseHOLD, etc.) have been run.

Usage

Give it a question and a context passage. Greedy decoding is strongly recommended — at higher temperatures a model this small drifts into the wrong task type.

from transformers import AutoTokenizer, AutoModelForCausalLM

tok = AutoTokenizer.from_pretrained("abhishekai/slm-125m-legal-sft")
model = AutoModelForCausalLM.from_pretrained("abhishekai/slm-125m-legal-sft").eval()

question = "What standard of proof applies, and what must the plaintiff show?"
context = (
    "In a civil negligence action the plaintiff must establish duty, breach, "
    "causation, and damages. The standard of proof is a preponderance of the "
    "evidence: the plaintiff must show it is more likely than not that the "
    "defendant's conduct caused the harm."
)
messages = [
    {"role": "system", "content": "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."},
    {"role": "user", "content": f"{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("<|eos|>"),
                     pad_token_id=tok.convert_tokens_to_ids("<|pad|>"))
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))

Limitations and intended use

A research and educational artifact — a demonstration that a coherent, grounded instruction-following model can be distilled onto a 125M base for a few dollars. Not suitable for production, and specifically:

  • It needs a context passage. It was trained to answer from provided context, not from parametric memory. Closed-book questions are out of distribution.
  • It does not do arithmetic. It will confidently state figures and percentages that do not follow from each other. Never trust a number it computes.
  • It still hallucinates and is not a source of legal or financial fact, and is not legal or financial advice. Do not deploy it in any advisory, compliance, or decision-making capacity.
  • Use greedy / low temperature. Sampling at higher temperatures makes a model this small slip into the wrong task (e.g. emitting JSON for a prose question).
  • 1024-token context, so question + passage together must be short.
  • English only, US-jurisdiction-skewed, and it inherits the biases of both its pretraining corpus and the teacher model that generated its fine-tuning data.

Data provenance and license

The model weights are released under Apache-2.0, inheriting the base model's license.

The fine-tuning data is synthetic, generated by Google's Gemini 2.5 Flash over passages from the base model's pretraining corpus (US case law — CC-BY-4.0; SEC filings — CC0-1.0; FineWeb-Edu — ODC-By 1.0). Synthetic data carries the teacher provider's usage terms; this artifact is published for research and education. If you intend to use it commercially, review Google's Gemini API terms and get your own counsel to look at it. None of this is legal advice.

Reproducibility

The full fine-tuning pipeline — passage sampling, teacher generation, LLM-judge grounding, deduplication, task balancing, eval decontamination, tokenization, and the SFT run — runs on Modal and is reproducible end-to-end.

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей