How to Configure UniPCMultistepScheduler with flow_shift Parameters for Optimal Cosmos Generation Quality

To configure the UniPCMultistepScheduler with flow_shift parameters, instantiate it using UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=10.0) and assign it to your Cosmos 3 pipeline's scheduler to control temporal smoothing during video generation.

The NVIDIA Cosmos repository leverages the UniPCMultistepScheduler from the Diffusers library to manage the denoising trajectory in the Cosmos 3 video generator. Tuning the flow_shift parameter is essential for balancing motion smoothness against per-frame sharpness, directly impacting the visual fidelity of generated outputs.

Understanding the flow_shift Parameter

The flow_shift argument controls how much "flow" or temporal consistency is injected into the denoising schedule. According to the NVIDIA Cosmos source code, this value determines the trade-off between coherent motion across frames and fine-grained detail preservation.

0–5: Minimal temporal smoothing that produces sharper per-frame details but may exhibit jitter between frames. Use this range for fast prototyping when frame-wise quality is paramount over motion consistency.

6–10: Balanced smoothing that generates coherent motion without sacrificing texture, representing the general-purpose range. The default value of 10.0 documented in the repository's README falls within this range.

11–15: Strong flow bias that enforces very smooth motion, ideal for long-duration videos where continuity is critical. Expect possible slight blur on fast-moving objects when using values in this range.

>15: Over-smoothing territory that can reduce sharpness and introduce ghosting artifacts. Reserve these values for extreme motion-stabilization experiments only.

How to Configure the Scheduler in Cosmos 3

To replace the default scheduler as demonstrated in the audiovisual cookbook, load the Cosmos 3 pipeline and instantiate the UniPCMultistepScheduler with your desired flow_shift value.

from diffusers import Cosmos3OmniPipeline
from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler

# Load the pre-trained Cosmos 3 checkpoint

pipe = Cosmos3OmniPipeline.from_pretrained(
    "nvidia/Cosmos3-Nano",
    torch_dtype=torch.bfloat16,
    device_map="cuda",
)

# Replace the default scheduler with flow_shift configuration

pipe.scheduler = UniPCMultistepScheduler.from_config(
    pipe.scheduler.config,          # reuse the default config (steps, betas, …)

    flow_shift=10.0                 # <-- the flow-shift value

)

This pattern appears in the repository at cookbooks/cosmos3/generator/audiovisual/run_with_diffusers.ipynb (lines 544–559) and the high-level usage is documented in README.md (lines 247–248). The from_config method copies the existing scheduler configuration while overwriting the flow_shift field.

Optimization Guidelines for flow_shift Tuning

Follow these steps to achieve optimal generation quality:

  1. Start with the documented default of flow_shift=10.0 as established in the NVIDIA/cosmos repository. This provides a good trade-off for most prompts.
  2. Increase by 2–3 units if you observe jitter, flickering edges, or inconsistent object placement between frames.
  3. Decrease toward the lower end (0–5) if the video appears blurry or lacks fine detail on static elements.
  4. Keep inference steps constant while tuning flow_shift; changing both num_inference_steps and flow_shift simultaneously makes it difficult to isolate the parameter's effect.
  5. Use seed reproducibility by setting torch.Generator(device="cuda").manual_seed(...) to compare results across different flow_shift settings.

Complete Implementation Example

The following implementation demonstrates the full workflow, including pipeline loading, scheduler replacement with explicit flow_shift control, and video generation:

import torch
from diffusers import Cosmos3OmniPipeline
from diffusers.schedulers.scheduling_unipc_multistep import UniPCMultistepScheduler
from diffusers.utils import export_to_video

pipe = Cosmos3OmniPipeline.from_pretrained(
    "nvidia/Cosmos3-Nano",
    torch_dtype=torch.bfloat16,
    device_map="cuda",
)

# Adjust flow_shift here – try 8.0, 10.0, 12.0, etc.

flow_shift_value = 10.0
pipe.scheduler = UniPCMultistepScheduler.from_config(
    pipe.scheduler.config, flow_shift=flow_shift_value
)

result = pipe(
    prompt="A mobile robot navigates a warehouse aisle and stops at a shelf.",
    num_frames=189,
    height=720,
    width=1280,
    fps=24,
    num_inference_steps=35,
    guidance_scale=6.0,
    generator=torch.Generator(device="cuda").manual_seed(1234),
)

export_to_video(result.video, "cosmos3_video.mp4", fps=24)

Key Source Files in NVIDIA/cosmos

The configuration patterns are documented in these specific locations:

  • README.md (lines 247–248): High-level usage snippet demonstrating flow_shift=10.0.
  • cookbooks/cosmos3/generator/audiovisual/run_with_diffusers.ipynb (lines 544–559): Notebook implementation showing exact scheduler instantiation and assignment.
  • cookbooks/cosmos3/generator/audiovisual/README.md: Detailed walkthrough of the Diffusers generator setup including scheduler imports.

Summary

  • Configure the scheduler using UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=value) as implemented in NVIDIA/cosmos.
  • The default flow_shift=10.0 provides optimal balance for most video generation tasks in Cosmos 3.
  • Lower values (0–5) preserve sharpness but may introduce jitter; higher values (>15) risk motion blur and ghosting.
  • Always isolate flow_shift testing by keeping num_inference_steps constant and using fixed random seeds for reproducible comparisons.
  • Reference the official cookbooks at cookbooks/cosmos3/generator/audiovisual/ for complete implementation patterns.

Frequently Asked Questions

What does flow_shift control in the UniPCMultistepScheduler?

The flow_shift parameter regulates the amount of temporal consistency injected into the denoising schedule during the UniPC multistep process. It determines how aggressively the scheduler smooths motion across frames, with higher values prioritizing temporal coherence over per-frame sharpness.

How do I know if my flow_shift value is too high?

If generated videos exhibit motion blur, ghosting artifacts, or reduced sharpness on fast-moving objects, your flow_shift value likely exceeds the optimal range. Try reducing it to 8.0 or 5.0 and compare results while keeping other parameters constant.

Can I tune flow_shift without changing other parameters?

Yes, and you should. The optimization guidelines recommend keeping num_inference_steps constant while adjusting flow_shift to isolate its specific effect on temporal smoothing. Use a fixed seed with torch.Generator(device="cuda").manual_seed(...) to ensure comparisons are valid across different values.

Where is the default flow_shift value documented in the repository?

The default value of 10.0 is explicitly documented in README.md at lines 247–248 and demonstrated in the cookbooks/cosmos3/generator/audiovisual/run_with_diffusers.ipynb notebook at lines 544–559, as shown in the implementation examples above.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →