Nodes/BSAI-Qwen-Prompt-Enhancer/BSAI Qwen Prompt Enhancer
ComfyUI Node

BSAI Qwen Prompt Enhancer

One node, four enhancement backends (switch via the backend dropdown; the matching widgets are shown/hidden automatically): (1) Official PE (local Qwen3.5-9B): load the official PE model from text_encoders with CLIPLoader, generate via the official chat template, outputting rewritten_prompt / wh_ratio / ratio_follow; I2I mode accepts image_1~image_16 (up to 16 images), refer to them as image_1/image_2 in the prompt. (2) Local LLaMA (GGUF+mmproj): llama.cpp loads a local vision LLM, auto-scanning models/LLM and text_encoders, reverse-engineering multi-image prompts; chat_handler auto-detects the latest model families. (3) Local HF (Transformers): loads HuggingFace safetensors models under models/LLM, covering Florence-2 (vision caption-to-prompt, requires image_1) and text LLMs such as Llama/Gemma (chat_template generation). (4) API (OpenAI-compatible): configure api_base / api_key / model_name to call an online or local API. Shared parameters apply to all backends; outputs are unified across 10 ports. Pick a speed_preset and the RECOMMENDED_* ports output the matching KSampler settings; on a KSampler right-click steps/cfg -> Convert to input to apply them in one click. Qwen Image 2.1 is a CFG-distilled architecture; the official recommendation is cfg=1.0. Acceleration presets are based on official day-0 settings (25 steps/cfg1/euler/simple). v1.08.0 adds distilled-LoRA presets: Viggle Turbo 6 steps (official node) / Pruna 5-8 steps (community conversion) / Alibaba PAI Fun-Acc 4 steps (experimental). Distilled presets require the matching LoRA and fixed sigmas (Viggle Turbo Sigmas / ManualSigmas / PDD); see ACCELERATION_GUIDE.md.

By xm6018924·Created about a month ago·Updated 3 days ago· 14
BSAI Qwen Prompt Enhancer
  • clip
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • image_9
  • image_10
  • image_11
  • image_12
  • image_13
  • image_14
  • image_15
  • image_16
  • ENHANCED_PROMPT
  • WH_RATIO
  • RATIO_FOLLOW
  • RAW_OUTPUT
  • THINKING
  • RECOMMENDED_STEPS
  • RECOMMENDED_CFG
  • RECOMMENDED_SAMPLER
  • RECOMMENDED_SCHEDULER
  • MERGED_TEXT
◄backendOfficial PE (local Qwen3.5-9B)►
◄prompt_textA girl in a red dress standing under a cherry tree, holding bubble tea, evening light►
◄system_templateQwen-Image-2.1 Official PE-T2I System Rules [official_t2i]►
◄custom_system_prompt►
◄user_requirement►
◄temperature0.70►
◄top_p0.95►
◄top_k40►
◄repeat_penalty1.10►
◄seed0►
◄max_tokens4096►
◄speed_presetStandard 25 steps/CFG1 (recommended)►
◄pe_modeauto►
◄min_p0.00►
◄thinkingtrue►
◄mtpauto►
◄llm_model_name<No GGUF model found>►
◄mmproj_name►
◄chat_handlerauto (auto-detect Qwen3.8/Gemma4/GLM4.6 and other supported models from the model name)►
◄n_ctx8192►
◄n_gpu_layers-1►
◄load_mtpfalse►
◄n_cmoe0►
◄kv_cache_quantauto (f16, no quant)►
◄use_mmaptrue►
◄use_mlockfalse►
◄flash_attnauto►
◄threads0►
◄keep_loadedfalse►
◄api_basehttps://dashscope.aliyuncs.com/compatible-mode/v1►
◄api_key►
◄api_model_nameqwen3.5-vl-9b►
◄timeout120►
◄strata_quantAuto (auto-adapt)►
◄ninfer_model(Auto — first model found)►
◄nemotron_model(Auto — first model found)►
◄hf_model_name▾►
◄hf_task<MORE_DETAILED_CAPTION>►
◄hf_deviceauto►
◄hf_keep_loadedtrue►
◄preview_onlyfalse►
CategoryBSAI/Qwen Image 2.1

Inputs (58)

