Skip to content

idea: H3 chain continuity from the previous segment's latent tail under a denoise mask (no pixel re-encode) #1150

Closed as not planned

Description

@dkackman

Carry an H3 chain's previous segment into the next as its latent tail under a denoise mask, instead of decoding it and re-encoding the pixels as guide rows. The aim is to take one VAE round trip out of every seam.

Source

knoic/ComfyUI-MiniMaxH3-PrefixStream (MIT, ComfyUI nodes), the "Native Masked AV" path in pipeline/native_masked_av.py. That path credits Herrgott's H3 Infinite Continuation Suite. Only concepts would come across: their code runs on ComfyUI's sampler and noise_mask plumbing, not on diffusers modular blocks. If any arithmetic is ported, credit it in docs/ATTRIBUTIONS.md.

What it does

  • Picks the source tail on H3's 1,4,4,4,4 frames-per-token grid: context lengths 5 + 17k (22 frames = 7 latent steps, 39 = 12). The tail has to be phase-aligned, starting where (start_step + t) % 5 == 0.
  • Copies those latent steps verbatim into the head of the new target latent. The audio latents go in the same way: duration rounded once at 40/24, then aligned to the video's end.
  • Builds separate video and audio denoise masks: 0 over the copied head (held), 1 over the rest (generated).
  • Drops any keyframe that falls inside the held head, so a frame-0 keyframe cannot fight the copied context.
  • Trims the held head off the deliverable afterwards.

Two optional knobs, both off by default in PrefixStream:

  • video_context_denoise: a soft value (they suggest A/B points 0 / 0.03 / 0.06) on the video head mask, so the model can lightly correct inherited texture. They note H3 rounds token masks to 1/256 granularity (0.06 becomes 0.0625), and that the value is not a calibrated "6 % repair".
  • audio_feather_ticks: a cosine ramp on the audio mask at the hand-over instead of a hard edge. They later set its default to 0, because feathering releases some held audio to regeneration.

How this differs from what we have

continuity: "guide" (dw/pipeline_processors/h3_guides.py, h3_guide_steps.py) decodes the previous segment and VAE-encodes guide_frames frames on the target canvas. It splices them in as extra condition rows held at t = 1.0, and the target rows at the same times are generated alongside them. That means one decode plus one encode per seam, and the guide costs about as much VRAM per voxel as the clip itself (#694). With the latent tail, the head is the target: no re-encode, no duplicate condition rows. The VRAM cost and the drift at the seam might both come down. Our H3 skill already says "drift compounds per seam".

Caveats

  • Unproven on real weights. PrefixStream's own analysis (docs/DEGRADATION_ANALYSIS_CN.md) says its runtime check used the real H3 mask and Euler code with a stand-in denoiser. No multi-segment run with the weights loaded has shown a quality gain. Copying the latent removes VAE re-encode error, but if the tail already carries texture damage, the copy carries it forward, frozen by the hard mask.
  • It is a different conditioning layout from guides, not a tweak to them. We would need the previous step's final latents (the refine's latents input gets partway there) and a masked-head layout block next to the guide-row one. It also has to fit our hold/refine/mask blocks: h3_mask.py regional edits already use a denoise mask, so check whether that path can be reused.
  • A joint AV model reads the video context when it predicts audio. A soft video mask can change the new audio even though the audio head stays held.
  • Batch size 1 only, in their implementation.

Suggested assessment

A/B on lem, everything branched from one clean first segment with a fixed seed sequence, prompts and settings. At least 5 seams per arm:

  1. Current guide continuity, 22 frames.
  2. Latent tail, hard mask, 22 frames.
  3. Arm 2 with video_context_denoise 0.03 and 0.06.

