AI Trends

Hands-on Performance Testing and Short-Film Workflow for Video Generation with LTX-2.5 on Trainium3

Hugging FaceUpdated Nov 27 20:36

AI summary

The author ran LTX-2.5 on half of a Trainium3 instance. Once the model was loaded, generating a 10-second 2048×1024 video with audio took 22 to 23 seconds. The workflow orchestrates shots using JSON and reuses frames from adjacent shots via from and to to maintain continuity of subjects and actions. By combining tensor parallelism and sequence parallelism, it reduced host processing time from about 280 seconds to about 8 seconds and NeuronCores compute time from 45 seconds to 15 seconds. The author also tested video continuation using real-world robot and car footage, but noted that training applications would still require generation conditioned on the robot’s or car’s actions.

Why read this

SelectedAI score 66

The article breaks down the complete process, from shot transitions to parallel optimization, providing a reference for deploying video-generation workflows on dedicated accelerators.

Topics

Tags

Body

Two goals

I had two goals. The first was to see how easy it is to generate videos with diffusers on Trainium3. Not the simple clips from the examples: I wanted to make short films from a script, closer to a real use case, like drafting a movie. The second was performance. I wanted to get close to what you get with CUDA, or with LTX's own API.

For CUDA, I found no real figure to compare against. The only one is LTX's claim of 6.8 s for a 10-second 720p clip on four B200 GPUs, with no detail on how it was measured. So I set CUDA aside and compared with LTX's online API instead, which LTX says makes a 10-second 1080p clip in 23.7 s. In the end, the setup matches it, and even beats it by about a second: 22 to 23 s for a 10-second clip at 2048×1024, once the models are loaded, on half of the machine. Not bad, considering how little time I had to optimize the pipelines.

How it works

The input is a film: a JSON list of shots, each with a name and a prompt, much like a storyboard. LTX-2.5 does better with long prompts, so each prompt is a paragraph on the style, the subject, the motion, the camera, the light and the sound. Here is the seal film's file, with the prompts shortened:

Each shot has a name and a prompt , and can have a seed , to keep the take I picked among several. Shots are chained with two keys. This chaining is the point, since prompts alone do not keep a subject from one shot to the next:

from : the shot starts from the last frames of an earlier shot. Starting from the earlier shot's last frame keeps a subject's look across a cut; starting from its last 25 frames (1 s) also continues the motion.

to : the shot ends on the first frames of a later shot, so that it leads into it.

A shot can also be trimmed, or have a caption drawn over it.

Making a film from shots works like animation, which has two ways to go. Straight ahead, each shot continues the one before. Pose to pose, you make the key shot first, until you get one you like; then the shots before it end on its first frames ( to ), and the shots after it start from its last frames ( from ). When a film builds up to a payoff (the moment everything was leading to), the payoff is the key shot. I found this order by trial and error, and made the seal film pose to pose, starting from iceberg .

The payoff is iceberg : the iceberg rolls over, and its wave drenches the seal. nap , the sleeping seal, ends on the first 9 frames of iceberg ( to ), so that the seal, the floe and the iceberg stay the same into the payoff. shake starts from the last 25 frames of iceberg ( from ): the dripping seal shakes off the water and flops down on the floe. The dream is made on its own, and a cut joins it to the rest.

On the diffusers side, three pipelines share the models of LTX-2.5 . LTX2Pipeline makes the shots from their prompt alone, and LTX2ConditionPipeline makes the shots that start or end on frames of another shot. These two follow the two-stage distilled recipe of the model card: 8 steps, then the third pipeline, LTX2LatentUpsamplePipeline , upscales the latents ×2 before 3 final steps.

The diffusers pipelines do all of the generation. The film part is about 160 lines of Python on top: read the film file, order the shots so each keyframe exists before the shot that needs it, and cut the frames to hand over; then trim, caption, even out the sound and assemble the film. The code is in dacorvo/video-generation . The films I kept are in the dacorvo/video-generation bucket, with their JSON files: the seal, the fox, and the goat, which trims two of its shots and draws a caption over its payoff.

Running on Trainium3