NameTypeDefaultDescription
backendCOMBOOfficial PE (local Qwen3.5-9B)7 options: Official PE (local Qwen3.5-9B), Local LLaMA (GGUF+mmproj), Local HF (Transformers), API (OpenAI-compatible), BSAI Strata (Qwen3.8-Flash-Next @8080), BSAI Nemotron (llama.cpp @8085), +1
prompt_textSTRINGA girl in a red dress standing under a cherry tree, holding bubble tea, evening light—
system_templateCOMBOQwen-Image-2.1 Official PE-T2I System Rules [official_t2i]354 options: No template (clear output, no system rules) [none], Qwen-Image-2.1 Official PE-T2I System Rules [official_t2i], Qwen-Image-2.1 Official PE-I2I System Rules [official_i2i], Official API prompt_extend Rewrite Style (with examples) [api_prompt_extend], Official Prompt Formula: Subject + Scene + Style + Lens + Mood + Details [formula_official], Official Poster / Slide Layout Template [layout_poster], +348
custom_system_promptSTRING—
user_requirementSTRING—
temperatureFLOAT0.700–2—
top_pFLOAT0.950–1核采样阈值。注意:ComfyUI v0.42+(#17221)修正了 top-p 边界语义(>= 判定 + 右移一位),同一 seed 的输出与旧核心不保证一致;本地 LLaMA (llama.cpp) 后端不受影响。
top_kINT400–1000—
repeat_penaltyFLOAT1.100–5—
seedINT00–18446744073709550000—
max_tokensINT409664–32768—
speed_presetCOMBOStandard 25 steps/CFG1 (recommended)14 options: Standard 25 steps/CFG1 (recommended), Fast 15 steps/CFG1 (iteration preview), Turbo 10 steps/CFG1 (quick draft), High quality 35 steps/CFG1 (detailed output), Cached 20 steps/CFG1 (with EasyCache node), Viggle Turbo 6 steps/CFG1 (official node, recommended), +8
pe_modeCOMBOauto3 options: auto, T2I (text-to-image), I2I (image-to-image / edit)
min_pFLOAT0.000–1—
thinkingBOOLEANtrue—
mtpCOMBOauto6 options: auto, off, 2, 3, 4, 5
llm_model_nameCOMBO<No GGUF model found>1 options: <No GGUF model found>
mmproj_nameCOMBO1 options:
chat_handlerCOMBOauto (auto-detect Qwen3.8/Gemma4/GLM4.6 and other supported models from the model name)15 options: auto (auto-detect Qwen3.8/Gemma4/GLM4.6 and other supported models from the model name), MTMD generic multimodal (recommended: Qwen3.5+/Gemma4/GLM with mtmd-mmproj), Qwen 3.8 / 3.6 / 3.5 vision (requires updated llama-cpp-python), Qwen 3 / 3-VL vision (requires updated llama-cpp-python), Qwen 2.5-VL / 2-VL vision, Gemma 4 vision, +9
n_ctxINT8192512–65536—
n_gpu_layersINT-1-1–200—
load_mtpBOOLEANfalseMTP (Multi-Token Prediction) 层保留开关。官方 ComfyUI v0.42 / 新版 llama.cpp 已支持 Qwen 3.x/3.5 MTP(含图像场景,含 MTP embedding offload 修复);模型带 nextn_predict 元数据且关闭本开关时自动剥离 MTP 层。追求吞吐加速可开启(需底层 llama.cpp 支持,开启失败时模型加载会报错,回退关闭即可)。
n_cmoeINT00–256Split MoE experts across CPU/RAM layers (-ncmoe). Only effective for MoE models, not dense. Qwen-35B-A3B is most stable around 24; 0 = off. Current 0.3.36 does not support it yet; it applies automatically after upgrading.
kv_cache_quantCOMBOauto (f16, no quant)KV cache quantization (-ctk/-ctv, q4_0 = video effect). Lower VRAM and faster, at a slight quality cost.
use_mmapBOOLEANtrueuse_mmap; can disable when RAM is tight / swapping (--no-mmap).
use_mlockBOOLEANfalseuse_mlock (--mlock) locks the model in RAM to avoid page-out.
flash_attnCOMBOauto-fa. auto = enable when the model supports it.
threadsINT00–256-t thread count (video example: 14); 0 = auto.
keep_loadedBOOLEANfalse—
api_baseSTRINGhttps://dashscope.aliyuncs.com/compatible-mode/v1—
api_keySTRING—
api_model_nameSTRINGqwen3.5-vl-9b—
timeoutINT12010–600—
strata_quantCOMBOAuto (auto-adapt)Strata quantization. Auto picks based on VRAM/RAM.
ninfer_modelCOMBO(Auto — first model found)NInfer model to load (models/LLM/*.ninfer). Changing it restarts the NInfer engine on the next run.
nemotron_modelCOMBO(Auto — first model found)Nemotron GGUF model to load (models/LLM/Nemotron/*.gguf, excludes mmproj). Changing it restarts the llama.cpp server on the next run.
hf_model_nameCOMBO1 options: <No HF model found>
hf_taskCOMBO<MORE_DETAILED_CAPTION>5 options: <MORE_DETAILED_CAPTION>, <DETAILED_CAPTION>, <CAPTION>, <OD>, <REGION_CAPTION>
hf_deviceCOMBOauto3 options: auto, cuda, cpu
hf_keep_loadedBOOLEANtrue—
preview_onlyBOOLEANfalse—
clipoptCLIP—
image_1optIMAGE—
image_2optIMAGE—
image_3optIMAGE—
image_4optIMAGE—
image_5optIMAGE—
image_6optIMAGE—
image_7optIMAGE—
image_8optIMAGE—
image_9optIMAGE—
image_10optIMAGE—
image_11optIMAGE—
image_12optIMAGE—
image_13optIMAGE—
image_14optIMAGE—
image_15optIMAGE—
image_16optIMAGE—

Outputs (10)

NameTypeDescription
ENHANCED_PROMPTSTRING—
WH_RATIOSTRING—
RATIO_FOLLOWSTRING—
RAW_OUTPUTSTRING—
THINKINGSTRING—
RECOMMENDED_STEPSINT—
RECOMMENDED_CFGFLOAT—
RECOMMENDED_SAMPLERSTRING—
RECOMMENDED_SCHEDULERSTRING—
MERGED_TEXTSTRING—