CoolFace
Modelpublic

sss22213/Qwen3.8-27B-Heretic-JP-Roleplay-NSFW-DanbooruTags

sourceHugging Faceapache-2.0updated 7d agoView on Hugging Face
5likes49downloads
Model Card

Qwen3.8-27B-Heretic-JP-Roleplay-NSFW-DanbooruTags

sss22213/Qwen3.8-27B-Heretic-JP-Roleplay-NSFW with one extra skill trained in: turning a scene description into a precise Danbooru tag prompt for anime image models (Stable Diffusion WebUI / A1111, Forge, ComfyUI, and any checkpoint trained on Danbooru tags). The roleplay ability, the thinking behaviour and the removed refusals of the parent model are kept. The adapter is merged into the bf16 weights; tokenizer, chat template and vision encoder are unchanged, so it loads and runs exactly like Qwen3.8-27B.

This model produces sexually explicit content on request and does not refuse. It is tagged not-for-all-audiences; do not deploy it where minors or unconsenting users can reach it.

Why this exists: the parent model could already write a scene and then "an A1111 prompt for it", but the tags it invented were vague or did not exist (sexy_pose, beautiful_lighting). Anime checkpoints only understand real Danbooru tags, so imprecise tags are wasted tokens. This fine-tune teaches the real vocabulary (about 13k+ tags with their exact spellings) and the mapping from a Japanese scene description to the tags that describe it.

Lineage

StepWhatWhere
1Qwen3.8-27B (Apache-2.0, vision-language, thinking)Qwen/Qwen3.8-27B
2Refusal direction ablated with Heretic (trial 198: 4/100 refusals, KL 0.0796)sss22213/Qwen3.8-27B-Heretic-NoRefusal
3Japanese roleplay QLoRA on reasoning-augmented data, merged at full strengthsss22213/Qwen3.8-27B-Heretic-JP-Roleplay-NSFW
4Scene → Danbooru tags LoRA trained on top of step 3, merged at quarter strengththis repository

How it was made

1. Training data: blind-captions

Source: dartags/danbooru-2408-blind-captions (MIT, 6.33M rows). Each row pairs a one-sentence Japanese description of a Danbooru post (summary_ja, written by an LLM from the post's tags, no image involved) with the post's tags. It is the dataset behind DanbotNL.

The rows were converted into chat samples (system / user / assistant) with LoRA Forge's prepare_blind_captions.py:

  • —Target = `summary_tags`, not `general`. summary_tags are the tags the description actually mentions; general is every tag on the post, including things invisible in the text (art style, year, censored). Training on general would teach the model to invent tags, which is the opposite of the goal.
  • —A1111 formatting. Underscores become spaces, parentheses are escaped (artoria pendragon \(fate\)), tags are comma-separated on one line in the order character → copyright → described tags. Posts rated questionable/explicit get a leading nsfw.
  • —Coverage sampling instead of random sampling. All 27 shards were scanned; every row containing a tag that had not yet been seen 30 times was kept, then 100k random rows filled in common combinations. This keeps the full long tail of the vocabulary in about 440k rows instead of 6M.
  • —Filters. Descriptions under 20 characters, rows with fewer than 5 or more than 40 tags, and every post carrying underage tags or wording (loli, shota, aged down, 幼女, 子供, …) were dropped. The last filter removed about 10% of the source and is not optional in the script.
  • —Rehearsal. 10,000 conversations from the parent model's roleplay set (aratako-rp-think1, with their full <think> traces) were shuffled in so the run keeps seeing long reasoning while learning short tag answers.

Final training set: 450,821 samples (440,821 scene → tags, 10,000 roleplay). The system prompt used for every tag sample (use the same one at inference):

あなたはイラスト生成用プロンプトの専門家です。与えられた場面描写を、Stable Diffusion WebUI(A1111)向けの Danbooru タグに変換してください。描写に含まれる要素だけをタグにし、存在しないタグを作らず、タグはカンマ区切りで一行に出力してください。

2. LoRA training

Trained with LoRA Forge (Unsloth + TRL SFT) on a single H100 SXM 80 GB (RunPod), in bf16, on top of the merged `Qwen3.8-27B-Heretic-JP-Roleplay-NSFW` weights rather than the original base, so the adapter learns the change relative to the roleplay model it will be merged into.

SettingValue
Base weightsQwen3.8-27B-Heretic-JP-Roleplay-NSFW, bf16 (no quantization)
LoRAr = 32, alpha = 32, dropout 0.05
Target modulesq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj — language-model layers only
Sequence length8,192 (no packing)
Batch4 × gradient accumulation 4 = 16 sequences
Optimizer / LRAdamW 8-bit, 4e-4, cosine schedule, 400 warm-up steps, weight decay 0.01
Epochs1.01 (28,459 steps), seed 3407
Lossassistant turns only
Empty <think> handlingmask — tag samples carry no reasoning; their empty think blocks are excluded from the loss so the run never trains the model to skip thinking
Resulttrain loss 0.507, 33.1 h, peak VRAM 61.9 GB

3. Merge

The adapter was merged into the bf16 Qwen3.8-27B-Heretic-JP-Roleplay-NSFW weights with PEFT merge_and_unload at `lora_alpha = 8` (effective scale alpha / r = 0.25). At the trained strength (alpha 32) and at alpha 16 the merged model's reasoning collapsed and its output degraded; alpha 8 keeps the roleplay behaviour and reasoning length of the parent while retaining the tag vocabulary. The learning rate of this run (4e-4) was four times the intended value, which is why a quarter-strength merge lands where a full-strength merge of a 1e-4 run would. Output: two safetensors shards, ~51 GB, Qwen3_5ForConditionalGeneration, unquantized.

Usage

Use it exactly like Qwen/Qwen3.8-27B — same chat template, same enable_thinking / reasoning_effort controls.

  • —Roleplay: leave thinking on, put the character sheet and scenario in the system message, as with the parent model.
  • —Scene → tags: use the training system prompt above and turn thinking off (enable_thinking=False, or /no_think). The tag samples were trained with an empty think block in context, so this matches training exactly and skips a reasoning trace you do not need. The reply is a single comma-separated line ready to paste into an A1111 prompt box (add your own quality tags and negative prompt).
python
from transformers import AutoModelForImageTextToText, AutoProcessor

model_id = "sss22213/Qwen3.8-27B-Heretic-JP-Roleplay-NSFW-DanbooruTags"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(model_id, dtype="auto", device_map="auto")

SYSTEM = ("あなたはイラスト生成用プロンプトの専門家です。与えられた場面描写を、"
          "Stable Diffusion WebUI(A1111)向けの Danbooru タグに変換してください。"
          "描写に含まれる要素だけをタグにし、存在しないタグを作らず、タグはカンマ区切りで一行に出力してください。")
messages = [
    {"role": "system", "content": SYSTEM},
    {"role": "user", "content": "電車の中で、黒髪の女子高生が窓際に立ち、頬を赤らめながらこちらを見ている。"},
]
inputs = processor.apply_chat_template(
    messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt",
    enable_thinking=False,
).to(model.device)
output = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(processor.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
# e.g. 1girl, solo, black hair, school uniform, train interior, standing, window, blush, looking at viewer

The full checkpoint is ~51 GB; for a single consumer GPU, quantize it (GGUF via llama.cpp / Ollama). Because the vision encoder is the stock Qwen3.8-27B one, a GGUF import can reuse the official Qwen3.8 vision projector for image input.

Limitations and caveats

  • —Adult content. The base has no refusals and the training data is explicitly NSFW. You are responsible for how you use it.
  • —*The tag training data is image summaries, not roleplay prose.* Descriptions in blind-captions are one sentence about a single picture. Converting a long multi-paragraph roleplay scene works, but the model was not trained on that input shape; shorter, picture-like descriptions give the most precise tags.
  • —Tags are only as good as `summary_tags`. The source captions and tag subsets were generated by LLMs from Danbooru metadata; artist tags, meta tags and anything not stated in the description are intentionally never produced.
  • —Quarter-strength merge. Tag precision is what survived at alpha 8; it is measurably better than the parent but not the maximum this adapter could give if reasoning length were not a constraint.
  • —No formal evaluation. Manual checks only: reasoning length and roleplay quality unchanged from the parent, generated tags checked against the Danbooru vocabulary. No benchmark numbers.
  • —Vision was not trained or evaluated.

Acknowledgements

  • —Qwen for Qwen3.8-27B.
  • —dartags / p1atdev for danbooru-2408-blind-captions and the DanbotNL work it comes from.
  • —Aratako for the roleplay dataset.
  • —p-e-w/heretic (Philipp Emanuel Weidmann) for the abliteration tool.
  • —Unsloth for the training stack.

Released under Apache-2.0, like the base model; the training data is MIT.