Serverless Deployment of Large Language Models on AWS Lambda
summary
Deploys Microsoft's Phi-3 (quantized 4-bit) into a Docker image run on AWS Lambda with Docker using llama.cpp, downloaded from Hugging Face, loading ~2.1–2.3 GB model into memory. Configuration uses 6 vCPUs / 10 GB ARM Lambda, cold starts average 17s, warm runs ~9s, throughput ≈9.2 tokens/sec. End result is an API that works for privacy or per-customer instances; cost after free tier ≈ $1.2 per 10k runs, slower and not cost-competitive with managed APIs.
AI-written summary · about
chapters (12)
- 0:00Introduction to serverless LLMs
- 4:07Why deploy LLMs on Lambda
- 9:29Lambda capabilities and constraints
- 13:51Setting up a basic Lambda Docker function
- 14:13Running LLMs with llama.cpp
- 17:36Lambda handler for LLM inference
- 20:25Local testing of the LLM Lambda
- 21:28Deploying to AWS Lambda
- 27:42Performance and cost analysis
- 30:51Optimizing model and deployment
- 32:38Next steps and alternatives
- 33:19Q&A and closing remarks
