Skip to content

feat: support guidance_schedule#1684

Open
stduhpf wants to merge 5 commits into
leejet:masterfrom
stduhpf:guidance_schedule
Open

feat: support guidance_schedule#1684
stduhpf wants to merge 5 commits into
leejet:masterfrom
stduhpf:guidance_schedule

Conversation

@stduhpf

@stduhpf stduhpf commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Supports a new guidance_schedule parameter (under --extra-sample-args) to improve Ideogram4 support. This could also benefit other models.

What it does: Allows the guidance (CFG scale) to change throughout the denoising process. For example, you can use lower guidance values during the final "polishing" steps to help reduce artifacts.

Format: <steps>x<guidance>[+<steps>x<guidance>...]

Examples:

  • 30x7.5 → use CFG scale 7.5 for the final 30 denoising steps.
  • 10x5.0+20x7.5 → use CFG scale 5.0 for the last 10 steps, and 7.5 for the 20 steps before that.
  • 10x4+10x6+10x8 → use CFG scale 4 for the last 10 steps, 6 for the preceding 10 steps, and 8 for the 10 steps before that.

Note: The schedule is applied in reverse order: the first entry corresponds to the final denoising steps, not the initial ones.

If the schedule contains fewer entries than the total number of denoising steps, the regular CFG scale parameter is used for the remaining earlier steps. If it contains more entries than there are denoising steps, the extra entries are ignored.

Related Issue / Discussion

N/A

Additional Information

