mlabonne/llm-course
Llm Course
This project is a comprehensive educational curriculum and engineering handbook focused on the lifecycle of large language models. It serves as a structured knowledge base for machine learning practitioners, covering the fundamental mathematical and architectural principles of transformer-based sequence modeling, as well as the practical implementation of supervised instruction fine-tuning and preference-based model alignment.
The repository distinguishes itself by providing a deep dive into advanced model composition and optimization techniques. It details methodologies for weight-space model merging and mixture-of-experts strategies, alongside practical guidance on low-precision parameter quantization and inference optimization to manage hardware requirements. Furthermore, it explores the development of autonomous agentic systems capable of tool-use orchestration and the construction of retrieval-augmented generation pipelines to ground model outputs in external data.
The content spans the entire technical stack, from foundational deep learning concepts and neural network design to the complexities of deploying, evaluating, and securing models in production environments. It includes a curated collection of technical articles, blog posts, and interactive notebooks that track state-of-the-art research trends and experimental methodologies in generative artificial intelligence.
Features
- Large Language Models - [New model release!](https://mlabonne.github.io/blog/posts/2026-02-12_GLM-5.html) Large Language Models
- Retrieval Augmented Generation Systems - Building intelligent systems that ground model responses in external data sources to improve accuracy and reduce hallucinations in production.
- Transformer Architectures - Processes input tokens through stacked attention layers to capture long-range dependencies and contextual relationships within sequential data.
- Supervised Fine-Tuning - SFT turns base models into helpful assistants, capable of answering questions and following instructions. During this process, they learn how to structure answers and reactivate a subset of knowledge learned during pre-t
- Preference-Based Model Alignments - Refines pre-trained model behavior by optimizing against human-provided feedback or reward signals to ensure helpful and safe outputs.
- Fine-Tuning Strategies - Mastering the end-to-end process of adapting pre-trained models through supervised fine-tuning and preference alignment techniques for specific tasks.
- Supervised Instruction Fine-Tuning - Adapts base models to specific task formats by training on curated datasets containing structured input-output instruction pairs.
- Retrieval Pipelines - Augments model outputs by dynamically fetching relevant external documents from a vector database to ground generated responses.
- Inference Optimization Techniques - Implementing techniques like quantization and efficient attention mechanisms to reduce hardware requirements and maximize throughput for deployed models.
- Agentic Orchestration Frameworks - Enables autonomous task execution by allowing models to reason about environment states and invoke external APIs or functions.
- Neural Networks - Neural networks are a fundamental part of many machine learning models, particularly in the realm of deep learning. To utilize them effectively, a comprehensive understanding of their design and mechanics is essential. -
- Post-Training Datasets - Post-training datasets have a precise structure with instructions and answers (supervised fine-tuning) or instructions and chosen/rejected answers (preference alignment). Conversational structures are a lot rarer than th
- Preference Alignment Strategies - Preference alignment is a second stage in the post-training pipeline, focused on aligning generated answers with human preferences. This stage was designed to tune the tone of LLMs and reduce toxicity and hallucinations.
- Model Merging Strategies - Combining multiple specialized models into a single, more capable architecture using advanced merging algorithms and mixture-of-experts strategies.
- Quantization Methods - Reduces memory footprint and computational overhead by mapping high-precision floating-point weights to lower-bit integer representations.
- Weight-Space Merging Techniques - Combines multiple fine-tuned model checkpoints into a single unified architecture without additional training to aggregate diverse capabilities.
- Model Evaluation Frameworks - Reliably evaluating LLMs is a complex but essential task guiding data generation and training. It provides invaluable feedback about areas of improvement, which can be leveraged to modify the data mixture, quality, and t
- Autonomous Agent Frameworks - Designing systems where models reason about environments and utilize external tools to perform complex, multi-step tasks without human intervention.
- Agentic Reasoning Frameworks - An LLM agent can autonomously perform tasks by taking actions based on reasoning about its environment, typically through the use of tools or functions to interact with external systems. * **Agent fundamentals**: Agents
- RAG Orchestration Patterns - With RAG, LLMs retrieve contextual documents from a database to improve the accuracy of their answers. RAG is a popular way of augmenting the model's knowledge without any fine-tuning. * **Orchestrators**: Orchestrators
- Model Merging Techniques - [Agent swarm and early fusion for better vision capabilities](https://mlabonne.github.io/blog/posts/2026-02-19_kimik25.html) Large Language Models
- LLM Engineering Guides - A practical guide detailing the implementation of model training, fine-tuning, deployment, and optimization strategies for production-grade artificial intelligence.
- Fine-Tuning Tutorials - | Notebook | Description | Article | Notebook | |---------------------------------------|-------------------------------------------------------------------------|---------------------------------------------------------
- Educational Curriculum Repositories - A structured collection of learning materials and technical guides covering the end-to-end lifecycle of modern large language models.
- Large Language Model Tutorials - [Agent swarm and early fusion for better vision capabilities](https://mlabonne.github.io/blog/posts/2026-02-19_kimik25.html) Large Language Models
- Local Model Execution - Running LLMs can be difficult due to high hardware requirements. Depending on your use case, you might want to simply consume a model through an API (like GPT-4) or run it locally. In any case, additional prompting and g
- Large Language Model Architectures - An in-depth knowledge of the Transformer architecture is not required, but it's important to understand the main steps of modern LLMs: converting text into numbers through tokenization, processing these tokens through la
- Machine Learning Mathematics - Before mastering machine learning, it is important to understand the fundamental mathematical concepts that power these algorithms. - **Linear Algebra**: This is crucial for understanding many algorithms, especially thos
- Retrieval Augmented Generation Guides - Real-life applications can require complex pipelines, including SQL or graph databases, as well as automatically selecting relevant tools and APIs. These advanced techniques can improve a baseline solution and provide ad
- AI Research Repositories - A curated repository of state-of-the-art methodologies, architectural insights, and experimental trends in the rapidly evolving field of generative models.
- Machine Learning Knowledge Bases - A comprehensive reference for fundamental concepts, mathematical foundations, and advanced techniques in deep learning and natural language processing.
- LLM Security - In addition to traditional security problems associated with software, LLMs have unique weaknesses due to the way they are trained and prompted. * **Prompt hacking**: Different techniques related to prompt engineering, i