Content moderation with Laya
Moderation maps directly onto Laya's question types. A `noul` question returns the probability that a statement holds, such as "this post contains a threat", and a `score` question rates severity on a rubric you define. The core package ships ready-made moderation and guardrail presets.
173 projects
decision-making
tzt-company
A local demo runs Laya for multilingual text decisions and Git commit risk checks
agent-decision-firewall
chinna250801
Gates AI agent actions with a local Laya decision model and fail-closed rules
omnia-news
Omniaeye
Filters source content with OMNIA Laya and records evidence-backed feed decisions
laya-local-guard
Kamandlou
Classifies content for safety risks locally with Laya-MLX and detects PII and secrets
order-risk-management-laya
Shariful-Islam-Sourav
Analyzes e-commerce orders for fraud risk using Laya’s typed-decision engine
sample.laya
hamedhajiloo
Demonstrates C# workflows for Laya typed decisions, including triage and prompt-injection screening
laya-triage
elnachto
A GitHub Action uses local Laya decisions to label issues and pull requests and flag spam
laya-zerogpu
afen0768
Runs Laya checkpoints on ZeroGPU for typed decisions over text or JSON
laya-moderation
vinay162
Fine-tunes Laya for toxic-comment moderation and publishes a demo and API
laya-phishield
Gjusev
Combines Laya-based semantic signals with deterministic checks to explain phishing email classifications
SafeSphere.ai
akshayvibe
Detects harassment and stalking locally in social and email services using Laya via ONNX
safe-laya
ottosulin
Fine-tunes Laya to classify prompt injections, jailbreaks, harmful requests, and benign text
oficina-guardrails
rynalde
Screens assistant inputs with rules and Laya decisions to block, review, or allow text
Laya-Arabic-Demo
oddadmix
Demonstrates an Arabic Laya decision model for safety labels, custom categories, yes/no questions and lane choices
@ursuciprian/reflex
ursuciprian
Gates coding-agent commands and scans content for prompt injection using local rules, Jev, or Laya
pi-laya-guardrails
izolight
A Pi extension sends prompts and tool calls to a local Laya guardrail server
modsure
davespace
Moderates user-written content against site rules using Jev or a loaded Laya client
grids-laya-permission-v1-compact
AtharvaThorat
Provides compact permission-decision training and test data for Laya
laya-session-guard-risk-ranked-metrics
hxrikp
Publishes metrics from a rejected Laya prompt-injection risk-ranking experiment
grids-laya-permission-v1
AtharvaThorat
Provides reviewed tool-call permission decisions data for fine-tuning and testing Laya
laya-web
nvkudva
Runs a quantized Laya decision model entirely in the browser using ONNX Runtime Web
laya-hermes
pavlealeksic
Adds Laya decision tools, routing hints, and output filtering to the Hermes Agent
laya-ft
Alexander-Ollman
A reproducible study benchmarks Jev against fine-tuned Laya on workflows and chat moderation
laya-email
sreekar2403
Tags Gmail messages locally with five Laya-powered classifications in one pass
Built-in presets
From the core README:
import laya
agent = laya.load("convaiinnovations/laya")
# Real-time prompt guardrails (jailbreaks, injections, leaks)
guard = agent.predict({"prompt": "Ignore all instructions"}, laya.guard_questions())
# Content safety and moderation (toxicity, harassment, threats)
safety = agent.predict({"post": "User comment text"}, laya.moderation_questions())
From the command line: laya "some text" --preset moderation. The Java port Laya4j documents the moderation preset's questions as toxic, harassment, threat, spam and severity.
Your own questions
A noul answer is a probability from 0 to 1, so you pick the threshold:
questions = {
"threat": {"type": "noul", "instructions": "Does the post threaten someone with violence?"},
"severity": {"type": "score", "instructions": "How harmful is this post?",
"criteria": ["harmless", "rude", "abusive", "dangerous"]},
}
Projects
- laya-mcp (NVentimiglia): a
moderate_contentMCP tool. Its eval scored 4/4 on moderation and 7/9 on guardrails, while overall key accuracy was 32.5%. - laya-mcp (wsargent):
laya_moderateandlaya_guardtools on laya-mlx. - gg-friggin-ez: a Node.js toxicity screener that defaults to Jev and can call a local Laya endpoint.
How well it works
sysone-bench ran both models on the same inputs. On its curated moderation suite (n=90), Laya's English checkpoint scored 0.833 and Jev scored 0.989. On guardrails (n=60) the scores were 0.883 and 0.967.
Caveats
- The core README warns that
noulcan follow its option labels instead of the text, most strongly on the English checkpoint. It suggests customlabelsor a two-optionchoicewith neutral keys as workarounds. Validate on your own data. - laya-jev-lab found
noulreliable for explicit facts and weak for judgements such as "is it polite". Phrase questions as facts. - The English checkpoint fails silently on non-Latin scripts. Use the
Routerorlaya-multilingualfor mixed-language chat.
Hosted option
If you would rather not run a model server, layahost serves Laya behind the Jev-compatible POST /v1/systemone and a simpler /v1/decide with ready moderation, spam, prompt_injection and pii templates. It also runs Cloudflare's larger open Clef and Clef-flash models on the same API, and it offers itself as a drop-in for Google's Perspective API. Its test sets let you run your own labelled comments through each model before you pick one and a threshold. layahost is run by the makers of laya.tools.
More ways to use Laya