/ Модель

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

Контекст
7 999 токенов
Параметры
149 млн
Лицензия
MIT
Архитектура
modernbert · dense
Базовая модель
ettin-encoder-150m
Библиотека
transformers
Опубликована
16 окт 2026

Ammu-1.0-OffOnTopic-Guardrail-base

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

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

55скачиваний за 30 дней1лайквеса обновлены21 окт 2026

Бенчмарки

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

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

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

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

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

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

Ammu-1.0-OffOnTopic-Guardrail-base — англоязычный классификатор-ограничитель от kalyan-ks на базе ModernBERT. Он оценивает запрос пользователя в контексте системного промпта и определяет, относится ли запрос к заданной теме. Модель представляет собой парный cross-encoder на 149 млн параметров с контекстом до 7 999 токенов; доступна в формате safetensors. В README заявлена INT8-квантизация, однако метаданные указывают формат safetensors.

Модель предназначена для предварительной проверки тематической уместности запросов, маршрутизации обращений к специализированным инструментам и фильтрации запросов до генерации ответа. В описанном авторами тесте на 4 008 примерах она показала Macro-F1 91,56%; качество и задержка в других условиях могут отличаться. Для классификации нужен системный промпт вместе с запросом, а точность на многоязычных и смешанных по намерению запросах может быть ниже. Лицензия — MIT.

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

  • Проверка соответствия запроса заданной теме
  • Фильтрация внеполосных запросов перед генерацией ответа
  • Маршрутизация запросов к специализированным инструментам или агентам
  • Проверка тематических границ чат-бота

Ограничения

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

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

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

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

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

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

Открыть на Hugging Face

Ammu-1.0-OffOnTopic-Guardrail-base

Off On Topic Guardrail Classifier | ModernBERT Architecture | 150M Parameters | 91.56% Macro-F1

Overview

Ammu-1.0-OffOnTopic-Guardrail-base is a lightweight cross-encoder guardrail model trained to determine whether an incoming user query is on-topic (On Topic) or off-topic (Off Topic) relative to the assistant's system prompt. It is trained on a diverse, high-quality curated dataset of (system_prompt, user_prompt) pairs spanning 336 specialized domains across 40 major industries.

The model achieves an overall Macro-F1 score of 91.56% on a curated holdout benchmark of 4,008 test instances, substantially outperforming frontier LLMs such as DeepSeek V4 Flash 0731 (81.95%) and GPT-6-luna (79.12%) by +9.61% and +12.44% Macro-F1 points respectively.

Quantized (INT8) Model

Key Features

  • High Performance: Achieves a 91.56% overall Macro-F1 score outperforming frontier LLMs like DeepSeek V4 Flash 0731 (81.95%) and GPT-6-luna (79.12%) across every difficulty tier.
  • ModernBERT Backbone: Built upon the ModernBERT architecture with 150M parameters and provides fast inference.
  • Extensive Domain Taxonomy: Trained on balanced, high-signal data spanning 336 specialized domains, 49 difficulty nuance profiles, 19 prompt interaction formats, 29 user personas, 8 linguistic registers, and 9 tones.
  • Sub-10ms Latency & Zero Token Cost: Provides deterministic upfront filtering with minimal latency overhead, bypassing expensive LLM inference passes for out-of-scope user interactions.

Use Case

  • Upfront Domain Boundary Guardrail: Intercepts off-topic queries, prohibited tasks, and adversarial domain escapes before queries reach expensive LLM generation passes.
  • Semantic Routing for Agentic Workflows: Routes in-scope domain queries to specialized tools, retrieval systems, or agent nodes while gracefully declining irrelevant requests.
  • Cost & Latency Optimization: Prevents wasted computation, token budget exhaustion, and unnecessary database lookups caused by irrelevant or out-of-domain user interactions.

Usage

# First install the Hugging Face transformers library
!pip install transformers torch

from transformers import pipeline

# Initialize the Off On Topic guardrail classification pipeline
classifier = pipeline(
    "text-classification",
    model="kalyan-ks/Ammu-1.0-OffOnTopic-Guardrail-base",
    device=0  # Set to 0 for GPU, or -1 for CPU
)

# Example system prompt defining a dedicated Python programming assistant
system_prompt = (
    "You are an expert Python programming assistant. Your task is to help developers "
    "write, optimize, and debug Python 3 code, explain standard library modules, and review "
    "Python algorithms. Do provide clean code snippets, explain exceptions, and discuss "
    "Python best practices (PEP 8). Don't write code in other languages such as JavaScript, "
    "C++, or Java. Don't answer questions on non-programming topics such as sports, general "
    "cooking, financial investing, or medical advice. Strictly decline any request outside Python programming."
)

