Stable Diffusion NSFW- Advanced Prompt Techniques

Stable Diffusion NSFW- Advanced Prompt Techniques

g

By gerogero

Updated: July 31, 2024

Introduction

Hi there! Here are some notes about how I structure your prompts to get better hentai generations. This guide is the result of personal experiences, so nothing is considered as ground truth, it’s just what is working well for me!

I’ll update this article from time to time.

Philosophy

I try to follow these basic core guidelines when I do my prompts.

I recommend reading Danbooru’s How-to, which are good base lines. Most of these models are trained from Danbooru-style tags, so Danbooru is a great resource overall.

  • Tag what you see, not what you know. Don’t use tags of stuff that is not visible in the final image).
  • Minimal Tagging Criteria. Too much tags cause noise and lead to less precise results. Keep things to the strict minimum, put down only what you absolutely want to see. For example, why put an “nsfw” tag if your scene is already explicit ?

What sex acts are these models capable of?

Danbooru is perfect for this. Check these lists of tags of Sex acts and Sexual positions.

Structure

Here is a way to structure your prompts by using 5 groups of words, with sub-categories inside.

I try to separate those concepts with break lines, it helps me to quickly make adjustment. I recommend having a look at Danbooru tag groups to find what you need.

Keep in mind that it’s a guideline. It’s ok to mix this order, especially inside a category.

1. Composition

  1. Quality
  2. Style (photorealistic, color palette, etc)
  3. Point of view
  4. Light, Time of day (day, night, sunset, …)

2. Subjects

  1. Main subject(s) (boy, girl, animal, object, landscape, …)

3. Actions

  1. Sex acts
  2. Sexual positions

4. Body

  1. Posture
  2. Main features (size, weight, body type, body fat, skin color, …)
  3. Body elements (breast, nipples, ass, …)
  4. Face related (eyes color, hairstyle, …)
  5. Expressions (happy, surprised, serious, determined, …)
  6. Clothes

5. Background

  1. Main environment (indoor, outdoor, …)
  2. Weather (wind, rain, snow, …)
  3. Objects (furnitures, vehicules, …)

About prompt’s length

The prompt is split by words (or chunks of words) to transform them into numerical representation called tokens. Depending on which models are used and how tokens are normalized, certain parts of your prompt will have more or less attention. My rule of thumb: the longer the prompt, the more control you’ll have over the whole prompt.

Here’s some resources if you want to read more on that matter:

Tokens with SDXL and SD15 models – Alen Knight

Token normalization & Weight interpretation – BlenderNeko (Github)

Example

Here is an example following the structure. I usually put some break lines to have a better look on the main areas of the prompt.

score_9, score_8_up, score_7_up, score_6_up, source_anime,
lineart, portrait, from above,
sidelighting, light particles,

1girl, ginger, solo,
writing, holding pencil,
sitting, heads up,

sweat, freckles, small breasts,
ginger hair, long hair, straight hair,
blue eyes, glowing eyes, glasses, looking at viewer,

smile, smirk, grin, frown,
white tank top,

indoor, library,
sunset, sunny, daylight,
desk, chair,

As you can see, the breaklines don’t divide perfectly the 5 fields of the structure. Depending on what you want to generate, it can make more sense to visually separate smaller and longer parts. Here, the subjectactions and posture of the body are grouped together: splitting them would create a mess visually more than anything.

Usecases

Here are some usecases and favorite keywords. I try to organise by logical group, from the most general to the more specific. I recommand to cherry-pick the one that make sense for you rather than copy-paste the all line.

You’ll also find a reference to where I place it in the structure. I’ll use an ID with the format [xx.yy], using the acronym of the category and its sub-category.

Keep in mind that some of them could also go higher or lower in the apparition order (e.g. upside down could be placed as [compos.pov] or [body.posture].

Generic

Here is what I use in almost all my prompt to influence the overall quality of the image. I usually add additional negative keywords if something that I don’t like appear, but not before. Again, I like to keep things short and simple.

Following list cover some classic cases, detailing both positive and negative prompts.

Note: Negative+ is an additional list where I cherry-pick according to the situation. In my experience, negative keywords related to anatomic don’t always improve the results, so I just keep them aside in case I need it.

Scenes

Subject