# How Gradient Estimation Reduces Inference Steps in LTX-2 Video Generation

> Discover how LTX-2 uses gradient estimation to cut video generation inference steps from 100 to 2. Learn how velocity-corrected sampling maintains quality with fewer steps.

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

---

**LTX-2 reduces diffusion inference steps from 50–100 down to as few as 2 by using velocity-corrected sampling that estimates trajectory curvature and compensates for larger sigma jumps.**

Standard diffusion models generate video by iteratively denoising across a dense schedule of **sigma levels** (noise scales). Each forward pass through the transformer is computationally expensive. According to the source code in `Lightricks/LTX-2`, the **gradient-estimating Euler loop** (`gradient_estimating_euler_denoising_loop`) replaces this dense stepping with a smarter trajectory prediction method.

## The Problem with Standard Euler Sampling

The conventional `euler_denoising_loop` proceeds sequentially through sigma values, computing a denoised estimate at each step. This requires **one transformer forward pass per sigma level**.

For high-quality video generation, schedules often contain 50–100 steps. The cost scales linearly: more steps means better quality but slower generation.

## How Gradient Estimation Works in LTX-2

The gradient-estimation technique, implemented 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 84–102), treats denoising as a **velocity field problem** rather than isolated point estimates.

### The Core Mechanism

The algorithm tracks how the **diffusion velocity changes between consecutive steps** and applies a predictive correction:

1. **Compute velocity** — Convert the current noisy latent and its denoised estimate into a velocity vector using `to_velocity` (lines 12–13 of the same file)

2. **Detect curvature** — Compare current velocity against `previous_video_velocity` or `previous_audio_velocity` to find `Δv`, the local change in direction

3. **Apply correction** — Scale `Δv` by `ge_gamma` (default **2.0**) and add to the previous velocity, forming a **corrected total velocity**:

   ```

   corrected_velocity = ge_gamma * Δv + previous_velocity
   ```

4. **Re-derive the denoised sample** — Use `to_denoised` to convert the corrected velocity back into a latent state for the next step

Because this corrected velocity **anticipates the true diffusion trajectory**, the sampler can take larger jumps through sigma space without drifting off course.

### Implementation Details

The implementation maintains separate velocity buffers for each modality:

- `previous_video_velocity`
- `previous_audio_velocity`

The correction only applies when both the latent state and its denoised counterpart exist (lines 106–115). The loop terminates when sigma reaches zero, ensuring the final output is exactly the corrected denoised latent (lines 29–34).

## Practical Impact: Step Reduction Without Quality Loss

The velocity correction compensates for **information loss that would normally occur with sparse sampling**. In standard Euler sampling, skipping 90% of steps causes visible artifacts because each large jump misaligns with the true probability flow.

With gradient estimation, the curvature-aware correction keeps the latent on track even with **2-step schedules**. The repository benchmarks demonstrate this acceleration preserves perceptual quality across video and audio generation tasks.

## Code Example: Using the Gradient-Estimating Sampler

```python
from ltx_pipelines.utils.samplers import gradient_estimating_euler_denoising_loop
from ltx_pipelines.utils.types import LatentState
from ltx_core.model.transformer import X0Model
from ltx_pipelines.utils.helpers import make_denoiser

# Prepare your diffusion components

denoiser = make_denoiser()  # Callable matching the Denoiser protocol

# Execute accelerated sampling

video_state, audio_state = gradient_estimating_euler_denoising_loop(
    sigmas=sigmas,              # Can be severely truncated (e.g., 2-5 values)

    video_state=video_state,
    audio_state=audio_state,
    stepper=stepper,
    transformer=transformer,
    denoiser=denoiser,
    ge_gamma=2.0,               # Tune for speed/quality tradeoff

)

```

The `ge_gamma` parameter controls correction strength. Higher values aggressively extrapolate velocity, enabling fewer steps at some risk of overshoot.

## Key Source Files

| Component | File Path | Relevant Lines |
|-----------|-----------|--------------|
| Gradient-estimating sampler | [`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) | 84–102 (main loop), 12–13 (velocity utils), 106–115 (correction logic) |
| Velocity/denoise conversions | [`packages/ltx-core/src/ltx_core/utils.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-core/src/ltx_core/utils.py) | `to_velocity`, `to_denoised` helpers |
| Diffusion step protocol | [`packages/ltx-core/src/ltx_core/components/diffusion_steps.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-core/src/ltx_core/components/diffusion_steps.py) | Underlying stepper interface |
| Pipeline integration example | [`packages/ltx-pipelines/src/ltx_pipelines/ti2vid_one_stage.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/ti2vid_one_stage.py) | Production usage pattern |

## Summary

- **Standard Euler sampling** requires 50–100 transformer passes for quality video generation
- **Gradient estimation** reduces this to 2–5 steps by predicting trajectory curvature from velocity changes
- The `ge_gamma * Δv` correction term compensates for sparse sigma schedules
- Implementation tracks per-modality velocities in `gradient_estimating_euler_denoising_loop`
- Quality is preserved because the correction aligns each large step with the true diffusion flow

## Frequently Asked Questions

### What is the minimum number of steps LTX-2 can use with gradient estimation?

Based on the implementation and repository benchmarks, **2 steps** is the practical minimum. The velocity correction becomes less stable below this threshold, as there is insufficient history to estimate meaningful curvature.

### How does `ge_gamma` affect generation quality and speed?

The `ge_gamma` parameter (default 2.0) scales the velocity correction term. **Higher values** enable fewer steps by more aggressively extrapolating trajectory, but may introduce instability if set too high. **Lower values** are more conservative, requiring more steps for equivalent quality but with greater stability.

### Can gradient estimation be used for audio-only or video-only generation?

Yes. The implementation in [`samplers.py`](https://github.com/Lightricks/LTX-2/blob/main/samplers.py) tracks `previous_video_velocity` and `previous_audio_velocity` separately, applying correction only when both the latent state and denoised estimate are present for each modality. Single-modality pipelines simply ignore the unused velocity buffer.

### Where is the underlying research for this technique published?

The algorithm is based on the paper *"Gradient-Estimation Sampling for Diffusion Models"* (OpenReview). The LTX-2 implementation adapts this approach for multimodal (video+audio) latent diffusion, with specific engineering for transformer-based denoisers.