…
Skip to content
Topics
On this page

What is Generative AI

Generative AI, often shortened to gen AI, is a type of artificial intelligence that creates new content, such as text, code, images, audio or video, from patterns it learned during training. It takes an instruction called a prompt and produces an output that did not exist before, instead of only labelling or ranking existing data.

  • Creates new output: It produces original text, code or images rather than selecting an answer from a fixed, predefined list of categories.
  • Learns from examples: It is trained on very large datasets and stores the statistical patterns it finds in parameters, the adjustable numerical weights inside a model.
  • Prompt-driven: It is controlled through natural-language instructions, so a developer can describe the required output instead of programming every rule explicitly.
  • Probabilistic: It predicts the most likely continuation one piece at a time, so identical prompts can return different results on separate requests.
  • Multimodal: Some models accept and produce several data types, such as text, images and audio, within a single request.
  • Built on foundation models: Most applications use a large pre-trained model, such as a large language model, that is adapted to many different tasks.
Generative AI turns one prompt into new content for a developer productA prompt asking to add an order lookup feature goes into a generative AI model. The model creates five kinds of new content: code, API docs, test data, UI copy and images for the documentation.PromptAdd an order lookupfeature, with docsGenerativemodelCodeAPI docsTest dataUI copyDoc images
Generative AI turns one prompt into new content for a developer product

For example, a software team can add generative AI to its developer product to draft code, write API docs, create test data, suggest UI copy and produce images for its documentation.

Key Characteristics of Generative AI

  • Foundation model: One large model is pre-trained once on broad, general data and then reused across many downstream applications.
  • Inference: Inference is the stage in which a trained model generates output for a new prompt, and every request carries a compute cost.
  • Context-aware output: It conditions each response on the prompt, the conversation history and any supplied reference documents.
  • Non-deterministic: Sampling parameters such as temperature control how varied or predictable the generated output is.
  • Adaptable: It can be specialised for a domain through fine-tuning or by retrieving relevant documents for each request.
  • Fixed knowledge: Its knowledge is limited to its training data unless current information is supplied at inference time.

How Generative AI Works

The steps below give a short overview. A full walkthrough is available in how generative AI works.

  1. Data collection: A large training dataset is assembled from sources such as public code repositories, technical documentation and web text.
  2. Training: The model repeatedly predicts missing or next pieces of the data and adjusts its parameters to reduce the prediction error.
  3. Pattern storage: After training, the parameters encode general patterns such as programming syntax, naming conventions and documentation style.
  4. Prompting: A user or an application sends a prompt that describes the required output, often with examples or reference material.
  5. Generation: The model produces output incrementally, and each new piece depends on the prompt and on everything generated before it.
  6. Validation: The output is checked by automated tests, schema validation or a human reviewer before it reaches production.

Example: Generating New Function Names in Python

The program below learns a naming pattern from eight function names in an API client and then generates names that were not in its training data.

Python
from collections import Counter

# Training data: function names already in a team's API client
names = [
    "get_user", "create_user", "delete_user", "list_users",
    "get_order", "list_orders", "get_invoice", "create_invoice",
]
# Learn the pattern: an action verb followed by a resource noun
verbs = Counter(n.split("_")[0] for n in names)
resources = sorted({n.split("_", 1)[1].rstrip("s") for n in names})
print("Verbs learned:", dict(verbs))
print("Resources learned:", resources)

# Generate: combine the learned parts into names not in the training data
new = []
for verb, _ in verbs.most_common():
    for res in resources:
        name = f"{verb}_{res}s" if verb == "list" else f"{verb}_{res}"
        if name not in names:
            new.append(name)
print("Generated:", new)
Output
Verbs learned: {'get': 3, 'create': 2, 'delete': 1, 'list': 2}
Resources learned: ['invoice', 'order', 'user']
Generated: ['create_order', 'list_invoices', 'delete_invoice', 'delete_order']
  • New, not copied: Every generated name follows the learned pattern, yet none of them appears in the training list.
  • Plausible is not correct: The name delete_invoice looks valid, but the real API may not support it. Generative models show the same risk, called hallucination.
  • Scale is the difference: This program learns two slots, while a real model learns patterns across billions of parameters.

Applications of Generative AI

  • Code generation: Generative AI tools complete functions, write unit tests and explain unfamiliar code inside an integrated development environment.
  • Documentation: Drafting API references, README files and release notes directly from source code and commit history.
  • Test data: Producing realistic synthetic records for automated tests without exposing real customer information.
  • UI copy: Suggesting consistent button labels, error messages and onboarding text for interface designers.
  • Images: Creating architecture diagrams, icons and illustrations for documentation from text descriptions.
  • Sector use: Banking, healthcare and public services also use it, as covered in applications of generative AI.

Advantages

  • Speed: It produces a first draft in seconds, which reduces repetitive writing for developers and technical writers.
  • Natural-language interface: Developers specify the desired result in plain language instead of implementing every rule.
  • Versatility: One general model can handle code generation, documentation, summarisation and translation.
  • Scalability: One deployed model can serve many concurrent users and applications through a single API.

Limitations

  • Hallucination: It can produce fluent output that is false, so important results need checking.
  • Cost and latency: Each request consumes compute resources, and larger models generally respond more slowly.
  • Bias: It can reproduce social and technical biases that are present in its training data.
  • Data privacy: Prompts can contain proprietary code or personal data, so access controls and data policies are required.
  • Licensing questions: The ownership of generated content and of training data is still debated in several countries.

Related pages compare generative AI vs traditional AI and the types of generative AI models.

Quick Quiz

Pick an answer to check yourself. Nothing is saved.

Question 1 / 3

  1. 1. What makes a model generative?

Frequently Asked Questions

What is the definition of generative AI in simple words?

A simple generative AI definition is software that creates new content, such as text, code or images, after learning patterns from large amounts of example data. It responds to a written instruction called a prompt.

What is the difference between generative AI and an LLM?

Generative AI is the broad category of models that create content of any kind. A large language model is one type of generative AI that works with text and code.

Is ChatGPT an example of generative AI?

Yes. ChatGPT is a chat product built on a large language model, which generates text in response to prompts. Image generators and code assistants are other generative AI examples.

Can generative AI write code?

Yes. Code models can complete functions, write tests and explain existing code. The output can contain bugs or call functions that do not exist, so it needs tests and review.

Does generative AI copy its training data?

It usually produces new combinations of learned patterns rather than stored copies. However, a model can sometimes reproduce text or code it saw often during training, which raises licensing questions.