/ Модель

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

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

Ammu-1.0-OffOnTopic-Guardrail-tiny

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

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

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

Бенчмарки

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

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

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

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

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

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

Ammu-1.0-OffOnTopic-Guardrail-tiny — компактный классификатор на архитектуре ModernBERT, разработанный для проверки соответствия запроса пользователя системному промпту. Это дообученная версия энкодера jhu-clsp/ettin-encoder-32m с 31,9 млн параметров и контекстом до 7 999 токенов; модель принимает пару текстов и относит запрос к классу «по теме» или «не по теме». Она предназначена для предварительной проверки границ предметной области и маршрутизации запросов в специализированные инструменты, системы поиска или агентные узлы.

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

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

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

Ограничения

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

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

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

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

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

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

Открыть на Hugging Face

Ammu-1.0-OffOnTopic-Guardrail-tiny

Off On Topic Guardrail Classifier | ModernBERT Architecture | 32M Parameters | 90.87% Macro-F1

Overview

Ammu-1.0-OffOnTopic-Guardrail-tiny is an ultra-lightweight, high-speed 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 90.87% 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 +8.92% and +11.75% Macro-F1 points respectively, with an ultra-compact 32M parameter footprint engineered for sub-3ms edge and microservice deployments.

Quantized (INT8) Model

Key Features

  • High Performance: Achieves a 90.87% overall Macro-F1 score (95.74% Easy, 89.66% Medium, 90.19% Hard), 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 32M parameters, offering minimal memory overhead and fast CPU/GPU 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-3ms 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-tiny",
    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 reverse a string without using in-built function 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 reverse a string without using in-built function in Python 3.12?
Prediction : On-Topic (Confidence: 0.9877)

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

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

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

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.9997)
"""

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-tiny32M95.7489.6690.1990.87
Ammu-1.0-OffOnTopic-Guardrail-small68M96.3788.9389.4490.35
Ammu-1.0-OffOnTopic-Guardrail-nano17M91.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-tinyHugging Face95.7489.6690.1990.87
DeepSeek V4 Flash 0731DeepInfra96.8375.8881.4281.95
GPT-6-lunaOpenAI95.3971.6379.1279.12

Key Takeaway: Ammu-1.0-OffOnTopic-Guardrail-tiny (32M) outperforms DeepSeek V4 Flash 0731 by +8.92% and GPT-6-luna by +11.75% overall Macro-F1. The performance difference is especially pronounced on Medium (+13.78% over DeepSeek, +18.03% over GPT-6) and Hard (+8.77% over DeepSeek, +11.07% over GPT-6) boundary queries, while running with sub-3ms 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-tiny-2026,
  title = {Ammu-1.0-OffOnTopic-Guardrail-tiny: 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-tiny}
}

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей