10 · MODEL SERVING & LOCAL AI
How Does a Model Become a Running AI Service?
A model file cannot serve users by itself. It needs a runtime, memory, hardware, and an interface that applications can call.
THE PROBLEM THIS MODULE SOLVES
“I downloaded a Qwen model. Why can’t my app use it directly?”
A model file does not by itself:
- listen for requests
- manage memory
- run inference
- expose an API
- handle concurrent users
- return application responses
The serving stack turns model weights into a usable service.
THE BIG PICTURE
Serving Stack
Quantization
Context size
KV cache
Model size
Latency
Tokens per second
ONE REQUEST THROUGH THE STACK
“Explain RAG.”
Receives the request.
Routes it to a running model.
Executes inference.
Processes prompt tokens.
Produces output tokens.
Returns the result.
Sees the answer.
How long the full request feels.
How fast tokens are generated.
WHY HARDWARE MATTERS
Why can’t every model run on every computer?
What is stored on disk.
What is needed while the model is actually running.
A model that fits on disk may still exceed available memory.
QUANTIZATION
Lower precision, different resource trade-offs
Larger memory requirement
Reduces numerical precision
Smaller resource requirement
Possible trade-offs include quality, speed, and compatibility. Quantization is not simply “compression.”
DEPLOYMENT ENVIRONMENT
Local vs Cloud
LOCAL
Runs on your hardware.
Good fit whenLocal control matters, hardware is available, or offline operation is useful.
ConstraintsMemory, setup, and maintenance.
CLOUD
Runs on provider infrastructure.
Good fit whenLarge managed infrastructure, scaling, or easy API access is preferred.
ConstraintsNetwork, usage cost, and governance considerations.
Neither is universally better.
UNDERSTAND EACH LAYER
Four roles in a running AI service
ACCESS
API · Model Serving
Lets applications reach the running model. Example: an app sends a chat request.
RUN
Runtime · Ollama · vLLM
Executes inference using model weights.
RESOURCE
Quantization · GPU / VRAM
Determines what can fit and run.
PERFORMANCE
Latency · Tokens per Second
Describes waiting time and generation speed.
KEY DISTINCTIONS
What not to confuse
MODEL vs RUNTIME
RUNTIME vs MODEL SERVING
QUANTIZATION vs FINE-TUNING
LATENCY vs TPS
REMEMBER THIS