Instructions to use tuanlai001/H3-IMAGE-PE-HERETIC-NVFP4-COMFYUI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusion Single File
How to use tuanlai001/H3-IMAGE-PE-HERETIC-NVFP4-COMFYUI with Diffusion Single File:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
This model is an uncensored (heretic) version of the prompt enhancer (PE) of MiniMax-H3-Image. It is a single-file NVFP4 checkpoint and loads directly in ComfyUI.
What this is
The upstream MiniMax-H3-Image prompt enhancer is a Qwen3.8-27B hybrid model (GatedDeltaNet linear attention + full attention, 64 layers) that rewrites short user prompts into long, structured image-generation captions. It ships in ModelOpt NVFP4 format, which transformers refuses to load as a pre-quantized checkpoint, so it cannot be used as-is for weight editing.
This repository contains the same enhancer with its refusal behavior abliterated, re-quantized to the ComfyUI NVFP4 layout so that ComfyUI can load it natively.
| Property | Value |
|---|---|
| Base | MiniMax-H3-Image prompt enhancer (Qwen3.8-27B) |
| Architecture | Qwen3_5ForConditionalGeneration, 64 layers, hidden 5120, vocab 248320 |
| Format | NVFP4 (E2M1, group size 16, fp8_e4m3 block scales, fp32 global scale) |
| File size | 17.92 GB, single .safetensors |
| Tensors | 2788 (401 quantized layers + scales + all remaining fp16/bf16 tensors) |
| Target | ComfyUI CLIPLoader, text_encoders/ |
Uncensoring pipeline
Tool: heretic v2.0.0.dev0 β directional ablation (abliteration) with an Optuna TPE multi-objective search over (refusals, KL divergence).
Step 1 β Dequantize. The upstream NVFP4 weights were dequantized to plain bf16 (E2M1 codebook + weight_scale per 16-element group + weight_scale_2 global scalar), producing a standard 54.71 GB bf16 checkpoint that transformers can load. Dequantization was verified lossless against the original byte stream.
Step 2 β Abliterate. Refusal directions were computed from the difference of mean activations on mlabonne/harmless_alpaca (25,058 prompts) versus mlabonne/harmful_behaviors (416 prompts), then projected out of the residual stream and of the attn.o_proj / mlp.down_proj writing matrices.
The search space per layer was a trapezoid over layer index β max_weight, max_weight_position, min_weight, min_weight_distance β plus a continuous direction_index. Over 13 studies / 1262 trials the Pareto front never produced a point with refusals β€ 10/100 and KL β€ 0.07; the front is flat and only slides along itself when the sampling bounds are widened or narrowed. This checkpoint is the closest point found.
Step 3 β Select. Trial 19 of the final study (R3), chosen by hand:
| Metric | Value |
|---|---|
| Refusals | 10 / 100 |
| KL divergence | 0.1419 |
direction_index |
40.5855 |
attn.o_proj |
max_weight 2.6749 @ pos 44.258, min_weight 1.5040 @ dist 51.367 |
mlp.down_proj |
max_weight 2.1627 @ pos 56.032, min_weight 1.9718 @ dist 17.446 |
| Layers modified | 89 / 128 abliterable (mlp only 39β63) |
Step 4 β Re-quantize for ComfyUI. ComfyUI's NVFP4 layout differs from ModelOpt's in two ways, and both matter:
- Nibble order is flipped. ComfyUI packs with
hi_first=True(high nibble = even column); ModelOpt packs the low nibble first. - Block scales must be swizzled. ComfyUI expects
weight_scalein cuBLAS blocked layout, shape(ceil(M/128)*128, ceil(K/16/4)*4), produced by itsto_blocked()transform.
So the bf16 weights were re-quantized from scratch with ComfyUI's own conventions, and the checkpoint carries the _quantization_metadata key plus a per-layer <name>.comfy_quant marker that ComfyUI's convert_old_quants reads to route the model through MixedPrecisionOps.
Verification: dequantizing the shipped file and comparing against the bf16 source gives max abs diff = 0.000000 on every layer that abliteration did not touch, and relative RMS 2.5e-2 on the 89 layers it did (pure FP4 quantization error). Nothing else was altered.
Usage in ComfyUI
Put the file in
ComfyUI/models/text_encoders/:ComfyUI/models/text_encoders/minimax-h3-image-pe-t2i-abliterated-nvfp4.safetensorsAdd a Load Clip node and select the model.
Connect clip node to Generate Text node and set thinking to true.
Notes:
- Requires a ComfyUI build with NVFP4 support (
comfy_quant/MixedPrecisionOps). Older builds will fall back and load incorrectly. - Needs a GPU that supports FP4 tensor cores to actually be fast; on older cards it will dequantize on the fly and be slow, but it still loads.
- The 17.92 GB file is a single shard β no index file, no shard list, nothing else to download.
Known limitations
- This is not a refusal-free model. It refuses roughly 1 in 10 of the benchmark prompts; it is a large reduction, not an elimination.
- Only 89 of 128 abliterable layers were modified. Layers outside the trapezoid are bit-identical to upstream.
- Make sure thinking is set to true, otherwise it may produce empty output.
- If it still produces empty output, try increase max_length value, I personally set it to 16384.
License and redistribution
This conversion is distributed under the MiniMax-H3-Image Community License Agreement β see LICENSE (verbatim upstream text).
Important points you must read in the full agreement:
- The license is limited to the Applicable Territory, defined as worldwide excluding the Excluded Territories: the European Union, the United Kingdom, the Republic of Korea and the United States of America.
- Redistribution requires providing a copy of the agreement, carrying prominent notices on modified files, and shipping the
NOTICEtext. - Commercial use above 1M USD annualized revenue, or providing a Hosted Service, requires separate prior written authorization from MiniMax.
Nothing about this repository being downloadable, private, or gated by itself demonstrates compliance with those territorial terms.
- Downloads last month
- 27,044
Model tree for tuanlai001/H3-IMAGE-PE-HERETIC-NVFP4-COMFYUI
Base model
Qwen/Qwen3.8-27B