Tools

AI-generated text

LTX-2.5 Video Generation Optimized for AWS Trainium3

A month-long test of AWS Trainium3 concluded with a five-day effort to run Lightricks’ LTX-2.5 video and audio model efficiently.

LTX-2.5 Video Generation Optimized for AWS Trainium3

Through its partnership with Amazon Web Services (AWS), a developer had a month to test a Trainium3 machine, primarily with Hugging Face models. In the final five days, the experiment turned to video generation with Lightricks’ LTX-2.5, examining whether diffusers could make short films from a script and what performance the hardware could deliver.

The trn3.48xlarge instance had 64 NeuronCores. Using half of them, the optimized setup produced a 10-second, 2048×1024 video with sound in 22 to 23 seconds once the models were loaded. That is close to the 23.7 seconds Lightricks reports for its LTX online API for a 10-second 1080p clip, although the measurements use different resolutions. The developer found no adequately documented CUDA comparison: Lightricks claims 6.8 seconds for a 10-second 720p video on four B200 GPUs, but provides no measurement details.

Building a film from shots

In the experiment, a film is a list of shots in a JSON file. Each shot has a name and a detailed prompt that can describe its style, subject, motion, camera, lighting and sound. An optional seed records which take was selected from several generations.

Shots can be connected through one another’s frames: a new shot can start from the final frames of an earlier one or end on the first frames of a later one. This helps preserve the appearance of subjects and settings across cuts and, if enough frames are carried over, can also continue motion. Shots can be trimmed and captioned.

For a film about a seal, the key shot was generated first: an iceberg rolls over and its wave drenches the animal. The preceding shot of the sleeping seal ends on the key shot’s first nine frames, while the following shot of the seal shaking off water starts from its final 25 frames. A dream sequence was generated separately and joined with a cut. The developer also made a fox film with consecutive shots and a goat film with trimmed shots and a caption.

Three diffusers pipelines handle generation: one creates shots from prompts, another uses frames from other shots, and the third doubles the size of the latent representation. The two-stage process uses eight steps, upscaling, and three further steps. Around 160 lines of Python handle film assembly, including shot ordering, trimming, captions and evening out sound levels.

From first run to optimization in five days

LTX-2.5 did not run on the NeuronCores out of the box: the transformer did not fit on a single core, and diffusers had no plan for splitting it. The first working version divided the transformer across four cores and took about 5 minutes 20 seconds to make a 10-second, 960×544 clip. The cores were computing for approximately 45 seconds of that time.

The optimized version used 32 cores and reduced total time to 22 to 23 seconds with roughly four times as many pixels, including 15 seconds on the NeuronCores. The model’s weights were split four ways and the video tokens a further eight ways. The latter technique, sequence parallelism, also made the higher resolution possible by reducing the computation graphs assigned to each core until they were small enough to load.

Substantial host-side changes also contributed to the speedup. One change cut prompt encoding from about 205 seconds to 7.5 seconds; later improvements to thread allocation and the removal of unnecessary tokens reduced it to approximately 1.4 seconds. Moving video decoding from the CPU to the NeuronCores brought 2048×1024 decoding down from 357 seconds to 1.6 seconds.

The developer also worked around memory-management and numerical issues, checking intermediate results against CPU runs. Some questions remained unresolved: at one size, a transformer compiled as a single graph returned an invalid numerical value; the first shot ending on keyframes was slow in new processes; and the latent upsampler could not load alongside the transformer and therefore remained on the CPU. Two open diffusers developments could improve parts of the pipelines and parallelism.

What the system can do

The developer said the speed is already competitive with the paid LTX API, but a service would benefit from keeping its processes running: loading the models takes about three minutes, and generating their first clip takes a further 80 seconds. With the film file and seeds retained, the selected film can be reproduced byte for byte using the same code. The conditioning pipeline can also start a shot from an image, such as a storyboard frame or character sheet, although the developer did not try this in a film.

The results are still better suited to drafts. The model often gets details wrong, requiring several takes per shot; in the goat example, three of four takes produced odd horns. Sound is generated separately for each shot, so levels can be balanced but audio does not automatically continue across cuts. A shot is limited to 20 seconds. Prompts alone do not guarantee consistent characters either: in an early fox sequence, the model handled a change of location by cross-dissolving to a different fox.

Continuing real footage and robotics possibilities

Lightricks also describes LTX-2.5 as a world model, with potential robotics applications. Such models can create alternative continuations of camera footage, including rare or dangerous events. The developer generated continuations from the first second of real videos; a single frame was not enough to convey how fast things were moving.

One clip from NVIDIA’s GR1-100 shows the head-camera view of a Fourier GR1-T2 humanoid robot. In the original six-second footage, the robot moves an orange from a plate to a tray. The model received only the first second, when the hands were still raised above the table, and independently generated a similar action. With a changed prompt, it also produced five takes in which a person helps the robot carry the orange to the tray, with gestures and timing varying between takes.

In another example, footage of a car on a snowy road from the Boreas dataset was continued with an alternative event: a passing truck threw slush onto the camera. When asked instead to accelerate, the model maintained the speed implied by the first second. The developer emphasized that these videos follow prompts rather than commands from the robot or car. Training conditioned on actions would require fine-tuning the pretrained LTX-2.5 model on the frames and actions of the robots concerned.