AI platform project 02

GPUs that turn themselves off.

Self-hosted models are cheap only when the GPUs are busy and expensive when they idle. This project is the arithmetic and the Kubernetes wiring for keeping them busy, or off.

KarpenterGPU OperatorvLLMKEDASpot

From model to running pod

Select a stage to see what happens there and which file implements it.

Size, pack and price it

Browser ports of the repo's planner. Prices are illustrative on-demand list prices; pass your own spot discount in the CLI.

Will it fit, and how many requests can it batch?

GPU memory = weights + KV cache (grows with context × concurrent sequences) + runtime overhead. vLLM claims 90% of the card up front.

usable 21.6 GBweights 16.1 GB · KV 3.2 GB · overhead 1.5 GBtotal 20.8 GB
weightsKV cacheoverhead
Fits with tensor parallel = 1. At 8,192 tokens of context this card holds at most 3 full-length sequences at once.

KV per token for Llama 3.1 8B: 2 × 32 layers × 8 KV heads × 128 × 2 bytes.

Bin-packing replicas onto GPUs

First-fit decreasing, the same algorithm as gpuplan/binpack.py. Each column is one GPU; its height is GPU memory.

node 1 · g6.xlarge
node 2 · g6.xlarge
node 3 · g6.xlarge
node 4 · g6.xlarge
node 5 · g6.xlarge
node 6 · g6.xlarge
embedder 1.5B8B int48B bf16
Nodes6
GPUs in use6
Memory used33%
$/hour (list)4.83
$/month always on3,478
$/month scale-to-zero1,449

Scale-to-zero pays only for active hours, but the first request after idle waits for a node launch, an image pull and a model load.

Cost per million tokens vs latency

More concurrent requests share the same GPU-hour, so cost per token falls. Once every batch slot is busy, extra requests only queue. Cost stops improving while latency keeps climbing.

$ per 1M output tokens$4.29$8.58request latency (s)9.819.71248163264concurrent requests (log scale)4 slots full
cost per 1M tokensp50 latencytime to first token
Real benchmark this model is calibrated on (mock server, not a GPU)
concurrencyTTFT p50latency p50tokens/s
10.06 s1.05 s30
40.06 s1.05 s121
81.11 s2.10 s121

From bench/loadtest.py against the mock vLLM server (4 slots, 40 tok/s per stream). Real GPU numbers need a real run. The repo claims none.

At the knee (4 concurrent): 115 tokens/s, $1.95 per 1M tokens, 1.12 s per request.

Test me

GPU inference on EKS8 questions

Concept checks, scenario calls and numbers from the real runs. Answer, then read why. Wrong answers can be retried at the end.

Run it yourself

Free: pytest -q (18 tests: planner maths, manifest policy rules, mock server and load test), python -m gpuplan, and a kind cluster running the mock vLLM with the same taints, labels and tolerations as the real Deployment. Real GPUs cost money: terraform/ installs the GPU Operator and KEDA into an existing EKS cluster with Karpenter. It is validated but has not been applied.