ComfyUI Node

Simple Remove Think

Simple Remove Think

By KLL535·Created 9 months ago·Updated a day ago· 85
Simple Remove Think
    • cleaned_text
    text

    Reasoning models are great until they aren't. Flip on enable_thinking for Qwen3.5 or Gemma4, and suddenly every answer comes wrapped in a <think>...</think> block - a rambling chain of thought before the actual response. If you're feeding that text into a prompt, a metadata tag, or a JSON parser, the thinking noise breaks everything downstream. Simple Remove Think is the cleanup step: it takes the model's raw output and returns just the answer.

    The mechanism is exactly what the node description says. It removes <think>...</think> blocks and the rarer <|channel>...</channel|> blocks from reasoning models, and it has a smart fallback for the messy case where the model emitted only a closing </think> tag - it trims everything before it, on the theory that the answer is what came after. It then collapses multiple blank lines into one and strips leading/trailing whitespace, so your output is clean enough to hand straight to another node.

    Inputs and outputs

    • text - the raw model output (multiline). Wire the main Qwen node's text output here.
    • cleaned_text - the answer with thinking stripped out. Feed it to your prompt builder, your text encoder, a save node, whatever.

    One small detail from the source: a </think> split is applied even when no opening tag was found, and the same for <channel|>. That's deliberate robustness - reasoning models occasionally drop tags, and this node treats a dangling closing tag as "everything before it was thinking."

    Install

    Part of the KLL535/ComfyUI_Simple_Qwen3-VL-gguf pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/KLL535/ComfyUI_Simple_Qwen3-VL-gguf
    

    or ComfyUI Manager (search ComfyUI_Simple_Qwen3-VL-gguf), restart, F5.

    When to use it

    If you never enable thinking, this node is a no-op you don't need. The moment you do - and for reasoning-heavy tasks like prompt refinement you almost certainly will - it becomes the default final step after the LLM node. It's a pure text node: no model, no VRAM, nothing to configure. There's a reasonable argument that the main Qwen node should strip thinking automatically, but it doesn't, because sometimes you want the raw chain of thought (debugging, distillation, watching the model work). The author left the choice to you, and this node is that choice made easy.

    The one thing it won't do: guarantee well-formed output from a model that stops mid-thinking or never closes its tags. When a reasoning model gets confused, the cleanup can't fix the answer, only the formatting. If your cleaned output still looks broken, the problem is upstream - check max_tokens (thinking eats them fast) and the prompt.

    Category🌐 SimpleQwenVL

    Inputs (1)

    NameTypeDefaultDescription
    textSTRING

    Outputs (1)

    NameTypeDescription
    cleaned_textSTRING