Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Nicole Koenigstein

Rating No ratings yet

Take a deep dive into Transformers and Large Language Models—the foundations of generative AI! Generative AI has set up shop in almost every aspect of business and society. Transformers and Large Language Models (LLMs) now power everything from code creation tools like Copilot and Cursor to AI agents, live language translators, smart chatbots, text generators, and much more. In Transformers in Action you’ll discover: • How transformers and LLMs work under the hood • Adapting AI models to new tasks • Optimizing LLM model performance • Text generation with reinforcement learning • Multi-modal AI models • Encoder-only, decoder-only, encoder-decoder, and small language models This practical book gives you the background, mental models, and practical skills you need to put Gen AI to work. What is a transformer? A “transformer” is a neural network model that finds relationships in sequences of words or other data using a mathematical technique called attention. Because the attention mechanism allows transformers to focus on the most relevant parts of a sequence, transformers can learn context and meaning from even large bodies of text. LLMs like GPT, Gemini, and Claude, are transformer-based models that have been trained on massive data sets, which gives them the uncanny ability to generate natural, coherent responses across a wide range of knowledge domains. About the book Transformers in Action guides you through the design and operation of transformers and transformer-based models. You’ll dive immediately into LLM architecture, with even the most complex concepts explained clearly through easy-to-understand examples and clever analogies. Because transformers are based in mathematics, author Nicole Koenigstein carefully guides you through the foundational formulas and concepts one step at a time. You’ll also appreciate the extensive code repository that lets you instantly start exploring LLMs hands-on.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on guide to how transformers and large language models actually work, from the linear-algebra basics of attention to building and adapting real models. Best for data scientists and ML engineers who want working intuition, not just theory. 【Book Arc】 - **Opening (~0%–10%)**: Sets up why transformers exist — the limits of RNNs, the vanishing-gradient problem, and how attention solves them — while framing the book's three-part, ten-chapter roadmap. - **Early (~10%–35%)**: Builds the core architecture: encoder/decoder components, self-attention, positional encoding, and the query/key/value intuition, with PyTorch code for multi-head attention. - **Middle (~35%–50%)**: Moves into model families and variants — tokenization with BPE, encoder-only vs. decoder-only vs. encoder-decoder designs, and how each is implemented in practice. - **Late**: Covers adapting and optimizing models for new tasks, plus text generation with reinforcement learning (excerpts do not detail these chapters). - **Ending**: Closes on multimodal AI models and retrieval systems, tying language and multimodal work together (excerpts do not detail these chapters). 【Key Takeaways】 - **Attention is the whole trick, and it's simpler than it looks** (Early): queries, keys, and values are just dot products, softmax, and weighted sums — the power comes from arranging these simple steps at scale. - **Transformers beat RNNs on parallelism and long-range context** (Early): processing all positions at once fixes both the sequential bottleneck and the vanishing-gradient problem that crippled recurrent models. - **Architecture choice is a design decision, not a default** (Middle): encoder-only, decoder-only, and encoder-decoder designs suit different tasks, and small language models are a legitimate option when scale isn't warranted. - **Tokenization shapes what a model can represent** (Middle): BPE subword units handle rare words, morphology, and idioms that whole-word vocabularies miss. - **You can learn this without being a mathematician** (Opening): the author deliberately walks through foundational formulas one step at a time, so the math is a bridge rather than a barrier. - **Theory is paired with runnable code** (Early–Middle): the book ships an extensive repository, so concepts like multi-head attention can be explored hands-on immediately. - **Bigger isn't always better** (Early): billion-parameter models can underperform in specialized domains like finance or healthcare where domain context matters more than raw scale. 【Reading Tips】 - Deep-read the attention and architecture chapters (Early–Middle); these are the load-bearing concepts everything else builds on. - Skim the introductory motivation if you already know why RNNs failed — but don't skip the query/key/value intuition, which pays off later. - Run the code repository alongside the text; the gradient and attention examples are designed to be experimented with, not just read. - Treat the later chapters on adaptation, RL-based generation, and multimodal systems as a map of where to go next rather than a complete treatment. 【Coverage Limits】 The excerpts cover the opening through roughly the middle of the book in detail; the later chapters on task adaptation, reinforcement-learning-based generation, and multimodal retrieval are named but not substantively described here.
Excerpt 1
h the foundational formulas and concepts one step at a time. You’ll also appreciate the extensive code repository that lets you instantly start exploring LLM...
View in text
Excerpt 2
ord and the rest of the sentence. The decoder, another com- ponent of the transformer model, uses these attention scores and the extracted features to genera...
View in text
Excerpt 3
essed by the encoder. Each layer in the decoder has primary components similar to the encoder: the self-attention mechanism and the FFN. How- ever, the decod...
View in text
Excerpt 4
bpe_tokens.extend( self.encoder[bpe_token] for bpe_token in ➥self.bpe(byte_seq).split(' ') Applies BPE to construct ) subwords and maps return bpe_tokens the...
View in text
Excerpt 5
nce or a con- tinuation of text, based on an input sequence. Sampling is the process of selecting the next word (or token) in a sequence during text generati...
View in text
Excerpt 6
math word problems and understanding commonsense reasoning. This is where other techniques like CoT and ToT come in. 4.2.2 One- and few-shot prompting The pa...
View in text
Excerpt 7
class trainer_stats = trainer.train() and trains the model Licensed to Damian Allen <manning@pixerati.com> 92 CHAPTER 5 Preference alignment and retrieval-au...
View in text
Excerpt 8
esentation. This enables them to answer questions, describe scenes, or take actions that depend on more than one kind of information. Instead of treating eac...
View in text
Tags
AI categories
Artificial IntelligenceProgrammingData
ISBN: 1633437884
Publish Year: 2025
Language: English
Pages: 258
File Format: PDF
File Size: 17.0 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…