Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
LLM Fundamentals & Fine-Tuning: From Theory to Practice
New
498 students

LLM Fundamentals & Fine-Tuning: From Theory to Practice

Understand transformers, prepare datasets, fine-tune with LoRA and QLoRA, and evaluate custom language models.
Last updated 11/2026
English

What you'll learn

  • Understand how Large Language Models (LLMs) work, including transformers, tokenization, embeddings, and attention mechanisms.
  • Learn when to use Prompt Engineering, RAG, Fine-Tuning, and other LLM customization techniques.
  • Prepare, clean, tokenize, and structure high-quality datasets for LLM fine-tuning.
  • Fine-tune open-weight language models using Python, PyTorch, Hugging Face Transformers, and TRL.
  • Implement Parameter-Efficient Fine-Tuning (PEFT) using LoRA and QLoRA to optimize training resources.
  • Configure training parameters, optimize model performance, and troubleshoot common fine-tuning challenges.
  • Evaluate LLMs using performance metrics, benchmarks, hallucination detection, and safety testing.
  • Build and deploy a customized AI assistant using fine-tuned models, FastAPI, Streamlit, and local inference tools.

Course content

16 sections • 113 lectures • 11h 24m total length
  • Welcome to LLM Fundamentals & Fine-Tuning6:00

    Welcome to LLM Fundamentals & Fine-Tuning. This opening lecture introduces the course, explains what you will build, and shows how every section connects to a single goal: understanding large language models well enough to adapt them to your own tasks.


    We begin with a roadmap of the full journey. You will start with the core ideas behind LLMs, including tokens, embeddings, and the Transformer architecture. From there you will learn how models are pretrained, how they generate text, and how to set up a local development environment. The second half of the course focuses on practical customization: deciding when to fine-tune, preparing high-quality datasets, evaluating models, running supervised fine-tuning, applying LoRA and QLoRA, and finally deploying your model in a simple application.


    This lecture also explains how the course is organized. Most sections combine short conceptual lectures with a hands-on lab, so you will not only read about each technique but also run it yourself. We cover what background helps most, such as basic Python and a general comfort with the command line, and we clarify that you do not need a research background or an expensive workstation to follow along.


    You will also hear how to get the most from the course: watch each concept lecture first, then complete the lab, and compare your results with the examples shown. By the end of this lecture you will know what the course covers, what you will be able to do when you finish, and how to approach the material so that each section builds naturally on the one before it.

  • What Are Large Language Models and Why Do They Matter?6:19

    This lecture answers a foundational question: what exactly is a large language model, and why has it become one of the most important technologies in modern software? We start with a plain-language definition. An LLM is a neural network trained on very large collections of text to predict what comes next in a sequence. That simple objective, repeated across billions of examples, produces a system that can summarize, translate, answer questions, write code, and follow instructions.


    We then look at why scale matters. As models grow in parameters, training data, and compute, they begin to show capabilities that smaller models do not, such as following complex instructions or reasoning through multi-step problems. You will learn what parameters actually are, why they are often described in billions, and how model size relates to cost, speed, and quality.


    Next we explore why LLMs matter in practice. We review common applications, including customer support assistants, document analysis, coding tools, search, content drafting, and data extraction, and we discuss how teams decide whether an LLM is the right tool for a given problem. We also touch on the business and engineering reasons organizations choose to customize models instead of relying only on general-purpose chat tools.


    Finally, we set expectations. LLMs are powerful but imperfect, and understanding their basic mechanics is the first step toward using them responsibly. By the end of this lecture you will be able to explain what an LLM is, describe why scale changed the field, and name several realistic use cases that motivate the rest of the course.

  • Understanding Generative AI, NLP, and Foundation Models6:23

    Terms like generative AI, natural language processing, and foundation models are often used interchangeably, but they describe different layers of the same landscape. This lecture sorts them out so that you can follow the rest of the course, and any industry discussion, with confidence.


    We begin with natural language processing, or NLP, the long-standing field concerned with helping computers work with human language. You will see how classic NLP tasks such as classification, translation, named entity recognition, and summarization were once handled by separate, specialized models, each trained for a single job.


    Next we introduce generative AI, which refers to systems that create new content such as text, images, audio, or code rather than only labeling existing data. We explain how language models fit within this category and how they differ from discriminative models that predict a label.


    We then cover foundation models. These are large models trained on broad data that can be adapted to many downstream tasks, either through prompting or through additional training. You will learn why this idea changed the way teams build AI products: instead of training a new model for every task, you start from a capable base and customize it.


    Finally, we connect these ideas to the workflow used throughout the course. A foundation model is pretrained, then often adapted through fine-tuning, and finally deployed for a specific use. After this lecture you will be able to explain how generative AI, NLP, and foundation models relate to one another and where LLMs sit among them.

  • Base Models vs. Instruction-Tuned Models vs. Chat Models5:59

    Not every language model you download behaves the same way, and choosing the wrong type is a common beginner mistake. This lecture explains the three main categories you will encounter: base models, instruction-tuned models, and chat models.


    We start with base models. These are produced by pretraining on large amounts of text and are very good at continuing a sequence. Ask a base model a question and it may answer, ramble, or simply generate more questions, because it has learned to predict text rather than to follow directions. You will see examples of this behavior so the difference becomes concrete.


    Next we look at instruction-tuned models. These start from a base model and receive additional supervised training on examples of instructions paired with high-quality responses. The result is a model that reliably tries to complete the task you describe. We explain, at a high level, how this tuning data is structured and why it changes behavior so much.


    Then we cover chat models, which are tuned to handle multi-turn conversations with roles such as system, user, and assistant. You will learn why chat models depend on specific message formats and why using the wrong format can quietly degrade results.


    We finish with practical guidance on choosing between these types. If you plan to fine-tune, which starting point is best? When is a base model preferable? By the end you will be able to identify each model type from its name and documentation and pick the right one for your goal.

  • What LLMs Can and Cannot Do6:14

    Understanding what LLMs can and cannot do is just as valuable as knowing how they work. This lecture gives you a realistic picture of their strengths and limits so that you can design better projects and avoid costly surprises.


    We begin with strengths. LLMs are excellent at tasks involving language patterns: drafting and rewriting text, summarizing long documents, extracting structured information, translating between languages, explaining concepts, generating and reviewing code, and answering questions when given relevant context. You will see examples of each and learn why they work well.


    We then examine the limitations. LLMs can produce confident but incorrect statements, a behavior commonly called hallucination. They have a fixed knowledge cutoff, so they do not know about events after training. They can struggle with precise arithmetic, long chains of logic, and tasks that require up-to-date or private data. They are also sensitive to how a prompt is worded, and they can reflect biases found in their training data.


    Next we discuss how these limitations shape engineering decisions. Techniques such as providing context in the prompt, retrieval, tool use, validation of structured output, and fine-tuning can each reduce certain failure modes, but none removes the need for evaluation and human oversight.


    Finally, we introduce simple habits for working safely: verify important claims, test on realistic examples, and measure results rather than relying on impressions. After this lecture you will be able to describe common LLM failure modes and decide whether a proposed use case is a good fit.

  • Introducing Our End-to-End Fine-Tuning Project6:23

    This lecture introduces the end-to-end project that gives the course its practical backbone. Rather than studying techniques in isolation, you will follow one fine-tuning project from a raw idea to a working, evaluated, and deployable model.


    We start by describing the project goal and why it was chosen. A clear, narrow task makes it easier to build a dataset, define success, and see measurable improvement after training. You will learn how to think about a target behavior, such as responding in a consistent style, following a specific format, or handling a particular domain.


    Next, we outline the project stages and show where each one appears in the course. First you will define the objective and gather or create training data. Then you will prepare and tokenize that data, measure the original model's performance to establish a baseline, and run supervised fine-tuning. After that you will explore parameter-efficient methods like LoRA and QLoRA, evaluate the results more rigorously, and finally serve the model locally behind a simple interface.


    We also discuss why baselines matter from the very beginning. Without knowing how the unmodified model performs, you cannot tell whether fine-tuning actually helped.


    By the end of this lecture you will understand the shape of the project, the artifacts you will produce along the way, and how each section contributes to the final result. This gives you a mental map to return to whenever you wonder why a particular technique matters.

  • Hands-on: Run a language model locally and examine its responses6:20

    It is time to get hands-on. In this lab you will run a language model on your own machine and carefully examine how it responds. The goal is not to build anything complex yet, but to develop intuition by observing a real model's behavior.


    You will start by loading a small open-weight model using a Python workflow and sending it a series of prompts. We will walk through each step so you understand what the code does: loading the model and tokenizer, encoding a prompt, generating output, and decoding the result back into readable text.


    Then you will explore. Try simple factual questions, formatting requests, instructions with constraints, and prompts the model is likely to struggle with. Notice where it follows directions, where it drifts, and where it produces confident but wrong answers. Compare how a small change in wording affects the response, and observe how the same prompt can produce different outputs across runs.


    As you experiment, we recommend keeping short notes about what works and what fails. These observations become valuable later, when you design evaluation sets and measure whether fine-tuning improved the model.


    We also talk about practical issues, such as response speed on your hardware, memory use, and what to do if the model does not fit on your machine. By the end of this lab you will have run a model locally, inspected its responses critically, and gathered first-hand evidence of the strengths and limits discussed earlier in the section.

  • LLM Fundamentals & Fine-Tuning Hands-On Lab Package1:31

    This lecture provides the Hands-On Lab Package that accompanies the course. Think of it as your central toolkit: a single place to find the materials you will use while following the practical lectures, so that you can focus on learning rather than hunting for files.


    We explain how to download the package and how to organize it on your computer. A tidy workspace helps you keep each lab separate and makes it easier to return to earlier exercises. We recommend creating a dedicated project folder and keeping your Python environment alongside it so that dependencies stay isolated.


    The lecture also shows how the package maps to the course structure. Each hands-on lecture refers to specific materials, and you will learn how to match them to the section you are working on. We describe a simple workflow for each lab: read the instructions, run the setup steps, execute the exercises in order, and compare your results with the expected outcomes.


    Because tools and libraries change over time, we also discuss how to handle version differences. If a library has been updated since the course was recorded, check the documentation, pin versions when you need reproducible results, and consult the course discussion area if you get stuck.


    By the end of this lecture you will have the lab materials ready, know how they are organized, and understand how to use them effectively throughout the rest of the course.

