Bottom line first: it runs, but do not do this.
Cloud engineers share a stubborn instinct. If serverless setups can chop video encoding into hundreds of parallel tasks, why not do the same with large language models?
Leaving a dedicated GPU instance warm burns money every idle second. If we could spin up models on demand like microservices and pay only for active compute milliseconds, would cloud bills drop significantly?
Software engineer Noah Lindner decided to test this premise. He split an open-weights decision model based on the Qwen architecture and crammed it into AWS Lambda functions.
The financial outcome was brutal. A single document inference run took 17 seconds and cost 3.4 cents. Compared to standard managed GPU endpoints running around 0.04 cents per run, this serverless pipeline proved unbearably slow and spiked costs by roughly 80x.
This was not a failure of serverless elasticity. Intermediate layer states simply do not belong in object storage.
Why Attempt Inference on AWS Lambda
Serverless compute remains attractive because you pay only for what executes.
For tasks like chunked video transcoding, thumbnail generation, or event-driven data sanitation, Lambda slashes infrastructure expenses.
In LLM inference, standard deployments face two major friction points:
First, the tension between cold starts and idle costs. Running an instance equipped with an A10G or A100 means paying fixed hourly rates regardless of whether requests arrive. Very few team budgets enjoy subsidizing quiet nights.
Second, elasticity under traffic spikes. When 2,000 concurrent requests land suddenly, fixed instances rely on auto-scaling groups. Pulling container images and loading weights takes two to three minutes. By the time nodes are warm, user requests have already timed out.
Turning LLMs completely serverless promised zero idle overhead with instantaneous scaling.
That was the theory. Practical physics quickly stepped in at the function runtime limit.
Pipeline Topology: 9.3GB Weights Across 34 Functions
The initial roadblock was deployment package sizing. AWS Lambda enforces strict package limits, capping uncompressed archives to 250MB via direct upload and restricting container image sizes.
The experimental workload used a fine-tuned decision model based on Qwen, weighing roughly 9.3GB. Packaging a 9.3GB monolithic model into a single Lambda function was an immediate dead end due to initialization and memory caps.
The author chose a layered pipeline decomposition:
Transformer architectures stack sequential layers. This Qwen model contained 32 sequential Transformer layers, each layer taking around 225MB. Adding an initial Embedding function and a final LM Head function resulted in 34 independent Lambda functions. A 225MB slice easily fits within standard Lambda container bounds.
The system topology became a sequential relay pipeline:
Prompt Input
│
▼
┌─────────────┐
│ Lambda 0 │ Load Embeddings vocabulary
└──────┬──────┘
│ Write activation tensors to S3
▼
┌─────────────┐
│ Lambda 1 │ Process Transformer Layer 0, ~225MB weights
└──────┬──────┘
│ Write activation tensors to S3
▼
... 30 intermediate layer functions chained sequentially
│ Write activation tensors to S3
▼
┌─────────────┐
│ Lambda 32 │ Process Transformer Layer 31
└──────┬──────┘
│ Write activation tensors to S3
▼
┌─────────────┐
│ Lambda 33 │ Load LM Head, output prediction probabilities
└─────────────┘
When the pipeline finished its first complete execution, the author checked outputs rather than costs.
Given the same test prompt, the top-1 token matched local PyTorch outputs. Forward propagation math remained sound across the splits.
Yet running document batches, pipeline warm-ups, and intermediate handoffs triggered 5,600 Lambda invocations in total.
Then came the AWS billing dashboard: 17 seconds and 3.4 cents for one document. Running is one thing, practical deployment is entirely another.
17 Seconds and 3.4 Cents: Breaking Down the 80x Bill Disaster
Does running successfully mean it belongs in production?
The metrics in AWS CloudWatch and Cost Explorer told a stark story.
A single document run took 17 seconds, accumulating 3.4 cents across compute runtimes and storage requests.
On a standard managed cloud GPU instance running an equivalent Qwen checkpoint, forward pass latency ranges between tens and hundreds of milliseconds, averaging around 0.04 cents per document.
Comparing 3.4 cents to 0.04 cents represents an 80x price explosion.
A project started to cut idle expenses became an expensive budget drain. Where did all the money go?
Expense One: S3 Latency and Tensor Serialization
Inside an accelerator card, activation tensors cross high-bandwidth memory at rates measured in terabytes per second across SRAM and HBM.
Between 34 isolated Lambda containers, process memory is strictly isolated. How does function N pass its hidden states to function N+1?
The tensors must be serialized and pushed out over the network.
The experiment leveraged Amazon S3 buckets to relay intermediate states. Across 32 layers, each step required serializing tensors, uploading to S3, and having the subsequent function fetch and parse them.
Assuming one PUT and one GET per layer per token step, 32 layers generate 64 object requests per token. Outputting 175 tokens requires over 11,000 S3 operations.
This is linear accumulation rather than exponential growth, yet it easily consumed the bulk of the 17-second execution. Most of the runtime was spent waiting on S3 roundtrips rather than matrix multiplication.
Expense Two: CPU Execution Penalties on Dense Matrix Math
AWS Lambda environments rely on standard CPU cores. Even allocating maximum function memory to earn proportionally higher CPU quotas, standard x86 or ARM instruction sets cannot rival dedicated tensor cores.
Operations completed in single-digit milliseconds on a GPU require hundreds of milliseconds on server CPUs.
Lambda bills by duration multiplied by allocated memory. Stretching runtimes by dozens of times across thousands of invocations rapidly turns micro-cent billing increments into painful sums.
Expense Three: Cold Starts and Tail Latency Compounding
Invocations across 5,600 function calls rarely execute uniformly. Instances encounter cold starts when spinning up containers, fetching 225MB layer weights, and initializing runtimes.
In a strictly sequential dependency chain, end-to-end latency reflects the sum of the slowest steps. When even two or three layers experience cold start scheduling delays, the entire downstream pipeline freezes waiting for inputs.
Realistic Architectural Boundaries for LLM Inference
While financially unviable, Noah Lindner’s experiment established clear system design boundaries for infrastructure engineers.
Compute-Intensive vs IO-Intensive Workloads
Serverless pipelines excel at video transcoding and batch log parsing because those workloads involve stateless data chunks. Chunks process independently, and compute throughput inside each worker vastly outweighs inter-node communication.
LLM inference is fundamentally bounded by memory bandwidth and ultra-low communication latency. Transformer auto-regressive generation requires sweeping model weights and referencing the previous token hidden states at every step. Cutting these tight couplings across loose network nodes contradicts basic hardware ergonomics.
False Elasticity vs Genuine Expense
Many teams obsess over zero-idle architectures, believing any unused compute cycle represents intolerable waste.
The data proves otherwise. In low-frequency workloads, an entry-level GPU instance sitting idle 80 percent of the time remains far cheaper each month than assembling thousands of high-overhead distributed cold starts. Idle costs are visible, while distributed network overhead, serialization burdens, and debugging complexity hide beneath the surface.
Pragmatic Serverless Patterns for Modern AI
Does this make serverless architectures irrelevant for modern AI?
Not at all. Practical serverless LLM implementations rely on platform-managed warm pools rather than shredding model weights across stateless handlers:
The first pattern uses GPU container instances billed by the second, where models remain pre-warmed on shared host storage while the routing layer directs requests without fragmenting topology.
The second pattern assigns lightweight auxiliary tasks to Serverless, including prompt rendering, content moderation, token authorization, and structured JSON parsing. The heavy weight matrices stay securely anchored on dedicated accelerators connected by high-speed interconnects.
Conclusion
The takeaways from this experiment are clear:
First, avoid treating Transformer layers like video segments. Layer states remain tightly coupled, and using S3 as a relay amplifies latency and API charges together.
Second, use dedicated small GPU instances for low-volume inference. Even with 80 percent idle time, it costs less than 5,600 serverless cold start assemblies.
Third, look to provider-managed warm GPU pools for genuine elasticity, rather than attempting to stitch model layers across serverless functions.
For low-frequency inference, is forcing pure serverless architectures worth the trouble?
True savings come from minimizing total monthly invoices, not from forcing zero idle percentages onto the wrong hardware abstraction.