Prompt guards

Prompt guards

A practical guardrail stack for image prompts that keeps outputs safe, compliant, and on-style—without crushing creativity. Use templates, negative prompts, filters, and moderation to reduce risk while maintaining quality.

Updated

Nov 18, 2025

Cluster path

/style/prompt-guards

Graph links

6 cross-links

Tags
prompt-guards
guardrails
prompt-engineering
negative-prompts
safety-checker
content-moderation
anime
comics
style
stable-diffusion
sdxl
comfyui
family:style
Graph explorer

What are prompt guards?

Prompt guards are structured rules and checks that shape or screen generation requests so outputs stay within policy and brand/style guidelines. For visual models (e.g., Stable Diffusion, SDXL, anime/comic LoRAs), guards reduce unsafe, off-brand, or low-quality results by combining:

  • Prompt-side constraints (templates, negative prompts, style locks)
  • Model-side filters (safety checkers, LoRA allowlists)
  • Pipeline controls (token filters, redaction, seed/CFG bounds)
  • Post-generation moderation (image classifiers, human review)

The best guard systems are layered, automated, and measurable.

Guard types and where they run

  1. Prompt-side
  • Templates: Force required attributes and forbid risky ones (age, nudity, gore, trademarks).
  • Negative prompts: Suppress known failure modes (anatomy errors, off-style artifacts) and disallowed content.
  • Style locks: Constrain composition, palette, and linework to an approved style.
  1. Model-side
  • Safety checker: Block sexual content involving minors, explicit nudity, sexual violence, and other prohibited classes.
  • Allowed LoRA/embeddings: Whitelist vetted assets; block unknown or risky tags.
  • Sampler/CFG bounds: Cap CFG scale and steps to avoid chaotic or hyper-detailed deviations.
  1. Pipeline-side
  • Input scrubbers: Regex/redaction for risky tokens (e.g., underage terms, brand names if disallowed).
  • Token filters: Deny-list/allow-list at tokenizer level; replace with safe synonyms when possible.
  • Metadata guards: Enforce seed ranges, aspect ratios, resolution caps, and watermarking.
  1. Post-generation
  • Image moderation: Classify outputs (e.g., NSFW, minors, gore) and automatically reject or blur.
  • Perceptual checks: Face/age estimators, skin-exposure heuristics, logo/IP detection.
  • Human-in-the-loop: Final review for flagged outputs or high-risk campaigns.

Safe prompt patterns for anime/comic outputs

Use these as starting points and adapt to your style guide.

Pattern: Style-locked character portrait (safe-age explicit)

[style] clean anime portrait, adult character, upper body, neutral lighting, studio background,
consistent line art, balanced proportions, subtle shading, no trademarks

Negative: (worst quality, lowres:1.2), child, minor, young-looking, loli, shota, gore, explicit nudity,
deformed hands, extra fingers, mangled anatomy, watermark, text, logo

Params: CFG 5–7, steps 20–30, 768x1024 max, Euler a/DPM++ 2M Karras

Pattern: Comic panel (non-violent, non-gory)

[style] comic panel, dynamic angle, clean inking, flat colors, SFW action pose, no blood,
no firearms, environment-safe props, caption box empty

Negative: gore, graphic injury, excessive violence, real brand logos, watermark, text artifacts,
multiple faces merged, extra limbs

Pattern: Background/scene (brand-safe)

[style] scenic background, daytime, public plaza, no people, soft palette, high legibility,
no signage, no text, no logos

Negative: crowd, faces, text, signboards, brand marks

Tip: Make "adult" (or "over 21") a required attribute for any human-like subject if your policy mandates it. Pair with an age classifier post-check.

Reference negative prompt sets

Maintain curated, audited sets instead of ad-hoc strings. Example SFW baseline:

  • Content: child, minor, young-looking, loli, shota, explicit nudity, sexualized, fetish, gore, graphic injury, self-harm
  • Quality: worst quality, lowres, jpeg artifacts, oversharpen, watermark, signature, text, logo
  • Anatomy: deformed hands, extra fingers, fused limbs, malformed, cross-eye, asymmetry

Version these lists, log changes, and A/B test their impact on quality and rejection rates.

Workflow: a practical guard stack (Stable Diffusion / ComfyUI)

  • Input stage: Validate prompt against deny/allow lists; redact risky tokens; auto-insert required attributes (e.g., "adult", "SFW").
  • Prompt construction: Apply approved template + project-specific style lock + baseline negative set.
  • Generation bounds: Enforce sampler whitelist, steps 20–35, CFG 4–8, size ≤ 1024 on longest side.
  • Asset control: Only load vetted models/LoRAs/embeddings; block user-supplied unknowns.
  • Safety check: Enable safety checker; set conservative thresholds for minors, nudity, gore.
  • Post checks: Run NSFW/minor/gore classifiers; logo/text detectors when brand safety matters.
  • Review: Auto-approve clean results; route flagged items to human review; store metadata and hashes.
  • Logging: Capture prompt, negatives, seeds, model hash, classifier scores for audits.

Tuning quality without weakening safety

  • Prefer targeted negatives over giant catch-alls; test removal impact before deploying.
  • Reduce CFG if outputs overshoot style; increase steps modestly for cleaner linework.
  • Use style-specific LoRAs at low weights (e.g., 0.6–0.8) to maintain consistency without mode collapse.
  • Add positive guidance for anatomy and composition instead of only stacking negatives.
  • Calibrate classifier thresholds per style (anime vs photoreal can bias detectors).

Troubleshooting common failures

  • Age ambiguity flags: Strengthen "adult" descriptors, increase clothing coverage terms, lower skin-exposure in positives; keep post-age classifier strict.
  • Text/logos creeping in: Add "no text, no logos" to positives; include watermark/text negatives; run OCR-based post check.
  • Anatomy errors: Add specific anatomy positives (clean hands, five fingers), keep deformed/extra-finger negatives, consider hand-fix LoRA within whitelist.
  • Off-brand palette/linework: Tighten style lock, reduce CFG, restrict LoRA count, and limit seed variance for batch runs.

Compliance and governance checklist

  • Document policy: Prohibited classes, edge cases, escalation paths.
  • Version control: Templates, negatives, model/LoRA inventories.
  • Automated gates: Input scrubbing, model whitelist, classifier thresholds.
  • Human review: For all flagged outputs and sensitive campaigns.
  • Audit logs: Prompts, parameters, model hashes, moderation results, approvals.
  • Periodic tests: Red-team prompts, drift checks after model updates.
  • Start with a small, versioned negative set
  • Whitelist models/LoRAs and lock parameters
  • Measure rejection and false-positive rates

Topic summary

Condensed context generated from the KG.

Prompt guards are layered constraints and checks—at prompt, model, pipeline, and post stages—that reduce unsafe or off-spec outputs in AI image generation while preserving the intended style.