GENERATIVE AI • LESSON 3

Training Data

Training data is the information an AI model learns from. For Generative AI, this can include text, code, images, audio, video, and other types of data. The quality, diversity, structure, and filtering of this data strongly influence what the model can learn and how it behaves.

CORE IDEA

A model can only learn patterns from the data it is trained on.

Training data provides the examples from which a model learns. The model processes those examples during training and adjusts its parameters so that it becomes better at its training objective.

01 Data Sources Text • Code • Images • Audio
02 Prepare Data Clean • Filter • Deduplicate
03 Training Examples Tokens and learning targets
04 AI Model Learns patterns
01

What Is Training Data?

Training data is a collection of examples used to teach a machine learning model.

For a Generative AI model, the training data can be extremely large and can contain many different forms of information.

T

Text

Books, articles, websites, documentation, conversations, and other text sources.

Example: "Python is a programming language."
</>

Code

Source code and programming examples from supported languages and formats.

Example: PHP, Python, JavaScript, SQL
IMG

Images

Images and associated information can be used by multimodal or image-generation systems.

Example: Image + caption
A

Audio

Speech, conversations, music, and other audio data can be used by audio-capable systems.

Example: Speech + transcript
Important: Training data is not simply "a giant database that the AI searches every time you ask a question." Training changes the model's parameters so that the model learns statistical patterns from the training process.
02

Where Can Training Data Come From?

Training data can come from many different sources. The exact sources used by a particular model depend on its creator, training process, licensing, availability, and intended use.

01

Publicly Available Information

Publicly accessible material can provide examples of language, programming, technical explanations, and other patterns.

02

Licensed Data

Organizations can obtain rights to use specific datasets or content for training.

03

Human-Created Examples

People can create, label, review, or rank examples that help train or improve AI systems.

04

Synthetic Data

Some training pipelines use artificially generated examples to supplement or improve particular capabilities.

IMPORTANT

"More data" does not automatically mean "better AI."

A huge dataset containing low-quality, duplicated, misleading, biased, or irrelevant information can create problems.

Data quality and data composition matter just as much as data volume.

03

Raw Data Is Not Ready for Training

Real-world data is messy.

Before data can be useful for large-scale training, it may need to be processed, filtered, cleaned, normalized, deduplicated, and transformed into a suitable format.

RAW DATA
Python is great!!!
Python is great!!!
BUY NOW!!! CLICK HERE!!!
Python is a programming language.
Random broken text ##@@!!
PROCESSED DATA
Python is great.
Python is a programming language.
Useful programming examples.

The exact preprocessing pipeline depends on the model and dataset. The important concept is that training systems generally do not blindly feed every piece of collected information directly into training.

04

Why Data Cleaning Matters

Suppose a dataset contains the same document hundreds of times.

If duplicates are not handled correctly, they can distort the training process and can also create evaluation problems.

DUPLICATES

Repeated information

The same content appears many times.

Reduce unnecessary repetition.
LOW QUALITY

Broken or useless content

Scraped fragments, malformed text, spam, or irrelevant material.

Filter or clean it.
DATA LEAKAGE

Evaluation contamination

Information from an evaluation set can accidentally appear in training data.

Separate datasets carefully.
BIAS

Imbalanced representation

Some viewpoints, languages, topics, or groups may be overrepresented.

Evaluate data composition.
05

From Text to Training Examples

For a language model, raw text is not directly processed as human-readable sentences during the mathematical computation.

Text is converted into tokens. Those tokens can then be arranged into training examples that the model can learn from.

RAW TEXT AI models learn patterns
TOKENS AI | models | learn | patterns
TRAINING TASK Predict the next token
PRACTICAL EXAMPLE

Next-token prediction

Imagine the training text contains:

Generative AI can create

A simplified training task could ask the model to predict the next token:

Generative AI can create → text

The actual systems use much more sophisticated training procedures, but this example gives you the core idea: training data becomes examples that provide a learning signal to the model.

06

Different Data Produces Different Capabilities

The type and composition of training data influence what a model becomes good at.

TRAINING DATA
Large amounts of text
Programming examples
Multilingual content
Technical documents
MODEL Learns statistical patterns
POSSIBLE CAPABILITIES
Language understanding
Code generation
Translation
Question answering
Important: Training data does not work like a checklist where adding one document automatically gives the model perfect knowledge of that topic. Model capabilities emerge from learning patterns across many examples.
07

Real-World Example — Training a Coding Model

Let's make this practical.

Imagine you want to build a model that is especially useful for software development.

REAL-WORLD SCENARIO

AI Coding Assistant

01 Training Data