Requirements

  • Basic Python programming knowledge is recommended, but advanced programming experience is not required.
  • No prior experience with Large Language Models or fine-tuning is necessary.
  • Basic understanding of Artificial Intelligence and Machine Learning concepts is helpful but not mandatory.
  • A computer running Windows, macOS, or Linux with internet access for downloading software and models.
  • At least 8 GB RAM for selected introductory exercises; 16 GB or more is recommended.
  • Access to a compatible GPU is recommended for hands-on LoRA and QLoRA fine-tuning exercises.
  • All core tools use open-source technologies, including Python, PyTorch, Hugging Face, and Ollama.
  • A willingness to experiment, write code, and explore real-world Generative AI applications.

Description

This course contains the use of artificial intelligence.

Master Large Language Models, Transformers, LoRA, QLoRA, Hugging Face, and AI Model Customization

Want to understand how Large Language Models (LLMs) actually work and learn how to customize them for real-world applications? This comprehensive, hands-on course takes you from LLM fundamentals to advanced fine-tuning techniques, helping you develop practical skills in Generative AI, Natural Language Processing (NLP), Machine Learning, and Deep Learning.

Whether you're an aspiring AI Engineer, Machine Learning Engineer, Data Scientist, Python Developer, or Generative AI enthusiast, this course will help you understand, train, evaluate, and deploy customized language models using popular open-source AI frameworks.

