Generation
Generation is the production of an output by a computational model from supplied input or context, often using patterns learned from data.
Learn Generative AI with PyTorch
A language-modeling task in which new text is produced without conditioning on a specific task label, here using a generic or empty prompt.
- How it is used
- Uses generic-seed generation to sample learned writing style and check for copied training passages.
- How deep it goes
- Walks through tokenization, shifted training targets, and iterative sampling, including temperature and top-K controls.
- Examples
- Compares passages generated from an UNK seed by GPT models trained for 20 and 40 epochs on three Hemingway novels.
- What you can do after
- Builds a small GPT-style model from scratch and evaluates its generated passages for coherence and copying.
Read how Learn Generative AI with PyTorch explains generation →
Deep Learning with Python, Third Edition
The process of producing new text token by token from a trained language model, often by feeding previous outputs back as inputs.
- How it is used
- Uses next-token predictions to extend prompts into generated text.
- How deep it goes
- Works through prompt priming, recurrent state propagation, token selection, and alternative sampling strategies.
- Examples
- Demonstrates Shakespeare-style character continuation and miniature GPT completions under different sampling settings.
- What you can do after
- Apply it via Keras to generate continuations and compare token-selection strategies.
Read how Deep Learning with Python, Third Edition explains generation →
Natural Language Processing in Action, Second Edition
Natural language generation, or text generation, is the computational production of human-readable natural-language text.
- How it is used
- Uses generation to compose chatbot replies, autocomplete text, and summarize search results.
- How deep it goes
- Explains decoding and token-by-token generation through conditional probabilities and temperature.
- Examples
- Exercises bigram autocomplete on Wikipedia sentences and compares it with Llama 2 completions.
- What you can do after
- Evaluate generation by comparing a simple autocomplete model with an LLM and considering reliability and bias.
Read how Natural Language Processing in Action, Second Edition explains generation →
Inside Deep Learning: Math, Algorithms, Models
The act of producing novel sequences or examples from a trained generative model.
- How it is used
- Uses trained next-token predictions to produce new sequences resembling the training data.
- How deep it goes
- Works through shifted training targets and a seed-to-sample PyTorch loop, including probability sampling and token decoding.
- Examples
- Uses a character-level Shakespeare model seeded with dialogue text and a printed, imperfect continuation.
- What you can do after
- Build it from scratch with a PyTorch GRU character model, then sample and decode its next-token predictions.
Read how Inside Deep Learning: Math, Algorithms, Models explains generation →
Generative AI in Action
Natural language generation is the computational production of human-readable language from structured or unstructured inputs.
- How it is used
- Uses text generation to draft business communications, suggest names, and continue passages from prompts.
- How deep it goes
- Explains token-by-token completion and API response fields without deep mathematical derivation.
- Examples
- Illustrates generation with a book-launch email and pet-salon name suggestions.
- What you can do after
- Apply it via Azure OpenAI by selecting a completion-capable model and interpreting generated text, finish reasons, and token usage.
Build a Reasoning Model (From Scratch)
The process of producing new textual output from a language model given prior context or instructions.
- How it is used
- Deploys pretrained language models to generate responses from prompts and support later evaluation and reasoning workflows.
- How deep it goes
- Explains token preparation, logits, argmax, streaming, and KV caching, while deferring attention and architectural internals.
- Examples
- Demonstrates a Berlin completion, streamed decoded output, a cached generation function, and a reusable generation wrapper.
- What you can do after
- Build it from scratch using tokenization, autoregressive decoding, streaming, end-of-sequence handling, and KV-cache optimization.
Read how Build a Reasoning Model (From Scratch) explains generation →
Deep Learning with R, Third Edition
The computational generation of natural-language text by a model.
- How it is used
- Uses generation to continue prompts and considers it as a way to augment sparse text data.
- How deep it goes
- Works through token-by-token decoding and fixed-shape compilation to reduce generation time.
- Examples
- Extends an advice prompt with a miniature GPT model, producing a continuation that eventually repeats itself.
- What you can do after
- Apply text generation via Keras using a prompt, a tokenizer, and a trained miniature GPT model.
Read how Deep Learning with R, Third Edition explains generation →
Build AI Drug Discovery Pipelines
Inference is the process of applying a trained model to input data to produce predictions.
- How it is used
- Uses inference to predict properties of unseen compounds and assess generalization.
- How deep it goes
- Defines frozen-weight prediction and demonstrates class outputs, probabilities, and batched neural-network evaluation.
- Examples
- Uses CYP3A4 inhibition predictions and neural-network test loss to illustrate inference.
- What you can do after
- Apply it via scikit-learn and PyTorch to produce predictions and evaluate them with appropriate metrics.
Read how Build AI Drug Discovery Pipelines explains generation →
Deep Learning with PyTorch, Second Edition
The task of producing a token sequence as output, conditioned on preceding input or context.
- How it is used
- Introduces generation as producing new text rather than only analyzing existing data.
- How deep it goes
- Works through next-character sampling and feedback, then implements a GPT-style decoder.
- Examples
- Generates character-level names from a start marker and trims samples at an end marker.
- What you can do after
- Builds a PyTorch sampling loop that generates character sequences from a trained model.
Read how Deep Learning with PyTorch, Second Edition explains generation →
Grokking AI Algorithms, Second Edition
Language generation is the computational production of natural-language text from learned patterns or supplied information.
- How it is used
- Uses language generation to turn prompts, outlines, or specifications into drafts for human refinement.
- How deep it goes
- Explains autocomplete probabilities and attention’s role in context without a worked model implementation.
- Examples
- Illustrates generation with phone autocomplete, product descriptions, ad copy, educational materials, and legal drafts.
- What you can do after
- Evaluate/understand how prompts and human refinement support LLM-assisted drafting.
Read how Grokking AI Algorithms, Second Edition explains generation →
Statistics Every Programmer Needs
Prediction is the process of estimating an outcome from patterns or information in input data without necessarily modeling its temporal ordering.
- How it is used
- Uses learned relationships, temporal patterns, or simulated uncertainty to estimate outcomes for decisions and evaluation.
- How deep it goes
- Explains method selection, implementation, comparison with observations, and limitations, but does not develop formal statistical proofs.
- Examples
- Demonstrates decision-tree labels, linear-regression responses, ARIMA stock forecasts, and Monte Carlo stock-price trajectories.
- What you can do after
- Apply it via Python models to generate predictions, compare them with observed values, and interpret accuracy alongside uncertainty and volatility.
Read how Statistics Every Programmer Needs explains generation →
Grokking AI Applications
Inference is the process of applying a trained model's parameters to input data to produce predictions or generated text.
- How it is used
- Applies trained model parameters to a prompt to generate a completion.
- How deep it goes
- Explains parameter application and prompt processing, but leaves the computations largely unspecified.
- Examples
- Uses a sentence about Italy’s capital, with “Rome” as the generated completion.
- What you can do after
- Understand how inference uses trained parameters to generate a completion from a prompt.
Math and Architectures of Deep Learning
A modeling approach that learns a data distribution so new samples resembling the training data can be generated.
- How it is used
- Models data distributions to generate samples and evaluate how probable new instances are.
- How deep it goes
- Descends from distribution properties through Bayesian parameter estimation, including priors, likelihoods, posteriors, and conjugate families.
- Examples
- Uses cat-image sampling, face-probability estimation, smooth density heat maps, and comparisons with irregular decision boundaries.
- What you can do after
- Apply distribution models to generate samples or estimate probabilities for new data instances.
Read how Math and Architectures of Deep Learning explains generation →
The Design of Web APIs, Second Edition
An output is data produced by an API operation and returned as a successful or erroneous result.
- How it is used
- Defines what an API operation returns so consumers can distinguish processing outcomes and use resulting data.
- How deep it goes
- Works through status-code selection, response data placement, and output modeling; detailed data models are handled as a separate step.
- Examples
- Uses a product-search response with 200 OK and matching products, plus an exercise returning a newly created travel destination.
- What you can do after
- Practice/perform it by choosing outcome statuses, locating response data, and deriving useful output models from resources.
Read how The Design of Web APIs, Second Edition explains generation →
Sutskever's List
A model that learns a data distribution and can sample new data from it.
- How it is used
- Uses learned text distributions to produce new sentences, paragraphs, and multiturn conversations.
- How deep it goes
- Explains conditional token prediction, next-token training, and causal masking without detailing sampling procedures.
- Examples
- Contrasts plausible, grammatically broken, and semantically odd sentences to show how models reflect syntax and meaning.
- What you can do after
- Understand how autoregressive models generate text and how next-token prediction trains them.
Build a DeepSeek Model (From Scratch)
Generation is the process of producing a sequence of tokens from a language model, typically by sampling or selecting successive outputs.
- How it is used
- Uses generation during fixed-model inference and as the rollout stage of policy optimization.
- How deep it goes
- Explains autoregressive repetition, KV-cache trade-offs, batching, and log-probability recording, but defers distributed production machinery.
- Examples
- Uses the prompt "The next day" and a trainer mapping from sampling functions to policy.generate implementations.
- What you can do after
- Apply it via a policy model's generate function and diagnose sequence-length, padding, and KV-cache bottlenecks.
Read how Build a DeepSeek Model (From Scratch) explains generation →
Causal AI
A generative model is a model that represents a process for generating observations, typically by specifying a joint or conditional probability distribution.
- How it is used
- Uses latent-variable models to generate observations and produce counterfactual media after interventions.
- How deep it goes
- Explains latent variables, assignment functions, and abduction-action-prediction, then demonstrates sampling without deriving model identification.
- Examples
- Demonstrates gaming outcomes, femur-length height inference, and semantic image editing with generated counterfactual artifacts.
- What you can do after
- Builds counterfactual generators with Pyro or graphical models and evaluates generated outcomes against interventional distributions.
Statistics Slam Dunk
The predict() function is an R function that generates predictions from a fitted model for supplied data, optionally returning interval estimates.
- How it is used
- Applies fitted regression models to test data and evaluates predicted outcomes against observed sports results.
- How deep it goes
- Explains required arguments, confidence intervals, response probabilities, thresholding, and downstream evaluation with errors and classification metrics.
- Examples
- Demonstrates regular-season win forecasts and playoff-qualification probabilities using train-test sports data.
- What you can do after
- Apply it via base R to generate numeric predictions, confidence intervals, or response probabilities for new observations.
Build AI-Enhanced Web Apps
The production of natural-language text by a computational model from an input or context.
- How it is used
- Supports web application features including content creation, marketing copy, conversational agents, customer support, and personalized responses.
- How deep it goes
- Explains the generation workflow and transformer foundations but stops short of implementation code, training procedures, and detailed model internals.
- Examples
- Uses marketing copy, product descriptions, customer-support chatbots, feedback responses, and conversational follow-up as examples.
- What you can do after
- Build it into web applications by routing user prompts through backend services and language-model APIs to deliver generated content.
Digital Twins in Action
Generative AI is a class of artificial-intelligence models that produces new content or data from learned patterns.
- How it is used
- Positions generative AI as a way to query digital twins and generate simulation scenarios or synthetic data.
- How deep it goes
- Explains grounding and specialization through equipment examples but does not specify an implementation.
- Examples
- Uses a pump-pressure question and a turbine diagnostic report to illustrate equipment-specific responses.
- What you can do after
- Evaluate how twin context can make language-model responses more relevant to specific equipment.
Domain-Specific Small Language Models
The task of producing output sequences from a model given an input context or prompt, here applied to proteins rather than natural language.
- How it is used
- Generates protein sequences for novel protein design and engineering.
- How deep it goes
- Traces inference through prompt prefill, KV-cache population, and autoregressive sampling, and compares cached with uncached runtime.
- Examples
- Demonstrates ten unprompted ProtGPT2 sequences beginning with M and a Transformers generation pipeline.
- What you can do after
- Apply protein generation through Hugging Face Transformers using ProtGPT2’s text-generation pipeline.
Read how Domain-Specific Small Language Models explains generation →
Enterprise RAG
Generation is the production of a natural-language response from a language model based on a query and supplied context.
- How it is used
- Returns answers by summarizing retrieved data in an enterprise RAG question-answer workflow.
- How deep it goes
- Defines generation as the final workflow step and summarizes retrieved data, without detailing its implementation internals.
- Examples
- Uses electronics product manuals and questions about headphone battery life or hair-dryer warranty periods.
- What you can do after
- Apply it via an enterprise RAG pipeline to return answers from retrieved product-manual data.
Transformers in Action
Natural language generation is the computational production of human-readable language from learned representations or structured information.
- How it is used
- Supports applications such as chatbots, story generation, translation, and other tasks requiring context-sensitive language output.
- How deep it goes
- Descends from sequence-level intuition to causal masking, tokenization, transformer blocks, and decoding strategies.
- Examples
- Uses translation, chatbot responses, story generation, GPT-2-style BPE encoding, and masked-attention code.
- What you can do after
- Evaluate generation pipelines by relating architecture, masking, tokenization, decoding, sampling, and prompting choices to output quality.
AI Agents in Action
A generative model is a machine-learning model that creates new content from input data rather than only predicting labels or classifications.
- How it is used
- Frames generation as the defining function of LLMs and as a step in an assistant workflow for producing new content.
- How deep it goes
- Defines generation and contrasts it with classification, but does not explain generation internals.
- Examples
- Uses an X post generated after YouTube search, transcript summarization, and filtering as a practical content-generation example.
- What you can do after
- Apply it via an assistant workflow to generate a post from researched and summarized material.
AI-Powered Search
A generative model is a model that produces new data or content according to patterns learned from its training data.
- How it is used
- Generates synthesized answers, summaries, and multimodal content directly from queries or analyzed search results.
- How deep it goes
- Defines the paradigm and illustrates its progression and risks, but does not provide implementation steps or model internals.
- Examples
- Uses a preference-based Paris itinerary and generated text, image, audio, and video as concrete examples.
- What you can do after
- Evaluate how generated search responses improve information access while introducing bias, censorship, propaganda, and safety risks.
LLM Evaluation and Alignment, The Foundational Ideas
Natural language generation is the task of producing human-readable language from structured, sensory, or linguistic inputs.
- How it is used
- Explains the response-producing component of Retrieval-Augmented Generation and supports diagnosis of system-level answer failures.
- How deep it goes
- Explains context-based synthesis and interacting component failures, but does not detail generation algorithms or evaluation metrics.
- Examples
- Uses a financial research assistant that combines earnings-report excerpts with a partially hallucinated and incomplete answer.
- What you can do after
- Diagnose whether unsupported or incomplete answers arise from generation, retrieval, or their interaction.
Read how LLM Evaluation and Alignment, The Foundational Ideas explains generation →
Build an AI Agent (From Scratch)
A task response is a standardized A2A message returned by an agent server with the result of processing a task request.
- How it is used
- Coordinates the standardized result exchange between A2A clients and agent servers after task execution.
- How deep it goes
- Explains the request-response flow and HTTP role but does not detail the response schema or server implementation.
- Examples
- Uses a math expert agent card and a client-server flow showing discovery, task submission, execution, and result return.
- What you can do after
- Understand how to trace an A2A task from agent discovery through server execution to the returned response.
Read how Build an AI Agent (From Scratch) explains generation →
Learn Go with Pocket-Sized Projects
A response message is a Protobuf message containing the output data for an API operation.
- How it is used
- Structures gRPC endpoint outputs so API changes remain compatible with existing clients.
- How deep it goes
- Explains dedicated message declarations and compatibility rationale, stopping short of generated implementation details.
- Examples
- Uses the CreateHabit endpoint with CreateHabitRequest and CreateHabitResponse containing a Habit field.
- What you can do after
- Build it from scratch by declaring version-tolerant Protobuf responses for gRPC endpoints.
Read how Learn Go with Pocket-Sized Projects explains generation →
Coding with AI
An output representing what a model estimates or generates as the likely result for given input and context.
- How it is used
- Frames generated code as a prediction based on developer input, existing code patterns, and requirements.
- How deep it goes
- Explains a five-step generation and feedback loop at a high level, without detailing the underlying algorithms.
- Examples
- Uses source code, comments, and natural-language requirements as inputs, with generated code as the predicted output.
- What you can do after
- Evaluate generated suggestions as predictions and decide whether to accept, modify, or reject them.
Also covered in
- Grokking Machine Learning
- Designing Deep Learning Systems: A guide for software engineers
- Grokking Machine Learning, Second EditionIn early access (MEAP)
- Introduction to Generative AI, Second Edition
- Get Programming: Learn to code with Python
- Fight Fraud with Machine LearningIn early access (MEAP)
- Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI
- Time Series Forecasting Using Foundation Models
- Server-Side WebAssembly
- Learn AI-Assisted Python Programming, Second Edition
- Troubleshooting Java, Second Edition
- Effective Data Analysis
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- transformer architectureA transformer is a neural-network architecture that uses attention-based interactions and position-wise transformations to model relationships among elements of sequences or other structured inputs.
- inputAn input is information, a value, or an action supplied to a system, program, or computation for processing or to influence its behavior.
- promptA prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
Related concepts
- language modelproduced by · A language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- variational autoencoderincludes · A variational autoencoder is a generative neural network that learns a probabilistic latent representation of data and decodes samples from it to reconstruct or generate data.
- retrieval-augmented generationpart of · Retrieval-augmented generation is a technique that retrieves relevant information from external sources and supplies it as context to a generative model when producing an output.
- Model Servingequivalent to · Model serving is the software infrastructure that hosts trained machine-learning models and handles inference requests, returning model outputs.
- labelcontrasts with · A label is a target value, category, or reference annotation associated with an example for learning, prediction, or evaluation.
Questions about generation
What is generation?
Generation is the production of an output by a computational model from supplied input or context, often using patterns learned from data.
Which Manning books explain generation?
Learn Generative AI with PyTorch, Deep Learning with Python, Third Edition, Natural Language Processing in Action, Second Edition, Inside Deep Learning: Math, Algorithms, Models, Generative AI in Action, Build a Reasoning Model (From Scratch), Deep Learning with R, Third Edition, Build AI Drug Discovery Pipelines and 21 more.
What should I know before learning generation?
Manning books that teach generation usually introduce language model, transformer architecture, input and prompt first.
What is the difference between generation and label?
Generation is the production of an output by a computational model from supplied input or context, often using patterns learned from data. A label is a target value, category, or reference annotation associated with an example for learning, prediction, or evaluation.
What kinds of generation are there?
Kinds of generation include variational autoencoder.
What is generation part of?
Generation is part of retrieval-augmented generation. Retrieval-augmented generation is a technique that retrieves relevant information from external sources and supplies it as context to a generative model when producing an output.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




























