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-demo

Pepito79

Notebook and script demos of Laya multilingual guardrails in front of an OpenAI chat

0·GitHub repo

elnachto_laya-triage

actions-marketplace-validations

Runs a fine-tuned Laya model in GitHub Actions to classify and triage issues

0·GitHub repo

dsh-auto-review-jev

xlennart

Adds Jev and self-hosted Laya decision API backends to a DeepSeek Harness approval plugin

0·GitHub repo

laya-chat-messages-classification

Facuzer

A chat app that uses Laya to moderate messages, classify sentiment, and fine-tune insult detection

0·GitHub repo

laya-webgpu

TakedaShinken

Runs Laya typed-decision models in browsers with WebGPU and ONNX Runtime Web

0·GitHub repo

naver-laya-mail-triage

KOJH-archive

Classifies Naver email locally with Laya and provides review and triage tools

0·GitHub repo

laya-react

dungdq4

Implements a React demo of Laya's typed decision patterns for routing, filtering, and moderation

0·GitHub repo

gatekeeper

weeklyvillain

A word game and interactive explainer uses Laya multilingual as its AI guard

0·GitHub repo

laya-sec-agent

bsisduck

Governs agent requests and tool execution with policy checks and optional local Laya signals

0·GitHub repo

FastFence

llama-lovers

A local policy gateway uses Laya and other models to assess agent inputs and outputs

0·GitHub repo
M

sentrygate

mnjkshrm

A local Node.js guard that uses Laya to detect prompt injections and redact PII

0·npm package

laya-layer

bsisduck

Enforces policy, budgets, and local semantic checks for agent applications

0·GitHub repo

laya

mes1234

Provides a Python implementation of the multilingual Laya typed-decision model

0·GitHub repo

laya-guardrail

FBR65

Checks text sentence by sentence with Laya before allowing an LLM call

0·GitHub repo

laya-ai-guardian

imranbuttcodes

A Streamlit dashboard uses Laya for content moderation and threat detection

0·GitHub repo

ThunderBird-Laya-Mail-Triage-extension

invince

Classifies and tags incoming Thunderbird mail using a local Laya decision server

0·GitHub repo

surety

ElyasMoshirpanahi

Certifies selective automation thresholds for probabilistic decisions from Laya and Jev

0·GitHub repo

assemble-api

felipeirl

Runs the Assemble app's API server with a Laya guardrail

0·GitHub repo

sintonia

Chere3

Filters YouTube recommendations using time-based profiles and Jev or Laya classification

0·GitHub repo

LayaAI

Abii9443

Evaluates chatbot responses using Laya decision models and supports fine-tuning

0·GitHub repo

pi-laya-auto-classifier

finngreig

Adds a Laya-powered local classification gate for tool calls in the Pi coding agent

0·GitHub repo

harmful-request-classification

zacharyabolton

Experiments compare TF-IDF, DeBERTa, and fine-tuned Laya for harmful-request classification

0·GitHub repo

pi-laya-firewall

r1cc4rd0m4zz4

Adds local Laya-powered policy checks and taint tracking to the Pi Coding Agent

0·GitHub repo

openai-decisions-vs-jev-vs-laya

mateusfonsek

Benchmarks OpenAI Decisions, Jev, and Laya on Portuguese-language decision tasks

0·GitHub repo

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_content MCP tool. Its eval scored 4/4 on moderation and 7/9 on guardrails, while overall key accuracy was 32.5%.
  • laya-mcp (wsargent): laya_moderate and laya_guard tools 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 noul can follow its option labels instead of the text, most strongly on the English checkpoint. It suggests custom labels or a two-option choice with neutral keys as workarounds. Validate on your own data.
  • laya-jev-lab found noul reliable 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 Router or laya-multilingual for 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