Your first step into the world of AI agents
Learn how to load and interact with local language models
A Local LLM is an AI language model that runs entirely on your computer, without needing internet or external APIs. Think of it as having your own AI assistant that never leaves your machine.
Your data never leaves your machine
No per-token API charges
Full control over model selection
Works without internet connection
LLMs don't generate entire sentences at once. They predict one token (word piece) at a time, building the response incrementally.
A token is a piece of text that the model processes. Think of it like this:
Tokens are not exactly words. Common words are usually 1 token, but rare or long words get split into multiple tokens. The model processes text token-by-token, not word-by-word.
Limited size (e.g., 2048, 4096, or 8192 tokens)
Has a maximum capacity (e.g., 4096 tokens)
Old messages must be removed
All previous messages affect the next response
Each prompt is independent unless you maintain context. The model has no memory between different script runs. To build an "agent", you need to keep context alive and maintain conversation history.
The way you phrase questions affects the response:
LLMs consume significant resources. Models need gigabytes of RAM/VRAM, inference takes time, and you must clean up properly to avoid memory leaks.
The model processes information and generates responses
To maintain state across interactions
Later examples add tools, memory, and reasoning loops
In the next lesson, you'll learn about using cloud-based models (OpenAI) and how they compare to local models.