How does Shopify CDN determine responsive image sizes?

What determines the sizes that the Shopify CDN can provide? Are there set image sizes that are generated on upload?

Or are the requested sizes generated and then cached?

I’m playing around with it and changing up the srcset values to suit what should be delivered. Fixing a set value in the ‘sizes’ attribute sometimes returns a different image size on subsequent reloads. That made me wonder if the CDN serves the closest version it’s got, and also generates the size you requested for the next request for it that might come through.

I couldn’t find much online on how it exactly works.

The requested sizes are generated on demand and pushed to the CDN.
The version number you’ll see on the image ensures you’re getting the latest one.

If you see an image (with version number) return something different and you’ve proven it’s not local cache it would be interesting to see that example.