Nodes/Gimbal-ComfyUI/πŸ”£ Gimbal Latent Math (Dispatcher)
ComfyUI Node

πŸ”£ Gimbal Latent Math (Dispatcher)

Eleven research operations behind one dropdown

By FormAndNoiseΒ·Created about a month agoΒ·Updated 19 days agoΒ· 0
πŸ”£ Gimbal Latent Math (Dispatcher)
  • latent
  • additional_latent
  • reference_batch
  • latent
  • mean_metric
  • op_telemetry
β—„oppipelineβ–Ί
β—„psi0.90β–Ί
β—„t0.50β–Ί
β—„subspace_rank-1β–Ί
β—„scale_cap10.0β–Ί
β—„jitter_strength0.001β–Ί
β—„sigma20.00β–Ί
β—„schedulecosineβ–Ί
β—„step0β–Ί
β—„channel_adaptivetrueβ–Ί
β—„seed0β–Ί

GimbalLatentMath is the pack's utility drawer: eleven latent-space operations, one node, one op dropdown. The rest of the suite gives each of these operations a friendly face (Compass Pro does the Slerp, Stabilizer does the Woodbury denoise); this node strips away the ceremony and exposes them as primitives. The tooltip on op says it best: transform ops rewrite the latent, metric ops pass it through and emit a FLOAT plus telemetry.

The operations

The dropdown offers: channel_diagonal_gaussian, truncation, slerp_mu, bounded_scale, dequantize, woodbury_impute, pipeline (runs several stages in sequence), and the metric ops log_likelihood, mahalanobis, total_correlation, and geodesic. The metric ops are the ones you'd run for diagnostics - they don't touch your latent, they score it. The transform ops are the ones you'd actually sample from.

The inputs that matter

The required ones are just latent and op. Everything else is optional, and only some matter per op - the tooltips tell you which:

  • psi (E3 truncation coefficient) - for truncation/pipeline. 1.0 = identity, <1.0 shrinks variance toward the centroid, >1.0 exaggerates.
  • t (E4 slerp fraction) - for slerp_mu. 0 = your input, 1 = the additional_latent you wire in as the target. If you use this op, that optional input becomes required in practice.
  • subspace_rank - for the SVD-based ops (woodbury_impute, the Mahalanobis metric). βˆ’1 = all components, 0 = Frechet-mean/isotropic only, otherwise the rank cap.
  • scale_cap (E11 tanh cap), jitter_strength (E12 dequantization amplitude, doubles as the bandwidth for total_correlation), sigma2 (residual variance, 0 = estimate from SVD), schedule/step/seed (for the dequantization decay), channel_adaptive (per-channel vs global centroid), reference_batch (the cohort anchor for centroid/Slerp).

Outputs are latent (rewritten for transform ops, passed through for metric ops), mean_metric (the scalar the metric ops produce), and op_telemetry (the full dict).

When you'd reach for it

If you're doing this as an end-user, honestly, rarely - the dedicated nodes are friendlier, and the pipeline op is basically a poor man's GimbalLatentStabilizer. Where this node shines is experimentation: it's the fastest way to A/B two operations without swapping nodes, and the metric ops (mahalanobis, log_likelihood) are the pack's "is this latent still sane?" scoreboard, which pairs naturally with GimbalLatentTelemetry for OOD auditing.

Installing and gotchas

Standard pack install: ComfyUI Manager β†’ search "Gimbal-comfy" β†’ install β†’ restart, or git clone https://github.com/FormAndNoise/Gimbal-comfy into ComfyUI/custom_nodes. Dependencies are torch/numpy/pillow, already bundled; nothing downloads. (README clone URL is stale - FormAndNoise/Gimbal-comfy is live.)

The main trap is expecting every op to work with no optional inputs wired. slerp_mu without an additional_latent is a no-op; geodesic without a comparison target measures against the batch centroid (fine if your batch has >1 sample, meaningless for a single latent). And the op names are LAMNr-framework jargon - the equations are in the pack's wiki, but nothing external explains them, because nobody outside the pack really discusses the framework at all. It's research-flavored infrastructure: solid math, thin hand-holding.

CategoryGimbal/Primitives

Inputs (14)

NameTypeDefaultDescription
latentLATENTβ€”
opCOMBOpipelineEquation set to apply. Transform ops rewrite the latent; metric ops pass it through and emit FLOAT + DICT telemetry.
psioptFLOAT0.900–3E3 truncation coefficient (truncation / pipeline). 1.0 = identity; <1.0 shrinks variance toward centroid; >1.0 exaggerates
toptFLOAT0.500–1E4 mu-Slerp interpolation fraction (slerp_mu). 0 = input, 1 = additional_latent target
subspace_rankoptINT-1-1–64E7/E8/E9 low-rank subspace size. -1 = all available SVD components; 0 = Frechet-mean / isotropic shrinkage only
scale_capoptFLOAT10.00.1–1000E11 bounded coupling-scale tanh cap (bounded_scale / pipeline)
jitter_strengthoptFLOAT0.0010–1E12 dequantization amplitude (dequantize / pipeline). Doubles as E10 Gaussian bandwidth for total_correlation (0 = auto median bandwidth)
sigma2optFLOAT0.000–100E7/E8/E9 residual isotropic variance. 0 = estimate from the SVD trailing eigenvalues
scheduleoptCOMBOcosineE12 dequantization decay schedule
stepoptINT00–1000000E12 current dequantization step (out of 1000); decay = 0 at step 1000
channel_adaptiveoptBOOLEANtrueE3 per-channel centroid vs global scalar centroid when no reference_batch is wired (truncation)
seedoptINT00–18446744073709550000Seed for reproducible E12 jitter
additional_latentoptLATENTTarget vector for E4 slerp_mu destination or E5 geodesic comparison. Optional; required only for those ops
reference_batchoptLATENTCohort anchor: E4 mu centroid (slerp_mu) or E3 centroid (truncation)

Outputs (3)

NameTypeDescription
latentLATENTβ€”
mean_metricFLOATβ€”
op_telemetryDICTβ€”