All Use Cases

Content Moderation

A controlled synthetic benchmark reported 91.5% accuracy and a 41ms batch-average time per item for content moderation.

The Challenge

Every platform with user-generated content faces the same dilemma: moderate too aggressively and you silence legitimate users; moderate too loosely and you expose your community to harm.

The technical challenge has several parts. Content moderation needs to be:

  • Fast — Users expect instant feedback when they post. A 500ms moderation delay feels broken.
  • Accurate — False positives drive users away. False negatives create liability.
  • Nuanced — Keyword filters can't distinguish "I'll kill it in the presentation" from an actual threat. Sarcasm, slang, coded language, and cultural context all matter.
  • Affordable at scale — Every message, every comment, every post needs moderation. At 100K+ items per day, per-call pricing adds up fast.

Rules catch explicit policy constraints but long keyword lists struggle with context. Direct LLM calls can handle nuance, but each request adds model latency, token usage, and a provider dependency. The right comparison uses your actual prompt, traffic, and error costs.

How Sparkient Solves It

Sparkient's compiled decision pipeline gives you a policy-specific model whose quality and latency can be measured before integration.

The Three-Stage Pipeline

  1. CEL Rules (<1ms) — Instant handling of blocklists, allowlists, and hard policy constraints. New accounts posting links? Auto-review. Known spam domains? Auto-reject. Established users with clean history? Lower scrutiny threshold.

  2. Compiled Classifier (<100ms target) — A compiled model trained on policy examples generated by an LLM teacher or supplied by you. It can learn patterns represented in the data; verify difficult language and every consequential class on a held-out set.

  3. Optional LLM Escalation — Low-confidence cloud decisions can call an LLM. Its latency depends on the model, prompt, provider, and retries; measure and tune the rate because escalated requests have a different credit profile.

What Makes This Different

Your moderation policy isn't the same as everyone else's. A gaming platform tolerates competitive trash talk. A children's education app doesn't. A financial forum needs to catch pump-and-dump schemes. A healthcare community needs sensitivity around self-harm.

Sparkient trains a model on your policy. You define what "approve," "review," and "reject" mean for your platform. The LLM teacher generates training data that matches your specific guidelines. The compiled model enforces them.

Code Example

python
import httpx

# Moderate a piece of content
response = httpx.post(
    "https://api.sparkient.ai/api/v1/decide",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "decision_type": "content-moderation",
        "input": {
            "text": "You're absolutely garbage at this game, uninstall already",
            "user_id": "player_789",
            "account_age_days": 45,
            "previous_violations": 1
        }
    }
)

result = response.json()
# {
#     "decision": "review",
#     "confidence": 0.82,
#     "latency_ms": 38,
#     "stage": "classifier"
# }

For offline or edge deployment:

python
from sparkient_edge import EdgePredictor

predictor = EdgePredictor.from_bundle("moderation.zip")
result = predictor.predict({"text": "Free money! Click here now!!!"})
# Inspect result.decision, result.confidence, and result.stage

Benchmark Results

| Metric | Sparkient Compiled Model | Best ML baseline | |--------|--------------------------|------------------| | Macro F1 | 0.900 | 0.606 | | Accuracy | 91.5% | 67.9% | | Average time per item in the batched run | 41ms | Not reported |

The runner did not measure per-request p95. On this synthetic noisy-data benchmark, the compiled model beat the best traditional ML baseline by 29.4 F1 points. This is not a customer-production result or a universal comparison with a live LLM.

Get Started

Define your moderation policy, train a compiled model, and test it against representative held-out cases. Start with the free tier — 5,000 one-time credits, no credit card required.

Import this template

Start with a small evaluation. Import a decision type, customise it, and test it on representative cases.

Import Template