# Format input pairs: {'text': system_prompt, 'text_pair': user_prompt}
queries = [
    {
        "text": system_prompt,
        "text_pair": "How do I implement a custom async context manager using contextlib in Python 3.12?"
    },
    {
        "text": system_prompt,
        "text_pair": "Can you configure a Redux store with reducers and middleware in React JavaScript?"
    },
    {
        "text": system_prompt,
        "text_pair": "Why is my multiprocessing Pool hanging when sharing a large NumPy array across workers?"
    },
    {
        "text": system_prompt,
        "text_pair": "What are the health benefits of a Mediterranean diet and how many calories are in olive oil?"
    },
    {
        "text": system_prompt,
        "text_pair": "I'm building a Python accounting tool. Can you advise me on the best tax deduction strategies for small businesses?"
    },
]

# Run guardrail classification inference
results = classifier(queries)

# Display predictions
for query, res in zip(queries, results):
    print(f"User Prompt: {query['text_pair']}")
    print(f"Prediction : {res['label']} (Confidence: {res['score']:.4f})\n")

"""
### Output
User Prompt: How do I implement a custom async context manager using contextlib in Python 3.12?
Prediction : On-Topic (Confidence: 0.8463)

User Prompt: Can you configure a Redux store with reducers and middleware in React JavaScript?
Prediction : Off Topic (Confidence: 0.9876)

User Prompt: Why is my multiprocessing Pool hanging when sharing a large NumPy array across workers?
Prediction : On-Topic (Confidence: 0.9098)

User Prompt: What are the health benefits of a Mediterranean diet and how many calories are in olive oil?
Prediction : Off Topic (Confidence: 0.9419)

User Prompt: I'm building a Python accounting tool. Can you advise me on the best tax deduction strategies for small businesses?
Prediction : Off Topic (Confidence: 0.9986)
"""

Model Evaluation

The model was evaluated on the curated holdout benchmark test set of 4,008 balanced instances from kalyan-ks/off-on-topic-guardrail across three difficulty tiers (Easy: 635, Medium: 1,571, and Hard: 1,802). All models were evaluated under identical conditions in FP32 precision.

Ammu Cross-Encoder Family Leaderboard

ModelParametersEasy Macro-F1 (%)Medium Macro-F1 (%)Hard Macro-F1 (%)Overall Macro-F1 (%)
Ammu-1.0-OffOnTopic-Guardrail-base150M97.1590.7190.3091.56
Ammu-1.0-OffOnTopic-Guardrail-tiny28M95.7489.6690.1990.87
Ammu-1.0-OffOnTopic-Guardrail-small68M96.3788.9389.4490.35
Ammu-1.0-OffOnTopic-Guardrail-nano14M91.7786.5586.3987.31

Comparison with Frontier LLMs

Frontier LLMs were evaluated zero-shot with structured Pydantic outputs with reasoning disabled to benchmark direct classification capability:

ModelProviderEasy Macro-F1 (%)Medium Macro-F1 (%)Hard Macro-F1 (%)Overall Macro-F1 (%)
Ammu-1.0-OffOnTopic-Guardrail-baseHugging Face97.1590.7190.3091.56
DeepSeek V4 Flash 0731DeepInfra96.8375.8881.4281.95
GPT-6-lunaOpenAI95.3971.6379.1279.12

Key Takeaway: Ammu-1.0-OffOnTopic-Guardrail-base (150M) outperforms DeepSeek V4 Flash 0731 by +9.61% and GPT-6-luna by +12.44% overall Macro-F1. The performance difference is especially pronounced on Medium (+14.83% over DeepSeek, +19.08% over GPT-6) and Hard (+8.88% over DeepSeek, +11.18% over GPT-6) boundary queries, while running with sub-10ms latency and zero API cost.

Limitations

  • Cross-Encoder Requirement: The model is a paired cross-encoder that evaluates user_prompt strictly with respect to a provided system_prompt. It cannot classify user queries in isolation without a reference system prompt.
  • Language Scope: The model is trained and evaluated predominantly on English language text; classification performance on multilingual or code-switched inputs may be lower.
  • Complex Mixed Intent: Prompts that deliberately weave permitted and restricted topics into a single complex composite request may present borderline confidence scores and benefit from threshold calibration.

Citation

@misc{ammu-1.0-offontopic-guardrail-base-2026,
  title = {Ammu-1.0-OffOnTopic-Guardrail-base: Off On Topic Guardrail Classification Model},
  author = {Kalyan KS},
  year = {2026},
  publisher = {Hugging Face},
  url = {https://huggingface.co/kalyan-ks/Ammu-1.0-OffOnTopic-Guardrail-base}
}

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей