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
laya-finetuning
mohanvarmaa22
Fine-tunes Laya as a prompt-safety classifier and reports evaluation results
laya-telegram-mod
Romay777
A self-hosted Telegram bot uses Laya or Jev to classify messages for group moderation
canvastty-plugin-assistant
BIackFIame
Adds a CanvasTTY assistant for command review, task triage, and orchestration advice
laya-demo
gen24AI
Demonstrates Laya decision workflows for routing, triage, guardrails, RAG filtering, and moderation
laya-demo
Slothwolf
Demonstrates typed decisions, multilingual routing, triage, guardrails, RAG filtering, and moderation with Laya
laya-classifier
gabe-santana
Screens emails for phishing using Laya, code-based signals, and policy rules
laya-scam-detector
chaceli
Fine-tunes and serves Laya as an ONNX scam-phrase detector with a FastAPI playground
laya-claude-code
anshc022
A Claude Code plugin runs Laya locally for prompt checks, task hints, and typed decisions
testing_arena_jev_vs_laya
Shadowsweep
Compares Jev and Laya in an automated security attack-detection and defense system
ai-sec-lab
shsingh
A Mac-based Kubernetes lab demonstrates prompt-security defenses using Laya and NOVA
layalog
gugaucb
Analyzes streamed logs with Laya decisions to classify severity and suggest mitigations
laya-demo
uulonger
Demonstrates typed Laya decisions for triage, moderation, guardrails, RAG filtering, and routing
laya-scam-detector
LiChace
Detects Chinese and English scam messages with a fine-tuned Laya model in the browser
gmr_golpe_pix
GumerJr
Fine-tunes Laya to detect Pix payment scams and evaluates local CPU inference
laya-guard
PS061188
Evaluates and fine-tunes Laya as a safety guard for commands issued to a coding agent
laya-warden
Gjusev
Combines Laya decisions and deterministic rules to supervise agent tool calls
laya-pii-scanner
martijnvanderkamp
Scans Dutch and English text for personal data using patterns and Laya
laya-prompt-injection-model
sangam14
Notebook that fine-tunes Laya for prompt-injection detection on Apple Silicon
linkedin-bullshit-o-meter
PhunkyBob
A browser extension that classifies LinkedIn posts using Jev or a local Laya server
GLaDOS
bearcut
Routes LLM requests using Laya-based security, intent, and complexity decisions
laya-hate-speech-benchmark
jasontiw
A reproducible benchmark compares Laya hate-speech detection with other classifiers
laya-demo
huggyf
Demonstrates Laya's typed decisions and calibrated probabilities across common workflows
laya-moderation-demo
Vinay57
Scores text for toxicity using a fine-tuned Laya model and exposes moderation endpoints
laya-test
devikaxminds
Tests Laya decision checkpoints on routing, review scoring, and content moderation tasks
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