Generative artificial intelligence (generative AI) refers to AI systems designed to produce content such as text, images, audio, video, or structured data. Rather than returning only a label or a number, a generative model produces an output with many possible valid forms.
For example, a classifier may decide whether an image contains a dog. An image-generation model may instead produce an image of a dog in a park. Both can use deep learning, but their tasks and outputs differ.
Generative AI is not one algorithm. It includes several families of models with distinct training objectives, representations, and generation procedures. Understanding these families provides a foundation for studying Transformers, large language models, and multimodal systems.
Start with a simple example
Imagine two AI tasks involving photographs of cats. In the first, the system receives an image and predicts “cat” or “not cat.” In the second, it receives the words “a cat sitting by a window” and creates a new image. The first is a discriminative prediction task; the second is a generative task.
A generative system learns statistical structure from training examples and uses that learned structure to produce new output. New does not necessarily mean unique, correct, or safe: generated content may reproduce training patterns, invent false details, or fail to match a prompt.
Several generative model families solve this problem differently:
- An autoregressive model produces one token or element at a time, conditioned on what came before.
- A GAN trains a generator against a discriminator that tries to distinguish generated from real examples.
- A VAE learns a structured latent representation and samples from a modeled distribution to generate data.
- A diffusion model commonly starts from noise and iteratively transforms it toward a data-like result.
Think of these as different generation procedures, not four names for the same network. The model family, underlying neural-network architecture, training objective, and user-facing product are separate design choices.
1. What makes a model generative?
A generative model learns properties of a data distribution and uses them to produce new examples or complete partially specified examples. Its output may resemble the training data statistically without being an exact copy of any particular training example.
A dataset of handwritten digits, for instance, contains many different shapes for the digit 3. A useful generative model learns enough regularity to generate plausible new handwritten digits, including variations not explicitly present in its training set.
Generative and discriminative modeling
| Aspect | Generative modeling | Discriminative modeling |
|---|---|---|
| Central goal | Model how data is distributed or produced | Predict an outcome or distinguish categories |
| Example task | Generate a plausible handwritten digit | Classify an image as digit 0–9 |
| Example output | An image, text sequence, or audio segment | A label, score, or predicted value |
| Typical evaluation | Quality, diversity, fidelity, usefulness | Accuracy, calibration, task-specific error |
The distinction describes the modeling objective, not a strict division between products. A single system may use both generative and discriminative components. For example, an image generator may use a text-image similarity model to evaluate whether generated images match a prompt.
Unconditional and conditional generation
An unconditional generator produces samples without a task-specific input, apart from randomness or a start token. A conditional generator generates content based on a supplied condition, such as a text prompt, class label, image, or audio segment.
Conceptually, an unconditional model learns a distribution , while a conditional model learns , where:
- denotes the generated data.
- denotes the condition, if present.
- denotes the learned model parameters.
The notation expresses a general modeling goal. Different model families may approximate, factorize, or sample from these distributions in different ways.
2. The generative AI workflow
A common lifecycle begins with a dataset, proceeds through model training, and ends with inference, during which the model produces new outputs.
- Collect and prepare data. Text, images, or other examples are cleaned and represented in a suitable format.
- Choose a model architecture and objective. The objective determines what the system learns to predict, reconstruct, distinguish, or denoise.
- Train the model. An optimization process updates parameters according to the training objective.
- Evaluate the model. Tests examine output quality, diversity, safety, and performance on relevant tasks.
- Generate outputs. A user provides input or the system samples random values, and the trained model performs inference.
Training and inference are separate processes. A model does not ordinarily update its learned weights each time it generates a response, although a separate product may store conversation context, retrieve documents, or run additional learning procedures.
3. Autoregressive models
An autoregressive model generates a sequence one element at a time, using previously available elements as context. In text generation, the elements are commonly tokens rather than entire words.
For a sequence , the chain rule of probability gives:
An autoregressive model represents or approximates these conditional probabilities. During generation, it repeatedly predicts possible next elements, selects or samples one, and appends it to the context.
Worked example: generating a sentence
Given the prompt The robot moved, a language model might assign different probabilities to the next token:
| Candidate next token | Illustrative probability |
|---|---|
forward | 0.50 |
slowly | 0.30 |
home | 0.15 |
. | 0.05 |
These numbers are invented for demonstration, not outputs from a particular model. If forward is selected, the model then predicts another token using the expanded context The robot moved forward.
Key characteristics
- Natural fit for ordered data such as text and some audio representations.
- Generates variable-length sequences through repeated prediction.
- Can incorporate prompts and previously generated context.
- Sequential generation can create latency because later elements depend on earlier elements.
- Errors or undesirable choices can affect subsequent steps.
Modern decoder-only language models typically use Transformer architectures to implement autoregressive prediction. However, autoregressive describes the probability factorization and generation process, whereas Transformer describes a neural network architecture. They are not synonyms.
4. Generative Adversarial Networks (GANs)
A Generative Adversarial Network (GAN) trains two neural networks through an adversarial objective:
- The generator creates synthetic examples, often from randomly sampled latent vectors.
- The discriminator attempts to distinguish real training examples from generated ones.
The generator tries to produce examples that the discriminator cannot reliably identify as synthetic. The discriminator simultaneously improves its ability to distinguish the two sources.
Basic training idea
- Sample real examples from the training dataset.
- Sample random latent vectors and convert them into synthetic examples with the generator.
- Update the discriminator using real and generated examples.
- Update the generator according to the discriminator’s feedback.
- Repeat according to the chosen training procedure.
A classical minimax GAN objective is:
Here, is the generator, is the discriminator, is a sampled latent vector, and represents the real-data distribution. Practical GAN variants frequently use modified objectives and stabilization techniques.
Strengths and limitations
GANs can create detailed synthetic images and have been used for image translation, restoration, and related tasks. Their training can be unstable, and a generator may suffer from mode collapse, producing too little variety even when the training data is diverse. Good visual quality alone does not guarantee sufficient diversity or faithful coverage of the data distribution.
5. Variational Autoencoders (VAEs)
A Variational Autoencoder (VAE) is a latent-variable generative model. It learns a compressed probabilistic representation of data and uses this representation to generate or reconstruct examples.
A typical VAE contains two learned components:
- An encoder, which maps an input to parameters of an approximate distribution over latent variables .
- A decoder, which models how an example may be generated from a latent variable .
The encoder commonly predicts the mean and variance parameters of a latent distribution. Sampling a latent vector and passing it through the decoder yields a reconstruction or new example.
The VAE objective
A common objective is the Evidence Lower Bound (ELBO):
This objective balances two goals:
- Reconstruction quality: Make the decoded output likely given the sampled latent representation.
- Latent regularization: Keep the approximate latent distribution related to a chosen prior, often a standard normal distribution.
The encoder parameters are represented by and the decoder parameters by . The KL-divergence term connects directly to Entropy, Cross-Entropy, and KL Divergence.
Why the latent space matters
A learned latent space can support interpolation and controlled variation. For example, two latent vectors corresponding to different handwritten digits may be interpolated to explore intermediate decoded shapes. These intermediate outputs are not guaranteed to be meaningful, but they help illustrate how VAEs organize variation.
VAEs are useful in representation learning, probabilistic generation, and some image and scientific-data applications. Depending on the architecture and objective, outputs may be less visually sharp than those from competing high-fidelity generation methods.
6. Diffusion models
A diffusion model learns to generate examples by reversing, or otherwise modeling, a gradual noise-related process. In a common image-generation formulation, training progressively corrupts images with noise, and the model learns information needed to reverse that corruption.
Forward and reverse processes
- Forward process: Add increasing amounts of noise to a clean training example over a sequence of steps.
- Learned reverse process: Estimate how to transform a noisy representation toward a sample consistent with the learned data distribution.
During inference, many diffusion systems begin from random noise and perform a series of learned denoising steps. A conditional image generator may use a text representation to influence those steps.
A common forward-noising formulation is:
Here is a clean example, is its noisy version at step , and controls the remaining signal. The equation is specific to a common Gaussian diffusion formulation, not every generative approach that uses the term diffusion.
What diffusion models do well
Diffusion-based methods have been particularly influential in image synthesis and editing. They often provide strong image quality and can support conditioning, inpainting, and other controlled-generation workflows. Some systems perform many sampling steps, which can increase inference cost, although accelerated samplers and alternative formulations can reduce the number of steps.
Important: A diffusion model does not merely apply a conventional photo-denoising filter. Its learned iterative process is used to sample new content from a learned distribution.
7. Comparing the four major model families
| Family | Core generation mechanism | Common use cases | Common challenge |
|---|---|---|---|
| Autoregressive | Generate each element conditioned on earlier elements | Text, code, sequential audio | Sequential decoding latency |
| GAN | Generator competes with a discriminator | Images, image translation | Training instability and mode collapse |
| VAE | Sample a latent representation and decode | Representation learning, reconstruction, synthetic data | Reconstruction–regularization trade-offs |
| Diffusion | Learn and sample through a noise-related reverse process | Image synthesis and editing, other modalities | Multi-step sampling cost |
These families can be combined. For instance, a system may use an autoencoder to represent images in a compact latent space and a diffusion model to generate those latent representations. A product may also combine a language model with a separate image-generation model.
8. A small Python example: autoregressive sampling
The following code illustrates sequential generation from a handwritten probability table. It is not a trained language model; its purpose is to show why each generated token depends on the previous context.
import random
transitions = {
"<start>": [("AI", 0.6), ("Models", 0.4)],
"AI": [("generates", 1.0)],
"Models": [("generate", 1.0)],
"generates": [("text", 0.5), ("images", 0.5)],
"generate": [("outputs", 1.0)],
"text": [("<end>", 1.0)],
"images": [("<end>", 1.0)],
"outputs": [("<end>", 1.0)],
}
rng = random.Random(7)
current = "<start>"
result = []
for _ in range(10):
options = transitions[current]
tokens = [token for token, probability in options]
probabilities = [probability for token, probability in options]
current = rng.choices(tokens, weights=probabilities, k=1)[0]
if current == "<end>":
break
result.append(current)
print(" ".join(result))
The sampler selects an element from a conditional distribution and repeats until an end token appears. A trained neural language model replaces the hardcoded table with probabilities computed from learned parameters and a much larger context.
What this example does not demonstrate
- There is no dataset or training procedure.
- It uses only the immediately preceding token as state.
- It cannot generalize beyond the explicitly listed transitions.
- It does not implement a Transformer or represent real LLM output quality.
Those distinctions matter: generating a sequence is not by itself evidence that a system has learned language.
9. How generative systems are evaluated
A generated sample may be fluent or visually appealing without being correct, diverse, or useful. Evaluation therefore depends on the task and the conditions under which the system will operate.
| Dimension | Question to investigate |
|---|---|
| Quality or fidelity | Does the output resemble a plausible example of the target type? |
| Diversity | Does the model produce a useful variety of outputs rather than repeating a narrow pattern? |
| Conditional relevance | Does the output follow the prompt or other supplied condition? |
| Factual reliability | Are factual claims correct and supported where necessary? |
| Safety | Does the system avoid unacceptable harmful or privacy-violating behavior? |
| Generalization | Does performance hold on representative unseen prompts or data? |
| Efficiency | What are the inference latency, memory requirements, and cost? |
Automated metrics can help, but no single score establishes overall usefulness. Human review and task-specific evaluation remain important, especially for open-ended generated content.
10. Risks and practical limitations
Hallucination and factual errors
A text generator can produce a plausible statement without verifying it against an authoritative source. Generation quality should not be confused with factual accuracy. Systems dealing with changing or private information may use Retrieval-Augmented Generation to provide relevant external context, although retrieval does not guarantee a correct answer.
Bias and unsuitable training data
A generative system can learn and reproduce stereotypes, mistakes, or other undesirable patterns present in its data. Dataset quality, evaluation, and deployment controls matter as much as architecture.
Memorization and privacy
Generative models may sometimes reproduce training examples or sensitive information. Responsible development includes appropriate data collection, access controls, privacy testing, and output safeguards.
Cost and computational constraints
Training advanced models may require substantial computation and data. Inference costs vary with model size, modality, input length, output length, and the generation process. A small, task-specific system can sometimes provide better engineering value than a very large general-purpose model.
The limits of model-family labels
Model families are useful categories, but modern architectures are increasingly hybrid. The practical question is not which label sounds most advanced. It is which modeling objective, data representation, generation method, and evaluation process fit the task.
11. Choosing a generative approach
Before selecting a model, determine:
- Output modality: Does the application generate text, images, audio, structured data, or multiple modalities?
- Conditioning: Must it obey a prompt, use reference material, or modify an existing input?
- Quality requirements: Which errors are tolerable, and how will outputs be assessed?
- Data and compute budget: Is training necessary, or can a pretrained model be integrated?
- Deployment constraints: What latency, memory, privacy, and reliability limits apply?
For a document assistant, adapting or integrating an existing language model may be more practical than training one from scratch. For custom synthetic image generation, an image-specific generative model may be a better starting point. The model family alone does not settle the decision: data, licensing, safety, and operational requirements also matter.
12. Connections to other PlainCS concepts
- Probability and Bayes’ Theorem: Probability distributions and conditional generation.
- Entropy, Cross-Entropy, and KL Divergence: Objectives used in probabilistic generative modeling.
- Training Neural Networks: Optimization and the learning process.
- Text Processing, Tokenization, and Embeddings: Representing input text for generative systems.
- The Transformer Architecture: An architecture widely used for sequence generation.
- Attention, Self-Attention, and Multi-Head Attention: Mechanisms used by many Transformer-based generative models.
- Large Language Models: Large-scale language modeling and generation.
- LLM Inference, Decoding, and Sampling: How token probabilities become generated text.
- Multimodal Artificial Intelligence: Systems that process or generate multiple modalities.
Some linked articles are planned parts of the AI Knowledge Map and may not yet be published.
References and further reading
- Goodfellow, I., Bengio, Y., & Courville, A. Deep Learning, Chapter 20: Deep Generative Models. Deep Learning book.
- Goodfellow, I., et al. (2014). Generative Adversarial Nets. NeurIPS paper.
- Kingma, D. P., & Welling, M. (2013). Auto-Encoding Variational Bayes. arXiv:1312.6114.
- Ho, J., Jain, A., & Abbeel, P. (2020). Denoising Diffusion Probabilistic Models. NeurIPS paper.
- Vaswani, A., et al. (2017). Attention Is All You Need. arXiv:1706.03762.
Related articles in
- AI Agents and Tool-Using Workflows — Learn agent goals, tool invocation, planning, state, permissions, and how to evaluate multi-step AI workflows.
- AI Development Tools: Git, Jupyter, and APIs — Learn how Git, Jupyter notebooks, Python environments, and APIs fit together in reproducible, secure artificial intelligence workflows.
- How AI Is Changing Theoretical Computer Science — AI is beginning to help researchers explore algorithms, mathematical structures, and formal proofs. Here is what it can do, what still needs human judgment, and why verification matters.