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)

6 Fine-tuning for classification

This chapter covers

  • Introducing different LLM fine-tuning approaches
  • Preparing a dataset for text classification
  • Modifying a pretrained LLM for fine-tuning
  • Fine-tuning an LLM to identify spam messages
  • Evaluating the accuracy of a fine-tuned LLM classifier
  • Using a fine-tuned LLM to classify new data

So far, we have coded the LLM architecture, pretrained it, and learned how to import pretrained weights from an external source, such as OpenAI, into our model. Now we will reap the fruits of our labor by fine-tuning the LLM on a specific target task, such as classifying text. The concrete example we examine is classifying text messages as “spam” or “not spam.” Figure 6.1 highlights the two main ways of fine-tuning ...

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