---
title: "How Meta animates AI-generated images at scale"
description: "Meta made its Meta AI image-animation feature fast enough for billions of users by stacking model optimizations."
url: "https://swe.quest/articles/how-meta-animates-ai-generated-images-at-scale-99df36d0b665f101"
canonical: "https://engineering.fb.com/2024/08/14/production-engineering/how-meta-animates-ai-generated-images-at-scale/"
source: "Meta Engineering"
published: "2024-08-14"
difficulty: "hard"
kind: "Case study"
reading_minutes: 8
tags: ["inference","performance","load-balancing","resilience","computer-vision"]
---

# How Meta animates AI-generated images at scale

A post on [Meta Engineering](https://swe.quest/sources/meta.md), published 2024-08-14, 8 min read, Case study. Original: [https://engineering.fb.com/2024/08/14/production-engineering/how-meta-animates-ai-generated-images-at-scale/](https://engineering.fb.com/2024/08/14/production-engineering/how-meta-animates-ai-generated-images-at-scale/)

## Summary

Meta made its Meta AI image-animation feature fast enough for billions of users by stacking model optimizations. These include bfloat16 precision, expanding temporal-attention context after the cross-attention projections, DPM-Solver sampling down to 15 steps, and combined guidance and step distillation that turned 32 multi-pass teacher steps into 8 single-pass student steps. TorchScript freezing came first, followed by a move to PyTorch 2.0 compile with context and sequence parallelism. In serving, a load-aware routing table keeps requests in-region and offloads to progressively farther regions as load nears capacity. Because each GPU accepts only one request at a time, retry-based probing for free GPUs started to cascade until execution delay and exponential backoff were added.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Load balancing](https://swe.quest/tags/load-balancing.md) (Infrastructure)
- [Resilience](https://swe.quest/tags/resilience.md) (Distributed systems)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)

## Prerequisites

- diffusion models
- classifier-free guidance
- PyTorch
- retries and backoff

## Keywords

Meta AI, DPM-Solver, PyTorch 2.0, TorchScript, bfloat16, U-Net, guidance distillation, torch.compile

## Related posts

- [Meta Andromeda: Powering the Next Generation of Ads Retrieval Through Model-System Co-Design](https://swe.quest/articles/meta-andromeda-powering-the-next-generation-of-ads-retrieval-through-model-4334615c71f64c69.md): Meta Engineering · 2026-10-28 · Hard · 11 min read · Recommendations & ranking, Ads, Inference & serving, Hardware, Performance engineering
  Meta's next-generation Andromeda ads retrieval engine co-designs model, system and GPU hardware to score every eligible ad with near ranking-level quality at over one billion ads per second per GPU server, a 100x lift over the 2024 system.
- [Meta Adaptive Ranking Model: Bending the Inference Scaling Curve to Serve LLM-Scale Models for Ads](https://swe.quest/articles/meta-adaptive-ranking-model-bending-the-inference-scaling-curve-to-serve-llm-b02b370caa05f2c4.md): Meta Engineering · 2026-03-31 · Hard · 9 min read · Recommendations & ranking, Inference & serving, Ads, Performance engineering, Hardware
  Meta Adaptive Ranking Model serves LLM-scale ads ranking models (O(10 GFLOPs) per token, O(1T) parameters) at O(100 ms) latency by routing each request to an appropriately complex model and computing user signals once per request instead of once per ad candidate.
- [Run FLUX.1-dev three times faster](https://swe.quest/articles/run-flux-1-dev-three-times-faster-ae60b80e0a362206.md): Modal · 2025-06-18 · Medium · 9 min read · Inference & serving, Performance engineering, Python, Computer vision, Serverless
  FLUX.1-dev image generation on Modal drops from ~6.75s to under three seconds per 1024x1024 image.
- [GEM Training: How Meta Doubled the Efficiency of Its LLM-Scale Ads Foundation Model](https://swe.quest/articles/gem-training-how-meta-doubled-the-efficiency-of-its-llm-scale-ads-foundation-1bf8547a323404ba.md): Meta Engineering · 2026-08-03 · Hard · 21 min read · Model training, Recommendations & ranking, Performance engineering, Hardware, Ads
  Meta doubled end-to-end training efficiency of GEM, its LLM-scale ads recommendation foundation model, to 20–25% MFU while scaling training FLOPs 4x in a year, by co-designing kernels, precision, parallelism, networking and memory.
- [Meta’s Generative Ads Model (GEM): Scaling the Central Model and Compute Engine for Frontier Ads AI](https://swe.quest/articles/meta-s-generative-ads-model-gem-scaling-the-central-model-and-compute-engine-588a45420da8f0cd.md): Meta Engineering · 2026-10-13 · Hard · 14 min read · Recommendations & ranking, Ads, Model training, Inference & serving, Scaling
  Meta's 2026 GEM replaces per-surface ads ranking models with a single central recommendation foundation model trained across Facebook, Instagram, Reels and deep-funnel conversion objectives, reporting 18.9% conversion and 12% CTR gains.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
