learn

What is LLM Inference?

Process of using a trained Large Language Model (LLM)

LLM inference is the process of using a trained Large Language Model (LLM) to generate an answer or prediction from an input.

Think of it as:

Training = teaching the model Inference = asking the trained model to do something

Simple example

You type:

“Explain photosynthesis in simple words.”

During inference, the LLM:

  1. Receives your text as input.
  2. Converts it into tokens.
  3. Processes those tokens through its neural network.
  4. Predicts the next token.
  5. Repeats this process until it has generated the response.

Training vs. inference

TrainingInference
PurposeLearn patterns/parametersGenerate an output
InputHuge datasetsYour prompt
ComputationUsually very expensiveUsually cheaper, but can still be expensive
HappensDuring model developmentEvery time you use the model
ExampleTeaching GPT language patternsGPT answering your question

Why “inference” matters

When people talk about inference cost, inference speed, inference hardware, or inference optimization, they're talking about making the process of running a trained LLM faster, cheaper, and more efficient.

For example, techniques such as quantization, batching, KV caching, and model parallelism are commonly used to optimize LLM inference.

Learning checkpoint

Mark this guide complete to include it in your local Engineering Journey.

Knowledge path

Connected concepts

Explore the knowledge graph

WATCH WITH THIS TOPIC