Skip to content
Scan a barcode
Scan
Paperback The LLM Engineer: Building Transformer Language Models with Python and PyTorch Book

ISBN: B0GWWQQFCT

ISBN13: 9798255965939

The LLM Engineer: Building Transformer Language Models with Python and PyTorch

Most developers working with large language models today are flying blind. They understand the interface but they don't really understand the machine. And there lies the gap - between knowing how to use a model and knowing how to build, debug, and adapt one - is where real engineering capability lives.

The LLM Engineer is a hands-on implementation guide that closes that gap completely. Starting from a single sentence - predict the next token - and ending with a quantized model serving requests through an OpenAI-compatible API, this book walks you through every layer of the modern LLM stack. No black boxes. No magic. Every concept is introduced once, explained precisely, and immediately followed by complete, runnable code.

The architecture you build matches the design of Llama 3, Mistral, and Gemma at the blueprint level - rotary position embeddings, grouped-query attention, SwiGLU activations, RMSNorm - not a toy approximation, but the real thing at teachable scale.

Inside this book, you'll learn how to:

Implement byte-pair encoding from scratch and understand the tokenizer quirks that cause real production bugsBuild scaled dot-product attention, multi-head attention, and grouped-query attention (GQA) - the memory-efficient variant used by every major open-weight model since 2022Construct a complete transformer block using pre-norm RMSNorm, SwiGLU feed-forward layers, RoPE positional encodings, and residual connectionsDesign and run a full training pipeline: packed sequences, AdamW with parameter-group weight decay, cosine warmup scheduling, gradient clipping, mixed-precision bfloat16, and distributed data parallelismFine-tune models efficiently using LoRA and QLoRA - implemented entirely from scratch, not just called from a libraryTrain for human preference alignment using Direct Preference Optimization (DPO), the technique that replaced PPO-based RLHF in most production pipelinesQuantize models to INT8 and 4-bit precision using GPTQ, AWQ, and GGUF for CPU deployment with llama.cppServe models at scale using vLLM with PagedAttention and continuous batching, and expose an OpenAI-compatible API

Along the way, you'll build:

A byte-pair encoding tokenizer that handles Unicode, byte-level encoding, and the edge cases that break naive implementationsA complete GPT-style transformer language model - architecturally identical to Llama 3 - trained from scratch on real text dataA full training loop with Weights & Biases experiment tracking, checkpointing, and distributed GPU support via PyTorch DDPAn inference engine with greedy decoding, temperature sampling, top-k, top-p, repetition penalties, speculative decoding, and structured output generationLoRA and QLoRA adapters injected and merged into a pre-trained model, reducing trainable parameters by over 99%A DPO-aligned instruct model trained on preference pairs, starting from an SFT checkpointA production-ready serving stack: quantized model exported to GGUF, served locally via Ollama, and deployed at scale with vLLM

Every chapter includes working, runnable code, common bug sections drawn from real implementation failures, and exercises that push your understanding beyond what the text alone can teach.

Recommended

Format: Paperback

Condition: New

$46.00
Save $3.67!
List Price $49.67
Ships within 2-3 days
Save to List

Customer Reviews

0 rating
Copyright © 2026 Thriftbooks.com Terms of Use | Privacy Policy | Do Not Sell/Share My Personal Information | Cookie Policy | Cookie Preferences | Accessibility Statement
ThriftBooks ® and the ThriftBooks ® logo are registered trademarks of Thrift Books Global, LLC
GoDaddy Verified and Secured