Machine Learning Q and AI cover

Machine Learning Q and AI

30 Essential Questions and Answers on Machine Learning and AI
by Sebastian Raschka
March 2024, 264 pp.

Download Chapter 17: Encoder- And Decoder-Style Transformers

Look Inside!

Machine Learning Q and AI back coverMachine Learning Q and AI pages 24-25Machine Learning Q and AI pages 164-165Machine Learning Q and AI pages 70-71

If you’re ready to venture beyond introductory concepts and dig deeper into machine learning, deep learning, and AI, the question-and-answer format of Machine Learning Q and AI will make things fast and easy for you, without a lot of mucking about.

Born out of questions often fielded by author Sebastian Raschka, the direct, no-nonsense approach of this book makes advanced topics more accessible and genuinely engaging. Each brief, self-contained chapter journeys through a fundamental question in AI, unraveling it with clear explanations, diagrams, and hands-on exercises.


FOCUSED CHAPTERS: Key questions in AI are answered concisely, and complex ideas are broken down into easily digestible parts.

WIDE RANGE OF TOPICS: Raschka covers topics ranging from neural network architectures and model evaluation to computer vision and natural language processing.

PRACTICAL APPLICATIONS: Learn techniques for enhancing model performance, fine-tuning large models, and more.

You’ll also explore how to:
• Manage the various sources of randomness in neural network training
• Differentiate between encoder and decoder architectures in large language models
• Reduce overfitting through data and model modifications
• Construct confidence intervals for classifiers and optimize models with limited labeled data
• Choose between different multi-GPU training paradigms and different types of generative AI models
• Understand performance metrics for natural language processing
• Make sense of the inductive biases in vision transformers

If you’ve been on the hunt for the perfect resource to elevate your understanding of machine learning, Machine Learning Q and AI will make it easy for you to painlessly advance your knowledge beyond the basics.

Author Bio 

Sebastian Raschka, PhD, is a machine learning and AI researcher with a  passion for education. As Lead AI Educator at Lightning AI, he is excited about making AI and deep learning more accessible. Raschka previously was Assistant Professor of Statistics at the University of Wisconsin-Madison, where he specialized in researching deep learning and machine learning, and is the author of the bestselling books Python Machine Learning and Machine Learning with PyTorch and Scikit-Learn. You can find out more about his research on his website at

Table of contents 

Chapter 1: Embeddings, Representations, and Latent Space 
Chapter 2: Self-Supervised Learning 
Chapter 3: Few-Shot Learning
Chapter 4: The Lottery Ticket Hypothesis
Chapter 5: Reducing Overfitting with Data
Chapter 6: Reducing Overfitting with Model Modifications
Chapter 7: Multi-GPU Training Paradigms 
Chapter 8: The Keys to the Success of Transformers 
Chapter 9: Generative AI Models
Chapter 10: Sources of Randomness
Chapter 11: Calculating the Number of Parameters
Chapter 12: The Equivalence of Fully Connected and Convolutional Layers 
Chapter 13: Large Training Sets for Vision Transformers
Chapter 14: The Distributional Hypothesis
Chapter 15: Data Augmentation for Text 
Chapter 16: “Self”-Attention 
Chapter 17: Encoder- And Decoder-Style Transformers 
Chapter 18: Using and Finetuning Pretrained Transformers
Chapter 19: Evaluating Generative Large Language Models 
Chapter 20: Stateless And Stateful Training 
Chapter 21: Data-Centric AI 
Chapter 22: Speeding Up Inference
Chapter 23: Data Distribution Shifts 
Chapter 24: Poisson and Ordinal Regression
Chapter 25: Confidence Intervals 
Chapter 26: Confidence Intervals Versus Conformal Predictions
Chapter 27: Proper Metrics 
Chapter 28: The K in K-Fold Cross-Validation
Chapter 29: Training and Test Set Discordance
Chapter 30: Limited Labeled Data 
Appendix: Answers to Exercises 

View the detailed Table of Contents
View the Index


“Sebastian has a gift for distilling complex, AI-related topics into practical takeaways that can be understood by anyone. His new book, Machine Learning Q and AI, is another great resource for AI practitioners of any level.”
–Cameron R. Wolfe, Writer of Deep (Learning) Focus

“Sebastian uniquely combines academic depth, engineering agility, and the ability to demystify complex ideas. He can go deep into any theoretical topics, experiment to validate new ideas, then explain them all to you in simple words. If you’re starting your journey into machine learning, Sebastian is your guide.”
–Chip Huyen, Author of Designing Machine Learning Systems

“One could hardly ask for a better guide than Sebastian, who is, without exaggeration, the best machine learning educator currently in the field. On each page, Sebastian not only imparts his extensive knowledge but also shares the passion and curiosity that mark true expertise.”
–Chris Albon, Director of Machine Learning, The Wikimedia Foundation

“Sebastian Raschka's new book, Machine Learning Q and AI, is a one-stop shop for overviews of crucial AI topics beyond the core covered in most introductory courses...If you have already stepped into the world of AI via deep neural networks, then this book will give you what you need to locate and understand the next level.”
–Ronald T. Kneusel, author of How AI Works