- 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.
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.
- One chat message
- Studying
Turn input into tensors
Follow one message as its text becomes integers.
- Planned
Look up embeddings
Follow each token ID as it selects a row of the model's table.
- Planned
Run one pass through the model
Follow the vectors through the layers to a score for every vocabulary entry.
- Planned
Choose the next token
Follow the scores as they become one chosen ID.
- Planned
Repeat for each new token
Follow the chosen token back to the input and around again.
- Planned
Reuse earlier work
Follow the state the model keeps so each cycle does not start over.
- Planned
Know when to stop
Follow the two ways a reply ends.
- Planned
Turn IDs back into text
Follow generated IDs back into characters and out to the user.
- How the weights get to the GPU
- Planned
Load the model weights
Follow the learned parameters from files on disk into a running server.
- Planned
Stage data through host memory
Follow bytes through ordinary CPU-side memory on their way to an accelerator.
- Planned
Fill GPU memory
Follow weights and input tensors into the memory GPU computation reads from.
- More than one GPU
- Planned
Cross GPU boundaries
Follow tensors and synchronization when one GPU is not enough.
Sources
- Tokenizer API
Covers text encoding into token IDs, attention masks, and PyTorch input tensors.
- Generation with LLMs (llm_tutorial)
Documents the autoregressive inference loop, KV cache reuse, sampling, and stopping criteria.
- CUDA Programming Guide: Programming Model
Defines host memory, device memory, and moving tensors between CPU and GPU.