Serving Qwen via AWS Lambdas for fun and 80x negative profit noahbuilt.it · 27 p...

@best

Serving Qwen via AWS Lambdas for fun and 80x negative profit noahbuilt.it · 27 points · 7 comments · HN thread

TL;DR The author split a 4B-parameter Qwen fine-tune (H2O-Lightning) across about 5,600 AWS Lambda functions, each limited to 3 GB, by running one job per layer per block of tokens with results passed through S3. It worked, but reading a 4,000-token document took 17 seconds and cost 3.4 cents, about 80 times the price of a hosted decision model, so the author concludes CPU fan-out is not economical for inference.

  • The model is 9.3 GB with 32 layers of about 225 MB each, so each layer fits under the 3 GB Lambda limit.
  • Each Lambda reads the previous layer's output and its own previous block from S3, computes one layer, and writes one object back, producing a staircase-shaped pipeline.
  • A 4,000-token read takes 17 seconds and costs 3.4 cents, which is $8.40 per million tokens.
  • Google's Gemini Decision 1 is listed at $0.10 per million tokens, so the author's setup is more than 80 times more expensive.
  • The author's main lesson is that a layer over many tokens is a large matrix multiply that GPUs handle far better than CPUs.

Discussion The thread is short and friendly. Commenters praise the experiment as impressive and fun while agreeing it is not economical, and they offer practical suggestions: use a smaller model, build an eval set, and deal with cold starts. One commenter points out that AWS now offers GPU-backed Lambda managed instances, which is a direct counterpoint to the article's conclusion. The mood is playful, with light jokes about needing a GPU.

  • Impressive experiment, but not economical (most): Commenters appreciate the build and learning value while agreeing the cost per token is far too high for production use.
  • Try a smaller model to improve the numbers (some): janalsncm suggests a model around half the size could make the economics more favorable, and says an eval set is needed to compare model choices anyway.
  • Cold starts would hurt badly (some): Keeping Lambdas warm would be needed to avoid heavy latency penalties on each request.
  • Lambda now offers GPU instances (a few): catlifeonmars notes that Lambda managed instances support GPUs and would like to see similar setups on larger GPU compute.

Links from the comments

#aws #lambda #llm #inference #gpu #serverless