Nodes/comfyui_davcha/ConditioningCompress
ComfyUI Node

ConditioningCompress

The token cap that does math instead of editing your prompt

By dchatel·Created 2 years ago·Updated 13 days ago· 2
ConditioningCompress
  • conditioning
  • CONDITIONING
max_tokens75

Some models stop paying attention past a certain number of prompt tokens - SD1.5's sweet spot is around 75, and longer prompts drift. The usual fix is to rewrite the prompt to fit. ConditioningCompress is the lazier, more interesting fix: it doesn't touch your text at all. It takes the already-encoded conditioning and mathematically squeezes it down to at most max_tokens worth of information. Drop it between your text encoder and the sampler, and long prompts stop overflowing.

This is the flagship of comfyui_davcha, and it's the one node in the pack with actual community presence. The author (dchatel, posting on Reddit as Occsan) announced it on r/StableDiffusion, describing it as projecting the conditioning into a subspace of at most N tokens - it "does not exactly preserve the most relevant tokens... but it preserves the most dominant features." He was honest about results, too: it seemed to help a little with prompt adherence and coherence on SD1.5, and "maybe it was just flukes."

How it works

The conditioning your CLIP produces is a tensor of token embeddings. ConditioningCompress runs singular value decomposition (SVD) on that tensor, keeps only the top max_tokens singular values, and rebuilds it. That's a low-rank projection: instead of chopping the text at token 75, it compresses whatever you gave it down to the max_tokens most dominant directions. Long passages, book excerpts, ChatGPT dumps - they all get flattened to a fixed budget of signal.

Inputs and outputs

  • conditioning - your CONDITIONING, straight from a text encode node.
  • max_tokens (INT, default 75, min 1) - the cap. 75 matches SD1.5's native limit; raise it for models that tolerate more.

Output is a CONDITIONING, wired into the sampler's positive or negative input. That's the whole graph: encode → compress → sample.

Installing it

# ComfyUI Manager → Install Custom Nodes → search "comfyui_davcha" → Install → Restart
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/dchatel/comfyui_davcha
cd comfyui_davcha
pip install -r requirements.txt

Standard pack caveat: requirements.txt lists only webp and rapidfuzz, but the module imports llama_cpp and cv2 at load. Missing either and the whole pack - this node included - won't appear. pip install llama-cpp-python opencv-python, restart.

Where people get burned

Set expectations. The single comment on the announcement thread summarized it well: it's useful for people who paste passages from books or ChatGPT and refuse to edit them down - otherwise just make the prompt shorter, which is free and often better. SVD per conditioning also isn't free on big batches, so this is a "fix the symptom in the graph" node, not a workflow you build around. Try it at 75 on a long SD1.5 prompt and see if your adherence holds. If your model has no real token ceiling, you're paying for a fix you don't need.

Categorydavcha

Inputs (2)

NameTypeDefaultDescription
conditioningCONDITIONING
max_tokensINT75

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING