--- license: apache-2.0 base_model: - Qwen/Qwen3.5-9B base_model_relation: finetune pipeline_tag: image-text-to-text library_name: transformers tags: - heretic - uncensored - abliterated - moss-image - text-encoder - prompt-enhancer - qwen3.5 --- # MOSS-Image Text Encoder — Heretic (Qwen3.5-9B) A decensored **Qwen3.5-9B**, made to be the text encoder *and* the prompt enhancer of [MOSS-Image](https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT). MOSS-Image's text encoder is the stock `Qwen/Qwen3.5-9B` — we checked: its weights are byte-identical to the official release (only `lm_head` and the MTP head are left out). Because the encoder is a complete chat model, one copy can both **rewrite** a short idea into a full caption and then **encode** that caption for the DiT. The official ComfyUI MOSS-Image template already does this with a w4a8 copy. The stock model, however, refuses or quietly softens many adult requests, and in that setup the refusal text itself gets encoded and rendered. This repo is the same model with refusals removed by [Heretic](https://github.com/p-e-w/heretic) (ARA modifier), merged into the weights. Everything else is untouched. ## What changed - Only **32 tensors** differ from `Qwen/Qwen3.5-9B`: `mlp.down_proj`, `linear_attn.out_proj` and `self_attn.o_proj` in decoder layers 15–31 (median relative change 11%). - Every other tensor is **bit-identical** to the original, including `lm_head`, the **MTP head** (usable for speculative decoding) and the **vision tower**. - `heretic_merge_info.json` lists every changed tensor and its relative change. ## Numbers Measured with thinking **off** (`` prefix), which is how a prompt enhancer runs. | | Refusals (Heretic, 100 prompts) | KL vs original (first token) | |---|---|---| | Qwen3.5-9B | 100/100 | 0 | | **This model** | 2/100 | 0.050 | Keyword counts can be gamed by off-topic answers, so we also had **gemma-4-12b** judge 60 answers from `mlabonne/harmful_behaviors` (greedy, thinking off, up to 1024 tokens): | | Full | Partial | Deflect | Refuse | |---|---|---|---|---| | Qwen3.5-9B | 0 | 0 | 8 | 52 | | **This model** | 37 | 1 | 19 | 3 | As a MOSS-Image prompt enhancer (official Prompt Enhancer skill as the system prompt, 10 explicit adult-sex requests, thinking off): the stock model refused **6/10**; this model refused **0/10**. ## INT8 for ComfyUI Two INT8 files in [`int8/`](./int8), in ComfyUI's native `int8_tensorwise` + ConvRot format (same layout as Comfy-Org's Qwen3.5-9B files; loads with the stock **Load CLIP** node, type `moss_image`): | File | Size | Contents | Use | |---|---|---|---| | `int8/moss_te_heretic_full_int8_convrot.safetensors` | 9.75 GB | everything (lm_head, MTP, vision tower) | text encoder **and** prompt enhancer (TextGenerate) | | `int8/moss_te_heretic_te_int8_convrot.safetensors` | 7.95 GB | language model only | text encoder only (cannot generate text) | Both encode identically. Measured in ComfyUI against this repo's BF16 on 36 held-out captions: mean relative error **2.75%** (max 5.6%), cosine >= **0.9988**. The full file's prompt enhancement was checked to produce normal text. Images were not A/B-tested for INT8 (lower-bit GGUFs already looked the same). Smaller files: [MOSS-Image-Text-Encoder-Heretic-DHQ-GGUF](https://huggingface.co/pottokao/MOSS-Image-Text-Encoder-Heretic-DHQ-GGUF) (down to ~3 GB). ## Caveats - Thinking **on** was not measured. Use it with thinking off, as a prompt enhancer does. - The merged weights shift the encoder slightly. If you only need encoding, the stock encoder is the reference; we are still comparing images from both. - 19/60 judged answers still deflect. Prompts may occasionally be softened. ## Search Distributed Heretic search (3 machines, ~4.5 h, 3 automatic search-box adjustments, 413 trials). Selected trial: refusals 1/100 @ KL 0.048 in search, chosen over a 0/100 trial whose low count came mostly from off-topic answers (judge: 18 full / 39 deflect). Parameters: start layer 15, end layer 31, preserve weight 0.392, steer weight 4.1e-4, overcorrect 0.988, neighbors 10, LoRA rank 50 (merged at scale 1.0). ## Use responsibly Adults only. Do not use this to depict minors or age-ambiguous people, non-consensual acts, or real people without their consent. You are responsible for complying with the law where you live. ## License Apache-2.0, same as Qwen3.5-9B.