Nodes/ComfyUI-LTX-Attention-Toolkit/LTX Attn — Metrics Heatmap
ComfyUI Node

LTX Attn — Metrics Heatmap

The block×head overview you'll actually live in

By g-raw·Created 3 months ago·Updated 2 months ago· 2
LTX Attn — Metrics Heatmap
    • heatmap_image
    • stats_text
    store_handle
    attn_typesa
    metricentropy
    step_idx-1
    colormapviridis
    cell_size16

    This is the node you'll reach for first after a capture, and honestly the one you'll keep coming back to. Metrics Heatmap renders the whole attention landscape of LTX-2.3 as a single image: X = transformer block (0–47), Y = head (0–31), color = one metric. Every one of the 1,536 heads gets a cell, so a single glance tells you where the "global" diffuse heads live, where the temporal/motion heads cluster, and which blocks look uniform. The profiling flow starts here - Setup Capture in reduced mode (which already computes all the metrics, no full maps needed) and then one heatmap per metric you care about.

    The metrics are the pack's real contribution, and they're worth learning because they translate "attention" into things you can act on:

    • entropy - high = diffuse attention (a global, mixes-everything head); low = sharply focused.
    • temporal - high = attends across video frames (motion/coherence behavior).
    • spatial - high = attends within the same frame (texture/structure behavior).
    • sink - high = attention mass piled on the first/last token (the sink-head phenomenon).
    • frame_dist_mean/std and spatial_dist_mean/std - attention-weighted average distance (and spread) in frames or patch units. High mean = looks far away; low std = consistent offset.
    • the _norm variants - same numbers divided by the max possible distance, so they land in [0, 1] and are comparable across runs with different frame counts or resolutions.

    The one thing to internalize: most of these metrics are not natively in [0, 1]. sink is roughly a probability, but temporal and spatial are raw scores with a much wider range. So the node normalizes per-image (min→max of whatever range actually exists in this store) and stamps a numeric colorbar along the bottom showing the literal [min, max]. Direction and magnitude both stay readable - that's a deliberate choice, and it means you can't compare two heatmaps' colors as if they shared a scale.

    The inputs that matter

    • metric - the 12-option list above. This is the whole game.
    • attn_type - sa (self-attention) or ca (cross-attention). Frame/spatial distance metrics read as 0 for ca, since text tokens have no geometry.
    • step_idx - -1 (default) averages across all captured steps; a specific index shows one step.
    • store_handle - the handle string from Setup Capture (blank = current active store).
    • cell_size / colormap - rendering; defaults are fine.

    Outputs are a heatmap_image IMAGE plus a stats_text STRING with the actual numbers. The text output is underrated - paste it into a notes file and you have a portable summary.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/g-raw/ComfyUI-LTX-Attention-Toolkit.git
    

    Restart ComfyUI. No extra dependencies, no model files. The pack is work-in-progress, so treat saved stores as potentially breakable between updates.

    Common issues

    Because this only needs metrics - which every capture mode computes - it's the most forgiving node in the pack. The failures people actually hit: (1) forgetting the two-run workflow and queuing the heatmap before the capture run populated the store (blank handle + no active store = empty output); (2) comparing raw metrics across runs with different frame counts/resolutions, when you should be using the _norm variants; (3) expecting ca mode to show frame-distance metrics, which are structurally zero for cross-attention.

    Categoryg_raw/LTX/Profiler

    Inputs (6)

    NameTypeDefaultDescription
    store_handleSTRING
    attn_typeCOMBOsa2 options: sa, ca
    metricCOMBOentropy12 options: entropy, temporal, spatial, sink, frame_dist_mean, frame_dist_std, +6
    step_idxINT-1-1–255
    colormapCOMBOviridis7 options: viridis, inferno, magma, plasma, hot, turbo, +1
    cell_sizeINT164–64

    Outputs (2)

    NameTypeDescription
    heatmap_imageIMAGE
    stats_textSTRING