You’re building an LLM-powered service.

The model performs well. Everything works as expected. You’re almost ready to ship.

There’s just one problem.

It’s slow. Really slow.

Users have enough time to grab a cup of coffee while waiting for a response. If they can cook a meal before the answer arrives, you’ve got a bigger problem.

The obvious solution comes to mind.

“Let’s upgrade the GPU.”

But the response is just as straightforward.

“Nope. Make it work with what we have.”

And that’s where the real engineering begins.

Fortunately, upgrading your GPU isn’t the only way to speed up LLM inference.

You can eliminate unnecessary computation, run your model more efficiently, or make better use of the GPU resources you already have.

Let’s walk through 10 practical optimization techniques that are actually used in production LLM systems.

First, What’s Actually Slow?

Before optimizing anything, you need to understand where the slowdown is happening.

LLM inference generally consists of two main stages.

Prefill is when the model processes the input prompt. Think of it as reading and understanding the question before answering.

Decode is when the model generates its response, one token at a time.

A few key metrics help us distinguish between different performance problems:

  • TTFT (Time to First Token): How long it takes to generate the first token.
  • TPOT (Time per Output Token): The average time needed to generate each subsequent token.
  • E2E Latency: The total time from submitting a request to receiving the complete response.
  • Throughput: The number of requests or tokens the system can process per second.

If the first token takes forever to appear, prefill or request queuing might be the bottleneck.

If the first token appears quickly but the rest of the response trickles out painfully slowly, decode might be the problem.

And if everything works fine until more users show up, you may have a GPU resource management issue.

Here’s the important distinction:

Making one request faster and handling many requests efficiently are two different optimization problems.

Keep that in mind as we explore the techniques.


Part 1. Stop Making the Model Do Unnecessary Work

Before figuring out how to make your GPU run faster, ask yourself a simpler question:

“Do we actually need all this computation?”

Sometimes the easiest optimization is eliminating work that never needed to happen in the first place.

1. Model Selection: Do You Really Need a 100B Model?

This might sound obvious, but it happens more often than you’d think.

A shiny new 100B-parameter model gets released. Its benchmark scores look incredible.

Naturally, as engineers, we want to try it.

But the feature we’re building simply summarizes three sentences from a news article into one.

Wait a second. Do we really need 100 billion parameters for that?

If an 8B model meets your quality requirements, there’s little reason to use a 100B model.

It’s like driving a semi-truck to the grocery store to pick up a carton of milk. Sure, it’s powerful, but do you really need all that horsepower?

Smaller models generally require less computation and memory, which can translate into faster inference.

Of course, actual performance depends on the model architecture and hardware. A smaller model that frequently produces incorrect answers and requires retries might end up being less efficient.

That’s why you should evaluate models of different sizes against your actual production quality requirements.

You can even consider Model Routing: use a smaller model for simple requests and a larger model for complex ones.

Choose the model you need, not the model you want to play with.

2. Output Optimization: Teach Your LLM to Stop Talking So Much

LLMs can be incredibly polite.

“What animal is this?”

“Certainly! I’d be happy to help. After carefully analyzing the information you’ve provided, I’ve determined that this animal is an elephant.”

Thanks, but all we needed was elephant.

The problem is that LLMs generate all those unnecessary words token by token.

And every token takes time.

This becomes particularly relevant for function calling and tool calling, where the output is often just structured data consumed by another program.

For example, instead of generating:

{"animal":"elephant","confidence":"high"}

You could use:

{"a":"e","c":2}

As long as your application knows that e means elephant and 2 represents high confidence, the shorter format works.

There’s a catch, though.

Fewer characters don’t always mean fewer tokens.

Actual token counts depend on the tokenizer, and overly compressed formats can increase output errors.

So start by removing unnecessary explanations and fields, then measure the actual token savings.

Sometimes the easiest way to generate tokens faster is to generate fewer tokens.

3. Thinking Mode: Does Identifying an Elephant Really Require Deep Reasoning?

Modern reasoning models can perform additional reasoning before producing their final answers.

That’s incredibly useful for complex math problems, coding, and planning.

But does every task really need that much thinking?

Consider this request:

“Classify this sentence as positive or negative.”

Does the model need to generate hundreds of reasoning tokens to answer that?

It’s like asking someone what they want for lunch and getting a full market research report in return.

Reasoning tokens consume time and computational resources, even if the final answer is just a single word.

If your model supports it, consider disabling Thinking Mode or reducing the thinking budget.

For straightforward classification or information extraction, you might use minimal reasoning. For complex planning or problem-solving, you can allocate more.

Of course, reducing reasoning can hurt accuracy, so always evaluate the quality impact.

Just because a model can think deeply doesn’t mean every question deserves deep thought.

4. Prompt Optimization: Long Questions Take Longer to Read

