/ Модель

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

Контекст
131 072 токена
Параметры
7,5 млрд
Лицензия
Llama 3.1
Архитектура
llama · dense
Базовая модель
Llama-3.1-8B-Instruct
Библиотека
transformers
Опубликована
26 ноя 2026

Llama-3.1-8B-Thinking-SFT

Генерация текстаТекст → текст8 профессий
191скачиваний за 30 дней0лайковвеса обновлены26 ноя 2026

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

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

Дообученная Llama 3.1 на 8 млрд параметров генерирует диалоговые ответы с блоком рассуждений для задач математики, кода и общего reasoning.

wesjos разработал Llama-3.1-8B-Thinking-SFT — дообученную методом SFT модель Meta-Llama-3.1-8B-Instruct с 7,5 млрд параметров. Она генерирует диалоговые ответы в формате, где блок рассуждений может предшествовать итоговому ответу; для этого в репозитории настроены специальные токены и шаблон чата. Модель принимает текст и выдаёт текст, использует архитектуру LlamaForCausalLM и контекст до 131 072 токенов.

Модель предназначена для диалогов и генерации ответов, в частности для задач на рассуждение, математику и код. В авторской оценке на GSM8K она показала 84,38% против 75,94% у базовой модели, но на наборе Hard-453 улучшения не было. Для корректной работы шаблона и специальных токенов нужно использовать токенизатор и chat template из этого репозитория. Обучение выполнено на англоязычном корпусе дистиллированных диалогов без этапа RL; рассуждения расходуют токены генерации. Лицензия — Llama 3.1 Community License (llama3.1).

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

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

Ограничения

Обучающий корпус преимущественно англоязычный; улучшение в авторской оценке наблюдалось на GSM8K, но не на Hard-453. Блок рассуждений расходует лимит генерации, а для корректной работы специальных токенов требуется токенизатор и шаблон чата из репозитория; модель наследует ограничения базовой Llama 3.1-8B-Instruct, включая склонность к галлюцинациям и срез знаний до декабря 2023 года.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Открыть на Hugging Face

Llama-3.1-8B-Thinking-SFT

Llama-3.1-8B-Instruct fine-tuned with thinking-style SFT (~8.03B params, BF16, single 16 GB safetensors). The model opens assistant turns with a <think> … </think> reasoning block, then writes the final answer.

why Llama-3.1-8B

  • this model isn't as good as modern models, but i like Llama. that is why i wanna finetune it. what i did is training 2 new tokens to teach model to think.

What changed vs. the base model

| | Base | This model |
|---|---|---|
| Thinking tokens | — | `<think>` = id **128002**, `</think>` = id **128003** |
| Token source | `<|reserved_special_token_0|>` / `<|reserved_special_token_1|>` | renamed in place — Qwen-style display names, token ids unchanged |
| Vocab size | 128,256 | 128,256 (**unchanged, no embedding resize**) |
| EOS | `<|eot_id|>` (128009) | unchanged — `</think>` does **not** end generation |
| PAD | `<|finetune_right_pad_id|>` (128004) | unchanged |

Because the two ids reuse the tokenizer's reserved special slots, this model is a drop-in replacement: same architecture, same config.json — any runtime that runs Llama 3.1 can run it, as long as it picks up this repo's tokenizer files and chat template (otherwise the model degrades to emitting literal <think> strings instead of the special tokens).

Chat template behavior

The shipped chat_template.jinja is the Llama 3.1 template with two additions:

  1. Thinking is on by default. With add_generation_prompt=True the template prefills <think> after the assistant header, so the model only writes the closing </think> itself: apply_chat_template(..., add_generation_prompt=True) → …<|start_header_id|>assistant<|end_header_id|>\n\n<think>
  2. enable_thinking=False removes the prefill — the model then decides on its own whether to open a thinking block.
  3. reasoning_content support. Assistant messages carrying an OpenAI-style reasoning_content field are rendered wrapped in <think>…</think> — handy for replaying teacher traces in multi-turn conversations.

To hard-disable thinking at inference time, suppress the open-token logit: logits[:, 128002] = -float("inf").

Usage

transformers

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tok = AutoTokenizer.from_pretrained("wesjos/Llama-3.1-8B-Thinking-SFT")
model = AutoModelForCausalLM.from_pretrained(
    "wesjos/Llama-3.1-8B-Thinking-SFT", dtype=torch.bfloat16, device_map="auto"
)

