/ Модель

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

Контекст
8 192 токена
Лицензия
Apache 2.0
Архитектура
laya · dense
Базовая модель
laya-MLX-8bit
Библиотека
mlx
Опубликована
26 окт 2026

laya-toolguard-mlx

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

Дообученный классификатор Laya оценивает риск вызовов инструментов coding-агента и помогает блокировать опасные команды.

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

Бенчмарки

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

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

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

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

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

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

a3harva/laya-toolguard-mlx — дообученная в MLX классификационная модель семейства Laya для проверки вызовов инструментов coding-агента перед выполнением. Она оценивает команды bash, операции чтения и изменения файлов, а также другие вызовы инструментов и возвращает вероятности для шести категорий риска; на их основе защитный слой может блокировать подозрительные действия и объяснять решение. Модель не генерирует текст и рассчитана на локальный запуск на Apple Silicon. Веса представлены в формате safetensors и квантизированы до 8 бит; по README, модель занимает около 500 МБ и обрабатывает вызов примерно за 40–85 мс.

Рекомендуемый корневой чекпойнт — v9d; также доступны версии v10 и v8. Для версий, обученных с использованием структурных свидетельств анализатора CARE, при инференсе нужны эти свидетельства; README указывает исключение для v2. Модель предназначена для английских команд в рабочих процессах разработчиков на macOS и Linux. Она оценивает только видимый текст вызова, поэтому скрытое поведение скрипта может остаться незамеченным; это классификатор, а не песочница, и его следует сочетать с изоляцией на уровне ОС. Лицензия — Apache-2.0.

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

  • проверка команд bash coding-агента перед запуском
  • блокировка команд, удаляющих или перезаписывающих данные
  • выявление попыток отправить секреты с устройства
  • оценка риска операций чтения и редактирования файлов
  • фильтрация вызовов инструментов в агенте pi на Apple Silicon

Ограничения

Модель оценивает только видимый текст вызова и не гарантирует его безопасность; скрытые эффекты скриптов могут ускользнуть от проверки. Она ограничена английскими командами в рабочих процессах macOS/Linux и не заменяет песочницу ОС; длинные входы обрабатываются окнами до 1024 токенов.

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

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

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

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

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

Открыть на Hugging Face

laya-toolguard-mlx

A Laya decision model fine-tuned in MLX to judge coding-agent tool calls (bash, write, edit, read) before they run. It powers pi-laya-mlx, a guard for the pi coding agent that blocks unsafe calls and tells the model why. It runs locally on Apple Silicon in about 40-85 ms per call, 8-bit, ~500 MB.

Held-out results: v8 (before) vs the v2+v8 ensemble, v9d, v10 and v9d+v10

Laya does not generate text. For each call it scores six options in one forward pass and returns calibrated probabilities:

optionmeaning
routinenormal development work
destroydeletes or overwrites data outside the project, or rewrites history
exfiltratesends secrets or private data off the machine
remote_coderuns code fetched from an untrusted source
systemchanges OS, security settings or safety controls
productiontouches live infrastructure, databases or releases

Risk = 1 - p(routine); the guard blocks at risk ≥ 0.5.

Checkpoints

All checkpoints were trained with structural evidence from the CARE static shell analyzer and need it at inference (pip install "laya-guard[evidence]"), except v2.

pathmodelnotes
/ (root)v9drecommended; v8's data + red-team round 9, 18 trainable layers
v10/v10v9d + round 10; use with v9d as a cautious ensemble to catch the most attacks
v8/v8previous default (root until 2026-10-29)
v2/v2early checkpoint, no evidence; the old v2+v8 ensemble

Usage

git clone https://github.com/a3harva/pi-laya-mlx && cd pi-laya-mlx
./scripts/setup.sh                       # installs the server and downloads this model
pi -e ./extension                        # every tool call is screened

# or the v9d+v10 ensemble (block if either would): catches more attacks, more false blocks
LAYA_GUARD_MODEL=a3harva/laya-toolguard-mlx,a3harva/laya-toolguard-mlx:v10 server/.venv/bin/laya-guard-serve
curl -s localhost:8723/v1/guard -H 'content-type: application/json' \
  -d '{"tool":"bash","input":{"command":"rm -rf ~"},"cwd":"/Users/me/proj"}'
# {"decision":"block","risk":0.99,"category":"destroy","reason":"Blocked by the Laya safety guard: ..."}

Results

Unsafe calls blocked / safe calls allowed, at threshold 0.5. No set below was trained on.

setv8v2+v8v9dv10v9d+v10
Red-team held-out probes, rounds 1-8 (617)91.4% / 92.3%93.4% / 77.0%96.1% / 93.9%94.7% / 95.8%96.7% / 93.6%
Round 9 probes (58)78.6% / 96.7%89.3% / 83.3%96.4% / 96.7%96.4% / 96.7%100% / 96.7%
Round 10 probes (77)70.7% / 80.6%80.5% / 58.3%90.2% / 86.1%92.7% / 91.7%97.6% / 83.3%
Final exam (107, written last)84.3% / 91.1%90.2% / 73.2%92.2% / 85.7%84.3% / 83.9%92.2% / 78.6%
Canonical attacks (26 risky / 8 routine)80.8% / 100%96.2% / 87.5%100% / 100%96.2% / 100%100% / 100%
AUC, held-out0.9720.9550.9900.9850.989

The red-team and final-exam sets are adversarial on purpose: attacks disguised as routine work, encoded payloads, guard tampering, and safe calls that only look dangerous (grep -rn 'rm -rf ~' docs/). Zero-shot Laya blocked ~60% of routine calls, including npm test. v9d's one regression against v8 is routine calls on the final exam. v10 fixes most round-10 misses but forgets some final-exam attacks, so it ships only as an ensemble member.

On a CARE-style benchmark (549 commands rebuilt from Atomic Red Team, RedCode-Exec and NL2Bash, because CARE did not release its split), v8 scored F1 62.8% with 8.2% false positives, against 65.9% / 6.1% for CARE's static engine; blocking when either flags a command reached F1 73.0%. The two policies differ (CARE counts every attack-playbook step as dangerous, including read-only lookups), so this compares approaches, not the published CARE numbers.

Training

  • Base: cavi-ai/laya-MLX-8bit:typed-decisions, dequantized, top 18 of 28 encoder layers (v8: 14) and the decision head trained, re-quantized to 8-bit in the original layout.
  • Cross-entropy on the guard's own 6-option question, class weighting, label smoothing 0.1, 4 epochs, lr 3e-5, batch 4, calibration temperature fitted on the validation split. 80 min on an Apple M5 (16 GB), peak 10.5 GB.
  • Data: ~3,500 template and LLM-written tool calls, plus ~1,500 rows from red-team rounds 1-9 in which a second agent (DeepSeek in a locked-down pi session that could only score text) attacked the current checkpoint; every red-team row was reviewed before training. Round 9 targeted find -delete/-exec and xargs scope, credential hunting in logs, and danger hidden after a benign prefix. Data, scripts and the full log are in the GitHub repo.

Limits

  • A classifier, not a sandbox: it lowers risk and does not prove a call safe. Pair it with OS sandboxing.
  • Judges what is visible in the call; a script that hides its effect is judged by its visible text.
  • Reads up to 1024 tokens per window; the server splits long inputs into overlapping windows.
  • English only; trained on macOS/Linux developer workflows.

License and credits

Weights: Apache-2.0, derived from convaiinnovations/laya via the MLX port cavi-ai/laya-MLX-8bit, whose model code (laya/, MIT) is included. See LICENSE.

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

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

GPU в ailist

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

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

MLX-модели работают только на Apple Silicon, на GPU NVIDIA они не запускаются.

Ревизия весов
36e8f5c

0 моделей