Generate
A generate function is a model operation that produces generated content from supplied inputs or conditioning during inference.
Domain-Specific Small Language Models
- How it is used
- Runs inference by producing text completions from prompts in Transformers and vLLM workflows.
- How deep it goes
- Demonstrates prompt completion, decoding, batching, and sampling options, without detailing generation internals.
- Examples
- Uses a universe-story prompt, three batched prompts, and a “Once upon a time” prompt for completion.
- What you can do after
- Apply generate through Transformers or vLLM to complete prompts, batch requests, and set sampling parameters.
Read how Domain-Specific Small Language Models explains generate →
Deep Learning with R, Third Edition
generate() is a text-generation method that extends a prompt with tokens sampled according to a configured generation strategy.
- How it is used
- Generates prompt continuations or model outputs, supporting text sampling and epoch-end image visualization.
- How deep it goes
- Demonstrates prompting, greedy sampling, max_length, and callback integration, but defers generation internals and sampling details.
- Examples
- Uses Gemma continuations for advice, brownies, and a factual question, plus a callback that displays generated image grids.
- What you can do after
- Apply it via KerasHub to generate bounded text continuations or integrate image generation into an epoch-end callback.
Read how Deep Learning with R, Third Edition explains generate →
Build a Large Language Model (From Scratch)
A function used to produce model outputs from input prompts by running generation over a fine-tuned language model.
- How it is used
- Generates and collects responses from an instruction-fine-tuned language model for manual comparison and evaluation.
- How deep it goes
- Shows call arguments, decoding, prompt slicing, and response storage, but does not detail the generation algorithm internally.
- Examples
- Uses instruction prompts, decoded model responses, a three-entry comparison, and a full test-set JSON export.
- What you can do after
- Apply it via generate calls to produce, decode, compare, and save instruction-following model responses.
Read how Build a Large Language Model (From Scratch) explains generate →
Related concepts
- callbackused by · A callback is a function or other callable supplied or registered with a component for invocation at a specified event, condition, or point in execution.
- GPT4Allused by · GPT4All is an open-source software ecosystem for running and interacting with language models locally on consumer or organizational hardware.
- language modelused by · A language model is a computational model that represents patterns in sequences of linguistic tokens, typically assigning probabilities to or predicting tokens to enable language generation or evaluation.
- vLLMused by · vLLM is an open-source library and serving engine for high-throughput, memory-efficient inference of large language models.
- causal language modelimplemented by · A causal language model predicts each token from preceding tokens only, without access to future tokens, enabling autoregressive sequence generation.
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.