What You'll Learn

1. Large Language Model Fundamentals

Understand the foundations of Artificial Intelligence (AI), Generative AI, Natural Language Processing, and Transformer Architecture. Explore tokenization, embeddings, self-attention, multi-head attention, positional encoding, neural networks, pretraining, and next-token prediction.

2. LLM Customization Strategies

Discover when to use Prompt Engineering, Retrieval-Augmented Generation (RAG), Supervised Fine-Tuning (SFT), and domain adaptation. Learn how to select the right approach based on model performance, business requirements, and available resources.

3. Data Preparation for Fine-Tuning

Learn essential LLM dataset preparation techniques, including data collection, cleaning, preprocessing, tokenization, synthetic data generation, instruction-response formatting, JSONL datasets, training-validation-test splitting, and data quality assessment.

4. Hands-On LLM Fine-Tuning

Gain practical experience with Python, PyTorch, Hugging Face Transformers, Hugging Face Datasets, and TRL. Configure training parameters, understand learning rates, batch sizes, epochs, gradient accumulation, optimizers, training loss, and model checkpoints.

5. Parameter-Efficient Fine-Tuning

Explore Parameter-Efficient Fine-Tuning (PEFT) techniques, including Low-Rank Adaptation (LoRA) and Quantized Low-Rank Adaptation (QLoRA). Understand 4-bit quantization, model compression, GPU memory optimization, adapter training, and efficient LLM customization.

