Skip to content
HIPS
  • Earn with your GPU
  • Pricing
  • Docs
Sign inJoin early access
  1. Learn
  2. /
  3. LLM inference

LLM inference, explained

LLM inference is running a trained large language model to turn a prompt into an answer, without changing the model. The text becomes tokens, the model reads them all at once in a step called prefill, then writes the answer one token at a time in a step called decode. Those two steps set its speed and its price.

A HIPS guide. Updated December 2, 2026. Sources at the end.

On this page+
  1. 01What is LLM inference?
  2. 02How LLM inference works, step by step
  3. 03Prefill and decode side by side
  4. 04Serving many requests at once
  5. 05What decides speed and cost
  6. 06One API request, step by step
  7. 07LLM inference on HIPS
  8. 08Questions
  9. 09Sources
Join early accessExplore models
FIG. 1LLM inference
01TEXT02TOKENS03PREFILL04KV CACHE05DECODE06STREAMED"EXPLAIN GPU INFERENCE..."PIECES OF WORDS, BY NUMBERMODEL WEIGHTSALL PROMPT TOKENS AT ONCEKEYS AND VALUES, KEPTREAD, THEN ADD ONEMODELONE TOKENPER TURNSTREAMED AS EACH TOKEN IS MADETIME TO FIRST TOKENTIME BETWEEN TOKENS

On this page

  1. 01What is LLM inference?
  2. 02How LLM inference works, step by step
  3. 03Prefill and decode side by side
  4. 04Serving many requests at once
  5. 05What decides speed and cost
  6. 06One API request, step by step
  7. 07LLM inference on HIPS
  8. 08Questions
  9. 09Sources
01

What is LLM inference?

Inference is using a model; training is making one. During inference, a large language model's weights stay fixed: it reads your prompt and predicts the answer, token by token. Every chat reply, code suggestion and summary an LLM produces is inference.

An inference server is the software that runs it: it loads the weights onto GPUs, schedules incoming requests, and answers them through an API. vLLM and llama.cpp are two open-source examples.

02

How LLM inference works, step by step

  1. 01

    1. Tokenize.The text is split into tokens, pieces of words the model knows by number. Each model has its own tokenizer, so the same text can be a different number of tokens on two models. Tokens are also what an API bills.

  2. 02

    2. Prefill.The model reads every prompt token at once and computes, for each one, the keys and values its attention layers need. In NVIDIA's words, because "the full extent of the input is known, at a high level this is a matrix-matrix operation that’s highly parallelized. It effectively saturates GPU utilization."[1] Prefill ends with the first token of the answer.

  3. 03

    3. Decode.The model writes the answer one token at a time. Each new token depends on every token before it, so the steps cannot run in parallel. NVIDIA: "The speed at which the data (weights, keys, values, activations) is transferred to the GPU from memory dominates the latency, not how fast the computation actually happens. In other words, this is a memory-bound operation."[1]

  4. 04

    4. Keep the KV cache.So that decode does not recompute every earlier token at each step, the keys and values are kept in GPU memory and grow by one entry per token. NVIDIA gives the size per token as "2 * (num_layers) * (num_heads * dim_head) * precision_in_bytes", and for a 7-billion-parameter model with a 4,096-token request, "~2 GB."[1]

  5. 05

    5. Sample and stop.At each step the model scores every possible next token, and a sampling rule (set by parameters such as temperature) picks one. Decoding stops at an end-of-answer token, a stop sequence or the maximum length you set.

  6. 06

    6. Detokenize and stream.Tokens turn back into text. With streaming on, each piece is sent as soon as it is made, so the reader sees the answer grow.

03

Prefill and decode side by side

Prefill and decode side by side
Prefill and decode side by sidePrefillDecode
What it doesReads the whole prompt at onceWrites the answer, one token per step
What limits itGPU computeGPU memory bandwidth
What you noticeTime to first tokenTime between tokens
What makes it longerA longer promptA longer answer
How an API bills itInput tokensOutput tokens

NVIDIA's benchmarking guide ties the two to the metrics people measure: time to first token "generally includes request queuing time, prefill time, and network latency," and inter-token latency is "the average time between consecutive tokens."[2] The low-latency guide shows how to measure both.

04

Serving many requests at once

One request at a time leaves most of a GPU idle during decode. Servers fix that by batching:

  • Batching decodes many requests in the same step. NVIDIA: "Since multiple requests use the same model, the memory cost of the weights is spread out."[1]
  • Continuous batching (also called in-flight batching) swaps finished requests out and new ones in at every step, instead of waiting for the slowest answer in a batch. In NVIDIA's words, the runtime "immediately evicts finished sequences from the batch."[1]
  • Paged KV cache. Each request's cache is stored in small blocks instead of one reserved stretch of memory, so less is wasted and more requests fit. The paper that introduced it, PagedAttention, reported "near-zero waste in KV cache memory."[3]

Batching raises total tokens per second across all users, but each user's answer can come slower as the batch grows. Every serving system picks a point on that trade-off.

05

What decides inference speed and cost

  • Model size. Every decode step reads the weights, so more weights mean more to read. A mixture-of-experts model reads only some of them per token: gpt-oss-120b has "117B parameters with 5.1B active parameters", by its model card.[4]
  • Precision. Fewer bits per weight means less memory to hold and less to read per step. NVIDIA: quantization means "you can transfer more parameters over the same amount of bandwidth, which can help to accelerate models that are bandwidth-limited."[1]
  • Context length. A longer prompt means a longer prefill and a larger KV cache for every step after it.
  • Answer length. Each output token is one more decode step.
  • Concurrency. More requests per batch raise throughput and can slow each one.
06

One API request, step by step

Here is a request to an OpenAI-compatible API, with each part tied to a step above. This sample is from HIPS's Quickstart.

cURL
curl https://ai.hips.com/v1/chat/completions \
  -H "Authorization: Bearer $HIPS_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"$HIPS_MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Explain GPU inference in two sentences.\"}]}"
  • messages is the prompt. It is tokenized, with the model's chat template, and read in prefill.
  • model chooses the weights, and with them the tokenizer, the speed and the rates.
  • A maximum output length, if you set one, caps the number of decode steps.
  • stream: true, if you add it, sends tokens as decode makes them.
  • The answer's usage counts the prompt tokens (prefill) and the completion tokens (decode): the two numbers a per-token bill multiplies.
07

LLM inference on HIPS

HIPS runs inference for open models through one OpenAI-compatible API. One base URL, https://ai.hips.com/v1, and one API key reach DeepSeek, Kimi, Qwen, GLM, GPT-OSS and the rest of the catalog.

  • Priced by the two steps. Input and output tokens are priced apart, per million tokens, per model. On HIPS's catalog of December 1, 2026, gpt-oss-120b cost $0.0294 per million input tokens and $0.147 per million output tokens in the Certified pool. usage holds the token counts; the charge is in the x-hips-cost-micros header, never in usage.
  • Streaming. stream: true returns server-sent events in OpenAI's chat.completion.chunk shape, then data: [DONE].
  • Prefill reused when it can be. Prompt caching is automatic, and writing to a cache costs nothing. A request's shared beginning, such as a long system prompt or a shared document, is kept in GPU memory only, reused by your workspace alone, and dropped after 30 minutes without use. No hit is promised.
  • Decode that can wait. Batch jobs run as capacity becomes free, at half the on-demand rate of the same model; live requests always come first.
  • Nothing kept. HIPS never trains on, retains or logs your prompt data.
  • One LLM API for open models
  • Model API pricing
  • Quickstart
08

LLM inference questions

What is LLM inference?

Running a trained large language model to produce an answer from a prompt. The model's weights do not change: it tokenizes the prompt, reads it in one parallel pass (prefill), then writes the answer one token at a time (decode).

What is an LLM inference server?

Software that loads a model onto GPUs, queues and batches incoming requests, runs prefill and decode, and returns answers through an API. vLLM and llama.cpp are open-source examples.

What is the KV cache?

The keys and values the model computed for every token so far, kept in GPU memory so that each new token does not recompute them. It grows with every token in every request being served, which is why long contexts need more GPU memory.

Why does the first token take longer than the rest?

Before the first token, the model must read the whole prompt (prefill), and the request may wait in a queue. After it, each token is one decode step. A long prompt therefore delays the start more than it slows the stream.

Is LLM inference done on GPUs?

Usually. Prefill needs a great deal of parallel compute and decode needs fast memory, and GPUs supply both. Small quantized models can also run on CPUs and laptops, more slowly.

09

Sources

  1. [1]

    NVIDIA Technical Blog, "Mastering LLM Techniques: Inference Optimization", published November 17, 2023, updated 2025, read December 2, 2026.

    developer.nvidia.com/blog/mastering-llm-techniques-inference-optimization/
  2. [2]

    NVIDIA NIM Benchmarking documentation, "Metrics", read December 2, 2026.

    docs.nvidia.com/nim/benchmarking/llm/latest/metrics.html
  3. [3]

    "Efficient Memory Management for Large Language Model Serving with PagedAttention", arXiv 2309.06180, submitted September 12, 2023, read December 2, 2026.

    arxiv.org/abs/2309.06180
  4. [4]

    Hugging Face, the openai/gpt-oss-120b model card, read December 2, 2026.

    huggingface.co/openai/gpt-oss-120b
  5. HIPS: the Docs' Quickstart and Chat completions reference; the catalog of December 1, 2026.

Send your first inference request

Join early access. When your invitation comes, make a key, send one request and read its cost.

Join early accessRead the Quickstart

Guides to running large language models

  • Private LLM: what it means and four ways to run one
  • Private AI server: buy, rent or use an API
  • Self-hosted LLM: what it takes and what it costs
  • Low-latency AI inference: measure it, then cut it
  • How to reduce LLM API costs

Product

  • Inference
  • Models
  • Serverless GPUs
  • GPU rental
  • Deploy your model
  • Coding agents
  • How it works
  • Use cases
  • Pricing

Models

  • DeepSeek API
  • Kimi API
  • Qwen API
  • GLM API
  • Gemma API
  • Mistral API
  • gpt-oss API
  • All models

Developer

  • Docs
  • Quickstart
  • Migrate to HIPS
  • HIPS SDK
  • Batch jobs
  • API reference
  • Claude Code pricing
  • Claude Code limits
  • Best models for coding
  • Token counter
  • LLM price table
  • VRAM calculator
  • Compare models

Provider

  • Earn with your GPU
  • Register GPU interest
  • Download for Mac
  • Download for Windows
  • Download for Linux

Resource

  • Security and Data
  • Resources
  • Tools
  • Guides
  • llms.txt

Compare

  • OpenRouter alternatives
  • Together AI alternatives
  • Groq alternatives
  • Runpod alternatives
  • Claude Code alternatives
  • Cursor alternatives
  • All comparisons

Company

  • About
  • Contact
  • Affiliate program
  • HIPS Payments

Legal

  • Legal
  • Consumer Health Data Privacy Policy
  • Report content
  • Cookie preferences

Support

  • Contact HIPS
  • Looking for payments support?

HIPS. AI inference for builders.

hips.com

Hyperscale Inference Processing Systems OÜ