Design a Text-to-Video generation platform (Sora/Runway)
A text-to-video platform (Sora/Runway) synthesizes short videos from prompts using spatio-temporal diffusion. Generation takes minutes on large GPU clusters, so the system is a long-running async job platform with progress streaming.
AI & Machine Learning, 6 components, about 35 min
1. Scope
In scope
- • Generate video from text
- • Long-running async jobs
- • Progress updates
- • Result storage/delivery
Out of scope
- • Model training
- • Real-time generation
- • Audio synthesis
2. Functional requirements
Must have
- • Submit a prompt → get a video
- • Handle minutes-long generation
- • Stream progress to the user
- • Store + deliver results
Nice to have
- • Upscaling/interpolation
- • Style/control params
- • Tiered pricing
3. Non-functional requirements
4. Back-of-envelope estimation
Assumptions
- • Each job uses many H100s for minutes
- • Video latent space (patches)
- • Multi-stage upscaling
- • Results in S3/CDN
Derived numbers
5. API design
{ prompt, params } → { jobId }
Real-time progress + final URL
6. High-level design
What each box in the reference diagram is responsible for:
7. Data model
8. Deep dives
Spatio-temporal diffusion
Video adds a time dimension to image diffusion. The model denoises across both space (each frame) and time (between frames) so motion is consistent — objects don't flicker or morph between frames. This couples frames together, which is what makes it so much more expensive than image generation.
Video VAE / latent patches
Operating on raw RGB frames is intractable. A video VAE compresses the clip into a compact latent representation (space-time patches); diffusion runs there, then decodes to frames. This is the key efficiency lever that makes minutes-not-hours generation possible.
Long-running async + progress
Jobs take minutes, so they're fully async with durable job state. Because users won't wait blindly, stream progress (% complete, preview frames) over WebSocket. Workers checkpoint so a failed node can resume rather than restart from scratch.
Cost management
GPU cost per second of output is enormous. Tier pricing by resolution/length, cap concurrent jobs per user, and use multi-stage rendering (generate low-res fast, upscale + frame-interpolate only if the user keeps it) to avoid wasting compute on discarded drafts.
9. Bottlenecks
- GPU supply → queue, quotas, tiered pricing
- Job failures mid-render → checkpointing
- Cost per second → multi-stage render, latent compression
10. Trade-offs
Generate full resolution or cascade
Choose: Generate a low-resolution, low-frame-rate latent first, then upscale in space and time.
Instead of: Generate at full resolution directly: enormous compute per step.
Cascades spread compute where it matters.
Job model
Choose: Long-running async jobs with checkpointed stages.
Instead of: Single monolithic job: a failure late wastes all compute.
Jobs take minutes on many GPUs.
Previews
Choose: Cheap previews before full renders.
Instead of: Only full renders.
Most iterations are discarded.
11. Failure modes
Stage fails after minutes of GPU time
Wasted compute.
Mitigation: Persist intermediate latents per stage; retry only the failed stage.
Capacity exhausted
Long queues.
Mitigation: Quotas, priorities and honest ETAs.
Harmful or deceptive video
Misuse.
Mitigation: Prompt and output filters, watermarking and provenance metadata.
12. What interviewers probe
Answer each one yourself before opening it.
Why is video so much more expensive than images?Show a strong answer
Frames × resolution × steps, plus temporal attention across frames; cost grows faster than linearly with length.
How do you keep frames consistent?Show a strong answer
Spatio-temporal latents generated jointly and temporal attention layers.
How do you schedule multi-GPU jobs?Show a strong answer
Gang scheduling so all GPUs of a job start together, packed to avoid fragmentation.
How do you deliver results?Show a strong answer
Encode to standard formats, store in object storage, serve via CDN with signed URLs.
Sign in to track this guide in your curriculum progress.