Llama 2 on Amazon SageMaker a Benchmark
A benchmark of 60 Llama 2 deployment configurations on Amazon SageMaker using the Hugging Face LLM Inference Container (TGI) covers 7B, 13B and 70B models on g5 (A10G) and p4d (A100) instances. Each configuration was measured for per-token latency and throughput at 1–20 concurrent requests, with and without GPTQ 4-bit quantization. GPTQ is the most cost-effective option: 7B on a g5.2xlarge costs about $3.50 per million tokens, and 13B fits on a single GPU. The best throughput came from 13B unquantized on p4d at roughly 668 tokens/sec with 20 concurrent requests, and the lowest latency was 7B on ml.g5.12xlarge at about 16.8 ms/token.
Related posts
- Introducing the Hugging Face LLM Inference Container for Amazon SageMaker
Hugging Face mediumAdeptHugging Face's LLM Inference Deep Learning Container for Amazon SageMaker is built on Text Generation Inference (TGI), which provides tensor parallelism, continuous batching, flash-attention, bitsandbytes quantization, safetensors loading and SSE token streaming. The walkthrough deploys the 12B Pythia Open Assistant model on an ml.g5.12xlarge instance (4 A10G GPUs) using the sagemaker Python SDK, with environment variables for GPU count and token limits. It then covers TGI generation parameters such as temperature, top_p, stop sequences and repetition penalty, and builds a Gradio chatbot on top of the endpoint. For a cheaper setup, a g5.2xlarge with int8 quantization is suggested.
- Introducing the Hugging Face Embedding Container for Amazon SageMaker
Hugging Face mediumAdeptThe Hugging Face Embedding Container for Amazon SageMaker, built on Text Embedding Inference (TEI), is now generally available for deploying open embedding models such as Snowflake Arctic Embed and BGE. TEI uses token-based dynamic batching, Flash Attention and Candle, and ships separate CPU and GPU images. A walkthrough with the sagemaker Python SDK covers retrieving the image URI, deploying snowflake-arctic-embed-m-v1.5 and load testing it. In the test, embedding ~1M tokens took about 841s (~5 req/s, 2s latency) on a ~$150/month CPU instance versus about 30s (~130 req/s, 4ms latency) on an ml.g5.xlarge A10G GPU at $1.408/hour. The recommendation is GPUs for bulk embedding and CPUs for low-cost endpoints.
- Benchmarking Text Generation Inference
Hugging Face mediumAdeptText Generation Inference ships a benchmarking tool that profiles LLM serving across batch sizes, plotting throughput against latency separately for prefill and decode so deployments can be tuned for a workload such as RAG or chat. Using a duplicable Hugging Face Space bundling TGI with JupyterLab, the walkthrough shows how to read the charts. Vertical regions mean added batch size buys throughput at no latency cost. Horizontal regions mean the server is compute bound: in the example, decode latency stayed flat near 5.3s up to batch 32, while prefill beyond 32 doubled TTFT with no throughput gain. The recommended loop is to benchmark on hardware matching production, adjust TGI launch settings, and repeat, checking real user token patterns in TGI logs.
- Optimizing inference speed and costs: Lessons learned from large-scale deployments
Together AI easyNoviceLower LLM inference latency and cost come mainly from how inference runs rather than from buying more GPUs. The levers covered are FP8/FP4 quantization (claimed 20–40% throughput gains), distilled models like DeepSeek-R1 variants (2–5× lower cost), regional proxies that cut 50–100 ms of TTFT, removing GPU stalls via kernel fusion, MoE execution and scheduling, and speculative decoding or MTP (20–50% faster decode). It also covers Blackwell-class hardware with tensor or expert parallelism and dynamically shifting GPU capacity between endpoints. A starting checklist: measure TTFT, decode TPS and network RTT, then add proxies, continuous batching and decoding optimizations.
- TGI Multi-LoRA: Deploy Once, Serve 30 Models
Hugging Face mediumAdeptText Generation Inference (TGI) v2.1.1 adds multi-LoRA serving: one base model such as Mistral-7B is deployed once, and many small LoRA adapters are loaded alongside it, with each request picking its adapter via an adapter_id. Adapters are tiny (13.6MB versus 14.48GB for the base), so loading 30 of them adds only about 3% VRAM. The post shows deployment via Docker with the LORA_ADAPTERS setting, Inference Endpoints through the GUI and in Python, and how to query a specific adapter. It argues that per-token cost stays flat as models are added and that consolidating bursty per-model traffic onto one deployment smooths GPU utilization.