/ Модель

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

Лицензия
Apache 2.0
Базовая модель
prompt-injection-guard-small
Библиотека
gguf
Опубликована
14 ноя 2026

prompt-injection-guard-small-ft-gguf

Классификация текстаТекст → label5 профессий

Мультиязычный классификатор keepmum на базе mmBERT-small выявляет prompt injection в содержимом, получаемом coding-агентами.

122скачиваний за 30 дней0лайковвеса обновлены14 ноя 2026

Бенчмарки

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

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

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

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

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

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

Это мультиязычный классификатор prompt injection и jailbreak, созданный keepmum на основе Prompt Injection Guard Small v2.3 от Horizon Labs. Модель дополнительно дообучена на результатах инструментов coding-агентов, а веса доступны в формате GGUF Q8_0 для запуска через llama.cpp. Архитектура — mmBERT-small с 141 млн параметров и mean pooling; модель относит текст к классам SAFE и INJECTION.

Модель предназначена для проверки содержимого, полученного агентом из файлов, веб-страниц, ответов MCP и вывода команд. В тестах автора дообученная версия лучше исходной обнаруживала атаки в отдельных наборах результатов инструментов и файлах репозиториев, сохраняя близкую долю срабатываний на обычном выводе инструментов. Для длинных текстов автор рекомендует оценивать окна до 2048 токенов и брать максимальную вероятность INJECTION; перед токенизацией требуется нормализовать текст, иначе некоторые невидимые символы могут скрыть инструкции. Это результаты собственного бенчмарка автора, а не гарантия качества на новых атаках.

Модель выпущена под лицензией Apache-2.0. Она может чаще исходной помечать обычный текст как подозрительный, пропускает некоторые атаки в коде и конфигурациях, а порог классификации нужно подбирать отдельно: для этой версии автор рекомендует значения около 0,2–0,3.

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

  • проверка вывода команд перед передачей его coding-агенту
  • поиск prompt injection в файлах репозитория
  • проверка содержимого веб-страниц для ИИ-агентов
  • анализ ответов MCP на внедрённые инструкции
  • классификация текста на безопасный и содержащий prompt injection

Ограничения

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

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

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

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

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

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

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

Открыть на Hugging Face

Prompt Injection Guard Small, keepmum fine-tune (v2.3-km1), GGUF

This is a fine-tuned version of Prompt Injection Guard Small v2.3 by Horizon Labs, as a GGUF for llama.cpp. keepmum modified the model by training it further on coding-agent tool output. It is not made, affiliated with, or endorsed by Horizon Labs. For the original model, its training data and its limitations, see Horizon Labs' model card.

keepmum, a local privacy proxy for coding agents, uses it for its optional check of tool results (files, web pages, MCP replies, command output) for instructions planted for the agent. The unmodified conversion is at keepmum/prompt-injection-guard-small-gguf.

File

FileSizeSHA-256
prompt-injection-guard-small-v2.3-km1.Q8_0.gguf164,357,760 bytes306b1bf5062ef25b0508c26bc3431318cd3d594f9c3c10b248c19a9e5e566926

Same architecture, tokenizer, labels (SAFE, INJECTION) and size as the original: mmBERT-small, 141M parameters, mean pooling.

What changed

The original catches attacks in documents well, but missed many in agent tool output. On AgentDojo's tool outputs and on prodnull's repository files it caught a minority at keepmum's settings. It was trained further for one run of 648 steps (2 epochs, learning rate 2e-5 with 6% warmup and linear decay, AdamW, weight decay 0.01, about 32,000 tokens per step, 2,048-token windows), from Horizon Labs' weights at commit 2efc2ed5, on an Apple M5 Pro.

Training data

25,555 examples, half injected. Data building: bench/ft_data.py; training: bench/ft_train.py.

PartSource (licence)Label
Tool results from coding-agent sessions, whole and as short fragmentsSWE-chat (ODC-BY), SWE-Hero OpenHands trajectories (CC BY 4.0)benign
The same tool results with a planted instruction (payloads built from goals, framings and wrappers, at the start, middle or end; 8% in other languages, 5% base64)built from the rows aboveinjected
AgentDojo's banking and slack suites, with and without its attacksAgentDojo 0.1.34 (MIT)both
MCP tool lists, half with one description poisoned; issue-style bug reports, half with a payloadwritten for thisboth
Agent instruction files, install guides, prompt templates in code, writing about attackswritten for thisbenign
Replay of the original's public training setsneuralchemy (Apache-2.0), S-Labs (MIT), deepset (Apache-2.0)both

