How AI's Actually Work — HAAW

The Inference Runtime

The Software Conducting the Orchestra — The model supplies learned weights. The GPUs supply arithmetic power. The runtime organizes the machinery required to turn an incoming request into executed model computation and generated output.

We Have Been Using It All Along

The inference runtime has been present in nearly every HAAW page even when we were concentrating on another part of the machine.

Something had to open the model files. Something had to allocate memory. Something had to arrange model tensors on hardware, invoke GPU computation, maintain request state, and coordinate generation.

That surrounding execution machinery is part of what we mean when we talk about an inference runtime or inference engine.

The runtime is not the LLM.

The LLM is the trained model. The runtime is software that knows how to load and execute that model on available computing hardware.

The Conductor Analogy

The Score

Model architecture and trained weights. They define the mathematical structure and learned parameter values.

The Orchestra

CPU, GPU, RAM, VRAM, storage, interconnects. The physical resources capable of performing and supporting the work.

The Conductor

Inference runtime. Coordinates execution, memory, scheduling, kernels, caches, and request flow.

The Audience Request

The prompt. The particular input that starts this performance.

The analogy has limits: software does not literally wave a baton at each arithmetic unit. Hardware schedulers, drivers, libraries, kernels, and runtime layers cooperate. But “conductor” is useful because the runtime coordinates resources without being the trained model itself.

Where the Runtime Sits

USER / APPLICATION
    │
    ▼
Interface / API / serving layer
    │
    ▼
INFERENCE RUNTIME / ENGINE
    │
    ├── model execution
    ├── memory management
    ├── request scheduling
    ├── KV-cache management
    └── hardware coordination
    │
    ▼
Drivers / compute libraries / kernels
    │
    ▼
CPU + RAM + GPU + VRAM + interconnects

Exact software stacks differ, and the boundary between “serving layer,” “runtime,” “framework,” and “engine” is not identical in every product. HAAW uses these terms functionally rather than pretending every implementation has the same process layout.

Job 1: Understand the Model

Before execution, software must know what model it is dealing with.

Architecture

Which model structure and operations are required?

Weights

Where are the learned parameter tensors and what are their shapes and numerical formats?

Configuration

How many layers, dimensions, attention heads, vocabulary details, context limits, and other settings apply?

Tokenizer

Which tokenization rules and vocabulary map text to the token IDs expected by the model?

Job 2: Decide Where Things Live

The runtime must arrange model and working data within the available memory hierarchy.

MODEL FILES on NVMe
    │
    ▼
system RAM / mappings / staging
    │
    ├──→ GPU 0 VRAM
    ├──→ GPU 1 VRAM
    └──→ possibly other memory / devices

Runtime asks:
What goes where?

On one GPU this can be relatively straightforward. Across several GPUs, placement becomes part of the execution strategy.

Job 3: Turn Model Operations Into Hardware Work

The model describes mathematical operations. The hardware ultimately needs executable operations.

Model operation
↓
Runtime / framework selects or prepares implementation
↓
Compute libraries / kernels
↓
Driver submits work to accelerator
↓
GPU executes arithmetic on tensors

A kernel in this context is a compiled accelerator function designed to perform a particular kind of computation on the GPU. It is not the Linux kernel, although both use the same word.

A Useful “Kernel” Warning

Linux Kernel

The core of the operating system: processes, memory, devices, filesystems, scheduling, and other system responsibilities.

GPU Compute Kernel

A function executed on accelerator hardware across many threads or processing elements to perform numerical work.

Same word. Completely different level of the machine.

Job 4: Accept and Prepare a Request

Now Craig types:

Why is the sky blue?

The surrounding service and runtime path must turn that request into model-ready input.

Request arrives
↓
Instructions / context are assembled as applicable
↓
Text is tokenized
↓
Token IDs are placed into request state
↓
Inference work is scheduled

Job 5: Schedule Work

A serving system may have many requests waiting at once.

Request A ─┐
Request B ─┤
Request C ─┼──→ SCHEDULER ──→ available accelerator work
Request D ─┤
Request E ─┘

The runtime may group compatible work into batches, interleave requests, prioritize stages, and manage limited accelerator memory.

The exact scheduling strategy varies, but the goal is to use expensive hardware efficiently while still producing responsive output.

Batching: Several Requests, Shared Opportunity

GPU hardware thrives on parallel work. A runtime can sometimes process portions of several requests together rather than treating every request as an isolated serial job.

Request A tokens ─┐
Request B tokens ─┼──→ BATCHED GPU WORK
Request C tokens ─┘

Batching can improve throughput, but it introduces tradeoffs involving latency, memory use, request lengths, and scheduling complexity.

Throughput and responsiveness are not identical goals.

A server optimized to process the greatest total number of tokens per second may make different scheduling choices from one optimized to minimize the delay experienced by one user.

Job 6: Manage the KV Cache

Each active sequence may accumulate key/value attention state during autoregressive generation.

