Skip to content

Require both modalities to opt in before enabling CFG in LTX2 pipelines - #14650

Open
rootonchair wants to merge 3 commits into
huggingface:mainfrom
rootonchair:fix-ltx2-distilled-guidance-gate
Open

Require both modalities to opt in before enabling CFG in LTX2 pipelines#14650
rootonchair wants to merge 3 commits into
huggingface:mainfrom
rootonchair:fix-ltx2-distilled-guidance-gate

Conversation

@rootonchair

@rootonchairrootonchair commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fix#14649

#14447 aligned the shared LTX-2 pipeline defaults with the LTX-2.5 base-model reference. As a side effect, distilled recipes that pass guidance_scale=1.0 (the documented "8 steps with CFG = 1" usage) silently started running CFG, STG, and modality-isolation guidance — at ~3x the compute and with worse output on distilled checkpoints.

This PR restores guidance_scale=1.0 as a complete off-switch, one commit per mechanism:

commitchangewhy
CFG gatedo_classifier_free_guidance: orand on the video/audio scalesaudio_guidance_scale=7.0 default kept CFG (and the negative prompt) active at guidance_scale=1.0. There is no use case that guides one modality while the other is disabled, so require both. Recommended base settings (3.0 / 7.0) still enable CFG.
STG defaultsstg_scale, audio_stg_scale: 1.00.0Separate gate (stg_scale > 0) with default blocks [28] — a perturbed-attention pass ran even "unguided". Back to opt-in; base-model doc examples already pass stg_scale=1.0 explicitly.
Modality guidance defaultsmodality_scale: 3.01.0, audio_modality_scale: 3.0NoneModality-isolation guidance is a third mechanism with its own gate (modality_scale > 1), running extra modality-isolated transformer passes each step. With the 3.0 default it stayed active even after CFG and STG were disabled — the LTX-2.5 distilled docs describe their inference as unguided, yet the example right below still executed it. Reverting the default to 1.0 makes unguided runs truly unguided; the base-model doc snippets that depended on the old default now set modality_scale=3.0 explicitly.

Measured on LTX-2.3-Distilled (5 seed-matched clips, 768x512x121, 8 steps): per-clip inference drops 22 s → 11 s → 6.9 s as each mechanism is removed (a true single pass per step), while fidelity to the bf16 reference improves and temporal flicker returns to bf16 levels.

guidance_rescale (0.0 → 0.7 in #14447) is deliberately untouched: it only applies while CFG is active, so it is inert for distilled runs after this fix.

Applied to LTX2Pipeline, LTX2ConditionPipeline, LTX2ImageToVideoPipeline, and the IC-LoRA variant.

Fixes the stale LTX-2.3 distilled examples in docs/source/en/api/pipelines/ltx2.md implicitly; the docs touched here are only the snippets that relied on the reverted defaults.

PR huggingface#14447 changed the audio_guidance_scale default to 7.0, which silently
kept classifier-free guidance (and the negative prompt) active for every
distilled recipe that passes guidance_scale=1.0 - at double the compute
and with measurably worse output on distilled checkpoints. LTX-2 has no
use case for guiding one modality while the other is disabled, so gate
CFG on both scales: guidance_scale=1.0 is a master off-switch again,
while the recommended base-model settings (3.0 video / 7.0 audio) still
enable it.
Applied to LTX2Pipeline, condition, image2video, and IC-LoRA variants.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X4NMaGamTgkHjL9EYqNZ7K
@github-actionsgithub-actionsBot added pipelines size/S PR with diff < 50 LOC labels Aug 30, 2026
PR huggingface#14447 also flipped stg_scale/audio_stg_scale defaults from 0.0 to
1.0 (with spatio_temporal_guidance_blocks defaulting to [28]), so
distilled recipes run a perturbed-attention guidance pass per step even
with guidance disabled. Revert both defaults to 0.0: STG is opt-in
again, and since audio_stg_scale resolves via `audio_stg_scale or
stg_scale`, a 0.0 default also restores the pre-huggingface#14447 "audio follows
video" behavior. The base-model doc examples already pass stg_scale=1.0
explicitly and are unaffected.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X4NMaGamTgkHjL9EYqNZ7K
PR huggingface#14447 flipped modality_scale from 1.0 to 3.0 (and audio_modality_scale
from None to 3.0), so distilled recipes run extra modality-isolated
transformer passes per step even with CFG and STG disabled - measured at
~40% additional compute and reduced fidelity on the distilled checkpoint.
Revert both defaults (audio back to None restores "follow video"), making
guidance_scale=1.0 a complete off-switch together with the CFG gate and
STG defaults. The docs' 2.5-distilled examples, which state they run
unguided, actually do so again; the two base-model snippets that relied on
the default now pass modality_scale=3.0 explicitly, matching the other
base-model examples.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X4NMaGamTgkHjL9EYqNZ7K
@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation size/M PR with diff < 200 LOC and removed size/S PR with diff < 50 LOC labels Aug 30, 2026
@rootonchair
rootonchairforce-pushed the fix-ltx2-distilled-guidance-gate branch from ae7d532 to 5b4613cCompareAugust 30, 2026 17:41
@github-actionsgithub-actionsBot added size/S PR with diff < 50 LOC and removed size/M PR with diff < 200 LOC labels Aug 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @rootonchair, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice.

Once the PR links an issue (or gets the no-issue-needed label), you can ignore this message — it stays here as a comment, but it no longer applies.

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

Labels

documentationImprovements or additions to documentationfixes-issuepipelinessize/SPR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

guidance_scale=1.0 no longer disables CFG in LTX-2 pipelines

1 participant

@rootonchair