Skip to Content
Build a Large Language Model (From Scratch)
book

Build a Large Language Model (From Scratch)

by Sebastian Raschka
September 2024
Beginner to intermediate
368 pages
9h 49m
English
Manning Publications
Content preview from Build a Large Language Model (From Scratch)

7 Fine-tuning to follow instructions

This chapter covers

  • The instruction fine-tuning process of LLMs
  • Preparing a dataset for supervised instruction fine-tuning
  • Organizing instruction data in training batches
  • Loading a pretrained LLM and fine-tuning it to follow human instructions
  • Extracting LLM-generated instruction responses for evaluation
  • Evaluating an instruction-fine-tuned LLM

Previously, we implemented the LLM architecture, carried out pretraining, and imported pretrained weights from external sources into our model. Then, we focused on fine-tuning our LLM for a specific classification task: distinguishing between spam and non-spam text messages. Now we’ll implement the process for fine-tuning an LLM to follow human instructions, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Build a Large Language Model (From Scratch)

Build a Large Language Model (From Scratch)

Sebastian Raschka
Hands-On Large Language Models

Hands-On Large Language Models

Jay Alammar, Maarten Grootendorst

Publisher Resources

ISBN: 9781633437166Supplemental ContentPublisher SupportOtherPublisher WebsiteSupplemental ContentErrata PagePurchase Link