messages = [{"role": "user", "content": "what is 89x12"}]
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# The rendered template already contains BOS — do not add special tokens again.
inputs = tok(text, return_tensors="pt", add_special_tokens=False).to(model.device)
out = model.generate(**inputs, max_new_tokens=1024, do_sample=True,
                     temperature=0.6, top_p=0.95, repetition_penalty=1.05)
print(tok.decode(out[0], skip_special_tokens=False))

Prompt / output shape (real sample, truncated):

<|begin_of_text|><|begin_of_text|><|start_header_id|>system<|end_header_id|>

Cutting Knowledge Date: December 2023
Today Date: 26 Jul 2024

you are a helpful assistant.<|eot_id|><|start_header_id|>user<|end_header_id|>

what do you know about yourself<|eot_id|><|start_header_id|>assistant<|end_header_id|>

<think>The user is asking what I know about myself. This is a meta-question about my own knowledge and capabilities. I should be transparent about what I can tell them.</think>I appreciate the question! Here's what I can share:

## What I Know About Myself

### Core Abilities
- **Language**: I understand natural language, generate text, and respond in many languages.
- **Knowledge**: I have been trained on a vast range of topics — history, science, technology, philosophy, culture, literature, and more.
- **Reasoning & Reasoning**: I can reason through logical steps, draw analogies, and make simple mathematical calculations.

### What I Don't Know (or struggle with)
- **Personal experiences**: I don't have feelings, memories, or a personal history.
- **Domain-specific expertise**: While broad, my knowledge has limits (especially very recent events or highly specialized fields like legal or medical practice without context).
- **Common sense in rare cases**: I may not always understand everyday situations that rely heavily on shared human experience (humor, nuanced social norms, etc.).

### How I Work
- I process input as text only.
- I generate responses based on patterns learned from training data.
- I can explain concepts, answer questions, write, code, summarize, translate, and more.

### Boundaries
- I'm an AI assistant, so I can make mistakes or not fully understand context.
- I don't have access to the internet in real-time after training.
- I should not be used for tasks requiring personal judgment or expertise beyond what I've been trained on.

Would you like me to help with something specific?<|eot_id|>

Serving notes

  • vLLM / SGLang / llama.cpp: serve from this repo so the runtime picks up its tokenizer.json / tokenizer_config.json / chat_template.jinja. With the stock Llama-3.1 tokenizer files the model outputs literal <think> text — the thinking tokens only exist in this repo's tokenizer.
  • Budget max_new_tokens for the reasoning block; the answer follows after </think>.

Sampling defaults (generation_config.json): temperature=0.6 · top_p=0.95 · top_k=0 (disabled) · repetition_penalty=1.05.

Training data

SFT only (no RL stage). The corpus is a chat-only cleaning of saidutta69/qwen-glm-kimi-distillation-clean, a teacher-distilled conversational corpus (Qwen3.8-Max / Kimi-K3):

Traces57,064 → 51,150 after removing all tool-calling rows (−10.4%); original splits kept — train 46,077 / validation 2,558 / test 2,515
Teachers (train split)qwen3.8-max-preview 42,942 · kimi-code/k3 3,135
Domains (train)math 12.9k · code 12.7k · reasoning 9.4k · instruction 6.5k · other 4.5k
Chain-of-thought~82% of assistant turns carry an explicit reasoning trace, trained inside <think>…</think>

Trained with Unsloth (the released config.json carries the Unsloth save markers).

Evaluation (author-run, same protocol for both models)

BenchmarkLlama-3.1-8B-InstructThis model
GSM8K (full test, 1,319 problems)75.94%84.38%
Hard-453 (453-problem hard set)72.63%72.63%

model learned how to use thinking tokens but doesnt really improve in hard questions. maybe DPO or RL would help but i didnt try yet.

Limitations

  • Task-dependent gains: no improvement on Hard-453; thinking mainly helped math word problems in this run.
  • English-centric training corpus.
  • Reasoning consumes token budget — size max_new_tokens accordingly.
  • Inherits all limitations of Llama-3.1-8B-Instruct (knowledge cutoff December 2023, hallucination, no real-time knowledge).

License & attribution

  • Weights: Llama 3.1 Community License, inherited from meta-llama/Llama-3.1-8B-Instruct. (Training started from the unsloth/Meta-Llama-3.1-8B-Instruct repack — identical weights, different default chat template.)
  • Training data: the upstream distillation corpus mixes non-commercial sources (CC BY-NC-SA 4.0, CC BY-NC 3.0, CC BY-SA 3.0, CC BY 4.0, MIT, Apache-2.0, ODC-BY) plus Alibaba Cloud Model Studio terms. To the extent this model derives from that data lineage, non-commercial research use only.

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей