AWS Lambda adds GPU inference with 48 invocations per GPU
Lambda now supports GPU inference with up to 48 concurrent invocations sharing one model per GPU. This reshapes serverless for AI if you measure well.
AWS Lambda can now run GPU inference on Managed Instances and allow up to 48 concurrent invocations per GPU sharing a single copy of the model in VRAM. You deploy an OCI image, use the same event sources, and pay EC2 On‑Demand for the instance plus a 9.75% management fee and 0.20 USD per million requests. If you were on the fence about serverless for models, the board just changed.
What happened
Lambda enabled G‑family GPUs for Managed Instances running containerized functions. Architecture-relevant details:
- Per‑environment concurrency: up to 48 invocations share one model copy in GPU memory.
- Base images: CUDA, CuPy, PyTorch, vLLM, and SGLang, ready for inference.
- Model via config:
MODEL_IDcan point to Hugging Face, ModelScope, S3, or a local path. - Provisioning: publishing a version provisions environments, downloads weights, and warms the engine.
- Faster starts: Seekable OCI and lazy loading claim up to 70% shorter environment startup.
- Scaling driven by GPU/CPU utilization and concurrency.
- Limits: image up to 32 GB, ephemeral storage 32 GB, memory 2–32 GB, accelerator memory 3–48 GB, and timeouts up to 90 minutes for async and event source mappings.
Why it matters
With 48 invocations sharing a model, you stop paying to load the same checkpoint N times. You also get native events, VPC, IAM, and networking within your account. For many teams, this removes the old trade‑off between rolling your own cluster and shipping prompts to a black‑box provider. If security is top of mind, this helps compared to the risks I discussed when cheap inference providers were stealing keys and prompts.
Multi‑tenancy and isolation
The model is shared in VRAM, invocations aren’t. Great for efficiency, but watch logical isolation and queuing. My rules of thumb:
- Don’t mix tenants with wildly different SLAs in the same environment. Head‑of‑line blocking will nuke your p95/p99.
- Split by model or premium tenant if there’s data sensitivity or strict latency.
- Enforce per‑request caps on tokens, time, and payload size. GPUs are powerful, not infinite.
- Version and pin weights per environment. Model swap is config + new version, treat it like a release.
Latency and cold starts
Publishing a version triggers warm‑up and weight download; lazy loading helps. Still, first‑token latency rules your UX. Measure:
- p50/p95/p99 for time‑to‑first‑token and full response.
- Impact of concurrency at 1, 8, 16, 32, and 48 on internal server queues.
- Streaming vs full responses trade‑offs for your product.
Batching and throughput
With vLLM or SGLang you can lean on batching and modern scheduling. The trick is not to torch latency chasing tokens/sec:
- Set a low max queue delay to protect p95.
- Tune batch size to expected prompt/response lengths.
- If calls are short and numerous, batching shines. If they’re long and interactive, separate queues.
Costs and limits that matter
- Pricing = G instance On‑Demand + 9.75% + 0.20 USD/million requests.
- Container image up to 32 GB; ephemeral storage 32 GB for temporary assets.
- General memory 2–32 GB; VRAM 3–48 GB. Ensure weights + KV cache actually fit with headroom.
- Async and event‑driven timeouts up to 90 minutes.
What I’d do before migrating
- Small pilot: 1–2 models, 2 GPU sizes in the G family. No big‑bang.
- Run your own benchmarks: tokens/s, p50/p95/p99, errors, and cost per 1k tokens. Document the method or it will rot. Related: AI is outpacing how we measure it.
- Isolation policy: by model or by critical tenant. Simple rule, fewer surprises.
- Batching with guardrails: target throughput without wrecking p95. Tune by traffic type.
- Weights and memory: confirm model + runtime fit in VRAM with margin.
- Events and networking: keep data inside your VPC whenever possible; fewer compliance and security headaches.
- Rollback plan: keep the previous version published and warm. If perf dips, revert in minutes.
My take: GPU Lambda puts serverless squarely in the conversation for production inference. It isn’t free and it isn’t for everything, but shared model + 48 invocations changes the math. Prove it with your numbers, not with slides.
PS: if it’s cheap without measuring p95, it wasn’t cheap.