liveBook · Manning

Generate

A generate function is a model operation that produces generated content from supplied inputs or conditioning during inference.

How 3 Manning books explain it

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 →

Also covered in

What to know first

Related concepts

Questions about generate

What is generate?

A generate function is a model operation that produces generated content from supplied inputs or conditioning during inference.

Which Manning books explain generate?

Domain-Specific Small Language Models, Deep Learning with R, Third Edition and Build a Large Language Model (From Scratch).

What should I know before learning generate?

Manning books that teach generate usually introduce language model, conversational ai, digital image and generation first.

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.