Nodes/KJNodes for ComfyUI/MiniMax H3 Prompt Weight
ComfyUI Node Runs on cloud

MiniMax H3 Prompt Weight

(word:1.5) is dead on LLM encoders — this makes it work again

By kijai·Created 3 years ago·Updated 3 days ago· 3,521
MiniMax H3 Prompt Weight
  • model
  • clip
  • model
  • positive
  • latent
◄text►
◄strength1.00►
◄width0►
◄height0►
◄mode▾►

Why your weights stopped working

If you came from SD 1.5 or SDXL, (word:1.5) is muscle memory. On any modern model with an LLM text encoder, that syntax does nothing - not weakened, discarded, because the encoder wrapper hands the tokenizer disable_weights=True and your parentheses get parsed as ordinary text. You can stack ((((important)))) all day and get an identical image.

MiniMax H3 is one of those models: chat-template LLM encoder, inert weight syntax, the usual 2026 negative-prompt mess. This node is the workaround - it parses the weights itself, finds the tokens those words became, and biases them inside the conditioning tensor. And its outputs make it a drop-in replacement for two core nodes at once, which is the part that surprises people.

How it works

Read the label carefully: this is not a CLIP attention hook. Nothing is being re-patched inside the encoder.

The node regex-scans text for (phrase:weight) terms, tokenizes the prompt with the terms stripped, and then locates each phrase's token ids inside the user-content span of the tokenized chat prompt. Words usually carry a leading-space token in context, so it tries the space-prefixed variant first and falls back. Then it does the arithmetic differently depending on direction:

  • Emphasis (w > 1) becomes an attention logit bias - strength × (w − 1) × 2 added at those token positions, carried in H3's minimax_token_tags conditioning key.
  • De-emphasis (w < 1) becomes value scaling - the token's representation multiplied by 1 + strength × (w − 1). At w = −1 that zeroes it, which is how (word:-1) "removes" a concept.

Overlapping phrases merge sensibly: multiplying factors, adding biases. Anything it can't find is skipped with a warning naming the phrase - so check your terminal, not the preview, when a weight seems to do nothing.

[cat|fox] is separate machinery: one prompt per option, each encoded, concatenated (the encoder is causal, so a further prompt only appends its own rows). The number after the pipe, as in [cat|fox:-1], is that option's attention bias - a mild ensemble, not a hard switch.

Under the hood it calls ComfyUI's own MiniMax H3 conditioning functions, which is why its third output exists.

The inputs and outputs that matter

model, clip, text are the usual trio, and text is where the weight syntax goes.

strength (default 1, range −4 to 4) multiplies the entire weighting effect. Leave it at 1 until the syntax is doing what you asked, then use it as a global dial. Values past 2 get ugly fast.

width / height - 0 means "use image_1's size, or 2048 without images"; the video modes use 1344×768 for 0. If you're doing image work, either wire the same numbers your latent uses or accept the default and match your latent to it.

mode is the interesting one, and it changes the node's whole shape:

  • text only - plain text conditioning.
  • text with empty image - appends a black picture's vision tokens, which the author notes softens H3's hard text-to-image rendering. A genuine quality lever, not a gimmick.
  • edit, edit video, first last frame - reference-image, reference-video/audio and keyframe conditioning. Picking one reveals the matching slots (a VAE, reference images/videos, an optional audio VAE, a frame count at 24 fps) plus a percent window outside of which the prompt is encoded without the references. That window is how you keep references from dominating the whole sample.

Outputs, and this is the important bit:

  • model - goes to the sampler's model input.
  • positive - goes to the sampler's positive conditioning. Negative is yours to handle as usual.
  • latent - a real empty latent, already the right size for the mode.

So it replaces your text encode and your empty latent in one node. Wire the latent output into the sampler and don't add a second Empty Latent alongside it.

Installing it

Same pack as the rest of KJNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt

Or Manager → search KJNodes ("KJNodes for ComfyUI") → install → restart. The pack's own dependencies are light - pillow, color-matcher, matplotlib, mss, opencv-python-headless - and there's no model to download here; it rides on whatever H3 checkpoint and encoder you already have.

Common issues

It won't load, or fails with an import error about nodes_minimax_h3. This node leans on ComfyUI's core MiniMax H3 nodes, so it needs a ComfyUI new enough to have them. Update ComfyUI and restart; KJNodes tracks core closely and is not the thing to blame.

A weight silently does nothing. The phrase probably wasn't found. Watch the console - the node logs exactly which phrase it skipped, and weighting [...] with the resolved positions when it worked. Long phrases, odd punctuation and words the tokenizer splits badly are the usual culprits. Try a single word.

first last frame throws about needing the VAE. Deliberate: with a frame connected the node has to encode the keyframes, so the VAE in that mode isn't optional.

One non-technical caveat, since you'll hit it: H3's open weights ship under a community licence that excludes the US, EU, UK and Korea, so the local-weights path isn't licensed for everyone reading this. The hosted service is a separate arrangement.

CategoryKJNodes/experimental

Inputs (7)

NameTypeDefaultDescription
modelMODEL—
clipCLIP—
textSTRINGPrompt, weights as (word:weight). [cat|fox:-1] blends one prompt per option, the number is that option's attention bias.
strengthFLOAT1.00-4–4Multiplier on the weighting effect.
widthINT00–163840 uses image_1's size, or 2048 without images. The video modes use 1344x768 for 0.
heightINT00–16384—
modeCOMBOtext with empty image adds a black picture's vision tokens, which softens the hard text-to-image rendering.

Outputs (3)

NameTypeDescription
modelMODEL—
positiveCONDITIONING—
latentLATENT—