LLM Training Stages
Base LLM
A base model is trained solely to predict the next token. It has no ability to answer questions or follow instructions — it simply continues text based on patterns learned during training.
Instruction-Tuned LLM
Fine-tuning transforms the base model into one that can answer questions, follow instructions, and behave helpfully toward users.
Reinforcement Learning from Human Feedback (RLHF)
Human evaluators compare multiple model responses and select the preferred one, reinforcing better behaviour over time.
LLMs create an illusion of thought — but underlying everything is just mathematics.
Retrieval Augmented Generation (RAG)
RAG allows an LLM to answer questions using external data it was not trained on. The process works as follows:
- Source data is broken down into smaller chunks.
- Each chunk is converted into a vector using an embedding model.
- The vectors are stored in a vector database.
- When a user submits a prompt, it is also vectorised and compared against the database.
- Semantically similar chunks are retrieved via semantic search.
- The LLM combines the original prompt with the retrieved data to generate a response.

Challenges of Building AI Agents
Control (Non-Determinism)
Agent behaviour is inherently unpredictable. Small hallucinations can propagate through subsequent steps and be treated as fact, compounding errors over time.
Latency and User Experience
Reasoning-heavy tasks consume large numbers of tokens. Poorly designed agents can fall into infinite loops, leading to excessive token usage and degraded performance.
Context and Memory
Agent memory is limited and fragile. Polluted conversation history can corrupt the agent's understanding and negatively affect its outputs.
Safety and Security
Agents operating autonomously introduce risks that must be proactively
