π£ Gimbal Latent Math (Dispatcher)
Eleven research operations behind one dropdown
- latent
- additional_latent
- reference_batch
- latent
- mean_metric
- op_telemetry
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) - fortruncation/pipeline. 1.0 = identity, <1.0 shrinks variance toward the centroid, >1.0 exaggerates.t(E4 slerp fraction) - forslerp_mu. 0 = your input, 1 = theadditional_latentyou 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 fortotal_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.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | β | |
| op | COMBO | pipeline | Equation set to apply. Transform ops rewrite the latent; metric ops pass it through and emit FLOAT + DICT telemetry. |
| psiopt | FLOAT | 0.900β3 | E3 truncation coefficient (truncation / pipeline). 1.0 = identity; <1.0 shrinks variance toward centroid; >1.0 exaggerates |
| topt | FLOAT | 0.500β1 | E4 mu-Slerp interpolation fraction (slerp_mu). 0 = input, 1 = additional_latent target |
| subspace_rankopt | INT | -1-1β64 | E7/E8/E9 low-rank subspace size. -1 = all available SVD components; 0 = Frechet-mean / isotropic shrinkage only |
| scale_capopt | FLOAT | 10.00.1β1000 | E11 bounded coupling-scale tanh cap (bounded_scale / pipeline) |
| jitter_strengthopt | FLOAT | 0.0010β1 | E12 dequantization amplitude (dequantize / pipeline). Doubles as E10 Gaussian bandwidth for total_correlation (0 = auto median bandwidth) |
| sigma2opt | FLOAT | 0.000β100 | E7/E8/E9 residual isotropic variance. 0 = estimate from the SVD trailing eigenvalues |
| scheduleopt | COMBO | cosine | E12 dequantization decay schedule |
| stepopt | INT | 00β1000000 | E12 current dequantization step (out of 1000); decay = 0 at step 1000 |
| channel_adaptiveopt | BOOLEAN | true | E3 per-channel centroid vs global scalar centroid when no reference_batch is wired (truncation) |
| seedopt | INT | 00β18446744073709550000 | Seed for reproducible E12 jitter |
| additional_latentopt | LATENT | Target vector for E4 slerp_mu destination or E5 geodesic comparison. Optional; required only for those ops | |
| reference_batchopt | LATENT | Cohort anchor: E4 mu centroid (slerp_mu) or E3 centroid (truncation) |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | β |
| mean_metric | FLOAT | β |
| op_telemetry | DICT | β |