Imagine you’re building a smartphone support chatbot.

A user asks:

“My Wi-Fi isn’t connecting.”

Your RAG system retrieves a massive user manual covering Wi-Fi settings, camera features, battery management, display brightness, and everything else.

The user has a Wi-Fi problem, but your model is busy reading the entire instruction manual.

Naturally, that takes time.

Longer prompts generally require more prefill computation and KV cache memory.

You can optimize prompts by retrieving only relevant document sections, removing duplicate search results, or trimming unnecessary conversation history.

But be careful.

Removing essential context can reduce answer quality.

The goal isn’t to make prompts as short as possible. It’s to remove information the model doesn’t need.

5. Prefix Caching: Why Read the Same Thing Twice?

Imagine a customer support chatbot that uses the same system prompt for every user.

It contains company policies, product information, and response guidelines, totaling thousands of tokens.

Now imagine recalculating that entire prompt every time someone asks a question.

Sounds wasteful, right?

That’s where Prefix Caching comes in.

It reuses the KV cache from previously processed prompt prefixes, reducing redundant prefill computation.

vLLM supports this through Automatic Prefix Caching.

There’s one important requirement: the token prefixes must actually match. Having the same meaning isn’t enough.

That’s why placing shared instructions at the beginning of your prompt and variable information toward the end can improve cache reuse.

Of course, the cached data must still be available in memory, and prefix caching doesn’t directly accelerate the decoding of new output tokens.

Don’t calculate the same thing twice if you can reuse the result.

Simple principle. Powerful optimization.


Part 2. Make the Necessary Computation Faster

You’ve eliminated unnecessary work.

But your model is still too slow.

Now it’s time to optimize how the model actually runs.

6. Quantization: Do You Really Need That Many Bits?

LLMs contain billions of parameters that must be read from GPU memory during inference.

What if we could represent those parameters using fewer bits?

For example, switching from BF16 to FP8 can theoretically cut raw model weight storage in half.

Why does that matter?

During decoding, especially with small batch sizes, LLM performance is often limited by memory bandwidth rather than raw GPU compute.

Think of a chef who can cook incredibly fast but spends most of the time waiting for someone to bring ingredients from the refrigerator.

Making the ingredients easier to deliver can speed up the entire process.

Quantization reduces the precision used to represent model data, potentially reducing memory usage and data transfer costs.

The good news is that many popular open-weight models already have quantized checkpoints available on Hugging Face.

In some environments, vLLM also supports online quantization, allowing supported models to be converted to lower precision, such as FP8, during loading.

But here’s the catch:

4-bit isn’t always faster than 8-bit.

Hardware support and dequantization overhead can make lower-precision formats slower in some cases. Quantization can also affect model quality.

The goal isn’t to use the fewest bits possible.

It’s to find the fastest configuration that meets your quality requirements on your actual GPU.

7. Speculative Decoding: What If We Could Predict the Next Few Tokens?

Traditional autoregressive LLMs generate tokens sequentially.

One token.

Then another.

Then another.

What if we could predict several upcoming tokens ahead of time?

That’s the idea behind Speculative Decoding.

In a common approach, a smaller draft model predicts several candidate tokens, and the larger target model verifies them in parallel.

Think of a junior engineer writing a first draft while a senior engineer reviews it.

Reviewing a good draft can be much faster than writing everything from scratch.

If the predictions are accurate, multiple tokens can be accepted in a single verification step.

Beyond draft-model approaches, techniques such as EAGLE, Multi-Token Prediction (MTP), and N-gram-based speculation are also available.

And here’s the good news:

You don’t necessarily have to implement these algorithms yourself.

vLLM supports several speculative decoding techniques, which can be enabled through configuration when the model and runtime are compatible. Some methods require additional weights.

However, if predictions are frequently rejected or the GPU is already heavily utilized, the additional computation may actually slow things down.

That’s why speculative decoding is particularly worth exploring when single-request decoding latency is your main bottleneck.


Part 3. Make Your GPU Handle More Users Efficiently

So far, we’ve mostly focused on speeding up individual requests.

But production services rarely have just one user.

As concurrent requests increase, efficient GPU resource management becomes critical.

8. Batching: Let Your GPU Do More Work at Once

Imagine 10 users sending requests to your LLM simultaneously.

If you process them one by one, you may leave much of the GPU’s parallel processing capability unused.

Batching groups multiple requests together so they can be processed more efficiently.

A particularly useful technique for LLM serving is Continuous Batching.

Instead of waiting for every request in a batch to finish, the system can admit new requests as others complete.

Think of a restaurant that seats new customers as soon as tables become available, rather than waiting for everyone in the restaurant to finish eating.

vLLM uses continuous batching to improve GPU utilization and throughput.

But there’s an important distinction:

Batching primarily improves throughput, not necessarily individual request latency.

