Taking Trainium3 to the Track: Generating Videos with LTX-2.5

In this articleTwo goalsHow it worksRunning on Trainium3 A 10-second video clip with sound generated 22 to 23 seconds on a Trainium3…

By Vane November 27, 2026 6 min read
Taking Trainium3 to the Track: Generating Videos with LTX-2.5


A 10-second video clip with sound generated 22 to 23 seconds on a Trainium3 machine running half its capacity. The test used the LTX-2.5 model from Lightricks, accessed via a partnership with AWS on a trn3.48xlarge instance equipped with 64 NeuronCores.

The author spent the month testing Hugging Face models on the hardware. With five days remaining, they shifted focus to video generation to see if the setup could handle more than simple example clips.

Two goals

The first objective was to determine how straightforward it is to generate videos using diffusers on Trainium3. The aim was not to produce simple demo clips, but to draft short films from a script, simulating a real-world use case. The second objective was performance, specifically matching or beating the speed of Lightricks’ own API or CUDA setups.

For CUDA, no direct comparison figure was available. Lightricks claims 6.8 seconds for a 10-second 720p clip on four B200 GPUs, but the measurement details are unclear. Instead, the comparison was made against Lightricks’ online API, which produces a 10-second 1080p clip in 23.7 seconds. The Trainium3 setup matched this time and improved slightly, delivering 22 to 23 seconds for a 10-second clip at 2048×1024 resolution once the models were loaded. This result was achieved with minimal time spent on pipeline optimisation.

How it works

The input format is a film file, a JSON list of shots containing a name and a prompt. Each prompt functions like a storyboard entry, detailing style, subject, motion, camera, light, and sound. LTX-2.5 performs better with longer prompts, so the descriptions were written as paragraphs covering these elements.

The following example shows the JSON structure for a short seal film, with prompts shortened for brevity:

[
  {"name": "dream", "prompt": "Style: cinematic, realistic, shallow depth of field. A plump seal ... is fast asleep on warm golden sand under palm trees ...", "seed": 3},
  {"name": "nap", "prompt": "Style: cinematic, realistic, wide-angle lens. ... a plump grey seal is fast asleep on a small ice floe ...", "seed": 1, "to": {"shot": "iceberg", "frames": 9}},
  {"name": "iceberg", "prompt": "Style: cinematic, realistic, wide-angle lens. ... the whole iceberg slowly rolls over ... and washes over the seal. ..."},
  {"name": "shake", "prompt": "Style: cinematic, realistic, wide-angle lens. ... It slowly shakes its head and body ... and flops down on its belly on the floe, ...", "from": {"shot": "iceberg", "frames": 25}}
]

Each shot includes a name and a prompt. It can also have a seed to select a specific take from several options. Shots are linked using two keys, which is essential because prompts alone do not maintain subject consistency across cuts.

  • from: indicates the shot starts from the last frames of an earlier shot. Using the final frame maintains the subject’s appearance. Using the last 25 frames (1 second) also continues the motion.
  • to: indicates the shot ends on the first frames of a later shot, ensuring a smooth lead-in.

Shots can also be trimmed or have captions overlaid. Constructing a film from shots operates like animation, using either straight-ahead or pose-to-pose methods. In straight-ahead, each shot continues the previous one. In pose-to-pose, key shots are created first. Once a key shot is approved, preceding shots end on its first frames (to), and following shots start from its last frames (from). When a film builds toward a payoff, that moment serves as the key shot. The author discovered the correct order through trial and error, building the seal film pose-to-pose starting from the iceberg shot.

The payoff is the iceberg shot, where the iceberg rolls over and its wave drenches the seal. The nap shot, showing the sleeping seal, ends on the first 9 frames of iceberg (to) to ensure the seal, floe, and iceberg remain consistent into the payoff. The shake shot begins from the last 25 frames of iceberg (from), depicting the seal shaking off water and flopping back onto the floe. The dream shot is generated independently, joined to the rest via a cut.

On the diffusers side, three pipelines share the LTX-2.5 models. LTX2Pipeline generates shots from prompts alone. LTX2ConditionPipeline generates shots that start or end on frames from another shot. Both follow the two-stage distilled recipe from the model card: eight steps followed by the third pipeline, LTX2LatentUpsamplePipeline, which upscales latents by two before three final steps.

The diffusers pipelines handle all generation. The film logic consists of roughly 160 lines of Python on top of the diffusers code. This code reads the film file, orders shots so keyframes exist before the shots requiring them, cuts frames for handover, trims sequences, adds captions, and assembles the final film. The code is available in dacorvo/video-generation. The retained films are in the dacorvo/video-generation bucket, including the seal, a fox, and a goat. The goat film trims two shots and draws a caption over its payoff.

Running on Trainium3

Initially, the model did not run on the NeuronCores. The transformer did not fit on a single core, and diffusers lacked a plan to split it. The first successful attempt split the transformer over four cores with patches. This took about 5 minutes 20 seconds for a 10-second clip, with NeuronCores computing for only 45 seconds of that time. The target resolution was also out of reach.

Five days later, the setup was significantly faster:

10-second clip with soundNeuronCoresWall timeOn the NeuronCoresvs. first attempt
First attempt, 960×54445 min 20 s45 s1×
Optimized, 2048×1024 (~4× more pixels)3222 to 23 s15 s14×

Achieving this required three types of work: enabling the model to run on NeuronCores via tensor parallelism, splitting it across more cores using sequence parallelism, and ensuring the host kept up with the compute. Most fixes were applied on the device, but the largest end-to-end savings came from the host, where the most obvious waste existed.

What it took to make it work

ProblemWorkaroundResult
The transformer does not fit on one NeuronCore, and diffusers has no tensor-parallel plan for itA plan, and an attention processor that runs on the heads of one rankThe transformer runs on 4 cores
The text encoder does not fit on a NeuronCore next to the transformer, so it runs on the CPUs. diffusers supports a pipeline split this way, but its LTX-2 pipelines give the text encoder its inputs on the NeuronCoresPin the pipeline to the host, and move the transformer’s inputs to the cores and its outputs backThe pipeline runs with its transformer on the cores
Compiled as one graph, the transformer returned NaN at one size, and each new process traced it again, even with every graph in the cacheCompile one block with compile_repeated_blocksFinite outputs, and tracing falls from 388 s to 18 s
torch-neuronx computes a bf16 GELU entirely in bf16, constants included (#1049)Compute the GELUs in fp32Transformer error against fp32: 0.297 → 0.158 (CPU bf16: 0.160)
At 2048×1024, the block graph of the transformer split 4 ways fails to loadSplit the video tokens 8 ways on top (sequence parallelism): two custom attention processors on diffusers’ set_attn_processor hook, each a few tensor reshapes around its collective calls (code)Stage 2 runs on 4 × 8 = 32 cores, at 3.0 s a step
A shot that starts from frames has a timestep per video token, and its block graph fails to loadEmbed only the two timesteps, and pick one for each token (code)A shot from frames takes about as long as one from a prompt

What it took to make it fast

ProblemWorkaroundGain
Each rank (one process per NeuronCore) ran the whole pipeline, and they all encoded the prompt on the CPUs of one socketRun the pipeline on rank 0 only, and send the other ranks the arguments of each callPrompt encoding: about 205 s → 7.5 s
torch-neuronx’s allocator leaves most of its memory segments unused (#1052)Pack the parameters into buffers of at most 1 GiBMemory per core: 22.96 GiB → 10.2 GiB
The attention runs as plain ops unless the sequence length is a multiple of 1

Scroll to Top