6. LLM Evaluation and Optimization

Evaluate models using accuracy, precision, recall, F1-score, human evaluation, task-specific benchmarks, and hallucination testing. Learn to identify overfitting, underfitting, catastrophic forgetting, and data leakage, while improving model quality through experimentation.

7. LLM Deployment and Inference

Discover how to serve customized AI models using Ollama, Hugging Face, FastAPI, Streamlit, and local inference frameworks. Explore model serving, inference optimization, API development, and AI application deployment.

Build a Real-World Fine-Tuning Project

Apply your knowledge through a practical end-to-end LLM fine-tuning capstone project. Prepare a custom dataset, establish baseline performance, fine-tune an open-weight language model using LoRA or QLoRA, evaluate improvements, and build a working AI-powered application.

Who Should Enroll?

This course is ideal for AI Developers, Software Engineers, Python Programmers, Data Scientists, ML Engineers, AI Architects, NLP Practitioners, and technology professionals who want practical experience with Large Language Models and Generative AI development.

Basic Python knowledge is recommended, but previous LLM fine-tuning experience is not required.

Start Building Customized AI Models

Move beyond simply using AI tools. Learn how language models work, when customization makes sense, and how to create specialized solutions through LLM training, fine-tuning, evaluation, and deployment.

Enroll today and start developing the practical LLM engineering skills needed to build customized Generative AI applications!

Who this course is for:

  • Beginners in Generative AI who want to understand how Large Language Models work and how they are customized.
  • Python Developers and Software Engineers interested in building AI-powered applications with fine-tuned language models.
  • Data Scientists and Machine Learning Engineers looking to develop practical skills in LLM training, LoRA, QLoRA, and model evaluation.
  • AI Engineers and Generative AI Developers who want to move beyond prompt engineering and RAG into model customization.
  • AI Architects and Technology Professionals evaluating fine-tuning strategies for enterprise AI applications.
  • Students, Researchers, and NLP Enthusiasts interested in transformer architectures, language modeling, and parameter-efficient training.
  • Technical Professionals and Career Changers looking to develop practical skills in Generative AI and LLM engineering.
  • Developers and AI Enthusiasts who want to build, evaluate, and deploy customized open-weight language models using open-source tools.