The runtime must reserve memory for it, associate it with the correct request, reuse it on later decode steps, and eventually reclaim that memory.

Request A → KV cache A
Request B → KV cache B
Request C → KV cache C

runtime tracks ownership + memory + lifetime

With many concurrent users, KV-cache management can become a significant part of accelerator-memory management.

Job 7: Run Prefill

We met prefill on the Generation Loop page.

The runtime processes the supplied prompt/context through the model, creating the internal state needed to begin generation.

Prompt token sequence
↓
Transformer computation across prompt
↓
Activations produced
↓
Attention K/V state retained as needed
↓
Logits for next-token choice

Job 8: Run the Decode Loop

Then generation becomes iterative.

1. use current sequence state
2. execute next-token model computation
3. produce logits
4. apply generation / sampling rules
5. select token
6. update request + KV cache
7. emit / buffer token
8. repeat until stop condition

The trained LLM produces the numerical scores. The generation procedure surrounding it determines how those scores become an actual token selection.

Job 9: Stream the Result

The user does not need to wait for the entire answer to be complete before seeing anything.

Token selected
↓
Token decoded toward text
↓
Output sent through serving layer
↓
Interface displays growing response

This is why an answer can appear to “type itself” even though the underlying generation loop is producing tokens sequentially.

Job 10: Know When to Stop

Generation cannot continue forever.

The runtime or surrounding serving system enforces stop conditions such as an end token, maximum token count, configured stopping sequence, cancellation, or other service policy.

decode → token → decode → token → decode → token
            │
            ▼
STOP CONDITION
            │
            ▼
generation ends

Job 11: Clean Up — Without Throwing Away the Model

When a request ends, request-specific state can be released or reused.

REQUEST ENDS
├── temporary activations → release / reuse
├── request buffers → release / reuse
├── KV cache → release / reuse when no longer needed
└── model weights may remain resident

Keeping the model loaded allows the next request to begin without reloading billions of parameter values from storage.

Now Add Multiple GPUs

The previous HAAW page showed why multiple accelerators introduce placement and communication problems.

The runtime now has another layer of responsibility.

INFERENCE RUNTIME
│
├── place model portions
├── schedule operations
├── coordinate transfers
├── synchronize dependent work
├── manage per-device memory
└── collect / forward results
    │
    ├──→ GPU 0 / VRAM 0
    ├──→ GPU 1 / VRAM 1
    └──→ GPU N / VRAM N

Exactly which responsibilities belong to the runtime, lower-level libraries, communication libraries, or serving framework varies by implementation. The important HAAW point is that software must coordinate the distributed execution somehow.

The Runtime Can Change Performance Without Changing the LLM

This is a subtle but powerful distinction.

Two systems can execute the same trained model weights yet perform differently because their runtimes use different:

Kernels

Different implementations can perform the same required model operation more or less efficiently.

Memory Strategies

Allocation, caching, paging, reuse, and placement can affect efficiency.

Scheduling

How requests are batched and interleaved affects throughput and latency.

Parallelism

How work is distributed across accelerators affects communication and utilization.

Same LLM does not necessarily mean same serving performance.

The trained model may be unchanged while the machinery executing it becomes substantially more efficient.

What the Runtime Does NOT Do

It Is Not the Training

Inference execution normally uses weights learned previously; it does not ordinarily retrain the model for each prompt.

It Is Not the Model

The runtime can be replaced or upgraded while the underlying trained model remains the same.

It Is Not the GPU

It directs and coordinates computation through software layers; the hardware performs the physical operations.

It Is Not the Interface

The chat window or API is the external communication boundary, not the numerical execution engine itself.

The Orchestra Is Finally Assembled

We now have distinct pieces with distinct jobs:

The model provides the learned parameters and mathematical structure.

The runtime organizes execution.

The operating system, drivers, and libraries provide the software path to the hardware.

The CPU, memory, interconnects, and GPUs physically carry out the work.

The interface carries requests in and generated results out.

What looked from the outside like one thing called “the AI” is actually a cooperating stack.

HAAW Checkpoint

Inference runtime
Software responsible for organizing and executing a trained model for inference on available hardware.
Serving layer
Software surrounding inference that accepts requests, manages service behavior, and returns results; exact boundaries with the runtime vary.
GPU compute kernel
An accelerator function that performs numerical work on GPU hardware; not the Linux kernel.
Scheduler
The mechanism that decides when and how available inference work is assigned to computing resources.
Batching
Combining compatible work from multiple inputs or requests so accelerator hardware can process it efficiently.
Prefill
Processing the supplied prompt/context to establish the model state from which generation begins.
Decode
The iterative phase that produces subsequent tokens while reusing retained sequence state such as the KV cache.
Streaming
Returning generated output incrementally instead of waiting for the complete response.
Runtime versus model
The runtime executes and coordinates the LLM; it is not the trained LLM itself.