Amazon · 2024–2025 · design author & lead engineer
Perceptual compression engine: the smallest file that still looks right.
An automated optimization pipeline for marketing and storefront graphics. Each image is compressed 60 ways in parallel and scored for how it looks to a human, and the smallest file that clears a quality floor ships.
- compressions tried in parallel per image
- 60
- SSIMULACRA 2 perceptual quality floor
- ≥ 80
- peak concurrent workers, sized from first principles
- 2,500
- of marketing graphics in scope, across web, desktop and mobile
- 100%
01 / architecture
How it works
- New
- Changed
- Existing
- 1Parallel enumeration30 quality levels (99 down to 70) × chroma subsampling on and off gives 60 compressions per image, all run at once. The whole space is searched in one round-trip of about 10 s.
- 2Perceptual scoring at scaleThe SSIMULACRA 2 binary is packaged into the serverless runtime. Each worker downloads the original and its candidate, scores them, and returns size and score.
- 3Selection ruleBy default, the smallest file scoring at least 80 wins. The chosen level and score go back in the response, so marketers see the quality cost of every file.
- 4Bounded binary searchFor the ~5% of requests with a hard file-size cap, a search from Q0 up to the default level runs at most 3 iterations and stops once the range is 5 levels or fewer. This caps latency and rendering cost.
- 5Async lineageAfter the response, a background job records the original as a source and each output as a variant, using Source. Lineage adds no latency, and repeat requests can reuse results.
- 6Backward-compatible APIA new quality mode and max-file-size field on the existing optimize API. Marketing tools preview the default result through a 30-day temporary URL and set a size cap only when they need one.
02 / trade-offs
Trade-offs, measured
Sizing the worker pool
Concurrency = requests per second × jobs per request × seconds per job
10 s per job is a conservative budget; the existing optimize API's p99 was about 8 s. Estimated running cost was about $1K per 100M renderings, which made full enumeration affordable.
Which path requests take
Share of marketing image requests
The size-cap path serves a small, shrinking share of traffic, so it was designed to spend as little compute as possible rather than search exhaustively.
Two algorithms for the size-cap path
Enumeration wins on latency and binary search wins on cost. Both are designed for this path; binary search is the fallback that caps compute.
03 / impact
Impact
- marketers no longer pre-compress images by hand, which used to degrade them before upload
- 0 manual steps
- a guaranteed perceptual quality floor, with the score returned for every file
- ≥ 80 on every image
- the full 60-candidate search finishes in about 10 s at a peak of 250 requests/min
- 1 round-trip
What it unlocked
- Lighter pagesSmaller payloads and less bandwidth across web, desktop and mobile storefronts
- Personalized creativesSource-to-variant links let ranking pick between product shots and AI-generated lifestyle edits
- Reuse, not recomputeEvery output is recorded, so repeat requests can be deduplicated
- Quality you can measureEach file carries its level and score, so the cost of compression shows up in metrics