When You Have a Ferrari
HuggingFace got access to an AWS Trainium3 machine for a month through their AWS partnership—specifically a trn3.48xlarge with 64 NeuronCores. They spent most of that time testing models and getting them to work. With five days left, engineer David Corvoysier asked himself: what if I tried to generate videos?
The answer: 22 to 23 seconds for a 10-second clip with sound at 2048×1024, once models are loaded, using half the machine. That matches LTX's own API (which they claim does 10 seconds of 1080p in 23.7 seconds) and beats it by about a second. On hardware that isn't CUDA.
This isn't a carefully orchestrated benchmark. This is what one person with domain knowledge and five days can achieve when given access to interesting hardware. And the results are surprisingly compelling.
The Goal: Real Filmmaking Workflow
Corvoysier had two goals. First: see how easy it is to generate videos with diffusers on Trainium3—not simple example clips, but "short films from a script, closer to a real use case, like drafting a movie." Second: performance close to CUDA or LTX's API.
For comparison points, LTX claims 6.8 seconds for a 10-second 720p clip on four B200 GPUs, but with no detail on measurement methodology. So Corvoysier compared against LTX's online API instead: 23.7 seconds for 10 seconds at 1080p.
The resulting system uses LTX-2.5 from Lightricks, which generates video and audio together. The input is a JSON file defining a film as a list of shots—each with a name, a prompt, and optional chaining parameters.
Shot Chaining: The Clever Part
The interesting workflow innovation here isn't the hardware optimization—it's the shot chaining. Prompts alone don't keep a subject consistent from one shot to the next. So Corvoysier implemented two keys:
from: the shot starts from the last frames of an earlier shot (1 frame keeps the subject's appearance; 25 frames continues the motion)to: the shot ends on the first frames of a later shot, leading into it
This enables two animation approaches. Straight ahead: each shot continues the previous one. Pose to pose: make the key shot (the payoff) first, then shots before it end on its opening frames, and shots after start from its closing frames.
In the seal film, iceberg (where the iceberg rolls over and drenches the seal) is the payoff and gets made first. nap ends on the first 9 frames of iceberg so the seal, floe, and iceberg stay consistent. shake starts from the last 25 frames of iceberg so the dripping seal continues the motion. dream stands alone with a cut joining it.
The code is about 160 lines of Python on top of three diffusers pipelines that share the LTX-2.5 models: LTX2Pipeline for shots from prompts, LTX2ConditionPipeline for shots that start or end on other frames, and LTX2LatentUpsamplePipeline for the upscale step. Films and JSON are available in the dacorvo/video-generation repo and bucket.
From 5 Minutes to 22 Seconds
Out of the box, nothing worked. The transformer doesn't fit on one NeuronCore, and diffusers has no plan to split it. The first running attempt took 5 minutes 20 seconds for a 10-second clip at 960×544, with NeuronCores actually computing for only 45 seconds.
Five days later: 22-23 seconds at 2048×1024 (roughly 4× more pixels) on 32 NeuronCores, with 15 seconds of actual compute. That's a 14× speedup while increasing resolution.
Making It Work
The first category of fixes: getting it to run at all.
- Tensor parallelism: Custom plan and attention processor to split the transformer across 4 cores
- Pipeline split: Pin the pipeline to host, move transformer inputs to cores and outputs back
- Graph compilation: Use
compile_repeated_blocksto compile one block instead of the whole graph—tracing dropped from 388 seconds to 18 seconds - GELU precision: Compute GELUs in fp32 to work around torch-neuronx computing them entirely in bf16, constants included. Transformer error against fp32 dropped from 0.297 to 0.158 (CPU bf16: 0.160)
- Sequence parallelism: At 2048×1024, 4-way split failed to load. Added 8-way split of video tokens on top (two custom attention processors, mostly tensor reshapes around collective calls). Result: stage 2 runs on 4×8=32 cores at 3.0 seconds per step
- Timestep embedding: Shots starting from frames have one timestep per video token; graph failed to load. Solution: embed only two timesteps and pick one per token
Making It Fast
The second category: eliminating waste, especially on the host.
- Pipeline efficiency: Each rank ran the whole pipeline and encoded the prompt on CPU. Solution: run pipeline on rank 0 only, send other ranks the call arguments. Prompt encoding: 205 seconds → 7.5 seconds
- Memory allocator: torch-neuronx's allocator leaves most memory segments unused. Pack parameters into buffers ≤1 GiB. Memory per core: 22.96 GiB → 10.2 GiB
- Attention optimization: Runs as plain ops unless sequence length is a multiple of 128 tokens. Generate at 1024×512 (512 tokens per frame) with
NEURON_LOGICAL_NC_CONFIG=2. Transformer step: 4.3 seconds → 3.0 seconds - Video decode: CPU decode was slow and didn't parallelize. Decode on NeuronCores split by frames, pass frames to rank 0 through shared memory. Decode at 2048×1024: 357 seconds → 1.6 seconds
- Strided slice workaround: Strided slices copied to device get filled by slow device-side copy. Use
.contiguous()before copying
What This Actually Means
This is a five-day sprint by one engineer with access to new hardware. It's not production-ready—Corvoysier documents the workarounds honestly, including issues filed against torch-neuronx.
But it demonstrates something important: AWS's custom silicon is competitive with NVIDIA for inference workloads when someone who knows the stack puts in the effort. Not through magic, but through parallelism strategies (tensor parallel + sequence parallel), fixing host-side waste, and working around compiler issues.
The 32-core layout is elegant: weights split 4 ways (one band of each layer per core), video tokens split 8 ways (one time-stretch of the clip per chip). Each core holds a quarter of the weights and an eighth of the tokens.
The bigger question is adoption. This required custom attention processors, pipeline splitting, memory packing workarounds, and fixing bf16 GELU behavior. That's the tax for being early on a platform. The wins are real—22 seconds matches LTX's API on arguably less hardware—but the path isn't paved yet.
For teams already committed to AWS infrastructure, Trainium3 looks increasingly viable for video generation workloads. For everyone else, the NVIDIA moat remains: it just works, and the ecosystem is massive.
But five days from "doesn't run" to "matches the vendor's own API" is genuinely impressive. This is what first-class platform support looks like when it's being built in public.