Diagrammatic

Design a Generative AI Image and Video Platform — System Design Interview Practice

Design a platform for generating images and videos from text prompts using diffusion models, with support for fine-tuning, style transfer, inpainting, and content safety filtering. Work through the requirements, architecture trade-offs, and an interactive design review.

Concepts and architecture decisions to consider

  • aiConcept to explore
  • generative aiConcept to explore
  • diffusion modelsConcept to explore
  • image generationConcept to explore
  • gpuConcept to explore
  • creative aiConcept to explore

Interview prompt

Design a generative image and video platform that accepts prompts and source media, schedules GPU inference and fine-tuning jobs, filters unsafe content, and serves durable results at scale.

  • Separate immutable prompts, input assets, model and adapter versions, job state, moderation decisions, and generated assets.
  • Use queue-backed GPU scheduling, batching where safe, quotas, cancellation, and per-tenant fairness for expensive workloads.
  • Apply prompt and output safety checks, provenance and watermark policy, copyright controls, and explicit content states.
  • Explain retries, deterministic seeds, model cache warming, partial video failure, privacy, deletion, and cost controls.

Requirements and scale assumptions

  • Create image or video jobs, upload inputs, select an approved model or adapter, generate variants, and retrieve results.
  • Expose queued, running, moderation, completed, failed, and canceled states with progress, seed, model, and cost metadata.
  • Support fine-tuning datasets, access controls, abuse reports, asset deletion, usage quotas, and signed result URLs.
  • Target p95 image generation below 10 seconds for the standard preset; video and fine-tuning are asynchronous jobs.
  • Scale GPU queues by model, resolution, frame count, and tenant while preventing one large job from starving short jobs.
  • Make job submission, asset writes, moderation, and billing idempotent; never charge twice for one attempt.
  • Keep completed assets available and queue work when a model host or GPU pool is unavailable.
  • Support 100,000 generations per hour, 10,000 concurrent jobs, and multiple image and video model families.
  • Partition queues by model and tenant; isolate high-resolution video and fine-tuning workloads.
  • Retain encrypted inputs, prompts, model manifests, moderation outcomes, and outputs under tenant retention policy.
  • Peak scale: Provide an API — Capacity assumption that drives partitioning and backpressure.
  • Latency target: Image generation under 10 seconds — User-facing budget for the primary request or read path.
  • Durable boundary: Committed before async — The source of truth is Generate images from text prompts; Support image-to-image transformation.
  • Async boundary: At-least-once workers — Keep Use Stable Diffusion or similar diffusion models, Implement LoRA for efficient fine-tuning, Use task queues (Celery, Bull) for async generation off the synchronous path.

Key entities

  • DatasetVersiondatasetId, version, schemaHash, qualityStatus, lineage, createdAt

    Immutable generative ai image and video platform input version used for reproducible training, evaluation, or replay.

  • FeatureSnapshotentityId, featureSetVersion, eventTime, values, sourceWatermarks

    Point-in-time generative ai image and video platform features with source watermarks so online and offline values can be compared.

  • TrainingRunrunId, datasetVersion, codeVersion, metrics, artifactUri, status

    Audited generative ai image and video platform run that records data, code, dependency, and evaluation lineage.

  • ModelVersionmodelId, version, stage, schema, qualityGates, endpoint

    A promotable generative ai image and video platform model version with rollout state, contract, and rollback metadata.

Data flow

  1. 1. Register and validate training dataThe generative ai image and video platform gateway records an immutable dataset version, schema, lineage, quality status, and privacy disposition.
  2. 2. Build point-in-time featuresFeature workers join generative ai image and video platform inputs using event-time watermarks, prevent leakage, and publish the same feature contract for training and serving.
  3. 3. Train and evaluate asynchronouslyThe orchestrator schedules generative ai image and video platform runs with checkpointed artifacts, reproducible environments, and metrics tied to the exact input versions.
  4. 4. Gate and serve a model versionA registry compares generative ai image and video platform quality, bias, safety, and compatibility gates before canary or production rollout with an immediate rollback pointer.
  5. 5. Monitor drift and learn from feedbackOnline inference records latency, errors, drift, and delayed labels so generative ai image and video platform retraining is evidence-driven rather than triggered by guesswork.

Deep dives and trade-offs

  • Reproducibility and leakage preventionPin generative ai image and video platform data, feature, code, dependency, and model versions for every run. Use point-in-time joins and quarantine failed quality or privacy checks before training. Keep raw inputs and artifacts immutable so a result can be replayed after a dependency changes.
  • Safe promotion and serving contractsSeparate generative ai image and video platform model registration from deployment and require signed artifacts plus schema compatibility. Use shadow traffic, canaries, rollback pointers, and per-version latency/error budgets. Return model version and feature freshness so clients can explain or reproduce a prediction.
  • Drift, feedback, and costMeasure feature drift, prediction drift, label delay, and segment-level quality for generative ai image and video platform rather than only aggregate accuracy. Sample expensive inference and cap retraining concurrency with an explicit GPU or compute budget. Keep human corrections and delayed labels linked to the original prediction and model version.
  • Batch versus online featuresPrefer a shared feature contract with batch backfills and a low-latency online serving path for decisions that need freshness. Two independently defined transformations create training-serving skew and hard-to-debug regressions.
  • Synchronous versus asynchronous inferenceKeep interactive generative ai image and video platform inference synchronous within a strict budget and queue large or expensive jobs. A request path that waits for model loading, enrichment, or retraining turns downstream slowness into an outage.
  • Global model versus segment modelsStart with one versioned model and add segment-specific models only when quality or policy evidence justifies the operational cost. Many simultaneously active versions multiply monitoring, rollback, and data-lineage burden.
Diagrammatic — system design practice and architecture review.