Compare a flat background region and skin across segments 1, 3 and 5 (#1152), seam continuity of motion and voice, peak VRAM, and wall time. Only if arm 2 beats arm 1 does this go to a plan.

Filed by Don, 2026-11-01, from a review of PrefixStream.

Activity

  1. added
    enhancementNew feature or request
    ideaAn idea for the researcher agent to assess
    owner:leadFeature lead's turn (harnest R11)
    on Nov 2, 2026
  2. dkackman commented on Nov 2, 2026

    @dkackman
    OwnerAuthor

    Plan v1: H3 chain continuity from the previous segment's latent tail (#1150)

    Written by model claude-opus-5-5 via provider anthropic (design session, 2026-11-01), against develop @ 4dd4d21.

    What this issue is. It's an idea, and it isn't a duplicate. It is the third version of one idea, "carry an H3 seam as latents, not pixels":

    What's new here is the layout. The carried head is the target's own rows, held under a mask, so there are no extra condition rows. That is a real difference from #1044 (no guide VRAM, and no duplicate rows at the same times), so I treat this as a feature rather than closing it as a duplicate. It belongs in that parked family, though.

    Verdict: defer. Park it with #1044/#1030. Reopen when #1152 can measure drift and shows guide chains drifting at the seams.

    The issue sets its own gate: "Only if arm 2 beats arm 1 does this go to a plan". Arm 2 doesn't exist yet. Getting to that A/B means building most of an engine path first. Today's evidence doesn't justify that.

    Value: real but unmeasured

    • Real use exists. Don's constitution-walk workspace is mid-take right now, running a custom ConstitutionWalkGuidedSegment, about 22 min per segment on lem:
      • seg03 ran once;
      • seg04 was re-rolled four times (seeds 1004, 1104, 1204, 1004), each followed by a chain QA / seg4 post-trim QA check-script run.
      • That is guided H3 continuation in real work. idea: decode a segment chain once - carry latents between segments, decode the take a single time #1030's plan found no chain use at all, so this is new evidence.
      • I couldn't open the workflow (get_job_workflow was denied in this session), so I don't know why seg04 was re-rolled. It could be drift, a seam problem, or just content.
    • Field reports: none. No field-report (open or closed) mentions seam drift, texture burn or guide VRAM.
    • Where guide seams were measured, they held. The idea (parked): H3 latent-space chunk continuation - blocked on multi-frame keyframes in diffusers #611 C-F311 A/B found no jump at the seams and no assess_output findings for guide. The verify of C-F304 heard speech carry across the seam word-for-word.
    • The claimed gain is unproven upstream. PrefixStream's own analysis ran a stand-in denoiser. No multi-segment run with real weights has shown a gain, and a hard mask freezes whatever damage the tail already carries.
    • The VRAM gain is real but modest.
      • A 22-frame guide is charged 28.71 B/voxel × 22 snapped frames × canvas (dw/vram_estimate.py:162-186), and chained-segments.json:16,22 already budgets for it.
      • The latent head adds no rows, so that term goes away.
      • No issue reports a guide chain that didn't fit.

    Build cost: about $14-20 before the A/B can even run, plus the A/B on lem

    The sweep found that none of what arm 2 needs exists today:

    needed today where
    hand the previous segment's latents on _SegmentCarry holds PIL frames + an audio tail only. _single_artifact drops every non-video output, latents included dw/pipeline_processors/chain.py:206-213, 462, 977-994
    latents out of an H3 step diffusers after_denoise leaves clean latents/audio_latents in state, but there is no output_type="latent", and they come out only as named in-memory outputs. pipeline.py:641-643 moves only a bare tensor to the CPU, not a dict mh3/decoders.py:106-126, 180-183; dw/result.py:504-514
    hold the first N target rows clean while generating from full noise the only per-row hold is the regional-edit blend: video only, takes a pixel source_video, needs refine_strength, refused together with latents, refused on chained steps, and mask_grow dilates in time h3_mask_steps.py:63-243; h3_mask_cells.py:63-92; h3_rules.py:649-655; pipeline.py:827
    hold the first N audio latents audio rows are channel-major, so "the first N" is two ranges, one per channel. The existing audio hold is whole-track or condition rows mh3/before_denoise.py:345; h3_hold_steps.py:279-293, 394-400
    a per-row clean timestep for generated rows row_timestep_plan only tells condition rows from generated ones. The scheduler steps every row after the condition prefix mh3/before_denoise.py:1250-1266; mh3/denoise.py:226-238

    Correction to the issue: "check whether the h3_mask.py path can be reused". It can't be reused as it is.

    • It is a refine-strength pixel blend.
    • It is barred from chains and from caller latents.
    • It never touches audio.

    The pattern carries over: a post-step overwrite of kept rows with scale_noise(source, …). The block itself doesn't.

    One more risk, from the VAE: it is causal and chunked. A tail copied from mid-clip only matches clip-start latents if it starts on a 17-frame chunk boundary. The issue's 5 + 17k phase rule is exactly that condition, so it must be enforced, not just advised.

    Inertia: moderate

    • One more continuity enum value (dw/workflow_schema.json:317-333), validated in dw/guides.py:234-283. It must stay out of the guide cap and out of guide_lengths (dw/guides.py:304-309).
    • A dw-owned head-hold block that pins private diffusers names, the way LAYOUT_ANCHORS already does (h3_guides.py:67-75). That is a second place that breaks on a diffusers bump.
    • Tests that pin the mode set:
      • tests/test_guide_chain_validation.py:112-123: every mode must validate on t2va, and the unknown-mode message must mention "guide".
      • tests/test_chain.py:824-1027.
      • tests/test_plugin_skills.py:420-426.
    • Docs:
      • docs/WORKFLOW_GUIDE.md:513, 1879-1903, 3024-3036, 3071-3072;
      • plugins/dw/skills/minimax-h3/SKILL.md:58-64;
      • script-to-video/references/joins.md:55.
    • No MCP, REST or UI surface: they pass the schema through.

    Reversibility

    Fine while it's unreleased. Once a saved workflow names the mode, removing it is a breaking-change.

    Cheaper alternatives

    1. Do nothing now, and measure first (idea: texture-band drift measurement across chain segments (assess/compare_outputs) #1152). A texture-band number across the segments of a real guide take tells us whether there is any drift to remove. It is far cheaper, and its method (one clean first segment, change one variable at a time, measure before the MP4 encode) is the method this A/B needs anyway. Recommended.
    2. idea: H3 Anti-Burn LoRA on chain continuation segments only #1151 (Anti-Burn LoRA on continuation segments) goes after the same symptom with no engine change.
    3. A smaller guide. guide_frames: 22 is already the minimum, so that lever is spent.

    Overlap

    Design, if reopened (recorded so the next session doesn't redo the sweep)

    Problem: every guide seam decodes the segment and re-encodes 22 or 39 frames as extra condition rows. That costs guide VRAM and may compound texture error per seam.

    Non-goals:

    Surface:

    • one new continuity value, "latent" (name open). It reuses guide_frames 22/39 as the head length, which maps to 7/12 latent steps (h3_rules.py:472);
    • no new MCP, REST or syntax keys beyond that enum value;
    • t2va/fl2va only;
    • the fl2va keyframe is dropped on segments after the first, because the held head already sets frame 0.

    Stages (each lands on develop):

    • A. Latent hand-off, no behaviour change (~$4, server).
      • run_chain asks each segment for latents/audio_latents, moves them to the CPU and holds them on _SegmentCarry, before _single_artifact drops them.
      • Unit test: a CPU tiny-DiT chain (as in tests/test_chain_h3_native.py) shows the carry shapes, and output stays bit-identical to today.
    • B. Head-hold block, unreferenced (~$6, server).
      • A dw step that takes head_latents/head_audio_latents.
      • It writes them into the target's first rows (video: a row prefix; audio: the per-channel ranges).
      • It gives those rows timestep 0 and overwrites them after each scheduler step.
      • It refuses a tail that isn't phase-aligned.
      • Unit test: held rows come out bit-equal to the input on the CPU harness.
    • C. Probe A/B on lem (tester; Don hears the result).
    • D. Wire it in, only if C shows arm 2 beats arm 1 (~$5, server + plugin).
      • The enum value, validation (outside the guide cap and guide_lengths), head trim via ChainConfig.head_trim, _record_seam wording, docs, skill.
      • Acceptance intent:
        • a chained-segments run with the new mode yields the same total frame count as guide, with no guide-VRAM warning;
        • validate refuses ref2va and source_video with it, and refuses guide_frames other than 22/39 with the existing message.

    Risks

    • The gain may simply not exist on real weights (upstream never showed one). Stage C is there to find out before D.
    • Under a hard mask the copy freezes tail damage. A soft head mask changes the new audio through joint AV attention, even with the audio head held.
    • A new private-diffusers coupling.

    Questions

    Q1 [scope] Defer and park with #1044/#1030, blocked by #1152? Default: yes. When #1152 closes, the driver hands this back, and a session reruns #1152's measurement on a real guide take (e.g. constitution-walk) to recheck the triggers. If otherwise: build stages A-C now as a probe (~$10 build plus Q2's GPU time), and D only on a win.

    Q2 [spend] Only if Q1 is "build": the A/B is 4 arms × ≥5 seams at ~20 min per H3 segment, so about 7 GPU-hours on lem. Default: not spent (deferred). If otherwise: it runs as stage C.

    Q3 [none] When this family unparks, this issue's layout replaces #1044's "latent carry" arm, and #1044 keeps only its crossfade arm. I'll note that on #1044 when it unparks.

    What would reopen it (triggers):

    1. idea: texture-band drift measurement across chain segments (assess/compare_outputs) #1152 lands, and on a real guide take its mid-band energy rises segment over segment at the seams.
    2. A field-report of drift or burn in an H3 guided chain.
    3. A guide chain that doesn't fit at 24 GB because of the guide term.
    4. Don rules that the reason seg04 of constitution-walk kept being re-rolled is seam drift.

    Reply in comments and hand back with owner:lead. Approve by adding status:plan-approved yourself. No agent may set it.

    Decision for Don: defer #1150 (H3 latent-tail continuity) and park it with #1044/#1030 behind #1152's drift measurement, or build the probe now.
    Kind: scope Default: deferred, parked, blocked by #1152.
    If otherwise: stages A-C get built (~$10) and about 7 lem GPU-hours go to the A/B (Q2). Reversible: yes

    — lead, claude-opus-5-5 via anthropic

  3. added
    featureWork bigger than a fix: designed with Don, built in stages (harnest R11)
    owner:donParked for human decision
    status:plan-reviewA feature plan is posted and waiting for Don
    and removed
    ideaAn idea for the researcher agent to assess
    owner:leadFeature lead's turn (harnest R11)
    on Nov 2, 2026
  4. dkackman commented on Nov 2, 2026

    @dkackman
    OwnerAuthor

    Ruling (Don, 2026-11-01): Q1: defer. Parked with #1044/#1030, and blocked by #1152 (GitHub link added). When #1152 lands, a session reruns its measurement on a real guide take (e.g. constitution-walk) and rechecks the plan's four reopen triggers. Q2 is not spent. Q3 stands as written: when this family unparks, this layout replaces #1044's latent-carry arm.

    Labelled parked.

    — recorded by claude-opus-5-5 (anthropic), relaying Don's ruling

  5. added and removed
    status:plan-reviewA feature plan is posted and waiting for Don
    on Nov 2, 2026
  6. dkackman commented on Nov 2, 2026

    @dkackman
    OwnerAuthor

    Evidence for the reopen triggers, from roycho87/NerdNotes (2026-10-31 to 2026-11-02; ComfyUI, real H3 weights). Unlike PrefixStream's stand-in-denoiser check, these are real multi-segment runs.

    A latent tail alone does not stop drift.

    • Their block-aligned masked-latent continuation (Clown Context) copies the tail latents verbatim, the same layout as this proposal. It was still visibly cloudy by shot 8.
    • Ablejones (Banodoco, 15 Sep 2026) found that chaining purely in latents still degrades, faster than expected.
    • Both point to drift building up while each segment samples, against clean held rows, rather than at a VAE round trip. NikoDemon80 measured it the same way.

    What did help was sampling-side. Partial noise on the held rows, ramping to clean at the join, plus clean anchors from segment 1. That is now #1166. If #1166's noise ramp turns out to be easier on masked target latents than on guide rows, that's an argument for unparking this layout as the vehicle. If it doesn't, the round-trip saving alone looks small.

    Posted 2026-11-02 at Don's request.

  7. dkackman commented on Nov 2, 2026

    @dkackman
    OwnerAuthor

    Trigger fired: #1152 (compare_outputs(texture_bands=true)) is closed and verified. The rerun this ruling calls for is folded into #1170's Stage A, which already loads constitution-walk seg 1–4. It posts texture bands per segment and across each seam here, then rechecks the four reopen triggers. Stays parked until those numbers are in. Given the NerdNotes evidence above (latent-tail chains still drift), unparking needs a trigger that clearly fires, or #1166 showing its noise ramp works better on masked target latents than on guide rows.

  8. dkackman commented on Nov 3, 2026

    @dkackman
    OwnerAuthor

    Folded into #1199 (Long-form media), whose design and plan Don approved on 2026-11-03. This idea gets a measured verdict on the shared long-take bench there, and is then either built or promoted to a default, or closed with its numbers. Held as owner:don + parked while Don's session works it, so no loop role picks it up. The hand-off comment on #1199 says what happens to it.

  9. dkackman commented on Nov 7, 2026

    @dkackman
    OwnerAuthor

    Verdict (long-form, #1199): stage A spiked (experimental_latent_carry, dark), not
    built.
    The previous segment's own final latents (video and audio rows) went in as
    the next segment's guide rows, in place of the decode and re-encode. Stage B's
    head-hold was not built, and the fl2va keyframe stays pixel. The benched arm and its
    numbers are #1044's: no burn fix on the static scene, worse seams on the moving arc,
    a tie under the keystone, and about 5 min saved per two-minute take. The
    VRAM-saving arm was not measured, and with the carry losing as a default it is not
    worth one. Record: bench/records/structural.md Steps 2-3 (R39 lists everything
    the A/B removes).

  10. dkackman commented on Nov 12, 2026

    @dkackman
    OwnerAuthor

    Verdict on latent carry under a held narration (narrated-long-take bench, 2026-11-12), seed 1, 12 segments (about 86 s).

    • It removes the saturation build outright (flat at 66-68, against 68 to 81 for guide carry) at no extra wall time.
    • It does not hold the face alone: natural to about 60 s, then face_drop meets guide carry's at 85 s (0.205 against 0.207).
    • On top of the arc keyframes it gave the flattest colour of any arm (73 to 76), but that arm's face over-sharpens from about 45 s; whether latent carry causes that is being isolated by one run without it.

    experimental_latent_carry stays experimental; no key was renamed.

    Evidence: bench/records/narrated.md; verdicts: docs/proposals/complete/narrated-long-take-complete.md (on feat/narrated-long-take, merging to develop today).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:sharedenhancementNew feature or requestfeatureWork bigger than a fix: designed with Don, built in stages (harnest R11)owner:donParked for human decisionparkedParkedstatus:plan-approvedDon approved the feature plan (Don only)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions