/ Модель

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

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

Llama3.1-8B-TRACE

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

Защитная диалоговая модель TRACE на базе Llama 3.1, оценивающая риск многоходовых jailbreak-атак перед формированием ответа.

817скачиваний за 30 дней0лайковвеса обновлены22 сен 2026

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Dipto084/Llama3.1-8B-TRACE — диалоговая защитная модель на архитектуре Llama 3.1 с 7,5 млрд параметров, разработанная для выявления многоходовых jailbreak-атак. Она анализирует траекторию беседы целиком, формирует оценку безопасности и затем отвечает с учётом этой оценки. По README, это вариант TRACE-GRPO: дообучение с подкреплением по рецепту TRACE, объединённое с весами базовой модели; для работы требуется системный промпт TRACE, задающий формат и правила оценки.

Модель предназначена для интеграции в чат-системы, где нужно обнаруживать попытки обхода защит и сохранять ответы на безвредные запросы. В карточке приведены результаты оценок на многоходовых атаках и проверках избыточных отказов; они отражают конкретные тестовые наборы и не гарантируют аналогичную защиту в эксплуатации. Контекст — до 131 072 токенов, вход и выход — текст, основной язык карточки — английский. Распространяется под лицензией Llama 3.1; при использовании следует соблюдать её условия.

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

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

Ограничения

Для корректного структурированного вывода необходим системный промпт TRACE. Результаты бенчмарков не гарантируют обнаружение всех атак в реальных диалогах.

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

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

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

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

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

Открыть на Hugging Face

Llama3.1-8B-TRACE

TRACE is a trajectory-aware defense model for multi-turn jailbreaks. Instead of judging each user message in isolation, it commits to an explicit safety assessment of the whole conversation so far — in a <STATE> block — and only then writes its reply in an <ANSWER> block. The assessment is part of the generation, so the reply is conditioned on it.

This checkpoint is the paper's TRACE-GRPO model: a LoRA policy trained with group-decoupled GRPO on top of the stage-1 SFT adapter, merged into the base weights for release. Across seven multi-turn attack benchmarks it averages 14.5% ASR, against 31.4% for the strongest baseline and 74.9% for the undefended target, while keeping 93.3% average compliance on over-refusal benchmarks.

  • Base model: meta-llama/Llama-3.1-8B-Instruct
  • Release form: full merged weights, bf16, single model.safetensors
  • Paper / code: TRACE
  • Companion model: Dipto084/Qwen3-8B-TRACE (same recipe on Qwen3-8B)

Paper

TRACE: Trajectory Aware Reasoning for Multi-Turn Adversarial Conversation Evaluation — arXiv:2608.15594 · Code: github.com/Dipto084/TRACE

Output format

<STATE>
{
  "cues": {"<cue_name>": "<turn reference and reasoning>"},
  "benign_interpretation":     {"score": 1-10, "explanation": "..."},
  "adversarial_interpretation":{"score": 1-10, "explanation": "..."},
  "jailbreak_score": 1-5,
  "action": "ALLOW | CAUTION | DECLINE",
  "justification": "..."
}
</STATE>
<ANSWER>
<the reply to the current user turn>
</ANSWER>

Only the <ANSWER> block should be shown to an end user. The <STATE> block is an internal reasoning commitment; it is useful for logging, auditing, and routing (e.g. escalate on action == "DECLINE"), but it is not user-facing text.

Usage

The model requires the TRACE system prompt — it defines the cue taxonomy, the scoring rubric, and the output contract above. Without it the model will not emit well-formed <STATE> blocks. The prompt ships with the model as system_prompt.txt; it is the file the attack evaluations load (agents/state_answer_action_prompt.txt in the code repo).

A second variant, system_prompt_or.txt, adds an explicit "harmful vs. harmful-looking" distinction and requires the first sentence of the <ANSWER> to be substantive. It is the prompt used for the PHTest over-refusal measurement; use it when over-refusal on sensitive-but-benign requests matters more than anything else.

