# Which Transformer Blocks Are Affected by STG in LTX-2 by Default?

> Discover which transformer blocks STG affects in LTX-2 by default. Learn how STG targets block 29 for video generation.

- Repository: [Lightricks/LTX-2](https://github.com/Lightricks/LTX-2)
- Tags: deep-dive
- Published: 2026-06-21

---

**By default, Spatio-Temporal Guidance (STG) in LTX-2 perturbs transformer block 29 only, disabling self-attention in that specific layer while preserving full attention mechanisms across all other blocks during video generation.**

Understanding which **transformer blocks are affected by STG in LTX-2** is essential for controlling the model's guidance behavior during inference and training. The LTX-2 video generation repository from Lightricks implements a selective perturbation strategy that targets specific architectural layers rather than distributing effects across the entire transformer stack. This default configuration applies uniformly to both video and audio guiders unless explicitly overridden.

## Default STG Configuration in LTX-2

The LTX-2 codebase hardcodes the default STG target across three critical configuration layers. According to the source code in `Lightricks/LTX-2`, transformer block 29 serves as the standard perturbation target for the base model.

### Validation Configuration

In [`packages/ltx-trainer/src/ltx_trainer/config.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-trainer/src/ltx_trainer/config.py), the `ValidationConfig` class defines the `stg_blocks` parameter with a default value of `[29]` (lines 530-533). This setting ensures that when running validation or training with default parameters, STG perturbations apply exclusively to transformer block 29.

### Pipeline Parameters

The inference pipeline constants in [`packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py) confirm this default for production inference. Lines 38-46 and 48-56 specify `stg_blocks=[29]` for both video and audio guider parameters in the default LTX-2 model configuration. The underlying `MultiModalGuiderParams` structure in [`packages/ltx-core/src/ltx_core/components/guiders.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-core/src/ltx_core/components/guiders.py) (lines 204-206) stores this default list, ensuring consistent behavior across the training and inference stacks.

**Note:** For the newer LTX-2.3 variant, the default target shifts to transformer block 28.

## How to Modify STG Block Selection

While block 29 is the default, the configuration supports two alternative modes: targeting all blocks or specifying custom indices. Setting `stg_blocks=None` applies STG perturbations to every transformer block in the architecture. Alternatively, providing a list of integers (e.g., `[25, 26, 27, 28, 29, 30]`) enables targeted multi-layer perturbation for fine-grained control over the guidance mechanism.

## Code Examples

Retrieve the default STG configuration using the validation config:

```python
from ltx_trainer.config import ValidationConfig

# Default configuration targets block 29

cfg = ValidationConfig()
print(cfg.stg_blocks)   # → [29]

# Override to affect all transformer blocks

cfg = ValidationConfig(stg_blocks=None)
print(cfg.stg_blocks)   # → None (perturbs all blocks)

```

Customize STG blocks for pipeline inference:

```python
from ltx_pipelines.utils.constants import LTX_2_PARAMS

# Expand STG to affect blocks 25-30

new_params = LTX_2_PARAMS.video_guider_params.replace(
    stg_blocks=[25, 26, 27, 28, 29, 30]
)
print(new_params.stg_blocks)   # → [25, 26, 27, 28, 29, 30]

```

## Summary

- **Transformer block 29** receives STG perturbations by default in standard LTX-2 models, while **block 28** is the default for LTX-2.3.
- The default is defined in [`packages/ltx-trainer/src/ltx_trainer/config.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-trainer/src/ltx_trainer/config.py), [`packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py), and [`packages/ltx-core/src/ltx_core/components/guiders.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-core/src/ltx_core/components/guiders.py).
- Both video and audio guiders use the same default block selection unless configured otherwise.
- Set `stg_blocks=None` to apply STG to all transformer blocks, or provide a custom list for selective multi-layer perturbation.

## Frequently Asked Questions

### Which specific transformer block does STG affect by default in LTX-2?

By default, STG affects **transformer block 29** in the standard LTX-2 model, or **block 28** in the LTX-2.3 variant. This configuration skips self-attention in that specific block while maintaining normal attention operations in all other layers.

### How do I apply STG to all transformer blocks instead of just block 29?

Set the `stg_blocks` parameter to `None` in your configuration. When `stg_blocks=None`, the system interprets this as a directive to apply STG perturbations across every transformer block in the architecture rather than restricting it to specific indices.

### Does the default STG configuration differ between video and audio guiders?

No, the default configuration is identical for both modalities. The `video_guider_params` and `audio_guider_params` in [`packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py) both specify `stg_blocks=[29]` by default, ensuring consistent spatio-temporal guidance behavior across video and audio generation tasks.

### Where in the LTX-2 source code is the default STG block defined?

The default STG block is defined in three locations: [`packages/ltx-trainer/src/ltx_trainer/config.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-trainer/src/ltx_trainer/config.py) (lines 530-533) for training configurations, [`packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py) (lines 38-56) for pipeline parameters, and [`packages/ltx-core/src/ltx_core/components/guiders.py`](https://github.com/Lightricks/LTX-2/blob/main/packages/ltx-core/src/ltx_core/components/guiders.py) (lines 204-206) for the underlying parameter structure.