Serving Qwen via AWS Lambdas for fun and 80x negative profit
A developer ran a Qwen model on AWS Lambdas using 5,600 CPU invocations per document, proving it works but costs 80 times more than GPU APIs.
summary is enough The short write-up delivers a fun, clear architecture experiment whose core numbers and conclusion are fully captured in the summary.
summary
An engineer split a 4-billion parameter Qwen model across 32 layers, orchestrating 5,600 AWS Lambda CPU invocations to process a 4,000-token document. The pipeline successfully performed inference via a staged staircase architecture utilizing S3 for state. However, the approach proved economically unviable, costing $8.40 per million tokens compared to $0.10 for commercial hosted models. The author ultimately concluded that CPU-based serverless matrix multiplication cannot compete with dedicated hardware.
key points
- The 9.3GB model was broken down into 32 layers, requiring 5,600 Lambda invocations per document to process tokens sequentially.
- Processing a 4,000-token document took 17 seconds at a cost of 3.4 cents, translating to $8.40 per million tokens.
- The experiment demonstrated that CPU serverless infrastructure is roughly 80 times more expensive and slower than specialized GPU hosting.
who should read it
Systems engineers and developers interested in serverless architectures and unconventional model inference setups.
discussion warm
consensus
Readers enthusiastically praised the creative madness of the experiment, with multiple participants noting that AWS Lambda now supports GPU instances.
I’m sure it’s still quite expensive but lambda can now access GPU instances via managed instances. I’d like to see the same thing implemented on some beefier GPU compute.
https://docs.aws.amazon.com/lambda/latest/dg/lambda-managed-...
It pointed out that AWS Lambda now supports managed GPU instances, directly prompting the author to try the experiment again with proper hardware.
Generated by an LLM from the article and thread. Check the sources before relying on it.