Skip to product information
Practical LLM Fine Tuning in One Book
Practical LLM Fine Tuning in One Book
Description
Book Introduction
Let's learn the fine tuning, PEFT, and vLLM serving techniques that are essential in the field through hands-on practice!

Learn everything about LLM Fine-Tuning from the forefront of AI technology! Master it step-by-step, from theoretical foundations to practical application. Covering the historical development of NLP and the core principles of backpropagation, an in-depth understanding of GPT models: from self-attention and tokenizer implementation to practical applications, analysis of the latest Gemma 2 and Llama 3 models and GPU parallel learning, hands-on fine-tuning techniques using LoRA and QLoRA, and model serving applicable to real-world services with vLLM.
You can learn both theory and practice simultaneously through hands-on projects in the Runpod environment, and it provides know-how that can be immediately applied in real-world environments, from single GPUs to multi-GPU environments.
  • You can preview some of the book's contents.
    Preview

index
▣ Chapter 1: NLP's Past and Present

1.1 Key Milestones in the Advancement of Natural Language Processing
1.2 Early history and turning points of machine translation
__1.2.1 The study of Artsruny and Troyansky
__1.2.2 Weaver's Proposal and the Georgetown-IBM Experiment
__1.2.3 Limitations of Early Machine Translation and a New Transformation
1.3 The Beginning of Artificial Intelligence
__1.3.1 Turing's Question: Can Machines Think?
__1.3.2 Limitations of the Turing Test
1.4 How does artificial intelligence learn?
__1.4.1 Development of artificial intelligence learning mechanisms
__1.4.2 Perceptron: The First Step in Artificial Intelligence Learning
1.5 Backpropagation Algorithm: A Revolution in Learning
__1.5.1 Nonlinearity: The Key to Building Smarter AI
__1.5.2 Backpropagation Algorithm
1.6 The Rise of Transformers: A New Era in NLP

▣ Chapter 2: GPT

2.1 Introduction and usage of Runpot
__2.1.1 Runpot Membership Registration
__2.1.2 Purchase Credits
__2.1.3 Pod Configuration
__2.1.4 Jupiter Lab
2.2 Data Preparation and Model Configuration
2.3 Building a Language Model
__2.3.1 Library Description
__2.3.2 __init__ function
__2.3.3 forward method
__2.3.4 generate method
2.4 Adding an Optimizer
__2.4.1 Passing data to the GPU
__2.4.2 Creating a Loss Function
__2.4.3 Review the entire code
2.5 Adding Self-Attention
__2.5.1 How information is exchanged between characters (average method)
__2.5.2 Exchange information faster with matrix multiplication operations
__2.5.3 What is self-attention?
__2.5.4 Why should we divide by dk?
__2.5.5 Applying Self-Attention
2.6 Multihead Attention and Feedforward
__2.6.1 Creating multi-head attention
__2.6.2 Creating a feedforward
2.7 Creating Blocks
2.8 Creating a Tokenizer
__2.8.1 Comparison of tokenization according to changes in vocab_size
__2.8.2 Creating a tokenizer

▣ Chapter 3: Overall Fine Tuning

3.1 Preparing the entire fine-tuning data
__3.1.1 Principles and types of overall fine tuning
__3.1.2 Various tasks and datasets
__3.1.3 Data Preprocessing
3.2 Analysis of Gemma and Llama 3 model structures
__3.2.1 Gemma Model Structure Analysis
__3.2.2 Comparison of Gemma and Gemma 2 Models
__3.2.3 Llama 3 model structure analysis
__3.2.4 Comparison of GPT, Gemma, and Llama
3.3 GPU Parallelization Techniques
__3.3.1 Data Parallelism
__3.3.2 Model Parallelism
__3.3.3 Pipeline Parallelization
__3.3.4 Tensor Parallel Processing
__3.3.5 FSDP
3.4 Fine-tuning Gemma-2B-it using a single GPU
__3.4.1 Runpot Environment Settings
__3.4.2 Preparing the Gemma model
__3.4.3 Preparing the dataset
__3.4.4 Checking the Gemma model's functions
__3.4.5 Generating keyword data
__3.4.6 Data Preprocessing
__3.4.7 Separating datasets and setting up collators
__3.4.8 Setting learning parameters
__3.4.9 Defining Evaluation Metrics
__3.4.10 Model Training and Evaluation
__3.4.11 Testing the fine-tuned model
3.5 Fine-tuning Llama3.1-8B-instruct using multiple GPUs
__3.5.1 Runpot Environment Settings
__3.5.2 Llama 3.1 Learning Parameter Settings
__3.5.3 Preparing the dataset
__3.5.4 Llama 3.1 Model Parameter Settings
__3.5.5 Examining the Llama 3.1 Model Training Code
__3.5.6 Running Llama 3.1 model training
__3.5.7 Wandb setup and usage
__3.5.8 Testing the trained Llama 3.1 model
__3.5.9 Evaluating Generated Text Data with OpenAI
__3.5.10 Calculating Grading Score

▣ Chapter 4: Efficient Parameter Tuning Techniques (PEFT)

4.1 LoRA Theory and Practice
__4.1.1 LoRA Concept
__4.1.2 Runpot Environment Settings
__4.1.3 Preparing the Gemma-2-9B-it model
__4.1.4 Data Preprocessing
__4.1.5 LoRA parameter settings
__4.1.6 Model Training
__4.1.7 Testing the trained model
__4.1.8 Evaluating model performance with OpenAI
4.2 QLoRA Theory and Practice
__4.2.1 Understanding Quantization
__4.2.2 Runpot Environment Settings
__4.2.3 Preparing the dataset
__4.2.4 Setting quantization parameters
__4.2.5 Model Preparation
__4.2.6 Parameter settings
__4.2.7 Model Training
__4.2.8 Uploading a model to the Hugging Face Hub
__4.2.9 Testing the trained model
__4.2.10 Evaluation using Exact Match
__4.2.11 Evaluating with the OpenAI API

▣ Chapter 5: Serving with vLLM

5.1 Paged Attention Principle
5.2 How to use vLLM
5.3 Accelerate LLaMA3 generation speed
5.4 Multi-LoRA using vLLM
__5.4.1 Multi-LoRA Practice
__5.4.2 Practice in a laptop environment
5.5 Things to keep in mind when using Multi-LoRA

▣ Appendix

Mathematical Review of Backpropagation
Backpropagation code review

Detailed image
Detailed Image 1
GOODS SPECIFICS
- Date of issue: December 17, 2024
- Page count, weight, size: 348 pages | 175*235*15mm
- ISBN13: 9791158395629

You may also like

카테고리