---
title: "Benchmarking Text Generation Inference"
description: "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."
url: "https://swe.quest/articles/benchmarking-text-generation-inference-6c04e8c47131c2d4"
canonical: "https://huggingface.co/blog/tgi-benchmarking"
source: "Hugging Face"
published: "2024-05-29"
difficulty: "medium"
kind: "How-to"
reading_minutes: 10
tags: ["inference","performance","llms"]
---

# Benchmarking Text Generation Inference

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2024-05-29, 10 min read, How-to. Original: [https://huggingface.co/blog/tgi-benchmarking](https://huggingface.co/blog/tgi-benchmarking)

## Summary

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. 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.

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)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- LLM decoding basics ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- KV cache ([easy posts on Caching](https://swe.quest/tags/caching.md?difficulty=easy))
- latency vs throughput ([easy posts on Performance engineering](https://swe.quest/tags/performance.md?difficulty=easy))

## Keywords

Text Generation Inference, TGI, Hugging Face Spaces, Inference Endpoints, JupyterLab

## Related posts

- [Boost your throughput with dynamic batching](https://swe.quest/articles/boost-your-throughput-with-dynamic-batching-c7c722ba8af78c33.md): Modal · 2024-09-16 · Medium · 4 min read · Inference & serving, Performance engineering, Serverless, Python
  Modal added a \`@modal.batched()\` decorator that groups incoming requests into batches flushed when either \`max\_batch\_size\` is reached or \`wait\_ms\` elapses, avoiding the unbounded waits of fixed-size batching.
- [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.
- [Benchmarking inference at scale: coding agents](https://swe.quest/articles/benchmarking-inference-at-scale-coding-agents-f8c09180ef476b13.md): Together AI · 2026-05-19 · Hard · 6 min read · Inference & serving, Performance engineering, LLMs, AI for coding
  On a long-context, high-concurrency coding agent workload (prompts ~45k–200k tokens, ~450-token outputs, EAGLE speculative decoding) running Kimi K2.5 on B200 GPUs, Together Inference Engine delivers 31% more per-user TPS than TensorRT-LLM at 2.5M TPM.
- [Prefill and Decode for Concurrent Requests - Optimizing LLM Performance](https://swe.quest/articles/prefill-and-decode-for-concurrent-requests-optimizing-llm-performance-66a6db57e54903ca.md): Hugging Face · 2025-04-16 · Medium · 10 min read · Inference & serving, LLMs, Performance engineering, Hardware
  LLM token generation splits into a compute-bound prefill phase, which processes all prompt tokens in parallel to produce the first token, and a memory-bandwidth-bound decode phase, which produces later tokens one at a time.
- [Make your llama generation time fly with AWS Inferentia2](https://swe.quest/articles/make-your-llama-generation-time-fly-with-aws-inferentia2-bc8b5e1981a590c0.md): Hugging Face · 2023-11-07 · Medium · 7 min read · Inference & serving, LLMs, Hardware, Cloud platforms, Performance engineering
  optimum-neuron can now compile and export Llama 2 models for text generation on AWS Inferentia2, using static input shapes (batch size, 2048 sequence length that also bounds the KV cache) and a configurable core count and fp16 precision.

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)