If you only have one user, there’s nothing to batch.

And if you make batches too large, individual requests may actually become slower.

For high-concurrency services, measure throughput alongside TTFT and TPOT.

9. Chunked Prefill: Don’t Let One Request Hog the GPU

Imagine several users sending short questions.

Then one user suddenly uploads a document containing tens of thousands of tokens.

“Please summarize this.”

Processing that massive prompt can occupy substantial GPU resources, potentially delaying other users’ ongoing decoding.

It’s like standing in a grocery checkout line with two items while someone ahead of you rolls up with five overflowing shopping carts.

Not ideal.

Chunked Prefill splits long prefill operations into smaller chunks, allowing the scheduler to interleave them with decoding work from other requests.

Why does this help?

Prefill tends to be more compute-intensive, while decoding with small batches is often memory-bandwidth-bound.

By scheduling these workloads together more effectively, the GPU may achieve better utilization.

vLLM V1 enables chunked prefill by default in supported configurations.

However, chunk sizes and scheduling policies can affect the trade-off between TTFT and TPOT.

Chunked Prefill is especially useful when your service handles a mix of short and long requests.

10. KV Cache Optimization: The Hidden GPU Memory Hog

You’ve successfully loaded your model into GPU memory.

Everything looks fine.

Then more users arrive, and suddenly you’re running out of memory.

“But the model fits!”

The culprit might be the KV cache.

LLMs store previously computed attention keys and values so they don’t have to recompute them for every new token.

This is essential for efficient decoding.

The problem?

As input sequences, generated outputs, and concurrent requests grow, so does KV cache memory usage.

Two techniques are particularly useful here.

Paged KV Cache manages cache memory in smaller blocks rather than requiring large contiguous allocations.

vLLM’s PagedAttention is a well-known example. It reduces memory waste and helps the system support more concurrent requests.

KV Cache Quantization stores the cache using lower-precision formats such as FP8.

For example, switching KV cache storage from BF16 to FP8 can theoretically reduce the raw cache data size by half.

Of course, actual performance depends on hardware support, attention kernels, and potential quality impacts.

One important detail:

KV cache optimization doesn’t automatically make a single request faster.

Its biggest benefit may be improved memory efficiency and higher concurrency.

So if you’re running out of GPU memory, don’t just blame the model weights.

Check the KV cache, too.


Quick Guide: Which Optimization Should You Try First?

You don’t need to apply all 10 techniques.

Start with the problem you’re actually experiencing.

The first token takes forever

Try: 4. Prompt Optimization + 5. Prefix Caching

Check input token counts and cache reuse. If requests are stuck in a queue, also investigate batching and chunked prefill.

The first token appears quickly, but generation is slow

Try: 6. Quantization + 7. Speculative Decoding

Look for memory bandwidth or sequential decoding bottlenecks.

The complete response takes too long

Try: 2. Output Optimization + 3. Thinking Mode

Reduce unnecessary output and reasoning tokens.

Performance collapses when more users arrive

Try: 8. Continuous Batching + 9. Chunked Prefill

Improve request scheduling and GPU utilization.

You’re running out of GPU memory

Try: 6. Quantization + 10. KV Cache Optimization

Check how much memory your model weights and KV cache consume.

The GPU is already busy, but throughput is still too low

Try: 1. Model Selection + 2. Output Optimization + 3. Thinking Mode

Focus on reducing the computation required per request.

GPU utilization is low, but decoding is still slow

Try: 7. Speculative Decoding

See whether you can use available compute resources more effectively. If you have enough concurrent requests, investigate batching as well.

These are starting points, not universal rules. The right solution depends on your actual bottleneck.

One Last Thing: Measure Everything

Before and after optimization, track at least three things:

Latency. Throughput. Quality.

Don’t just look at averages. Check tail latency metrics such as p95, too.

And benchmark under realistic conditions, including actual concurrency levels, input lengths, and output lengths.

If you double inference speed but also double the error rate, you haven’t really solved the problem.

Optimization techniques can also interact with one another, so introduce changes incrementally and measure how the bottleneck shifts.


Final Thoughts: Maybe the GPU Isn’t Slow. Maybe We’re Asking It to Do Too Much.

When LLM inference is slow, the GPU is usually the first thing we blame.

And sometimes, hardware really is the limiting factor.

But in production systems, performance problems often come from somewhere else.

Are we using a model that’s unnecessarily large?

Are we generating tokens nobody needs?

Are we repeatedly computing things we’ve already calculated?

Are we scheduling requests inefficiently?

Being told you can’t upgrade your GPU can be frustrating.

But constraints like these often push us to understand our systems more deeply.

Great AI engineering isn’t about throwing more compute at every problem. It’s about getting more useful work done with the resources you already have.

And sometimes, the best optimization starts with one simple question:

“Do we really need to compute this?”