Buy New
-
To see product details, add this item to your cart.
Ships from: Amazon.com Sold by: Amazon.com
Used - Like New
-
To see product details, add this item to your cart.
FREE Returns
Return this item for free
We offer easy, convenient returns with at least one free return option: no shipping charges. All returns must comply with our returns policy.
Learn more about free returns. How to return the item? - Go to your orders and start the return
- Select your preferred free shipping option
- Drop off and leave!
Ships from: Amazon Sold by: Leaves & Streams
Return this item for free
We offer easy, convenient returns with at least one free return option: no shipping charges. All returns must comply with our returns policy.
Learn more about free returns.- Go to your orders and start the return
- Select your preferred free shipping option
- Drop off and leave!
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
Build a Large Language Model (From Scratch)
Purchase options and add-ons
In Build a Large Language Model (from Scratch) bestselling author Sebastian Raschka guides you step by step through creating your own LLM. Each stage is explained with clear text, diagrams, and examples. You’ll go from the initial design and creation, to pretraining on a general corpus, and on to fine-tuning for specific tasks.
Build a Large Language Model (from Scratch) teaches you how to:
- Plan and code all the parts of an LLM
- Prepare a dataset suitable for LLM training
- Fine-tune LLMs for text classification and with your own data
- Use human feedback to ensure your LLM follows instructions
- Load pretrained weights into an LLM
Build a Large Language Model (from Scratch) takes you inside the AI black box to tinker with the internal systems that power generative AI. As you work through each key stage of LLM creation, you’ll develop an in-depth understanding of how LLMs work, their limitations, and their customization methods. Your LLM can be developed on an ordinary laptop, and used as your own personal assistant.
About the technology
Physicist Richard P. Feynman reportedly said, “I don’t understand anything I can’t build.” Based on this same powerful principle, bestselling author Sebastian Raschka guides you step by step as you build a GPT-style LLM that you can run on your laptop. This is an engaging book that covers each stage of the process, from planning and coding to training and fine-tuning.
About the book
Build a Large Language Model (From Scratch) is a practical and eminently-satisfying hands-on journey into the foundations of generative AI. Without relying on any existing LLM libraries, you’ll code a base model, evolve it into a text classifier, and ultimately create a chatbot that can follow your conversational instructions. And you’ll really understand it because you built it yourself!
What's inside
- Plan and code an LLM comparable to GPT-2
- Load pretrained weights
- Construct a complete training pipeline
- Fine-tune your LLM for text classification
- Develop LLMs that follow human instructions
About the reader
Readers need intermediate Python skills and some knowledge of machine learning. The LLM you create will run on any modern laptop and can optionally utilize GPUs.
About the author
Sebastian Raschka is a Staff Research Engineer at Lightning AI, where he works on LLM research and develops open-source software.
The technical editor on this book was David Caswell.
Table of Contents
1 Understanding large language models
2 Working with text data
3 Coding attention mechanisms
4 Implementing a GPT model from scratch to generate text
5 Pretraining on unlabeled data
6 Fine-tuning for classification
7 Fine-tuning to follow instructions
A Introduction to PyTorch
B References and further reading
C Exercise solutions
D Adding bells and whistles to the training loop
E Parameter-efficient fine-tuning with LoRA
- ISBN-101633437167
- ISBN-13978-1633437166
- PublisherManning
- Publication dateOctober 29, 2024
- LanguageEnglish
- Dimensions7.38 x 0.7 x 9.25 inches
- Print length368 pages
Frequently bought together

