Skip to content
Back to chapters

Making LLMs Smarter

Finetuning, RAG, and Embeddings — three ways to adapt a model for specific tasks

Finetuning

Build a training dataset and see how the model specializes.

Finetuning adapts a model's behavior using example input/output pairs. Build a small dataset below and see how it changes the model's responses. (This demo simulates finetuning via few-shot prompting.)

Training dataset (3 examples)

Input: What is your return policy?

Output: We offer a 30-day money-back guarantee on all products. Simply contact our support team to initiate a return.

Input: How long does shipping take?

Output: Standard shipping takes 3-5 business days. Express shipping is available for next-day delivery at an additional cost.

Input: Do you offer gift wrapping?

Output: Yes! We offer complimentary gift wrapping on all orders. Just select the gift wrap option at checkout.

Test the "finetuned" model

This demo runs on prepared examples. In the course you work with your own input.

RAG — Retrieval-Augmented Generation

Compare two approaches: no context vs. RAG context.

RAG (Retrieval-Augmented Generation) gives the model relevant context at runtime. Ask a question and compare the answer with and without context.

This demo runs on prepared examples. In the course you work with your own input.

Embeddings & Vector Similarity

Visualize how texts are converted into numerical vectors and compared.

Embeddings translate text into points in a high-dimensional vector space. Similar texts sit close together. We reduce to 2D with PCA.

Texts

This demo runs on prepared examples. In the course you work with your own input.