Nodes/Gimbal-ComfyUI/🎚️ Gimbal Semantic Slider (PCA)
ComfyUI Node

🎚️ Gimbal Semantic Slider (PCA)

PCA your latent batch and dial one attribute without moving the rest

By FormAndNoiseΒ·Created about a month agoΒ·Updated 19 days agoΒ· 0
🎚️ Gimbal Semantic Slider (PCA)
  • latent_batch
  • base_latent
  • modified_latent
  • pc_preview
β—„pc_index1β–Ί
β—„slider_value0.00β–Ί
β—„orthogonalizefalseβ–Ί

Some attributes are tangled: change the lighting and the pose shifts, change the style and the character drifts. Gimbal Semantic Slider is the pack's attempt to untangle one of them - it runs PCA over a batch of your latents, finds the directions of most variation, and lets you slide along a single principal component while everything else stays put. In principle, that's "turn up warm lighting" without touching composition.

In practice, the honest version: this is the pack's most genuinely clever node and also the one where expectations need the most management. PCA finds the axes of variance in your data - it does not know that PC3 means "dusk lighting." Whether a component maps to a useful semantic attribute is something you discover by testing, not something the node tells you. That's a feature once you've got a good batch; it's a trap if you assume PC1 is always meaningful.

How it works

You feed it latent_batch (at least two samples - PCA needs variance) and a base_latent to modify. The node flattens the batch, mean-centers it, and runs randomized SVD (torch.pca_lowrank) to get the top components and their standard deviations. Then it builds a delta: slider_value Γ— std Γ— pc_vector for the component selected by pc_index (1–10), and adds it to the base latent. orthogonalize (off by default) removes the component of the change parallel to the base, which tightens the "only this attribute moves" effect at the cost of some strength.

Outputs: modified_latent (your base + the slider delta, into a KSampler) and pc_preview - a latent showing the component direction itself, so you can visualize what axis you're actually dragging along. The PCA result is cached per batch, so sliding back and forth is cheap once it's computed.

The inputs that matter

  • latent_batch - where the variance comes from. Build it from a handful of generations that differ in the attribute you care about (e.g. 4–8 images varying only in lighting) and stack them into one batch.
  • pc_index - which component to drag. Start at 1 (most variance) and move up.
  • slider_value - βˆ’5 to 5, default 0. Start small (Β±0.5) and step up; the PC is normalized by its own standard deviation, so "1.0" is already a full standard deviation of movement.

Common issues

If you get a ValueError about needing β‰₯ 2 samples, your batch is too small - the node will not (and should not) do PCA on a single latent. If the slider seems to change everything, you've picked a PC that captures global variation rather than your target attribute - try a different pc_index, or feed it a tighter batch that varies along only the dimension you want to control. And as always with this pack, refine at denoise ~0.5 with modest CFG, or the final pass undoes your surgical edit.

Install

# ComfyUI Manager β†’ search "Gimbal"
# or:
cd ComfyUI/custom_nodes
git clone https://github.com/FormAndNoise/Gimbal-comfy
pip install -r Gimbal-comfy/requirements.txt

Restart ComfyUI; it's under Add Node β†’ Gimbal/Flight Instruments as "🎚️ Gimbal Semantic Slider (PCA)". Just torch, numpy, pillow - no model downloads.

CategoryGimbal/Flight Instruments

Inputs (5)

NameTypeDefaultDescription
latent_batchLATENTβ€”
base_latentLATENTβ€”
pc_indexINT11–10β€”
slider_valueFLOAT0.00-5–5β€”
orthogonalizeBOOLEANfalseβ€”

Outputs (2)

NameTypeDescription
modified_latentLATENTβ€”
pc_previewLATENTβ€”