Kept out of training, for the test: SWE-chat sessions and SWE-Hero shards that keepmum's benchmark reads, AgentDojo's travel and workspace suites, and all of InjecAgent, LLMail-Inject, CodeIPI, prodnull and keepmum's hand-written set. Training texts equal to a test text were dropped.

Evaluation

keepmum's public benchmark (bench/guard_public.py), as keepmum runs the model: 2,048-token windows, the highest window's P(INJECTION), and a higher threshold for tool results under 200 characters. Each model is at keepmum's Medium setting, where it flags the same share of 2,000 real Claude Code, Codex and Gemini CLI tool results (SWE-chat): 1.7% for the original, 1.5% for this one. Only documents kept out of training are counted.

Original (0.8; 0.995 under 200 characters)This model (0.222)
AgentDojo, travel and workspace suites (511 attacks)80.8%91.4%
prodnull repository files (2,432 attacks)25.0%49.5%
InjecAgent (600)75.5%75.2%
LLMail-Inject phase 2 (600)*98.2%98.7%
CodeIPI (35)48.6%40.0%
keepmum's hand-written set (144 attacks)140140
SWE-Hero tool output flagged (753)0.9%1.7%
prodnull benign files flagged (1,690)0.4%1.7%
Security writing and code that quotes attacks, flagged5%3%

* LLMail-Inject is in the original's training data.

  • AgentDojo's test suites use the same seven attack templates as its training suites, with other tasks and tool outputs: that score is easier than new attacks would be. The other sources were not used in training at all.
  • It loses three CodeIPI attacks (injections in issues, code comments and configs) and flags a little more ordinary tool output and repository files than the original.
  • Its scores sit lower than the original's: use thresholds near 0.2–0.3, not 0.65–0.98.
  • Full results: bench/results/GUARD.md.

The benchmark was put together by one author, and its hand-written part is small. Treat these figures as a comparison between the two models, not as how well either detects injections in general.

Conversion

Converted with llama.cpp's convert_hf_to_gguf.py at commit 8642541b and quantized to Q8_0, with the same adjustments as the unmodified conversion (tokenizer read as mmBERT's, pre-tokenizer in mmBERT's form, rank pooling with a 2-wide output). Script: bench/horizon_gguf.py --model injection-ft. In llama-server with keepmum's normalizer and windows, it scores keepmum's hand-written holdout as the fine-tuned weights do in PyTorch (AUC 0.992, recall 0.979, no false alarms); 4 of 472 verdicts differ, all within 0.03 of the threshold.

Normalize the text first

The model's tokenizer normalizes text before the model sees it, and llama.cpp does not. Without it, instructions hidden in invisible characters go unread. Apply it before tokenizing, in this order:

  1. Decode smuggled text: Unicode tag characters U+E0020–E007E to ASCII (subtract 0xE0000), and variation selectors U+E0110–E016E to ASCII (subtract 0xE00F0).
  2. NFKC.
  3. Remove invisible and formatting characters.
import re, unicodedata

SMUGGLED = {cp: chr(cp - 0xE0000) for cp in range(0xE0020, 0xE007F)} | {cp: chr(cp - 0xE00F0) for cp in range(0xE0110, 0xE016F)}
INVISIBLE = re.compile("[\xad᠎​-‏‪-‮⁠-⁤⁦-⁩︀-️"
                       "\U000e0000-\U000e007f\U000e0100-\U000e01ef̱̅-̸⃐-⃿]")

def normalize(text: str) -> str:
    return INVISIBLE.sub("", unicodedata.normalize("NFKC", text.translate(SMUGGLED)))

Use with llama.cpp

llama-server -m prompt-injection-guard-small-v2.3-km1.Q8_0.gguf --embedding -c 2048 -ngl 99
curl -s localhost:8080/embeddings -H 'content-type: application/json' \
  -d '{"content": ["<tool result text>"], "embd_normalize": -1}'

embd_normalize: -1 returns the raw logits for [SAFE, INJECTION]; their softmax gives P(INJECTION). The server adds <bos> and <eos> around a text input. For a longer text, tokenize it with /tokenize ("add_special": false) and score windows of 2,048 tokens (keepmum overlaps them by 256) and take the highest.

Licence

Apache-2.0 (LICENSE). Horizon Labs' NOTICE, with the MIT notice of the base model mmBERT-small, is included unchanged. Modifications by keepmum: the further training described above, and the conversion to GGUF. The training data's licences are in the table above; SWE-chat (ODC-BY) and SWE-Hero (CC BY 4.0) are credited to their authors, SALT-NLP and NVIDIA.

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

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

GPU в ailist

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

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

GGUF-веса поддерживаются только для текстовых LLM (llama.cpp).

Ревизия весов
5f2c815

0 моделей