Customers who viewed this item also viewed
- Build a Reasoning Model (From Scratch)PaperbackFREE Shipping by AmazonGet it as soon as Sunday, Sep 20
- Hands-On Large Language Models: Language Understanding and GenerationPaperbackFREE Shipping by AmazonGet it as soon as Monday, Sep 21
- AI Engineering: Building Applications with Foundation ModelsPaperbackFREE Shipping by AmazonGet it as soon as Sunday, Sep 20
- Domain-Specific Small Language Models: Efficient AI for local deploymentPaperbackFREE Shipping by AmazonGet it as soon as Monday, Sep 21
- Designing Machine Learning Systems: An Iterative Process for Production-Ready ApplicationsPaperbackFREE Shipping by AmazonGet it as soon as Sunday, Sep 20
- LLM Engineer's Handbook: Master the art of engineering large language models from concept to productionPaperbackFREE Shipping by AmazonGet it as soon as Monday, Sep 21
Customers also bought or read
- Build a Reasoning Model (From Scratch)#1 Best SellerProgramming Algorithms
Paperback$47.82$47.82FREE delivery Sun, Sep 20 - Hands-On Large Language Models: Language Understanding and Generation
Paperback$37.68$37.68FREE delivery Mon, Sep 21 - AI Engineering: Building Applications with Foundation Models#1 Best SellerEnterprise Applications
Paperback$52.40$52.40FREE delivery Sun, Sep 20 - LLM Engineer's Handbook: Master the art of engineering large language models from concept to production
Paperback$39.99$39.99FREE delivery Mon, Sep 21 - Domain-Specific Small Language Models: Efficient AI for local deployment
Paperback$41.51$41.51FREE delivery Mon, Sep 21 - Reinforcement Learning from Human Feedback: LLM alignment and post-training
Just releasedPaperback$59.99$59.99FREE delivery Mon, Sep 21 - Knowledge Graphs and LLMs in Action: Build AI systems using connected data
Paperback$55.99$55.99FREE delivery Mon, Sep 21 - Designing Machine Learning Systems: An Iterative Process for Production-Ready Applications
Paperback$40.00$40.00FREE delivery Sun, Sep 20 - LLMs in Production: From language models to successful products
Paperback$48.13$48.13FREE delivery Sun, Sep 20 - The Hundred-Page Language Models Book: hands-on with PyTorch (The Hundred-Page Books)
Paperback$46.95$46.95FREE delivery Mon, Sep 21 - Building LLMs for Production: Enhancing LLM Abilities and Reliability with Prompting, Fine-Tuning, and RAG
Paperback$43.38$43.38FREE delivery Mon, Sep 21 - Natural Language Processing with Transformers, Revised Edition
Paperback$41.60$41.60FREE delivery Sun, Sep 20 - AI Agents in Action: Build, orchestrate, and deploy autonomous multi-agent systems
Paperback$59.99$59.99 - Machine Learning with PyTorch and Scikit-Learn: Develop machine learning and deep learning models with Python#1 Best SellerSpeech & Audio Processing
Paperback$36.05$36.05FREE delivery Sun, Sep 20 - Deep Learning with PyTorch, Second Edition: Training and applying deep learning and generative AI models
Paperback$51.68$51.68FREE delivery Mon, Sep 21 - Building AI Agents with LLMs, RAG, and Knowledge Graphs: A practical guide to autonomous and modern AI agents
Paperback$41.99$41.99FREE delivery Mon, Sep 21 - Mathematics of Machine Learning: Master linear algebra, calculus, and probability for machine learning
Paperback$44.30$44.30FREE delivery Mon, Sep 21 - Deep Learning (Adaptive Computation and Machine Learning series)
Hardcover$51.51$51.51FREE delivery Sep 21 - 24 - AI Agents and Applications: With LangChain, LangGraph, and MCP
Paperback$51.69$51.69FREE delivery Mon, Sep 21 - AI Systems Performance Engineering: Optimizing Model Training and Inference Workloads with GPUs, CUDA, and PyTorch#1 Best SellerComputer Hardware Design & Architecture
Paperback$86.07$86.07FREE delivery Mon, Sep 21 - AI Agents in Action, Second Edition: Intelligent workflows with LLMs, MCP, A2A, and more#1 New ReleaseNatural Language Processing
Paperback$47.48$47.48FREE delivery Mon, Sep 21 - Hands-On Machine Learning with Scikit-Learn and PyTorch: Concepts, Tools, and Techniques to Build Intelligent Systems
Paperback$77.72$77.72FREE delivery Mon, Sep 21 - Building Applications with AI Agents: Designing and Implementing Multiagent Systems
Paperback$56.44$56.44FREE delivery Sun, Sep 20 - Prompt Engineering for LLMs: The Art and Science of Building Large Language Model-Based Applications
Paperback$54.51$54.51FREE delivery Mon, Sep 21 - Designing Multi-Agent Systems: Principles, Patterns, and Implementation for AI Agents
Paperback$46.39$46.39FREE delivery Mon, Sep 21 - Deep Reinforcement Learning Hands-On: A practical and easy-to-follow guide to RL from Q-learning and DQNs to PPO and RLHF
Paperback$32.75$32.75Delivery Mon, Sep 21 - Large Language Models: A Deep Dive: Bridging Theory and Practice
Hardcover$43.61$43.61FREE delivery Sun, Sep 20
From the Publisher
“The most understandable and comprehensive explanation of language models yet! Its unique and practical teaching style achieves a level of understanding you can’t get any other way.”
Cameron Wolfe, Senior Scientist, Netflix
“Sebastian combines deep knowledge with practical engineering skills and a knack for making complex ideas simple. This is the guide you need!”
Chip Huyen, author of Designing Machine Learning Systems and AI Engineering
“Definitive, up-to-date coverage. Highly recommended!”
Dr. Vahid Mirjalili, Senior Data Scientist, FM Global
why this book?
Build a Large Language Model (From Scratch) offers a practical, hands-on approach to understanding and constructing large language models (LLMs) from the ground up.
By guiding you through each stage—from data preparation and coding attention mechanisms to pretraining and fine-tuning—this book demystifies the inner workings of LLMs using Python and PyTorch.
Ideal for developers and machine learning enthusiasts, it empowers you to build a functional GPT-style model on a standard laptop, fostering a deeper comprehension of generative AI technologies.
about Manning
Manning helps developers and tech professionals stay ahead in a fast-moving industry with expert-led books, videos, and projects. Learning never stops, but it’s hard to keep up, so we focus on content that’s practical, clear, and trusted. As an independent publisher, we adapt quickly, from pioneering early-access books to offering DRM-free eBooks. Our series, like "In Action" and "In a Month of Lunches", reflect a commitment to making complex topics accessible.
LLMs in Production: From language models to successful products
|
AI Agents in Action
|
Natural Language Processing in Action, Second Edition
|
Effective Conversational AI: Chatbots that work
|
Data Analysis with LLMs: Text, tables, images and sound (In Action)
|
Causal AI
|
|
|---|---|---|---|---|---|---|
| Customer Reviews |
4.5 out of 5 stars 36
|
4.0 out of 5 stars 51
|
4.8 out of 5 stars 8
|
4.8 out of 5 stars 7
|
4.8 out of 5 stars 7
|
4.4 out of 5 stars 14
|
| Level of proficiency | Intermediate | Intermediate | Intermediate | Intermediate | Intermediate | Advanced |
| About the reader | For data scientists and ML engineers. | For intermediate Python programmers. | For intermediate Python programmers. | For developers, engineers, and product managers. | For data scientists and data analysts. | For data scientists and machine learning engineers. |
| Special features | Includes liveBook with out built-in AI assistant. | Includes liveBook with out built-in AI assistant. | Includes liveBook with out built-in AI assistant. | Includes liveBook with out built-in AI assistant. | Includes liveBook with out built-in AI assistant. | Includes liveBook with out built-in AI assistant. |
| Pages | 456 | 344 | 688 | 328 | 232 | 520 |
Editorial Reviews
Review
A clear, hands-on guide that empowers readers to build their own models and explore the cutting edge of AI. -- Guillermo Alcántara, Project manager, PepsiCo Global
Must-have resource for quickly getting up to speed on LLMs. Whether you're new to the field or looking to deepen your knowledge, it’s the perfect guide. -- Walter Reade, Staff Developer Relations Engineer, Kaggle/Google
A fantastic resource for diving into LLMs—a must-read for anyone eager to get hands-on! -- Dr. Vahid Mirjalili, Senior Data Scientist, FM Global
From the Back Cover
From the back cover:
Build a Large Language Model (From Scratch) is a practical and eminently-satisfying hands-on journey into the foundations of generative AI. Without relying on any existing LLM libraries, you'll code a base model, evolve it into a text classifier, and ultimately create a chatbot that can follow your conversational instructions. And you'll really understand it because you built it yourself!
About the reader:
Readers need intermediate Python skills and some knowledge of machine learning. The LLM you create will run on any modern laptop and can optionally utilize GPUs.About the Author
Product details
- Publisher : Manning
- Publication date : October 29, 2024
- Language : English
- Print length : 368 pages
- ISBN-10 : 1633437167
- ISBN-13 : 978-1633437166
- Item Weight : 1.35 pounds
- Dimensions : 7.38 x 0.7 x 9.25 inches
- Best Sellers Rank: #5,175 in Books (See Top 100 in Books)
- #1 in Computer Neural Networks
- #2 in Computer Programming Languages
- #2 in Python Programming
- Customer Reviews:
About the author

Sebastian Raschka, PhD is an LLM Research Engineer with over a decade of experience in artificial intelligence. His work bridges academia and industry, including roles as senior engineering staff at an AI company and a statistics professor.
As an independent researcher and industry expert, Sebastian collaborates with companies on AI solutions and serves on the Open Source Advisory Board at University of Wisconsin–Madison.
Sebastian specializes in LLMs and the development of high-performance AI systems, with a deep focus on practical, code-driven implementations.
