Recommended Values for Ideogram4 (source: https://github.com/ideogram-oss/ideogram4/blob/main/src/ideogram4/sampler_configs.py)

  • 48 steps: 3x3.0+45x7.0
  • 20 steps: 2*3.0+18*7.0
  • 12 steps: 1*3.0+11*7.0

(since 7.0 is the default CFG scale, you can get away with just Nx3.0 and the rest will be padded with 7.0 anyways)

Examples: (generated with #1669 also applied)

No guidance schedule Recommended schedule
guidance_schedule_off guidance_schedule_on
image output
Commands used

.\buildhip\bin\sd-cli.exe -h --diffusion-model ..\ComfyUI\models\unet\Ideogram\ideogram4-Q8_0.gguf --uncond-diffusion-model ..\ComfyUI\models\unet\Ideogram\ideogram4_unconditional-iQ4_NL.gguf --llm ..\ComfyUI\models\llm\Qwen\Qwen3-VL-8B-Instruct-Q4_K_M.gguf --vae ..\ComfyUI\models\vae\flux\full_encoder_small_decoder.safetensors --diffusion-fa -v --color --offload-to-cpu -W 1024 -H 1536 --preview proj --steps 20 --extra-sample-args "guidance_schedule=2x3" -p --% "{\"aspect_ratio\":\"2:3\",\"high_level_description\":\"An abstract, dreamlike digital illustration of Hatsune Miku surrounded by swirling energy and power elements in a vibrant blue color palette.\",\"compositional_deconstruction\":{\"background\":\"An abstract, ethereal void filled with deep indigo and electric blue gradients, featuring floating geometric shards, swirling energy ribbons, and soft bokeh particles that create a sense of weightless, dreamlike depth.\",\"elements\":[{\"type\":\"obj\",\"bbox\":[120,250,880,750],\"desc\":\"Hatsune Miku, depicted with delicate linework. She has long, wind-swept teal twin-tails flowing dynamically around her. Her eyes feature striking white pupils against a vivid blue iris. She wears her signature futuristic grey and teal outfit with glowing accents, her expression one of focused intensity.\"},{\"type\":\"obj\",\"bbox\":[450,400,600,550],\"desc\":\"A sleek, futuristic silver and teal microphone held close to Miku's mouth, emitting small arcs of blue electricity.\"},{\"type\":\"obj\",\"bbox\":[100,100,900,900],\"desc\":\"Swirling power elements consisting of jagged electric bolts and flowing neon-blue energy ribbons that spiral around the central figure, emphasizing a sense of raw energy and movement.\"}]}}"

\buildhip\bin\sd-cli.exe --diffusion-model ..\ComfyUI\models\unet\Ideogram\ideogram4-Q8_0.gguf --uncond-diffusion-model ..\ComfyUI\models\unet\Ideogram\ideogram4_unconditional-iQ4_NL.gguf --llm ..\ComfyUI\models\llm\Qwen\Qwen3-VL-8B-Instruct-Q4_K_M.gguf --vae ..\ComfyUI\models\vae\flux\full_encoder_small_decoder.safetensors --diffusion-fa -v --color --offload-to-cpu -W 1024 -H 1024 --preview proj --steps 12 --extra-sample-args "mu=0.5,std=1.75;guidance_schedule=1x3" -p --% "{\"high_level_description\":\"A square 1024 x 1024 luxury fashion magazine cover featuring exactly one short chubby fluffy cat as the main model. The cat sits on a soft ivory studio floor, facing the viewer with a stylish calm expression, wearing tiny black sunglasses, a red silk scarf, and a small gold collar charm. In front of the cat on the floor is a wide horizontal luxury nameplate that clearly reads ideogram4.cpp. The whole design feels premium, fashionable, clean, and editorial.\",\"style_description\":{\"aesthetics\":\"luxury fashion magazine cover, high-end pet couture campaign, minimalist editorial design, elegant studio photography, soft paper texture, refined typography, fashionable and polished\",\"lighting\":\"Soft diffused studio lighting, gentle spotlight on the cat, subtle floor shadow, warm ivory highlights, clean separation between subject and background\",\"photo\":\"high-resolution fashion editorial photography look, front-facing cat portrait, crisp fur details, glossy sunglasses, clear readable nameplate text, shallow depth of field\",\"medium\":\"mixed media fashion photography and premium editorial graphic design\",\"color_palette\":[\"#F4EFE7\",\"#111111\",\"#D8B56D\",\"#B73A3A\",\"#FFFFFF\",\"#8A7A6A\"]},\"compositional_deconstruction\":{\"canvas\":\"Square 1024 x 1024 canvas with a normal upright orientation. Do not rotate the poster or any text. Use a clean fashion magazine cover layout.\",\"background\":\"Warm ivory studio backdrop with subtle paper grain, a soft spotlight gradient, faint floor shadow, and a few minimal gold editorial lines. The background is spacious, premium, and uncluttered.\",\"layout\":\"Top center has a small elegant headline. Center area features one cat as the main fashion model. Lower foreground has a wide horizontal luxury nameplate placed on the floor in front of the cat. Bottom center has a small footer. All text is horizontal, upright, and readable left to right.\",\"elements\":[{\"type\":\"text\",\"desc\":\"Top center headline reading LOOK WHAT I FOUND in a refined high-fashion serif font. The headline is horizontal, centered, elegant, and secondary to the nameplate text.\"},{\"type\":\"obj\",\"desc\":\"Exactly one short chubby fluffy cat sitting in the center like a luxury fashion model. The cat has a large round head, compact body, short legs, soft detailed fur, expressive eyes, and a calm confident pose. The cat is cute and rounded, not tall, not stretched, not duplicated.\"},{\"type\":\"obj\",\"desc\":\"Tiny glossy black sunglasses worn naturally by the cat, slightly oversized but still showing the cat face clearly. The sunglasses add a chic fashion-editorial attitude.\"},{\"type\":\"obj\",\"desc\":\"A red silk scarf tied neatly around the cat neck, with soft folds and a couture feeling. The scarf must not cover the cat face or the nameplate.\"},{\"type\":\"obj\",\"desc\":\"A small gold collar charm or fashion accessory under the scarf, subtle and premium, adding a luxury campaign detail.\"},{\"type\":\"obj\",\"desc\":\"In the lower foreground, place a wide horizontal luxury nameplate on the floor in front of the cat. The nameplate is low, flat, landscape-oriented, much wider than tall, like a fashion show seat card or premium display plaque. It is centered, front-facing, level, and fully visible. It must not become vertical, tall, standing, rotated, or side-facing.\"},{\"type\":\"text\",\"desc\":\"Print the exact text ideogram4.cpp only on the wide horizontal nameplate. Use clean bold black lettering, perfectly spelled, lowercase, with the number 4 and .cpp extension. The text must fit completely inside the nameplate, stay horizontal, and be readable from left to right.\"},{\"type\":\"obj\",\"desc\":\"Add sparse premium editorial accents around the edges: thin gold lines, small code brackets, tiny cursor marks, subtle dots, and minimal geometric details. No extra cats, no stickers, no animal faces, no busy decorations.\"},{\"type\":\"text\",\"desc\":\"Bottom center footer reading tiny paws, big compile energy in a small refined monospace or editorial font. The footer is horizontal, centered, understated, and much smaller than the nameplate text.\"}]}}"

Checklist

@wbruna

wbruna commented Jun 21, 2026

Copy link
Copy Markdown
Contributor
  • 48 steps: 3x3.0+45x7.0
  • 20 steps: 2*3.0+18*7.0
  • 12 steps: 1*3.0+11*7.0

Maybe it could be provided as a fraction of the total number of steps, as with --strength? Something like 0.08*3.0 would be close to the above values.

We could even support both styles: integers for an exact number, floating point for a fraction.

@stduhpf

stduhpf commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

There are plenty of possible ways to implement it, it could also be based on the sigma values like the --moe-boundary. I'm focusing on this format for now, but it could be worth investigating in the future.

@stduhpf stduhpf force-pushed the guidance_schedule branch from 4957da2 to 5512523 Compare June 21, 2026 16:38
@stduhpf stduhpf force-pushed the guidance_schedule branch from 5512523 to ee5f8cd Compare June 21, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants