dbest's picture
Card: drop em dashes
b7d82a6 verified
|
Raw History Blame Contribute Delete
5.47 kB
---
license: other
license_name: qwen-research
license_link: LICENSE
base_model:
- Qwen/Qwen-Image-2.1-PE-T2I
pipeline_tag: text-to-image
tags:
- heretic
- abliterated
- prompt-rewriting
- text-to-image
- qwen-image
---
# Qwen-Image-2.1-PE-T2I Heretic (abliterated)
> **Not affiliated with or endorsed by Alibaba / Qwen.** A community derivative of
> [`Qwen/Qwen-Image-2.1-PE-T2I`](https://huggingface.co/Qwen/Qwen-Image-2.1-PE-T2I), redistributed under the
> **Qwen Research License** (copy included as `LICENSE`). **Non-commercial use only**; commercial use needs a separate
> licence from Qwen.
The **text-to-image prompt rewriter** for Qwen-Image-2.1, a fine-tuned Qwen3.5-VL 9B that turns a short request into
a detailed English prompt plus a recommended aspect ratio, with its refusal behaviour reduced by
[Heretic](https://github.com/p-e-w/heretic) directional ablation. bf16, same shapes and parameter count as the source.
**`system_prompt.txt` is included and required** (the unmodified file from the source repo).
Companion: [darrellbest/Qwen-Image-2.1-PE-I2I-Heretic](https://huggingface.co/darrellbest/Qwen-Image-2.1-PE-I2I-Heretic)
for image edits.
## Results
| | Refusals | KL divergence |
|---|---:|---:|
| Original | 98/100 | 0 *(by definition)* |
| **This model**, re-measured after export | **31/100** | **0.0130** |
| This model's trial during the search | 24/100 | 0.0131 |
Measured by Heretic on `mlabonne/harmful_behaviors` (refusals) and `mlabonne/harmless_alpaca` (KL divergence, the
damage to ordinary behaviour), with Heretic's default system prompt. The first row is an independent evaluation of the
exported weights (`evaluate_model`); the search's own figure for the same trial was 24/100. The KL matches exactly;
the refusal gap is within about 1.6σ at n = 100. For reference, the same evaluation of
[pottokao/Qwen-Image-2.1-PE-T2I-Heretic](https://huggingface.co/pottokao/Qwen-Image-2.1-PE-T2I-Heretic) measured
5/100 at KL 0.0349 (its card: 3/100, 0.036), a stronger ablation with more side effects.
**This is a light-touch ablation.** Across 1,000 trials the search's Pareto front bottomed out at 23/100 refusals, so
this model keeps roughly a quarter to a third of the original's chat-style refusals, while changing its ordinary behaviour less than
most ablations (KL 0.013; for comparison the I2I companion is 9/100 at KL 0.037). If you need fewer refusals, pick a
stronger ablation. Pareto front of the search:
| Refusals | KL | |
|---:|---:|---|
| 23/100 | 0.0194 | trial 228 |
| **24/100** | **0.0131** | **trial 225 (this model)** |
| 30/100 | 0.0089 | trial 223 |
| 36/100 | 0.0085 | trial 245 |
| 46/100 | 0.0044 | trial 231 |
With n = 100 the refusal count is noisy (σ ≈ 4 here), so 23 vs 24 is no difference; 225 was chosen for its lower KL.
## Does it still rewrite prompts?
Checked through a real image app's prompt-enhancer path (the official `pe_core` output contract, `enable_thinking`,
Qwen's sampling settings) on a plain request and two borderline ones (a horror poster with a bloodied survivor; a
soldier aiming a rifle). Every answer parsed, with a detailed prompt and an aspect ratio. As with the other
Qwen-Image-2.1 rewriters, the original is already relaxed about edgy image subjects; the ablation mainly changes its
refusals of chat-style harmful instructions, which is what the 98/100 baseline measures.
NVFP4 build for vLLM on Blackwell:
[darrellbest/Qwen-Image-2.1-PE-T2I-Heretic-NVFP4](https://huggingface.co/darrellbest/Qwen-Image-2.1-PE-T2I-Heretic-NVFP4).
## Reproduce
- Heretic `3521f86` (main, 2026-09-21), default config except `n_trials = 1000` and `export_strategy = "merge"`.
transformers 5.17.0, torch 2.11.0+cu130, one RTX PRO 6000 Blackwell.
- Trial 225 parameters: `direction_scope = global`, `direction_index = 17.498`,
`attn.o_proj: max_weight 1.49 at 21.632, min_weight 0.958, min_weight_distance 16.843`,
`mlp.down_proj: max_weight 1.452 at 21.259, min_weight 0.001, min_weight_distance 10.638`.
## Use
Exactly like the original: load with `AutoModelForImageTextToText` / `AutoProcessor` and use `system_prompt.txt` as
the system prompt.
## The family
| Model | Format | Use it with |
|---|---|---|
| [PE-T2I-Heretic](https://huggingface.co/darrellbest/Qwen-Image-2.1-PE-T2I-Heretic) | bf16 safetensors | transformers / diffusers |
| [PE-T2I-Heretic-GGUF](https://huggingface.co/darrellbest/Qwen-Image-2.1-PE-T2I-Heretic-GGUF) | GGUF BF16 / Q8_0 / Q4_K_M | llama.cpp, Ollama |
| [PE-T2I-Heretic-NVFP4](https://huggingface.co/darrellbest/Qwen-Image-2.1-PE-T2I-Heretic-NVFP4) | NVFP4 (compressed-tensors) | vLLM on Blackwell |
| [PE-I2I-Heretic](https://huggingface.co/darrellbest/Qwen-Image-2.1-PE-I2I-Heretic) | bf16 safetensors | transformers / diffusers |
| [PE-I2I-Heretic-GGUF](https://huggingface.co/darrellbest/Qwen-Image-2.1-PE-I2I-Heretic-GGUF) | GGUF BF16 / Q8_0 / Q4_K_M (+ mmproj) | llama.cpp, Ollama |
| [PE-I2I-Heretic-NVFP4](https://huggingface.co/darrellbest/Qwen-Image-2.1-PE-I2I-Heretic-NVFP4) | NVFP4 (compressed-tensors) | vLLM on Blackwell || [PE-Heretic-ComfyUI](https://huggingface.co/darrellbest/Qwen-Image-2.1-PE-Heretic-ComfyUI) | single-file safetensors (T2I + I2I) | ComfyUI |
**T2I** rewrites a short request into a detailed prompt for new images; **I2I** rewrites an edit instruction, reading the
image being edited. Both are prompt rewriters for [Qwen-Image-2.1](https://huggingface.co/Qwen/Qwen-Image-2.1), not
image generators.