The conversation is passed as a single user message, not as a list of chat turns. The model was trained and evaluated on the whole trajectory collapsed into one message with numbered turns; the last turn holds only the user message being answered:

[Turn 1]
USER: ...
ASSISTANT: ...
[Turn 2]
USER: ...

The model replies with <STATE>…</STATE><ANSWER>…</ANSWER>. Show the user only the ANSWER, and append only the ANSWER to the history for the next turn — the STATE block never re-enters the context.

The easiest way to get all of this right is the reference package at github.com/Dipto084/TRACE, which provides the formatting and parsing helpers plus an OpenAI-compatible proxy that lets any client (or attack framework) talk to the model with ordinary chat messages. Doing it by hand:

import re
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Dipto084/Llama3.1-8B-TRACE"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="bfloat16", device_map="auto")
system_prompt = open("system_prompt.txt").read()

def format_trajectory(history, user_message):
    # history: list of (user, answer) pairs already exchanged; answers are ANSWER text only
    lines = []
    for i, (u, a) in enumerate(history, start=1):
        lines += [f"[Turn {i}]", f"USER: {u}", f"ASSISTANT: {a}"]
    lines += [f"[Turn {len(history) + 1}]", f"USER: {user_message}"]
    return "\n".join(lines)

def parse(raw):
    m = re.search(r"<ANSWER>(.*?)</ANSWER>", raw, re.S)
    return m.group(1).strip() if m else re.sub(r"<STATE>.*?</STATE>", "", raw, flags=re.S).strip()

history = []
for user_message in ["first user turn", "second user turn"]:
    messages = [
        {"role": "system", "content": system_prompt},
        {"role": "user", "content": format_trajectory(history, user_message)},
    ]
    ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
    out = model.generate(ids, max_new_tokens=4096, do_sample=False)
    raw = tok.decode(out[0][ids.shape[-1]:], skip_special_tokens=True)
    answer = parse(raw)
    history.append((user_message, answer))
    print(answer)

Serving with vLLM (the evaluations used greedy decoding, temperature 0):

vllm serve Dipto084/Llama3.1-8B-TRACE --max-model-len 65536 --dtype bfloat16

Budget generously for the completion: the <STATE> block is generated before the answer.

Training

Stage 1 — SFT. The training corpus is built by orchestrating five attack frameworks (Crescendo, ActorAttack, Chain-of-Attacks, ICON, X-Teaming) over 300 harmful behaviors from JailbreakBench and HarmBench, paired with benign multi-turn dialogs and harm-adjacent benign dialogs generated from OR-Bench seeds: 4k adversarial + 2.4k benign + 600 sensitive-but-benign conversations, which expand to 18.2k per-turn trajectories. A frontier LLM annotates every trajectory with the full reasoning trace (cues, dual-hypothesis scores, jailbreak score, action). Stage 1 trains a LoRA adapter (rank 32, alpha 64) on 12.5k of those trajectories, minimizing cross-entropy over the concatenated STATE and ANSWER blocks.

Stage 2 — GRPO with group-decoupled advantages (GDPO). The SFT adapter is trained further with reinforcement learning against a co-located Qwen3-8B-AWQ judge. Standard GRPO normalizes the summed reward across the group, which collapses distinct reward combinations into identical advantages; GDPO instead normalizes each component independently within the group before aggregating into a per-token advantage. Harm-adjacent benign trajectories sit in the RL mixture, so safety and over-refusal are coupled into every gradient step rather than balanced post-hoc.

Reward components:

ComponentGrounded inSignal
R_jb<STATE>jailbreak-score accuracy
R_con<ANSWER>behavioral consistency: the generated response checked against the ground-truth action
R_cue<STATE>cue-set agreement

A structural gate (R_struct) floors the reward at -2.0 when the output does not parse as a well-formed STATE/ANSWER pair.