Large amounts of programming-related examples.

02 Learning

The model learns patterns connecting code tokens and natural-language instructions.

03 Developer Prompt

"Create a PHP function that validates an email address."

04 Generated Code
function isValidEmail(string $email): bool
{
    return filter_var(
        $email,
        FILTER_VALIDATE_EMAIL
    ) !== false;
}

The important point is that the model learned relationships between natural language and code patterns from its training process.

08

Real-World Example — Multilingual AI

Suppose a model is trained on many languages. The training data can contain examples in English, Spanish, Hindi, Telugu, French, German, and many other languages.

TRAINING EXAMPLES
English

How are you?

Spanish

¿Cómo estás?

Hindi

आप कैसे हैं?

Telugu

మీరు ఎలా ఉన్నారు?

POSSIBLE MODEL CAPABILITY

Multilingual generation

The model may learn statistical relationships across multiple languages and become capable of processing or generating text in those languages.

Practical developer lesson: If you build an AI application for users in multiple countries, understanding language coverage and data quality becomes an important part of evaluating the model you choose.
09

Training Data Can Contain Bias and Errors

This is one of the most important limitations to understand.

If training data contains incorrect information, stereotypes, poor-quality examples, or imbalanced representation, the model can learn patterns that reproduce some of those problems.

DATA Unbalanced or low-quality examples

The dataset does not represent the desired use case well.

MODEL Learns patterns

The model may learn undesirable statistical patterns from the data.

OUTPUT Potentially biased result

The problem may appear during real-world use.

DEVELOPER WARNING

Never assume that a model is correct simply because it was trained on a huge dataset.

Large-scale training can create powerful capabilities, but it does not guarantee factual accuracy, fairness, or reliability.

Production AI applications still need evaluation, testing, monitoring, and appropriate safeguards.

10

Training Data vs Your Application Data

As a GenAI developer, you will often work with your own application data. It is important not to confuse that data with the original training data used to build a foundation model.

MODEL TRAINING DATA

Used to train the model

  • Used during model development.
  • Helps establish model capabilities.
  • Changes to parameters happen during training.
APPLICATION DATA

Used by your AI application

  • Your company documents.
  • Customer information.
  • Product catalogues or internal knowledge.
PRACTICAL DEVELOPER EXAMPLE

Company chatbot

Imagine a company wants an AI assistant that can answer questions about its internal employee handbook.

User question
      ↓
Company handbook
      ↓
Retrieve relevant information
      ↓
Generative AI model
      ↓
Answer

The company does not necessarily need to retrain the foundation model on the entire handbook. Later in this course, you will learn how embeddings, vector search, and RAG can provide application-specific information to a trained model.

11

The Complete Training Data Picture

Put everything together and the process looks like this:

01 Collect Gather useful data.
02 Filter Remove unsuitable content.
03 Clean Improve data quality.
04 Tokenize Convert content into tokens.
05 Train Learn patterns and update parameters.
COMMON MISCONCEPTION

"The model stores every training document and looks it up when I ask a question."

That is not a good mental model for understanding how foundation-model training works.

During training, the model adjusts its parameters based on patterns in the training examples. During inference, the trained model uses those parameters together with the current input and context to generate an output.

If an application needs the model to retrieve exact, current company information, techniques such as RAG can provide external information at inference time.

REMEMBER THIS

Training data is the foundation from which the model learns patterns.

  • Training data provides examples for learning.
  • Generative AI can use different types of data, including text, code, images, and audio.
  • Raw data usually needs processing and filtering before training.
  • Data quality, diversity, and composition matter.
  • Poor or biased data can contribute to poor or biased model behavior.
  • Training data is different from application data used by your AI system.
  • Later, RAG will show how external knowledge can be supplied to a trained model at inference time.
QUICK CHECK

Test Your Understanding

1. What is training data?

Answer: Training data is a collection of examples that a machine learning model processes during training so it can learn useful patterns.

2. Why does data quality matter?

Answer: Because the model learns from patterns in its training data. Poor-quality, duplicated, biased, or misleading data can negatively affect learned behavior.

3. Does a foundation model need to be retrained every time a company adds a new document?

Answer: No. Applications can often provide external information at inference time using techniques such as retrieval-augmented generation (RAG).

4. What happens to model parameters during training?

Answer: Training updates the model's parameters so that its predictions become better according to the training objective.

LESSON 3 • TOPIC COMPLETE

You now understand where AI models get the data they learn from.

You have learned what training data is, where it can come from, why it needs preparation, how it becomes training examples, and why data quality matters.

Next, we will move from the data to the thing that actually learns from it: AI Models.