llm

Articles about large language models: how they work and how to use them from Python.

RAG Project: Build, Evaluate, and Ship a Retrieval App

Anyone can wire a Large Language Model (LLM) to a folder of documents and get answers back. Proving those answers are good is a different job, and it is the one interviewers actually probe. This RAG project is the capstone for the GenAI chapter: build a document-question app, score it with real numbers, trace every request, and gate every merge behind CI. “If you cannot measure it, you cannot improve it, and you certainly cannot ship it.” Last Updated: July ... Read More

GenAI: QLoRA Fine-Tuning with Unsloth on a Free Colab GPU

QLoRA is the trick that lets you fine-tune a 7B-class open model on a free Colab Graphics Processing Unit (GPU) without renting a single hour of cloud compute. It stands for Quantized Low-Rank Adaptation, and it stacks two ideas: load the big base model in 4-bit precision so it barely uses memory, then train only a thin set of adapter matrices on top. The other tutorial in this series (fine-tuning LLMs guide) covers the theory of LoRA and QLoRA. This ... Read More

RLHF vs DPO: How LLMs Learn Human Preferences

Supervised fine-tuning gets you a model that answers correctly yet still manages to be tactless, wordy, or too eager to please. The last polish comes from preference tuning, and RLHF vs DPO is the choice of route: one trains a reward model and runs reinforcement learning, the other folds the whole objective into a single loss. This post explains both in plain words and runs the DPO loss for real in Python. “A model does not learn what you tell ... Read More