Please enable JavaScript to use CodeHS

AI literacy / data

Where Does AI Training Data Come From?

Every AI model is built from a giant pile of examples. Follow that pile from web pages, books, and people, through cleaning and labeling, all the way into a model. Then see how the data decides what the AI gets right, and who it gets wrong.

AI literacy ~12 min Middle / High school 4 hands-on labs
File 01 / Sources

What is training data, and where does it come from?

Training data is the set of examples an AI model studies while it is being built. An AI does not get a list of rules. Instead it sees huge numbers of examples and slowly adjusts itself to match the patterns in them. That process is called training. (If that is new to you, How Do Computers Learn? explains it step by step.)

Think of a chef who has never been given a recipe, only thousands of finished dishes to taste. Whatever dishes they taste is what they learn to cook. If every dish was salty, their cooking will be salty too. Training data works the same way: the model can only learn what is in the pile.

For a chatbot, that pile is enormous. Large language models learn from many trillions of tokens (small word pieces). Here is where those examples usually come from:

  • Public web pages

    Programs called crawlers visit billions of public pages and save their text: articles, forums, recipes, how-to guides.

  • Books and articles

    Long, carefully edited writing teaches a model grammar, facts, and how to stay on topic.

  • Computer code

    Public code helps AI write and explain programs. It also seems to help with step-by-step thinking.

  • Images with captions

    Pictures paired with text, like a photo labeled "dog catching a frisbee," teach image generators and vision AI.

  • Licensed datasets

    Companies pay publishers, news outlets, and photo libraries for permission to use their content.

  • Human-written examples

    Paid workers write sample answers and rank chatbot replies to show the model what "helpful" looks like.

  • User conversations

    Some apps use chats to improve future models, when their rules and your settings allow it.

  • Synthetic data

    Examples made by another AI, like practice math problems with worked answers. Useful, but errors can copy forward.

Most AI companies describe their data sources in general terms but do not publish the exact list. That is one reason people debate training data so much. You will see those debates in section 6.

File 02 / Cleaning

Cleaning the pile: garbage in, garbage out

Raw web data is messy. The same article gets copied onto hundreds of sites. Spam pages repeat "CLICK NOW" forever. Some posts are mean, and some include people's phone numbers. Before training, engineers run the data through filters: small programs that delete or fix examples that look like problems.

Programmers have an old saying: garbage in, garbage out. If you feed a system bad data, you get bad results. More data is not automatically better. A smaller, cleaner set often beats a bigger, messier one. Try it below.

LAB 1

The data pipeline

Here are 16 examples from a pretend web crawl. Turn on filters and watch what gets removed. Then press Train the toy model to see what it picked up.

    16examples kept
    0problems still inside
    0good examples lost

    Notice two things. First, the "moon is made of cheese" card always slips through. Filters look for patterns like repeated words or bad language. They cannot check whether a sentence is true. Second, the extra strict filter removed a perfectly good example just because it used slang. Real teams constantly balance these trade-offs.

    Filters also matter for safety. If someone sneaks harmful examples into data on purpose, that is called data poisoning. Learn how it works in What Is Data Poisoning?

    File 03 / Labeling

    The humans who label it

    Some AI learns from raw text alone. But a lot of AI needs labels: the "right answer" attached to each example. A photo gets the label "cat." An email gets "spam" or "not spam." Two chatbot answers get ranked "A is better than B."

    Those labels mostly come from people called data labelers (also called annotators or raters). Many are contract workers around the world, paid per task. Some are experts, like doctors labeling X-rays or programmers judging code. Labelers follow written guidelines, but people still disagree, especially on tricky examples. When labels disagree, the model gets mixed signals. That is called label noise.

    LAB 2

    Be a data labeler

    Label each message as positive or negative. Go with your gut. Afterward, compare with five other (pretend) labelers.

    Item 1 of 10

    positive votenegative voteyour vote

      Real labeling teams handle this by having several people label each item and taking the majority vote, writing clearer guidelines ("sarcasm counts as negative"), or adding a third choice like "mixed." Labeling can also be hard work. Some labelers have to review upsetting content so it can be filtered out, which is why people argue about fair pay and mental health support for this job.

      File 04 / Representation

      Who gets left out: bias in training data

      Bias in data often is not about anyone being mean. It is about who shows up in the pile, and how often. If a group is over-represented (shows up a lot), the model learns it well. If a group is under-represented (rare or missing), the model has little to learn from and makes more mistakes for those people.

      For example, a speech app trained mostly on one accent may struggle with others. Most web text is in English, so many models are weaker in other languages. Build your own toy example below.

      LAB 3

      Build a handwriting reader

      You are training an app that reads handwritten notes. Choose how many samples from each kind of handwriting go into the training set. Then see how the app reads a test note from each group.

      Training set

      Test: "Meet at the library at 3"

        0%average accuracy (tested on data that looks like the training set)
        0%worst group

        That gap between the average and the worst group is the big lesson. A company can say "our app is over 90% accurate" and be telling the truth, while the app still fails a group that was rare in the data. Training text can also carry stereotypes, like always pairing certain jobs with certain genders, and the model can repeat them. Dig deeper in AI Bias and Fairness.

        File 05 / Time

        Data cutoffs: why AI doesn't know recent news

        Collecting and training takes months, so at some point the team stops adding data. That date is the model's training data cutoff. The model learned nothing after it. Models usually come out months after their cutoff, and people keep using them for a long time, so the gap keeps growing.

        LAB 4

        Slide the cutoff

        Here is a timeline of news at a made-up school, Riverside Middle. Move the cutoff and ask the model about the school.

          See the three ways the model can respond? Sometimes it admits it does not know. But sometimes it gives an old answer as if it were current, which is worse because it sounds sure. Some chatbots can search the web to fill the gap, but the model itself does not update until a new one is trained. For anything recent, check a current source.

          File 07 / FAQ

          Frequently asked questions

          Where does AI training data come from?

          Most large AI models learn from a mix of sources: public web pages collected by programs called crawlers, books, computer code, images with captions, datasets that companies pay to license, examples written or rated by human workers, and sometimes user conversations when the company's rules allow it. More and more, some training data is also synthetic, which means another AI made it. Companies usually do not publish the full list.

          Is AI trained on my chats?

          It depends on the app and your settings. Some chatbot companies may use conversations to improve their models unless you turn that off, and others do not by default. School and work accounts often have different rules. Look in the app's settings or privacy policy for a setting about using your data to train or improve models.

          Why doesn't AI know about recent events?

          A model only learns from data collected up to a date called its training data cutoff. Anything that happened after that date is not in what it learned. Models are usually released months after their cutoff, so the gap keeps growing. Some chatbots can search the web to fill the gap, but the model itself does not update.

          What does a data labeler do?

          A data labeler is a person who adds the right answers to training examples. They might tag what is in a photo, mark whether a message is friendly or rude, or rank which of two chatbot answers is better. Labelers follow written guidelines, and several people often label the same item so their answers can be compared.

          Can AI training data be biased?

          Yes. If some groups of people, languages, or situations show up much more than others, the model learns those well and does worse on the rest. Stereotypes in the text it reads can also be copied. A model can look accurate on average while still failing a group that was rare in its data.

          Is it legal to train AI on copyrighted books and art?

          This question is still being debated by courts, lawmakers, creators, and AI companies, and the answer can differ from country to country. Some people argue training is a fair use that creates something new. Others argue creators should be asked and paid. Some AI companies now sign licensing deals with publishers and other content owners.

          File 08 / Check

          Quick quiz

          1. A team doubles its training data by adding millions of spam pages. What most likely happens?

          2. Five labelers split 3 to 2 on whether “Great, another pop quiz” is positive. What is this called?

          3. An app is 94% accurate overall but often fails for young kids. What is the most likely reason?

          4. You ask a chatbot about last week's game, and it confidently gives last year's score. Why?