HyperparameterValue
Advantage estimatorGDPO, norm_adv_by_std_in_grpo=False
Reward weights (R_jb, R_con, R_cue)0.6, 0.6, 0.4
LoRA rank / alpha32 / 64 (q,k,v,o,gate,up,down)
Learning rate1e-5
KL loss coefficient0.03
Entropy coefficient1e-3
Train batch / PPO mini / micro per GPU64 / 32 / 2
Rollouts per prompt, temperature8, 0.9
Max prompt / response length16384 / 3072
JudgeQwen3-8B-AWQ (4-bit), vLLM, temperature 0
Hardware4x H100 80GB

Evaluation

All numbers are from the TRACE paper (Table 2 and Table 3). Every model in the comparison, TRACE included, is built on Llama-3.1-8B-Instruct. TRACE-SFT is the stage-1 ablation — this model without the RL stage; TRACE-GRPO is this checkpoint.

Behavior-level attack success rate (ASR, %) across seven multi-turn attack frameworks; lower is better. FITD and AMA are held-out attacks, not represented in the training corpus.

DefenseX-TeamingCrescendoActorAttackCoAICONFITDAMAAvg
Llama-3.1-8B-Instruct (undefended)90.874.245.098.386.780.848.374.9
Self-Reminder-MT71.725.811.770.861.740.825.244.0
LLaMA-Guard-3-MT89.249.120.894.270.025.836.555.1
X-Guard58.328.319.279.265.037.523.344.4
Red-Queen-Guard30.820.89.245.880.047.528.337.5
NBF-LLM85.860.07.587.47.574.231.750.6
STAIR44.210.010.042.569.224.220.031.4
TRACE-SFT38.340.818.339.22.535.029.229.0
TRACE-GRPO (this model)20.814.24.221.71.720.019.214.5

Lowest ASR on six of the seven attacks, and less than half the average ASR of the strongest baseline (14.5 vs 31.4).

Over-refusal — full-compliance rate (%) on benign prompts; higher is better.

DefensePHTestXSTestAvg
Llama-3.1-8B-Instruct (undefended)93.292.893.0
Self-Reminder-MT59.462.861.1
LLaMA-Guard-3-MT88.692.090.3
X-Guard83.391.687.5
Red-Queen-Guard71.186.478.8
NBF-LLM82.592.487.5
STAIR44.162.053.1
TRACE-SFT85.894.490.1
TRACE-GRPO (this model)93.093.693.3

This is the axis where multi-turn defenses usually pay: the next-best defense by ASR (STAIR, 31.4) complies with only 53.1% of benign prompts, while TRACE-GRPO matches the undefended model's compliance (93.3 vs 93.0) at less than half that ASR.

General capability (%), base vs. the two TRACE stages:

BenchmarkLlama-3.1-8B-InstructTRACE-SFTTRACE-GRPO
ARC-Challenge (25-shot)81.180.780.6
BBH (3-shot CoT)61.569.568.2
GSM-8K (0-shot)81.179.279.6
HellaSwag (10-shot)80.077.878.1
MMLU-Pro (5-shot CoT)43.844.843.5

Single-turn robustness under AutoDAN-Turbo, a strong single-turn attacker that discovers jailbreak strategies autonomously (a length-1 trajectory under the TRACE formulation). ASR@k is over k independent attempts — lower is better; Avg. Attempts to jailbreak per behavior — higher is better.

TargetASR@3ASR@5ASR@10Avg. attempts
Llama-3.1-8B-Instruct67.581.790.83.5
+ TRACE-GRPO (this model)11.721.738.38.0

Trajectory-aware reasoning does not cost single-turn robustness — it more than doubles the attacker effort per successful jailbreak.

Citation

@article{miah2026trace,
  title   = {TRACE: Trajectory Aware Reasoning for Multi-Turn Adversarial Conversation Evaluation},
  author  = {Miah, Md Messal Monem and Anika, Adrita and Yu, Zhiyuan and Huang, Ruihong},
  journal = {arXiv preprint arXiv:2608.15594},
  year    = {2026}
}

Use of this model is subject to the Llama 3.1 Community License.

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей