# How to Reduce Inference Steps While Maintaining Quality Using Gradient Estimation in LTX-2

> Reduce LTX-2 inference steps to 20-30 while maintaining quality. Learn how gradient estimation and the specialized Euler sampler accelerate your workflow.

- Repository: [Lightricks/LTX-2](https://github.com/Lightricks/LTX-2)
- Tags: performance
- Published: 2026-06-20

---

**You can reduce LTX-2 inference steps from approximately 40 to 20–30 while preserving perceptual quality by replacing the standard Euler sampler with `gradient_estimating_euler_denoising_loop` and tuning the `ge_gamma` correction coefficient.**

LTX-2 is an open-source audio-video generation framework by Lightricks that uses diffusion models to produce high-fidelity content. The default inference pipeline relies on the standard Euler denoising loop, which requires around 40 diffusion steps to achieve optimal visual fidelity. By implementing **gradient estimation to reduce inference steps while maintaining quality**, developers can achieve roughly 30% faster generation without sacrificing output quality.

## Understanding the Gradient Estimation Mechanism

The core innovation lies in how the sampler estimates latent velocity. In standard diffusion ODEs, each step moves from noisy latents toward denoised predictions based on velocity vectors. The gradient estimation variant computes this velocity using `to_velocity`, then refines it by incorporating the previous step's velocity (`previous_velocity`). This correction effectively doubles the information extracted per step, allowing larger effective moves toward the data manifold.

### Velocity Correction and Information Extraction

The corrected velocity calculation enables each diffusion step to make greater progress toward the final denoised output. Rather than taking 40 small steps, the model can take 20–30 larger, information-rich steps that maintain the same trajectory toward the data manifold. This approach is detailed in the paper *"Gradient Estimation for Diffusion Processes"* (OpenReview), which provides the theoretical foundation for the implementation in the Lightricks/LTX-2 repository.

## Implementation Details

The implementation resides in the LTX-2 pipelines package and serves as a drop-in replacement for the standard Euler loop.

### The `gradient_estimating_euler_denoising_loop` Function

Located in [`packages/ltx-pipelines/src/ltx_pipelines/utils/samplers.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/utils/samplers.py) (lines 79–99), this function handles joint audio-video denoising with gradient estimation. It accepts the same arguments as the regular Euler loop plus the `ge_gamma` parameter for velocity correction strength.

### The `ge_gamma` Parameter

The `ge_gamma` parameter controls the aggressiveness of velocity correction. The default value of `2.0` works well for most LTX-2 models, providing stability while maximizing step efficiency. Values above 2.5 may introduce instability, while values below 1.5 reduce the acceleration benefits.

## Practical Usage Examples

You can integrate gradient estimation into existing pipelines by replacing the standard loop call.

### Replacing the Standard Euler Loop

To enable gradient estimation in your pipeline, import the function and pass it your existing components:

```python
from ltx_pipelines.utils.samplers import gradient_estimating_euler_denoising_loop
from ltx_core.components.diffusion_steps import EulerDiffusionStep

# Prepare your existing components

stepper = EulerDiffusionStep()
sigmas = torch.logspace(start=0, end=-4, steps=25)  # Reduced step count

# Execute with gradient estimation

video_state, audio_state = gradient_estimating_euler_denoising_loop(
    sigmas=sigmas,
    video_state=video_state,
    audio_state=audio_state,
    stepper=stepper,
    transformer=transformer,
    denoiser=denoiser,
    ge_gamma=2.0,  # Default correction coefficient

)

```

This pattern works in any pipeline that builds a `sigmas` schedule and uses compatible steppers, such as [`ti2vid_two_stages_hq.py`](https://github.com/Lightricks/LTX-2/blob/main/ti2vid_two_stages_hq.py).

### Tuning the Correction Coefficient

For optimal results on your specific content, you can experiment with different `ge_gamma` values:

```python

# Evaluate multiple gamma values to find the quality/speed sweet spot

for gamma in [1.5, 2.0, 2.5]:
    video_state, audio_state = gradient_estimating_euler_denoising_loop(
        sigmas,
        video_state,
        audio_state,
        stepper=EulerDiffusionStep(),
        transformer=my_transformer,
        denoiser=my_denoiser,
        ge_gamma=gamma,
    )
    # Evaluate quality metrics (e.g., CLIP score) and select optimal gamma

```

## Performance Impact and Trade-offs

**Step Reduction**: Gradient estimation reduces the required diffusion steps from ~40 to ~20–30, translating to approximately 30% faster inference times.

**Memory Consumption**: Memory usage remains unchanged because the implementation reuses the same intermediate tensors as the standard Euler loop.

**Quality Preservation**: The perceptual quality of generated video and audio remains equivalent to the 40-step baseline, as the velocity correction maintains the same trajectory toward the data manifold.

**Compatibility**: The function is a drop-in replacement for `euler_denoising_loop`, requiring no changes to configuration files or pipeline architecture beyond substituting the function call.

## Summary

- **Gradient estimation** in LTX-2 allows you to **reduce inference steps from ~40 to ~20–30** while maintaining output quality.
- The **`gradient_estimating_euler_denoising_loop`** function in [`packages/ltx-pipelines/src/ltx_pipelines/utils/samplers.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/utils/samplers.py) implements velocity correction using the `ge_gamma` parameter.
- **Default `ge_gamma` of 2.0** provides optimal stability and acceleration for most models.
- The technique requires **no additional memory** and works as a **drop-in replacement** for existing Euler sampler calls in pipelines like [`ti2vid_two_stages_hq.py`](https://github.com/Lightricks/LTX-2/blob/main/ti2vid_two_stages_hq.py).
- By extracting more information per step, gradient estimation achieves **~30% faster inference** without sacrificing visual or audio fidelity.

## Frequently Asked Questions

### What is the default value of `ge_gamma` in LTX-2?

The default value is `2.0`. This setting provides an optimal balance between acceleration and stability for most LTX-2 models, though you can tune it between 1.5 and 2.5 depending on your specific quality requirements.

### How many steps can I reduce with gradient estimation?

You can typically reduce the step count from approximately 40 steps to 20–30 steps. This represents a roughly 30% reduction in inference time while preserving the perceptual quality of the generated audio-video content.

### Does gradient estimation increase memory usage?

No. The implementation reuses the same intermediate tensors as the standard Euler loop, so memory consumption remains unchanged. The additional velocity calculation requires minimal computational overhead with no extra memory allocation.

### Which files contain the gradient estimation implementation?

The primary implementation is in [`packages/ltx-pipelines/src/ltx_pipelines/utils/samplers.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/utils/samplers.py) (lines 79–99). You can also find compatible stepper definitions in [`packages/ltx-core/components/diffusion_steps.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-core/components/diffusion_steps.py) and usage examples in [`packages/ltx-pipelines/src/ltx_pipelines/ti2vid_two_stages_hq.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/ti2vid_two_stages_hq.py).