Surface
Workbench
Review
Studying
Kind
Journey
Sources
3

One request through an LLM

Follow one chat message from typed text to streamed reply, then trace how the model’s weights reached GPU memory before it arrived.

inference · llm systems

This is the first systems journey. It begins with the chat message a user sends: text becomes token IDs, embeddings, forward-pass scores, sampled tokens, cached attention state, and a streamed UTF-8 reply. The second phase steps underneath the running server to follow how the model’s weights and request tensors actually travel from disk, through host memory, into GPU HBM. A final step asks what changes when one GPU is not enough.

Each step links to one concept, which owns the full explanation.

  1. One chat message
  2. Turn input into tensors

    Follow one message as its text becomes integers.

    Studying
  3. Look up embeddings

    Follow each token ID as it selects a row of the model's table.

    Planned
  4. Run one pass through the model

    Follow the vectors through the layers to a score for every vocabulary entry.

    Planned
  5. Choose the next token

    Follow the scores as they become one chosen ID.

    Planned
  6. Repeat for each new token

    Follow the chosen token back to the input and around again.

    Planned
  7. Reuse earlier work

    Follow the state the model keeps so each cycle does not start over.

    Planned
  8. Know when to stop

    Follow the two ways a reply ends.

    Planned
  9. Turn IDs back into text

    Follow generated IDs back into characters and out to the user.

    Planned
  10. How the weights get to the GPU
  11. Load the model weights

    Follow the learned parameters from files on disk into a running server.

    Planned
  12. Stage data through host memory

    Follow bytes through ordinary CPU-side memory on their way to an accelerator.

    Planned
  13. Fill GPU memory

    Follow weights and input tensors into the memory GPU computation reads from.

    Planned
  14. More than one GPU
  15. Cross GPU boundaries

    Follow tensors and synchronization when one GPU is not enough.

    Planned

Sources

  1. Tokenizer APIHugging Face

    Covers text encoding into token IDs, attention masks, and PyTorch input tensors.

  2. Generation with LLMs (llm_tutorial)Hugging Face

    Documents the autoregressive inference loop, KV cache reuse, sampling, and stopping criteria.

  3. CUDA Programming Guide: Programming ModelNVIDIA

    Defines host memory, device memory, and moving tensors between CPU and GPU.