---
title: "Discussion on \"How LLM inference works and how to optimize it\" | Hashnode"
description: "Discussion on \"How LLM inference works and how to optimize it\". LLM inference runs in two phases: prefill reads the prompt, decode writes the answer. What to measure, cache and change for faster, cheaper inference."
url: "https://hashnode.com/posts/how-llm-inference-works-and-how-to-optimize-it/6af6094e3fffe9b4b1f19140"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How LLM inference works and how to optimize it](https://bigcircle.hashnode.dev/how-llm-inference-works-and-how-to-optimize-it?utm_source=hashnode&utm_medium=feed)

LLM inference runs in two phases: prefill reads the prompt, decode writes the answer. What to measure, cache and change for faster, cheaper inference.

4d ago · 13 min read · bigcircle.hashnode.dev  
Read the article

-   [#llm](https://hashnode.com/tag/llm)
-   [#artificial-intelligence](https://hashnode.com/tag/artificial-intelligence)
-   [#machine-learning](https://hashnode.com/tag/machine-learning)
-   [#performance](https://hashnode.com/tag/performance)

## Written by

[Tirth Gajjar](https://hashnode.com/@tirthgajjar)

@tirthgajjar · Gandhinagar, India

  
[View profile](https://hashnode.com/@tirthgajjar)

Founder of BigCircle (https://bigcircle.ai). We build production AI systems with governance built in.

Founder of BigCircle (https://bigcircle.ai). We build production AI systems with governance built in.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