Out of the box, the model does not run on the NeuronCores: the transformer does not fit on one, and diffusers has no plan to split it. The first attempt that ran (the model card's pipeline, with the transformer split over 4 cores and a few patches) took about 5 min 20 s for a 10-second clip, and the NeuronCores were actually computing for only about 45 s of it. What's more, the target resolution was out of reach.

Five days later:

Getting there took three kinds of work: making the model run on the NeuronCores (requires tensor parallelism), splitting it over more of them (sequence parallelism), and making the host keep up with them.

Most of the fixes below are on the device, and that is where most of the effort went. The biggest end-to-end savings came from the host: the low-hanging fruit, since that is obviously where the waste was.

What it took to make it work

What it took to make it fast

Three issues were never explained: the transformer compiled as one graph returned NaN at one size, the first shot that ends on keyframes was slow in each new process (even with every graph in the cache), and the latent upsampler fails to load next to the transformer, so it stays on the CPU.

Some of this is being fixed upstream. diffusers#15420 (open) fixes the LTX-2 pipelines, which would make the second workaround above unnecessary. diffusers#14725 (still open) brings tensor and context parallelism into one ParallelConfig , and a _tp_plan for LTX-2.5 is planned.

Lessons learned

Both sides fell hard: the host and the device. Once running, a clip's host time fell from about 280 s to about 8 s (~35×), and its time on the NeuronCores from 45 s to 15 s (3×, at four times the pixels, and with a second stage the first attempt could not even load).

Sequence parallelism is how one clip uses the machine. Tensor parallelism is imposed by memory (the transformer does not fit on one core) and capped by the 32 attention heads. Splitting the sequence over more cores is what puts 32 of the 64 NeuronCores on a single clip, and what made 2048×1024 possible at all, by shrinking each core's graph until it loaded.

On Trainium, plan for the size of the graphs. The shapes decide whether the attention takes the fast kernel, and graphs that are too large fail to load.

Check against the CPU first. Each split of the models was checked on CPU before it ran on the device, and the comparison with CPU found the GELU issue.

Keep the traced code stable. In the build I used, torch-neuronx's cache key included the file and line of each traced op, so an edit could trigger a recompile of up to 30 minutes per graph. I had already reported it ( aws-neuron/torch-neuronx#1027 ), and the issue is now closed.

A film needs more than prompts. Prompts alone do not keep a character, or a mountain, from one shot to the next, so shots start or end on frames of other shots. Each shot also stays in one place: when a shot in an early version of the fox film took the fox from the forest to the lake, the model made a cross-dissolve to another fox.

Make several takes of each shot. The model often gets a detail wrong: the same prompt gave the goat funny horns in 3 takes out of 4. I made 4 takes of each new shot and picked one.

Professional use cases

On the performance side, once the models are loaded, a 10-second 2048×1024 clip with sound takes 22 to 23 s. That rivals LTX's paid API, on half of the instance. A service would keep its processes up, as they take about 3 minutes to load the models, and 80 s for their first clip.

On the feature side, diffusers has what it takes to draft a movie. The shots come from prompts, and keep their subject from one shot to the next by starting or ending on frames of other shots. Takes differ by their seed, and the film file keeps the one I picked. Re-run with the same code and film file, and you get the same film back, byte for byte. A shot can also start from an image, such as a storyboard frame or a character sheet, which the condition pipeline takes the same way as frames (I did not try it in a film).

What keeps it at drafts:

The model still gets details wrong, so each new shot needs several takes.

Each shot makes its own sound. The film evens out the background level, but the sound does not carry over from one shot to the next.

A shot lasts at most 20 s, the model's limit.

From films to world models

LTX calls LTX-2.5 a world model, with robotics as an emerging use. Robots, cars and drones learn from videos of what their cameras see, and a world model can make more of them, including events too rare or too risky to film. So I also tried it on real footage, with the same code: a shot can start from the first second of a real camera clip and invent what happens next. One frame was not enough, as the model cannot tell from it how fast things move.

Here is the head camera of a Fourier GR1-T2 humanoid robot (a clip from NVIDIA's GR1-100 ), looking down at a table. In the real 6-second clip, the robot's left hand picks an orange from a plate and drops it in a tray. The model only sees the first second of that clip (the hands raised, before anything moves) and invents the rest. What really happened, next to its invention:

Same scene, same pick: the model invents the grab on its own, and keeps the table, the hands and the fruit consistent with the real footage. More interesting are the events that did not happen. From the same second, with only the prompt changed, a person leans over and grabs the orange too, and the human hand and the robot hand carry it to the tray together. Five takes, with the real footage first:

The person's gestures and timing differ in each take, and the robot's arm adapts to them. That is the appeal for training: not one continuation of a clip, but a distribution of them, each reproducible from its film file and seed.

The robotics folder of the bucket has the five takes with their JSON files, and a second example from the front camera of a car in a snowstorm ( Boreas ), where the alternate event is slush thrown on the lens by a passing truck. Asked to make the car accelerate instead, the model kept its speed: the prompt does not override what the first second of footage already implies.

These videos follow prompts, not the robot's or car's commands: a training setup would need generation conditioned on those actions. For that, a team fine-tunes the pre-trained checkpoint of LTX-2.5 on the frames and actions of its own robots.

The Ferrari made it around the track, on half of its cylinders.

Models mentioned in this article 2

Lightricks/LTX-2.5-Diffusers

Lightricks/LTX-2.5-Pre-Trained

Datasets mentioned in this article 1

nvidia/PhysicalAI-Robotics-GR00T-GR1

More Articles from our Blog

Hugging Face ❤️ TorchTPU: TPUs, Natively

+1

Does Your Model Run on AWS Trainium? Look It Up

Models mentioned in this article 2

Lightricks/LTX-2.5-Diffusers

Lightricks/LTX-2.5-Pre-Trained

Datasets mentioned in this article 1

nvidia/PhysicalAI-Robotics-GR00T-GR1

Source

Hugging Face