Building with AI

Running LTX-2.5 video generation on AWS Trainium3 with diffusers

Engineers optimized the LTX-2.5 model to generate 10-second videos with sound in 22 seconds on half an AWS Trainium3 instance, matching commercial API speeds.

Server hardware transforming into video film strip
Illustration generated for this article

Engineers at Hugging Face successfully ran the LTX-2.5 video and audio generation model on AWS Trainium3 hardware. By optimizing the diffusion pipeline for NeuronCores, they achieved generation times of 22 to 23 seconds for a 10-second clip at 2048x1024 resolution. This performance rivals proprietary APIs while running on open-source infrastructure.

What happened

The team secured access to a trn3.48xlarge instance, which features 64 NeuronCores, for a one-month testing period. While most of the time was spent validating various Hugging Face models, the final five days were dedicated to a stress test involving video generation. The goal was to determine if complex, multi-shot films could be generated using the diffusers library on this specific hardware architecture.

They selected LTX-2.5 from Lightricks, a model capable of generating synchronized video and audio. The initial attempt failed to meet practical standards, taking over five minutes to generate a low-resolution clip. However, after significant optimization of both the host CPU processes and the device-level tensor operations, the team reduced the wall-clock time to under 23 seconds for high-resolution output. This result was achieved using only 32 of the available 64 cores.

The project also aimed to compare performance against industry benchmarks. While direct CUDA comparisons were unavailable due to lack of detailed public metrics, the team compared their results to LTX’s own online API. The optimized Trainium3 setup matched and slightly exceeded the API’s claimed speed of 23.7 seconds for a similar task, demonstrating that specialized AI accelerators can compete with general-purpose GPU clusters when properly tuned.

How it works

The system treats video creation as a structured film production rather than a single prompt response. Input is provided as a JSON file containing a list of shots, each with detailed prompts describing style, motion, lighting, and sound. To maintain character and scene consistency across cuts, the pipeline uses a chaining mechanism. Shots can reference the final frames of previous shots or lead into the first frames of subsequent ones, ensuring visual continuity.

Technically, the implementation relies on three specific diffusers pipelines. The base pipeline generates shots from text prompts, while a conditional pipeline handles shots that must align with existing frames. A third pipeline upscales the latent representations before the final generation steps. The orchestration layer, consisting of about 160 lines of Python, manages the ordering of shots, ensures keyframes exist before dependent shots are processed, and assembles the final video with trimmed clips and synchronized audio.

Running this on Trainium3 required overcoming significant architectural hurdles. The transformer model was too large for a single NeuronCore, necessitating tensor parallelism to split weights across four cores. Additionally, sequence parallelism was employed to split video tokens across eight groups of cores, allowing the system to utilize 32 cores for a single clip. This dual-parallel approach enabled the handling of high-resolution inputs that would otherwise fail to load due to memory constraints.

Key details

  • Hardware: AWS trn3.48xlarge instance with 64 NeuronCores.
  • Model: LTX-2.5 by Lightricks, generating video and sound simultaneously.
  • Performance: 22–23 seconds wall time for a 10-second clip at 2048x1024 resolution.
  • Optimization gain: Reduced generation time from 5 minutes 20 seconds to 23 seconds through host and device tuning.
  • Parallelism strategy: Combined tensor parallelism (4 ways) and sequence parallelism (8 ways) across 32 cores.
  • Consistency method: Shots are chained using from and to frame references to maintain subject continuity.

Why it matters

For engineers building generative media applications, this demonstration proves that non-CUDA hardware can handle state-of-the-art video diffusion models efficiently. The ability to match commercial API speeds on open infrastructure suggests a viable path for cost-effective, scalable video generation services. It highlights that performance bottlenecks often lie in data movement and host-side processing rather than just raw compute power.

The work also provides a blueprint for managing large models on memory-constrained accelerators. By implementing sequence parallelism, the team bypassed graph loading failures that occurred at higher resolutions. This technique allows developers to scale beyond the memory limits of individual chips without sacrificing output quality, a critical capability as video models continue to grow in complexity and parameter count.

Furthermore, the structured approach to video generation offers a more reliable workflow for creative professionals. Instead of relying on luck with single prompts, users can script scenes with precise control over transitions and continuity. This method reduces the need for excessive re-generation, making the technology more practical for drafting storyboards or producing short-form content where consistency is paramount.

What you can do

  • Implement tensor and sequence parallelism when deploying large transformers on NeuronCores to manage memory limits.
  • Use frame-chaining techniques in diffusers pipelines to maintain visual consistency across multiple video shots.
  • Optimize host-side CPU threads by pinning ranks to specific cores to prevent resource starvation during parallel processing.
  • Compile repeated blocks separately to reduce tracing time and avoid NaN errors in large computational graphs.
  • Generate multiple takes for each shot and select the best result, as current models may still produce occasional artifacts.
  • Monitor graph sizes and sequence lengths to ensure attention kernels operate efficiently, avoiding slow fallback paths.
  • #aws trainium
  • #video generation
  • #diffusers
  • #ltx-2.5
  • #machine learning

Tools from the Bytechap store

$89

DocBento

Self-hosted document management that reads every scan and answers with page citations.

Live demo

Keep reading

All stories