# Stage-2 DeRoPE Clock Guide — What Works Well & How to Use It This guide covers the **experimental Stage-2 DeRoPE stack** shipped on this branch (`H3Stage2Clock` + ready-to-drop workflows in `examples/experimental/`). Every default here comes from 80+ controlled ablations across 6 test clips (live-action panning shots and fast anime sword/vault action). If you want the full story of what broke, which hypotheses failed, and how we found these fixes, read [`docs/STAGE2_CLOCK_JOURNEY.md`](STAGE2_CLOCK_JOURNEY.md). --- ## 1. The Four Levers That Actually Work ### Lever 1 — Pop-Free `K=3` Fine-Band Splice (`keep_fine_bands = 3`) MiniMax-H3's temporal RoPE spectrum has periods: - Band 0: **3.8 frames** - Band 1: **6.7 frames** - Band 2: **11.9 frames** (1.43 turns inside one 17-frame VAE chunk) - Band 3: **21.2 frames** (first band slower than a 17-frame chunk) Keeping **3 fine bands** (`keep_fine_bands = 3`) leaves Bands 0–2 on the native stock grid while putting Band 3+ on the True Clock. That single change eliminates: - Chunk-start white exposure flashes (`t % 5 == 0` singletons jumping 25–30 luma levels under `K=2`), - Translucent multi-exposure ghosting on static backgrounds, and - The 8-frame vertical camera bob that `K=2` excites and `hold = 4` aliases into an every-other-frame buzz. ### Lever 2 — Two-Pass Split (`σ ≥ 0.80` Clock → `σ ≤ 0.571` Pure Native Stock) Leaving *any* compressed temporal RoPE active during the final low-sigma detail steps (`σ = 0.571, 0.333`) causes adjacent held frames to blend edges across time (blurry ghost boots, soft limbs). Splitting the denoise cleanly at `handoff_sigma = 0.65` solves it with **zero extra steps**: - **Pass 1 (`σ ≥ 0.80`):** `H3Stage2Clock` (`K=3` + optional RYS loop, with **no LoRA** or a `K=3` clock LoRA). - **Pass 2 (`σ ≤ 0.571`, final 2 steps):** Pure native stock model + `euler` + `DisableNoise` — **no True Clock, no clock LoRA, no RYS loop**. On Pika's 6-step schedule (`[1.0, 0.973, 0.923, 0.80, 0.571, 0.333, 0.0]`), `handoff_sigma = 0.65` automatically splits every common entry point: - Enter at **`σ = 0.973`**: 3 Pass-1 steps (`0.973 → 0.923 → 0.80 → 0.571`) + 2 Pass-2 stock steps (`0.571 → 0.333 → 0.0`). - Enter at **`σ = 0.923`**: 2 Pass-1 steps (`0.923 → 0.80 → 0.571`) + 2 Pass-2 stock steps. - Enter at **`σ = 0.800`**: 1 Pass-1 step (`0.80 → 0.571`) + 2 Pass-2 stock steps. ### Lever 3 — Deterministic `euler` + Zero-Training Damped RYS Middle-Block Loop Switching from stochastic `lcm` to deterministic **`euler`** removes re-noising jitter during the short Pass-1 window. Adding a zero-training **RYS ("Repeat Your Self") middle-block loop** during Pass 1 only — adapted from the LLM middle-layer duplication trick (David Noel Ng, 2024) into a DiT-safe damped residual loop that runs a middle window of DiT blocks once more and blends `h = h_save + 0.20 * (h_loop - h_save)` — dramatically improves spatial/temporal lock without retraining or the contrast/color overshoot of raw 100% looping: - **`16-32` (`α = 0.20`):** Best general balance and **best when paired with `SelfRefiningSamplerPlus`** (tight velocity control, razor-sharp anime swords, 3–4× calmer horizons). - **`20-36` (`α = 0.20`):** Best **without** `SelfRefiningSamplerPlus` on live-action walking/panning shots (preserves original warm palette and unlocks freer natural stride fluidity while keeping 3× calmer vertical stability than source). - **Keep Pass 2 loop OFF:** Looping both passes showed no benefit over Pass-1-only. ### Lever 4 — Optional `ComfyUI-SelfRefiningSamplerPlus` at Fixed `σ` (`perturb_strength_scale = 1.0`) If you install [`ComfyUI-SelfRefiningSamplerPlus`](https://github.com/Alex240z/ComfyUI-SelfRefiningSamplerPlus) (implements arXiv:2601.18577 Predict-and-Perturb self-refinement and natively supports H3's `NestedTensor` audio-video latents), wiring `SamplerSelfRefinePlus` into `H3Stage2Clock`'s `sampler` input gives a major jump in edge crispness and fast-action coherence (e.g. solid katana blades instead of smears, clean sparks, sharp tiles). Two rules are critical when using `SelfRefiningSamplerPlus` on H3: 1. **Always set `perturb_strength_scale = 1.0`** (fixed-`σ` P&P, `uncertainty_metric = "l1_mean"`, `uncertainty_threshold = 0.20`, `max_substeps = 2`). Values `> 1.0` shift anime colors and can push dilated clips across the `σ > 0.92` speed-up cliff. 2. **Use the Identity-Locked curve when entering at `σ = 0.973` on character/anime shots:** - Standard curve (best on `σ = 0.973` live-action silhouettes or `σ = 0.80`): `[[0.0, 1.0], [0.5, 0.5], [1.0, 0.5]]` (`[2, 1, 1]` substeps on 3 Pass-1 steps) - **Identity-Locked curve** (skips P&P on `σ = 0.973` so 97.3% noise cannot re-roll face/gender/camera angle, then refines on `σ = 0.923 & 0.800`): `[[0.0, 0.0], [0.5, 1.0], [1.0, 0.5]]` (`[0, 2, 1]` substeps on 3 Pass-1 steps) --- ## 2. Quick-Reference Recipe Matrix | Scenario | Entry `σ` | Clock & Loop (`H3Stage2Clock`) | Sampler | LoRA (Pass 1) | Why This Works | | :--- | :--- | :--- | :--- | :--- | :--- | | **Live-action high-denoise (max smoothness + sharpness)** | `0.973` | `K=3`, RYS `16-32`, `α=0.20`, `handoff=0.65` | `SelfRefine+` (`scale=1.0`, standard curve) + `euler` | **None** *(or `K=3` LoRA)* | Best overall temporal smoothness, calm horizon, zero ghost boots, no `K=2` LoRA drag. | | **Live-action high-denoise (zero extra node packs / freer stride)** | `0.973` | `K=3`, RYS `20-36`, `α=0.20`, `handoff=0.65` | Plain `euler` | **None** *(or `K=3` LoRA)* | Exact original warm lighting, fluid walking stride, 3× calmer horizon than source, core nodes only. | | **Anime / complex framing at high denoise (`σ = 0.973`)** | `0.973` | `K=3`, RYS `16-32`, `α=0.20`, `handoff=0.65` | `SelfRefine+` (`scale=1.0`, **Identity-Locked** `[0,2,1]` curve) + `euler` | **None** *(or `K=3` LoRA)* | Prevents `σ=0.973` camera/identity flips while sharpening swords, sparks, and flying debris and halving stutter. | | **Fast-action anime at medium denoise (`σ = 0.80`)** | `0.800` | `K=3`, RYS `16-32`, `α=0.20`, `handoff=0.65` | `SelfRefine+` (`scale=1.0`, `1` Pass-1 step) + `euler` *(or plain `euler`)* | **None** *(or `K=3` LoRA)* | Solid sharp blades, zero background ghosting, exact source pose & palette. | | **Maximum source identity & color lock** | `0.923` | `K=3`, RYS `16-32`, `α=0.20`, `handoff=0.65` | `SelfRefine+` (`scale=1.0`, 2 Pass-1 steps) + `euler` | **None** | Locks original face, silhouette, golden-hour warmth, and ~1.0× natural speed without touching `σ=0.973`. | > **Recommended `K=3` Pass-1 LoRAs (optional — download from [`MATLOWAI/MiniMax-H3-Variable-Clock`](https://huggingface.co/MATLOWAI/MiniMax-H3-Variable-Clock)):** > Everything in the table works with **no clock LoRA at all**. Legacy `run f` was trained at `K=2`, so inside `K=3 + SelfRefine+ + RYS 16-32`, dropping `run f` actually improved smoothness. Three dedicated **`K=3` sustained-hold LoRAs** (trained across 108 clips / 27 live-action + anime sources with chunk starts inside `hold=4` plateaus) beat both `NO LoRA` and `run f` across all 4 benchmark scenes — always load on **Pass 1 only** and keep **Pass 2 pure native stock**: > > | LoRA file (Pass 1 only, strength `1.0`) | Trained on | Best for | Key measured wins (1 seed/scene) | > | :--- | :--- | :--- | :--- | > | **`minimax_h3_variable_clock_k3_hisigma_flow_step1000_lateattn_r16.safetensors`** | High-sigma only (`σ ∈ [0.55, 1.00]`), DIS smooth-flow `K=3`, blocks `0-34` + late attention (`lateattn` trim) | **Best all-around Pass-1 LoRA** (calmest horizon + lowest exit stutter + clean anime) | `pier`: `dy_hf 0.113 px`, `exSt 1.63`, `sharp 2.17`; `bamboo`: solid red katana + `held_dy_hf 0.354` (2.7× calmer than `run f`); `panrun`: `chunk 1.14` | > | **`minimax_h3_variable_clock_k3_flow_step400_r16.safetensors`** | Full-sigma DIS smooth-flow `K=3`, step 400 sweet spot | **Smoothest overall motion** across live + anime | `pier`: `midSt 1.48` (smoother than source `1.51`), `f147pk 2.15×`, clean RYS `dy_hf 0.110 px`; `bamboo`: `1.004×` sharp, `held_dy_hf 0.348`; `panrun`: `stutter 3.30`; `rooftop`: `chunk 0.41` | > | **`minimax_h3_variable_clock_k3_hisigma_flow_step1000_r16.safetensors`** | High-sigma only (`σ ∈ [0.55, 1.00]`), DIS smooth-flow `K=3`, all 50 blocks | **Maximum sharpness & lowest chunk jump** | `pier`: `sharp 2.323`, `chunk 0.41`, `f147pk 2.28×`; `panrun`: `chunk 1.12` | > | **`minimax_h3_variable_clock_k3_repeat_step1000_r16.safetensors`** | Full-sigma repeated-frame `K=3`, step 1000 | **Tightest horizon lock** on panning shots | `pier`: `dy_hf 0.111 px / dy_mx 0.23 px` (3.3× calmer than source `0.75 px`); `rooftop`: `sharp 2.265` | ### Leaderboard Comparison Across Top Methods (1 Seed/Scene, Two-Pass `handoff_sigma = 0.65`, Pass 2 Pure Stock `euler`) *`dy_hf / dy_mx` = vertical horizon jitter in px (`pier` source `0.171 / 0.75`); `midSt / exSt` = mid-hold / exit-ramp stutter (`pier` source `midSt = 1.51`); `chunk` = 17f chunk-boundary luma jump; `sharp` = Laplacian fine-detail ratio vs source; `held_dy_hf` = `bamboo` held-span background jitter. `panrun` `K=3` LoRA rows use Identity-Locked `SRP` (`[0, 2, 1]`).* | Method / Stack (Pass 1 → Pure Stock Pass 2) | Extra Deps | `pier` `dy_hf / dy_mx` | `pier` `midSt / exSt` | `pier` `chunk / sharp` | `bamboo` `PSNR / held_dy_hf` | `panrun` `chunk / stutter` | `rooftop` `chunk / stutter` | | :--- | :--- | ---: | ---: | ---: | ---: | ---: | ---: | | *Source clip (`pier`)* | — | *`0.171 / 0.75`* | *`1.51 / —`* | *`— / 1.00`* | — | — | — | | **Plain `K=3` Two-Pass (`euler`, no RYS, no SRP)** | Core only | `0.361 / 0.68` | — | **`0.36`** / — | — | — | — | | **`K=3` + `RYS 16–32` (`euler`, no SRP, `+run f`)** | Core only | **`0.103 / 0.19`** | — | **`0.29`** / `1.68` | **`21.48 dB`** / `0.943` | `1.70 / 5.48` | **`0.41`** / `4.34` | | **`K=3` + `RYS 20–36` (`euler`, no SRP, NO LoRA)** | Core only | `0.150 / 0.31` | `5.08 / 3.32` | `0.56 / 1.71` | `21.26 dB`† / `0.721`† | — | — | | **`K=3` + `RYS 20–36` (`euler`, no SRP, `+k3_flow_s400`)** | + `K=3` LoRA | **`0.110 / 0.27`** | `5.25 / 3.51` | `0.53 / 1.64` | — | — | — | | **`K=3` + `RYS 16–32` + `SRP 1.0` (NO LoRA)** | + `SRP` | `0.215 / 0.59` | `1.75 / 1.64` | `0.49 / 2.06` | `19.87 dB / 0.459` | — | `0.45` / **`2.45`** | | `K=3` + `RYS 16–32` + `SRP 1.0` + Legacy `run f` (`K=2`) | + `SRP` + `K=2` | `0.176 / 0.40` | `1.59 / 1.92` | `0.51 / 2.04` | `20.14 dB / 0.955` | — | — | | **`K=3` + `RYS 16–32` + `SRP 1.0` + `k3_hisigma_flow_step1000_lateattn`** *(Best All-Around)* | + `SRP` + `K=3` | **`0.113 / 0.36`** | `2.03` / **`1.63`** | `0.56 / 2.17` | `19.91 dB` / **`0.354`** | `1.14 / 4.38` | `0.95 / 2.92` | | **`K=3` + `RYS 16–32` + `SRP 1.0` + `k3_flow_step400`** *(Smoothest Overall)* | + `SRP` + `K=3` | `0.341 / 0.70` | **`1.48`** / `1.77` | `0.58 / 2.13` | `19.89 dB` / **`0.348`** | `1.25` / **`3.30`** | **`0.41`** / `2.73` | | **`K=3` + `RYS 16–32` + `SRP 1.0` + `k3_hisigma_flow_step1000`** *(Sharpest / Lowest Chunk)* | + `SRP` + `K=3` | `0.169 / 0.47` | `2.10 / 1.91` | **`0.41` / `2.32`** | `19.91 dB / 0.385` | **`1.12`** / `6.11` | `1.03 / 3.37` | | **`K=3` + `RYS 16–32` + `SRP 1.0` + `k3_repeat_step1000`** *(Tightest Horizon Lock)* | + `SRP` + `K=3` | **`0.111 / 0.23`** | `2.43 / 2.13` | `0.55 / 2.06` | `19.94 dB / 0.426` | `1.39 / 4.55` | `0.83 / 3.66` | *†`bamboo` `RYS 20–36` row measured with `run f` (`Wave 6`); `RYS 16–32` `NO LoRA` on `bamboo` hit `21.37 dB / 0.727`.* --- ## 3. Included Experimental Workflows All three workflows live in `examples/experimental/` (each with a ComfyUI UI `.json` and headless `_api.json`): 1. **`examples/experimental/stage2_derope_k3_rys_twopass.json`** - **Dependencies:** Core ComfyUI + `ComfyUI-MAINodes` only (no third-party sampler, no clock LoRA required). - **Default setup:** `H3Stage2Clock` (`K=3`, RYS `20-36`, `α=0.20`, `handoff_sigma=0.65`) → `SamplerCustomAdvanced` Pass 1 → `SamplerCustomAdvanced` Pass 2 (pure stock `euler` + `DisableNoise`). - Change the `SplitSigmas` entry step to switch between `σ = 0.973` (`step = 1`), `σ = 0.923` (`step = 2`), and `σ = 0.800` (`step = 3`) — `H3Stage2Clock` splits Pass 1 and Pass 2 automatically. 2. **`examples/experimental/stage2_derope_k3_rys_selfrefine.json`** - **Dependencies:** Core ComfyUI + `ComfyUI-MAINodes` + [`ComfyUI-SelfRefiningSamplerPlus`](https://github.com/Alex240z/ComfyUI-SelfRefiningSamplerPlus) (no clock LoRA required). - **Default setup:** `SamplerSelfRefinePlus` (`perturb_strength_scale=1.0`, `l1_mean`, Identity-Locked curve `[[0.0, 0.0], [0.5, 1.0], [1.0, 0.5]]`) → `H3Stage2Clock` (`K=3`, RYS `16-32`, `α=0.20`, `handoff_sigma=0.65`) → two-pass `euler` finishing. 3. **`examples/experimental/stage2_derope_k3_rys_selfrefine_lora.json`** *(Full Champion Stack)* - **Dependencies:** Core ComfyUI + `ComfyUI-MAINodes` + `ComfyUI-SelfRefiningSamplerPlus` + [`minimax_h3_variable_clock_k3_hisigma_flow_step1000_lateattn_r16.safetensors`](https://huggingface.co/MATLOWAI/MiniMax-H3-Variable-Clock) (or `k3_flow_step400`). - **Default setup:** Loads the `K=3` clock LoRA **only onto Pass 1** (`Pass-1 Guider`) while keeping **Pass 2 strictly on the stock Pika model** (`Pass-2 Guider`, `DisableNoise`). --- ## 4. Hold-Map Tips for `K=3` - **Keep `hold` uniform across `17k` chunk-start singletons (`S(1)`) and 4-frame tokens (`G4`):** Use standard `H3ManualHoldMap` / `H3JerkOracle` ramps (`1 → 2 → 3 → 4 → 3 → 2 → 1`). Do **not** force `hold = 1` on every `17k` singleton under `K=3` — that breaks the uniform `world_step / stock_step` ratio against `K=3`'s stock Bands 0–2 and creates a 5-frame periodic stutter. - **If you notice faint microstutters specifically on `hold = 2` exit ramps:** H3's 4-frame causal VAE decoder has a periodic 4-frame velocity wave that aliases at Nyquist under `hold = 2` and cancels cleanly under `hold = 4`. Testing `ramp = False` (`hold = 4` uniform across the held span) halves exit microstutter, at the trade-off of a sharper single step at the `1 → 4` entry/exit seam. --- ## 5. Additional Fixes Included on This Branch While building and testing `H3Stage2Clock`, three source-level bugs in `motion.py` were confirmed and fixed with unit tests: 1. **Same-length reference-video collision:** `_install_true_clock_patch` previously matched solely on token count (`len(spans) == n`), allowing a reference video with the same latent length as the target to inherit the target's clock. Reference blocks now stay strictly on the stock grid. 2. **Stale `_GUIDE_LAYOUTS` cache:** `_install_guide_layout_patch` now clears `_GUIDE_LAYOUTS[seq_len]` when a later layout of the same sequence length carries no guide condition rows. 3. **True Clock + DyRoPE patch-stacking crash:** Patch guards now walk the `_h3_prev` wrapper chain so running `H3TrueClock`, then `H3DyRoPE`, then `H3TrueClock` again in one ComfyUI session never double-wraps `rope_freqs`.