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

1·GitHub repo

agent-decision-firewall

chinna250801

Gates AI agent actions with a local Laya decision model and fail-closed rules

1·GitHub repo

omnia-news

Omniaeye

Filters source content with OMNIA Laya and records evidence-backed feed decisions

1·GitHub repo

laya-local-guard

Kamandlou

Classifies content for safety risks locally with Laya-MLX and detects PII and secrets

1·GitHub repo

order-risk-management-laya

Shariful-Islam-Sourav

Analyzes e-commerce orders for fraud risk using Laya’s typed-decision engine

1·GitHub repo

sample.laya

hamedhajiloo

Demonstrates C# workflows for Laya typed decisions, including triage and prompt-injection screening

1·GitHub repo

laya-triage

elnachto

A GitHub Action uses local Laya decisions to label issues and pull requests and flag spam

1·GitHub repo
A

laya-zerogpu

afen0768

Runs Laya checkpoints on ZeroGPU for typed decisions over text or JSON

1·HF Space

laya-moderation

vinay162

Fine-tunes Laya for toxic-comment moderation and publishes a demo and API

1·GitHub repo

laya-phishield

Gjusev

Combines Laya-based semantic signals with deterministic checks to explain phishing email classifications

1·GitHub repo

SafeSphere.ai

akshayvibe

Detects harassment and stalking locally in social and email services using Laya via ONNX

1·GitHub repo

safe-laya

ottosulin

Fine-tunes Laya to classify prompt injections, jailbreaks, harmful requests, and benign text

1·GitHub repo

oficina-guardrails

rynalde

Screens assistant inputs with rules and Laya decisions to block, review, or allow text

1·GitHub repo
O

Laya-Arabic-Demo

oddadmix

Demonstrates an Arabic Laya decision model for safety labels, custom categories, yes/no questions and lane choices

1·HF Space
U

@ursuciprian/reflex

ursuciprian

Gates coding-agent commands and scans content for prompt injection using local rules, Jev, or Laya

576·npm package
I

pi-laya-guardrails

izolight

A Pi extension sends prompts and tool calls to a local Laya guardrail server

282·npm package
D

modsure

davespace

Moderates user-written content against site rules using Jev or a loaded Laya client

129·npm package
A

grids-laya-permission-v1-compact

AtharvaThorat

Provides compact permission-decision training and test data for Laya

0·HF dataset
H

laya-session-guard-risk-ranked-metrics

hxrikp

Publishes metrics from a rejected Laya prompt-injection risk-ranking experiment

0·HF dataset
A

grids-laya-permission-v1

AtharvaThorat

Provides reviewed tool-call permission decisions data for fine-tuning and testing Laya

0·HF dataset

laya-web

nvkudva

Runs a quantized Laya decision model entirely in the browser using ONNX Runtime Web

0·GitHub repo

laya-hermes

pavlealeksic

Adds Laya decision tools, routing hints, and output filtering to the Hermes Agent

0·GitHub repo

laya-ft

Alexander-Ollman

A reproducible study benchmarks Jev against fine-tuned Laya on workflows and chat moderation

0·GitHub repo

laya-email

sreekar2403

Tags Gmail messages locally with five Laya-powered classifications in one pass

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