Qwen LM
Qwen LM runs a chat model inside ComfyUI — no Ollama, no GGUF, no second process
- image
- config
- text
- thinking
Most LLM nodes in ComfyUI are one of two things: a thin client that talks to an Ollama or llama.cpp server running somewhere else, or a GGUF loader that bolts a second runtime onto your install. Qwen LM does neither. It loads a chat model through ComfyUI core's own text-encoder loader and generates with the model's own generate, which means no server, no extra process, no .gguf, and the model shares the same VRAM accounting as everything else in your graph.
That matters because of a distinction people blur constantly: the language model inside your checkpoint (the frozen Qwen3 or T5 encoder that turns your finished prompt into conditioning) is a completely different animal from the LLM you drop into the graph yourself as a tool node. Qwen LM is the second kind. It runs before your sampler, writes text, and hands that text downstream to your encode node. Nothing about your generation changes unless you wire it up.
What you actually get
Six models, all of them vision-capable, all downloaded from the public Hugging Face repo beycanai/Qwen-LM (no token needed):
Qwen3.5-4B,Qwen3.5-9B,Qwen3.8-27BQwen3-VL-8B InstructandQwen3-VL-8B Instruct AbliteratedQwen3.5-9B Abliterated
That last pair is the interesting part. The instruct Qwen3-VL builds carry the usual assistant-style refusals, which is exactly what breaks an explicit captioning or prompting job. The abliterated builds - refusal directions surgically removed from the weights - are the community's standard fix, and they're in the list here rather than something you have to go hunt for. Qwen3.5 and 3.8 are the text-first family with a thinking mode; Qwen3-VL has no thinking mode at all.
precision gives you BF16 (full weights), INT8 ConvRot (8-bit, roughly half the size, and the default for a reason) and W4A8 (4-bit, Qwen3.8-27B only). The list only ever shows precisions the selected model actually has.
The mechanism, briefly
The node tells ComfyUI core to load the safetensors file with comfy.sd.load_clip - architecture inferred from the weights - then calls the model's own generate. It does not use core's Qwen chat templates; it builds the prompt itself the way the official template renders it, and tokenizes it with the model's own tokenizer. That last detail is not cosmetic: core's tokenizer splits words differently from the official one, so Hindi, Thai and Arabic-with-harakat text would get different token ids. The node works around it; Latin, CJK and Korean text comes out identical either way.
system, user and assistant are your three turns. assistant is a prefill - the answer starts with that text and text includes it. Drop a single { in there and the model completes JSON straight from the opening brace instead of wrapping it in a friendly preamble. That's the cheapest reliability trick in the whole node.
thinking needs a model that has the mode (Qwen3.5 and 3.8 do; Qwen3-VL doesn't). On, the reasoning lands on the thinking output and only the answer on text. It's off by default here even though the official templates think by default, which is the right call for caption and prompt work - you don't want to pay reasoning tokens per frame and then hope the scratch-work doesn't leak.
image takes a batch: every frame becomes one image the model sees, placed before your user text. Each side is rounded to a multiple of 32 and scaled into the official Qwen pixel budget, bicubic, so a 1920×1080 frame goes in as 1920×1088.
Install
Same pack, same two commands. This node needs nothing beyond ComfyUI itself - no opencv, no postfx, no extra runtime.
cd ComfyUI/custom_nodes
git clone https://github.com/0xBeycan/ComfyUI-BCNodes
pip install -r ComfyUI-BCNodes/requirements.txt
Restart, then type qwen, llm, vlm or caption in the node search. If the repo is still sitting under its old name ComfyUI-AutoBypass, delete that folder first.
The model file is looked for by name in every Qwen-LM folder (subfolders included, extra_model_paths.yaml respected), then anywhere under models/text_encoders - so if you already have the file, it gets used where it is. Otherwise it downloads on first run into models/Qwen-LM/, through a .part file that resumes if you interrupt it, reporting to the console every 10%. The download does not show on the node's progress bar. That confuses people. Check your terminal.
Where people get burned
- INT8 and W4A8 need a cu130 torch. Those precisions run on comfy-kitchen's CUDA kernels, and on a cu12x build ComfyUI 0.37 turns that backend off and you get the slow fallback instead. Not broken, just slower than it should be.
- cuDNN attention can fail to build a plan on some GPU/cuDNN combinations (seen on 3090/4090/5090 with Qwen3-VL-8B). The node catches the first failure, retries the run without cuDNN attention, and disables it for LM generation for the rest of the process. If it somehow fails twice you're told to launch with
--use-split-cross-attention. - Your host CPU matters more than you'd think. Qwen3.5's linear-attention prefill runs as thousands of small kernels, so launch overhead dominates. Measured: ~1.15 s per tag caption on a 4090 host, ~20 s on a 3090 cloud host. If captions take forever on a rented GPU, rent a different one.
max_new_tokensis VRAM, not just a limit. Core reserves the KV cache for prompt plus that value before the first token. At the 32768 default that's about 1 GiB for the 4B/9B, 2 GiB for the 27B, 4.5 GiB for Qwen3-VL-8B. Captions and rewritten prompts don't need 32768 - cut it.- Empty
userwith no image is an error, and so isthinkingon together with anassistantprefill. Both tell you what to fix before any file is touched. - No prompt syntax here.
(word:1.2),embedding:fooand\(are plain text - the text is tokenized as written. - The seed's control starts at
fixed. Queue again and you get ComfyUI's cached answer, not a new one. Set it to randomize when you're iterating.
One honest note on the pack itself: it has essentially no community footprint - an exact search for ComfyUI-BCNodes in the reddit corpus returns zero threads. No legacy bugs with a fix thread already written, and nobody to ask either. Everything above is verified against the shipped source, not folklore.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | Qwen3.5-9B | The chat model (the built-in ones all see images): the built-in list plus the models.yaml in models/Qwen-LM. The file is looked for by name in models/Qwen-LM (subfolders too), then anywhere under models/text_encoders, and downloaded into models/Qwen-LM when missing. |
| precision | COMBO | INT8 ConvRot | The model file's weights: BF16 (full), INT8 ConvRot (8-bit, about half the size), W4A8 (4-bit, Qwen3.8-27B only). Only the selected model's precisions are shown; another one is an error. |
| lora | COMBO | None | A LoRA from models/Qwen-LM/loras: a .safetensors file (PEFT or ComfyUI key names) or a PEFT folder (adapter_config.json + adapter_model.safetensors). Its alpha is read from the file, its metadata or its config file (a file in ComfyUI's names without one: alpha = rank, core's convention); a LoRA trained on another base model is refused. |
| lora_strength | FLOAT | 1.00-100–100 | How strongly the LoRA changes the model: strength x alpha / rank x B @ A, core's LoRA math. 0 runs the model without it. |
| thinking | BOOLEAN | false | The model reasons before it answers: the reasoning comes out on thinking, the answer on text, and sampling takes the model's thinking-on defaults. Only on models with a thinking mode (not Qwen3-VL), and not with an assistant prefill. Qwen3.8-27B thinks at its official default effort, xhigh. |
| max_new_tokens | INT | 327681–262144 | The most tokens the model writes (reasoning and answer); it stops earlier at its end token. 32768 is the official length for most queries. Core reserves the KV cache for prompt + max_new_tokens before the first token: at 32768, about 1 GiB of VRAM for Qwen3.5-4B / 9B, 2 GiB for Qwen3.8-27B and 4.5 GiB for Qwen3-VL-8B (bf16), in proportion to the value. |
| seed | INT | 00–18446744073709550000 | The sampling seed, used when do_sample is on (the model defaults have it on). Its control starts at fixed, so queueing again gives the cached answer instead of a new run; set it to randomize for a new answer each time. |
| keep_model_loaded | BOOLEAN | true | On: the model (with its LoRA) stays loaded for the next run; one model file is held at a time, another one replaces it. Off: it is unloaded when the run ends, after an error too, except an unusable models.yaml or an unknown model name (raised before the model is known). |
| system | STRING | The system message. Empty: no system turn (Qwen3.8-27B with thinking on still has one, holding its reasoning-effort line). Qwen3.5 / 3.8 strip the whitespace around it, Qwen3-VL takes it as written. | |
| user | STRING | The user message, the prompt. Empty only when an image is connected; the images come before this text. | |
| assistant | STRING | Prefill: the answer starts with this text, and text includes it (a prefill of { gives complete JSON). Empty: none. Not with thinking on. | |
| imageopt | IMAGE | Images the model sees, one per frame of the batch, before the user text. Each is resized as the official Qwen processor does (sides multiples of 32, 65536 to 16777216 pixels, bicubic); core caps an image at 12845056 pixels. MTP does not run with images. | |
| configopt | BC_LM_CONFIG | Sampling from an LM Config node: the fields edited there, or fed by a link, replace the model's defaults for the mode (thinking on / off); the others keep them. Not connected: the model's official defaults. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| thinking | STRING | — |