Nodes/KJNodes for ComfyUI/Ideogram4 Optimizations KJ
ComfyUI Node Runs on cloud

Ideogram4 Optimizations KJ

Shave VRAM off local Ideogram 4 runs (at your own risk)

By kijai·Created 3 years ago·Updated 2 days ago· 3,030
Ideogram4 Optimizations KJ
  • model
  • model
chunk_ffntrue
ffn_chunks2
ffn_seq_threshold1024
bf16_ropetrue

Ideogram 4 landed as open weights in June 2026 - a 9.3B single-stream DiT with genuinely standout character and IP knowledge - and it got native ComfyUI support the same day. It's also Kijai's node ecosystem that made the model actually usable for most people: his prompt-builder node solved the model's biggest practical problem (it only understands structured JSON prompts, not plain English) within about a day of release. Ideogram4OptimizationsKJ is a different, smaller piece of that same ecosystem - not a workflow fix, a memory optimization for people running the model locally and hitting VRAM limits.

The node's own description is blunt about the trade-off, in capital letters: experimental, and may change your output. This isn't hedging - it's a real correctness-for-memory trade, and you should treat it that way.

How it works

Two independent optimizations, both targeting the two largest short-lived (transient) tensors inside the model's forward pass. chunk_ffn splits the SwiGLU feed-forward activations across the token dimension instead of computing them all at once, trading a bit of compute overhead for a smaller peak memory footprint. bf16_rope applies rotary position embeddings directly in the model's working dtype (bf16) instead of upcasting to fp32 first, which is normally done for numerical precision - skipping that upcast saves memory but is the more likely of the two to shift output slightly.

The inputs and outputs that matter

  • model in, model out - this node patches your loaded Ideogram 4 model and passes it along; wire it in right after your model loader, before anything that samples with it.
  • chunk_ffn (default true) - the main toggle. Turn it off first if you're troubleshooting an output difference, since it's the less aggressive of the two changes.
  • ffn_chunks (default 2, 1–64) - how many pieces the feed-forward computation gets split into. Higher means lower peak memory but more overhead; there's a real diminishing-returns point here.
  • ffn_seq_threshold (default 1024, 256–65536) - the sequence length above which chunking actually kicks in; below this threshold the node presumably isn't worth the overhead, so it skips chunking.
  • bf16_rope (default true) - the second, more precision-sensitive toggle.

How to install it

Via ComfyUI Manager: search "KJNodes for ComfyUI," install, restart. Manually:

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

then restart. You'll need Ideogram 4's weights already set up separately (the fp8 or nf4 checkpoint) - this node optimizes an existing model, it doesn't fetch one. Worth noting Ideogram's weights ship under a non-commercial license, so check that fits your use case regardless of what this node does.

Common issues & troubleshooting

Output looks subtly different from a run without this node. That's the expected, documented trade-off - start by disabling bf16_rope first, since forcing rotary embeddings into bf16 is the more likely source of a visible shift; keep chunk_ffn on if memory is still tight, since mathematically it should be closer to lossless (just reordered computation) than the rope change.

Barely any VRAM savings on smaller resolutions or shorter prompts. ffn_seq_threshold gates when chunking activates at all - if your sequence length isn't crossing that threshold, chunk_ffn isn't doing anything yet. Lower the threshold if you want it to kick in more aggressively, but expect proportionally less benefit at small scale anyway.

You don't actually need this node. If you're running Ideogram 4 on a GPU with plenty of headroom, this is solving a problem you don't have while introducing a small output-fidelity risk you didn't need to take. It earns its keep specifically at the edge of what your VRAM can handle.

CategoryKJNodes/experimental

Inputs (5)

NameTypeDefaultDescription
modelMODEL
chunk_ffnBOOLEANtrueChunk the feedforward activations over the sequence dim to cap the (B, L, hidden) intermediate.
ffn_chunksINT21–64Number of chunks to split the feedforward sequence into. More chunks = lower peak, slightly more overhead.
ffn_seq_thresholdINT1024256–65536Only chunk when the token sequence length exceeds this (skips chunking for tiny sequences).
bf16_ropeBOOLEANtrueApply RoPE in the input dtype instead of fp32. ~Halves RoPE activation memory; matches the HF reference dtype.

Outputs (1)

NameTypeDescription
modelMODEL