Nodes/ComfyUI/Context Windows (Manual)
ComfyUI Node Runs on cloud

Context Windows (Manual)

Sample long video without your VRAM collapsing

By Comfy-Org·Created 4 years ago·Updated 29 minutes ago· 129,853
Context Windows (Manual)
  • model
  • MODEL
context_length16
context_overlap4
context_schedulestandard_static
context_stride1
closed_loopfalse
fuse_methodpyramid
dim0
freenoisefalse
cond_retain_index_list
split_conds_to_windowsfalse
latent_retain_index_list
causal_window_fixtrue

Context Windows (Manual) is the general-purpose version of a trick that video generation desperately needs: instead of denoising a whole long clip at once, you slide a short context window over the frame sequence, sample each window, and fuse the results. The whole point is VRAM - temporal attention scales quadratically with frame count, which is why a 121-frame clip wants far more than double the memory of a 61-frame one. This node makes long video fit where it didn't before, at the cost of some attention coherence at window boundaries.

ComfyUI shipped this node alongside the Wan-specific variant in late August 2025, announced as the groundwork for "sliding context windows instead of all at once." It's marked experimental, and it shows: it's powerful, but you're expected to understand what the knobs mean.

How it works

The node doesn't touch weights - it installs a context handler on a cloned model that slices the latent sequence into overlapping windows, runs the sampler's attention within each window, and fuses the overlapping regions back together. context_length and context_overlap define the windows; the schedule controls how windows are laid out over the sampling steps; the fuse method decides how overlapping areas get blended (the default, pyramid, weights each window's center most heavily). FreeNoise shuffling randomizes noise in the overlap so windows don't leave visible seams. It also wires a wrapper so ComfyUI's VRAM math only counts the windows it actually samples.

The inputs that matter

The node has a lot of fields; a beginner sets four and leaves the rest:

  • context_length (default 16) and context_overlap (default 4) - window size and how much neighboring windows share. More overlap smooths seams but costs compute.
  • context_schedule - standard_static, standard_uniform, looped_uniform, batched. Static keeps the same windows for every step; uniform slides them step-dependent. Default standard_static is the safe start.
  • fuse_method (default pyramid) - how overlaps blend. Leave it.

The advanced ones matter when you hit real models: cond_retain_index_list keeps the encoded start image in every window for concat-style I2V models (Wan I2V, HunyuanVideo I2V, Cosmos I2V, SVD) - set it to '0' - while latent_retain_index_list does the same for inplace-style I2V (LTXV, AnimateDiff) where the reference lives in the latent itself. causal_window_fix (default on) adds a causal fix frame so non-first windows behave.

Output: the patched MODEL for your sampler. Ships with ComfyUI core.

Common issues & troubleshooting

Seams and "jumps" at window boundaries are the classic complaint. The long-Wan threads are full of people fighting sudden morphing between windows. Raise the overlap, make sure FreeNoise is on (the Wan variant defaults it on; this one defaults it off), and check the fuse method. If a clip still jumps, some models just don't cooperate with context windows yet - "some WAN models still need tuning" was in the announcement itself.

I2V content vanishes after the first window. That's the retain-index problem - the start image only lives in window zero. Set cond_retain_index_list to '0' (or latent_retain_index_list for LTXV-style models) so every window sees it.

Window length isn't in frames for this node. Unlike the Wan and LTXV variants, this manual node counts in latent positions - if your VAE compresses 4x temporally, a context_length of 16 covers 61 real frames. That's exactly why the Wan/LTXV wrappers exist.

Categorymodel/patch

Inputs (13)

NameTypeDefaultDescription
modelMODELThe model to apply context windows to during sampling.
context_lengthINT16The length of the context window.
context_overlapINT4The overlap of the context window.
context_scheduleCOMBOstandard_staticStep-dependent scheduling algorithm for context windows.
context_strideINT1The stride of the context window; only applicable to uniform schedules.
closed_loopBOOLEANfalseWhether to close the context window loop; only applicable to looped schedules.
fuse_methodCOMBOpyramidThe method to use to fuse the context windows.
dimINT00–5The dimension to apply the context windows to.
freenoiseBOOLEANfalseWhether to apply FreeNoise noise shuffling, improves window blending.
cond_retain_index_listSTRINGList of latent indices to retain in the conditioning tensors for each window. For concat-style I2V models (e.g. Wan I2V, HunyuanVideo I2V, Cosmos I2V, SVD) the encoded start image lives in the c_concat conditioning channels; setting this to '0' will retain that start image content at sub-pos 0 of every window.
split_conds_to_windowsBOOLEANfalseWhether to split multiple conditionings (created by ConditionCombine) to each window based on region index.
latent_retain_index_listSTRINGList of latent indices to retain in the noise latent itself for each window. Use for workflows where reference content (e.g. a start image) lives directly in the noise latent rather than in separate conditioning channels (e.g. inplace-style I2V like LTXV, AnimateDiff). Independent of cond_retain_index_list.
causal_window_fixBOOLEANtrueWhether to add a causal fix frame to non-0-indexed context windows.

Outputs (1)

NameTypeDescription
MODELMODELThe model with context windows applied during sampling.