---
title: "Llama 2 on Amazon SageMaker a Benchmark"
description: "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."
url: "https://swe.quest/articles/llama-2-on-amazon-sagemaker-a-benchmark-289c7cbbcebbac6e"
canonical: "https://huggingface.co/blog/llama-sagemaker-benchmark"
source: "Hugging Face"
published: "2023-09-26"
difficulty: "medium"
kind: "Research"
reading_minutes: 6
tags: ["inference","llms","cost-optimization","performance","cloud"]
---

# Llama 2 on Amazon SageMaker a Benchmark

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-09-26, 6 min read, Research. Original: [https://huggingface.co/blog/llama-sagemaker-benchmark](https://huggingface.co/blog/llama-sagemaker-benchmark)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Cost optimization](https://swe.quest/tags/cost-optimization.md) (Reliability & operations)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)

## Prerequisites

- LLM inference basics ([easy posts on Inference & serving](https://swe.quest/tags/inference.md?difficulty=easy))
- AWS EC2 GPU instance types ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))

## Keywords

Llama 2, Amazon SageMaker, Text Generation Inference, GPTQ, Hugging Face LLM DLC, NVIDIA A10G, NVIDIA A100

## Related posts

- [Introducing the Hugging Face LLM Inference Container for Amazon SageMaker](https://swe.quest/articles/introducing-the-hugging-face-llm-inference-container-for-amazon-sagemaker-49df0e101e3d8d72.md): Hugging Face · 2023-05-31 · Medium · 8 min read · Inference & serving, LLMs, Cloud platforms, Python
  Hugging 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.
- [Introducing the Hugging Face Embedding Container for Amazon SageMaker](https://swe.quest/articles/introducing-the-hugging-face-embedding-container-for-amazon-sagemaker-cc289650f9404f51.md): Hugging Face · 2024-06-07 · Medium · 7 min read · Inference & serving, Cloud platforms, RAG & retrieval, Python
  The 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.
- [Benchmarking Text Generation Inference](https://swe.quest/articles/benchmarking-text-generation-inference-6c04e8c47131c2d4.md): Hugging Face · 2024-05-29 · Medium · 10 min read · Inference & serving, Performance engineering, LLMs
  Text 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.
- [Optimizing inference speed and costs: Lessons learned from large-scale deployments](https://swe.quest/articles/optimizing-inference-speed-and-costs-lessons-learned-from-large-scale-1e80b28572985147.md): Together AI · 2026-01-22 · Easy · 6 min read · Inference & serving, LLMs, Cost optimization, Performance engineering
  Lower LLM inference latency and cost come mainly from how inference runs rather than from buying more GPUs.
- [TGI Multi-LoRA: Deploy Once, Serve 30 Models](https://swe.quest/articles/tgi-multi-lora-deploy-once-serve-30-models-a0e1ef82f00c7a41.md): Hugging Face · 2024-07-18 · Medium · 12 min read · Inference & serving, LLMs, Cost optimization
  Text 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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
